diff options
author | Karl Berry <karl@freefriends.org> | 2010-05-15 00:29:54 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-05-15 00:29:54 +0000 |
commit | e10ad83d90b52e4e9a049154008dba384ad6cc12 (patch) | |
tree | e19011aa72dc32b07d538a2f9cfda0a751e9aaf9 /Master/texmf-dist/tex/latex/skeyval | |
parent | 05037a2db5937feaff7d1dab8ce1364014c13749 (diff) |
skeyval 0.71 (13may10)
git-svn-id: svn://tug.org/texlive/trunk@18266 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/skeyval')
-rw-r--r-- | Master/texmf-dist/tex/latex/skeyval/skeyval.sty | 677 |
1 files changed, 360 insertions, 317 deletions
diff --git a/Master/texmf-dist/tex/latex/skeyval/skeyval.sty b/Master/texmf-dist/tex/latex/skeyval/skeyval.sty index 3178e0be5e4..78727c65eb1 100644 --- a/Master/texmf-dist/tex/latex/skeyval/skeyval.sty +++ b/Master/texmf-dist/tex/latex/skeyval/skeyval.sty @@ -1,6 +1,6 @@ %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++% % % -% This is file 'skeyval.sty', version 0.7. % +% This is file 'skeyval.sty', version 0.71. % % % % This package and accompanying files may be distributed and/or % % modified under the conditions of the LaTeX Project Public License, % @@ -70,9 +70,10 @@ \SKV@setcode{096}{12}% ` \SKV@setcode{126}{13}% ~ \def\SKV@rcsid$#1: #2 #3 #4 #5${#4 v#3} -\ProvidesPackage{skeyval}% - [\SKV@rcsid $Id: skeyval.sty,v 0.7 2010/05/05 09:00:00 Ahmed Musa $ - Extensions to the xkeyval parser (AM)] +\ProvidesPackage{skeyval}[% + \SKV@rcsid $Id: skeyval.sty,v 0.71 2010/05/05 09:00:00 Ahmed Musa $ + Extensions to the xkeyval parser (AM) +] \NeedsTeXFormat{LaTeX2e}[1996/12/01] \ifnum0=0% \ifx\eTeXversion\SKV@undefined1\else\ifnum\eTeXversion<\tw@1\fi\fi @@ -85,16 +86,16 @@ \newcount\SKV@depth \protected\def\@nil{\@nil} \def\@nnil{\@nil} +\long\def\@firstofthree#1#2#3{#1} +\long\def\@secondofthree#1#2#3{#2} +\long\def\@thirdofthree#1#2#3{#3} \long\def\@gobblethree#1#2#3{} \long\def\SKV@car#1#2\@nil{#1} \long\def\SKV@cdr#1#2\@nil{#2} \long\def\SKV@carcube#1#2#3#4\@nil{#1#2#3} -\long\def\@firstofthree#1#2#3{#1} -\long\def\@secondofthree#1#2#3{#2} -\long\def\@thirdofthree#1#2#3{#3} -\def\SKV@threeafter{\expandafter\expandafter\expandafter} +\def\SKV@threexp{\expandafter\expandafter\expandafter} \def\SKV@aftercs#1#2{\expandafter#1\csname#2\endcsname} -\def\SKV@xaftercs#1#2{\SKV@threeafter#1\csname#2\endcsname} +\def\SKV@xaftercs#1#2{\SKV@threexp#1\csname#2\endcsname} \SKV@aftercs\let{SKV@1of1}\@firstofone \SKV@aftercs\let{SKV@1of2}\@firstoftwo \SKV@aftercs\let{SKV@2of2}\@secondoftwo @@ -112,11 +113,15 @@ \def\SKV@unifxcs#1#2{\begingroup\expandafter\endgroup\expandafter \SKV@unifx\expandafter#1\csname#2\endcsname} \def\SKV@ifdefined#1{\@nameuse{SKV@\ifdefined#11\else2\fi of2}} +\def\SKV@oifdefined#1{\@nameuse{SKV@\expandafter\SKV@ifdefined#1{1}{2}of2}} \def\SKV@unifdefined#1{\@nameuse{SKV@\SKV@ifdefined{#1}{2}{1}of2}} \def\SKV@ifcsname#1{\@nameuse{SKV@\ifcsname#1\endcsname1\else2\fi of2}} \def\SKV@unifcsname#1{\@nameuse{SKV@\SKV@ifcsname{#1}{2}{1}of2}} -\def\SKV@iftest#1#2{\@nameuse{SKV@\@nameuse{if#1}#21\else2\fi of2}} -\def\SKV@uniftest#1#2{\@nameuse{SKV@\SKV@iftest{#1}{#2}{2}{1}of2}} +\def\SKV@iftest#1#2{\@nameuse{if#1}#2\relax\expandafter\@firstoftwo + \else\expandafter\@secondoftwo\fi} +\def\SKV@uniftest#1#2{\SKV@iftest{#1}{#2}\@secondoftwo\@firstoftwo} +\protected\def\SKV@AtEndAfterPackageEnd#1{\AtEndOfPackage + {\SKV@AfterPackageEnd{#1}}} \begingroup \def\SKV@tempa{% \def\SKV@nodocerr{% @@ -152,27 +157,36 @@ \SKV@ifx\SKV@documentclass\SKV@undefined\SKV@nodocerr\relax } \SKV@tempa\endgroup +\def\SKV@notdefinable{% + \PackageError{skeyval}% + {Command '\@backslashchar\resvd@a' not definable, + \MessageBreak or name '\@backslashchar\@qend...' illegal}% + {Command '\@backslashchar\resvd@a' already defined.}% +} \def\SKV@ifdefinable#1{% - \begingroup\escapechar92\afterassignment\endgroup - \xdef\reserved@a{\expandafter\@gobble\string#1}% - \edef\resvd@a{\expandafter\SKV@car\string#1\@nil}% - \SKV@ifx\resvd@a\@backslashchar{}{% + \begingroup + \escapechar92\relax + \xdef\resvd@a{\expandafter\@gobble\string#1}% + \edef\resvd@b{\expandafter\SKV@car\string#1\@nil}% + \SKV@ifx\resvd@b\@backslashchar{}{% \PackageError{skeyval}{Backslash required}{Backslash required in argument of '\string\SKV@ifdefinable'.}% }% - \let\resvd@a\SKV@undefined \SKV@ifdefined#1{% - \SKV@ifx{#1}\relax\@firstofone\@notdefinable + \SKV@ifx{#1}\relax{\aftergroup\@firstofone}% + {\aftergroup\SKV@notdefinable}% }{% - \edef\reserved@b{\expandafter\SKV@carcube\reserved@a xxx\@nil}% - \SKV@ifx\reserved@b\@qend\@notdefinable - {\SKV@ifx\reserved@a\@qrelax\@notdefinable\@firstofone}% + \edef\resvd@b{\expandafter\SKV@carcube\resvd@a xxx\@nil}% + \SKV@ifx\resvd@b\@qend{\aftergroup\SKV@notdefinable}% + {\SKV@ifx\resvd@a\@qrelax{\aftergroup\SKV@notdefinable}% + {\aftergroup\@firstofone}}% }% + \endgroup } \def\SKV@csifdefinable#1{\begingroup\expandafter\endgroup \expandafter\SKV@ifdefinable\csname#1\endcsname} \newcommand*\@ifpackagecurrent[2]{% - \@nameuse{SKV@\SKV@iftest{num}{\SKV@threeafter\@parse@version + \@nameuse{SKV@\SKV@iftest{num}{\SKV@threexp\@parse@version \csname ver@#1.\@pkgextension\endcsname//00\@nil <\expandafter\@parse@version#2//00\@nil}{2}{1}of2}} \newcommand*\@ifpackagenotcurrent[2]{% @@ -186,10 +200,10 @@ \endinput }% }{\RequirePackage{xkeyval}[2008/08/13]} -\newcommand\SKV@ifdefinable@n[1]{% +\newcommand*\SKV@ifdefinable@n[1]{% \XKV@sp@deflist\SKV@tempa{#1}% \XKV@for@o\SKV@tempa\SKV@tempa{% - \edef\resvd@a{\SKV@threeafter\SKV@car + \edef\resvd@a{\SKV@threexp\SKV@car \expandafter\string\SKV@tempa\@nil}% \SKV@unifx\resvd@a\@backslashchar{}{% \PackageError{skeyval}{Backslash not allowed}{Backslash not @@ -251,8 +265,9 @@ }{}% \endgroup } -\define@boolkeys[KV]{skeyval@i}[SKV@]{st,pl,ask,sk,loc,uv}[true] -\setkeys[KV]{skeyval@i}{st,pl,ask,sk,loc,uv} +\define@boolkeys[KV]{skeyval@i}[SKV@]{tempsw,st,pl,ask,rt, + lt,sk,loc,uv}[true] +\setkeys[KV]{skeyval@i}{tempsw,st,pl,ask,rt,lt,sk,loc,uv} \define@boolkey+[KV]{skeyval}[SKV@]{verbose}[true]{}{% \SKV@inputerr{#1}{verbose}% } @@ -270,7 +285,7 @@ ifXKV@pl,ifXKV@knf,CurrentOption,ifSKV@sk}% \SKV@ifempty{#3}{\advance\XKV@depth\@ne}{}% \or - \def\SKV@ste{ifSKV@st,ifSKV@pl,ifSKV@ask}% + \def\SKV@ste{ifSKV@st,ifSKV@pl,ifSKV@ask,ifSKV@rt,ifSKV@lt}% \SKV@ifempty{#3}{\advance\SKV@depth\@ne}{}% \else \SKV@err{Unknown state identifier}% @@ -290,59 +305,53 @@ \SKV@def*\SKV@savstate{\SKV@state{1}{@\romannumeral\SKV@depth}{}} \SKV@def*\SKV@resstate{\SKV@state{1}{}{@\romannumeral\SKV@depth}} \def\XKV@srstate#1#2{\SKV@state{0}{#1}{#2}} -\def\SKV@scantoksa#1#2{% - \begingroup - \edef\SKV@tempa{\endgroup - \unexpanded{% - #1\everyeof{\noexpand}\endlinechar\m@ne - \makeatletter\scantokens - }{#2}% - \catcode`\noexpand\@=\the\catcode`\@\relax - \everyeof{\the\everyeof}% - \noexpand\endlinechar\the\endlinechar\relax +\SKV@def*\SKV@scantoksa{\SKV@testopt\SKV@sc@ntoksa{,}} +\SKV@def\SKV@sc@ntoksa[#1]#2{% + \SKV@for[#1]{#2}\SKV@resvda{% + \SKV@expnext\SKV@ensurescape\SKV@resvda + \begingroup + \let\@xp\expandafter + \edef\SKV@resvdb##1##2{##1{##2{\SKV@expox\SKV@resvda}}}% + \everyeof{\noexpand}\endlinechar\m@ne + \SKV@resvdb{\@xp\xdef\SKV@resvda}{\scantokens\@xp}% + \endgroup }% - \SKV@tempa } -\def\SKV@scantoksb#1{% - \begingroup - \everyeof{\noexpand}% - \endlinechar\m@ne - \xdef#1{\scantokens\expandafter{#1}}% - \endgroup +\SKV@def*\SKV@emptycmds{\SKV@savstate\SKV@testoptd\SKV@em@tycmds} +\SKV@def\SKV@em@tycmds[#1]#2{% + \ifSKV@st\let\glob@lrel@x\global\else\let\glob@lrel@x\relax\fi + \SKV@for[#1]{#2}\SKV@resvda{% + \SKV@expnext\SKV@ensurescape\SKV@resvda + \glob@lrel@x\expandafter\let\SKV@resvda\@empty + }% + \SKV@resstate } +\SKV@pdef*\SKV@csdef{\SKV@savstate\SKV@t@stoptb{\SKV@newcs\def}} +\SKV@pdef*\SKV@csgdef{\SKV@savstate\SKV@t@stoptb{\SKV@newcs\gdef}} +\SKV@pdef*\SKV@csedef{\SKV@savstate\SKV@t@stoptb{\SKV@newcs\edef}} +\SKV@pdef*\SKV@csxdef{\SKV@savstate\SKV@t@stoptb{\SKV@newcs\xdef}} \SKV@def*\SKV@newcs#1#2{% - \SKV@ifcsname{#2}{% - \SKV@csifx{#2}\relax{}{\def\reserved@a{#2}\@notdefinable}% - }{\SKV@aftercs{#1}{#2}}% -} -\SKV@def*\SKV@n@wcs#1#2{% + \ifSKV@st\let\l@ngrel@x\relax\else\let\l@ngrel@x\long\fi \ifSKV@pl - \let\SKV@next\SKV@newcs + \let\SKV@next\SKV@n@wcs \else - \let\SKV@next\SKV@aftercs + \def\SKV@next{\l@ngrel@x\SKV@aftercs}% \fi \SKV@resstate\SKV@next#1{#2}% } -\SKV@pdef*\SKV@csdef{\SKV@savstate\SKV@t@st@pta\SKV@@csdef} -\SKV@def*\SKV@@csdef#1{\SKV@n@wcs\def{#1}} -\SKV@pdef*\SKV@csgdef{\SKV@savstate\SKV@t@st@pta\SKV@@csgdef} -\SKV@def*\SKV@@csgdef#1{\SKV@n@wcs\gdef{#1}} -\SKV@pdef*\SKV@csedef{\SKV@savstate\SKV@t@st@pta\SKV@@csedef} -\SKV@def*\SKV@@csedef#1{\SKV@n@wcs\edef{#1}} -\SKV@pdef*\SKV@csxdef{\SKV@savstate\SKV@t@st@pta\SKV@@csxdef} -\SKV@def*\SKV@@csxdef#1{\SKV@n@wcs\xdef{#1}} +\SKV@def*\SKV@n@wcs#1#2{% + \SKV@ifcsname{#2}% + {\SKV@csifx{#2}\relax{}{\def\resvd@a{#2}\SKV@notdefinable}}% + {\l@ngrel@x\SKV@aftercs{#1}{#2}}% +} \SKV@def*\SKV@csuse#1{\SKV@ifcsname{#1}{\@nameuse{#1}}{}} \SKV@pdef\SKV@expargs#1#2#3#4\@nil{% \begingroup \protected@edef\SKV@tempa{\endgroup - \ifcase#1\relax - \unexpanded{#2}{#3}% - \or - \unexpanded{#2#3}{#4}% - \or - \unexpanded{#2}{#3}{#4}% - \or - \unexpanded{#2}#3\unexpanded{#4}% + \ifcase#1\relax\unexpanded{#2}{#3}% + \or\unexpanded{#2#3}{#4}% + \or\unexpanded{#2}{#3}{#4}% + \or\unexpanded{#2}#3\unexpanded{#4}% \else \SKV@err{Unknown expansion type '\string#1' for \string\SKV@expargs}{I expected your first @@ -377,21 +386,19 @@ \SKV@def*\SKV@ifnextch@r{% \ifx\@temptoks\SKV@nxc\let\SKV@nxb\SKV@nxa\fi\SKV@nxb } -\SKV@pdef\SKV@ifstar#1#2{% - \SKV@ifnextchar*{\begingroup - \def\SKV@tempa*{\endgroup #1}\SKV@tempa}{#2}% -} -\SKV@pdef\SKV@ifplus#1#2{% - \SKV@ifnextchar+{\begingroup - \def\SKV@tempa+{\endgroup #1}\SKV@tempa}{#2}% -} -\SKV@pdef\SKV@ifask#1#2{% - \SKV@ifnextchar?{\begingroup - \def\SKV@tempa?{\endgroup #1}\SKV@tempa}{#2}% -} -\SKV@pdef\SKV@ifbrack#1#2{\SKV@ifnextchar[{#1}{#2}} -\SKV@pdef\SKV@ifparen#1#2{\SKV@ifnextchar({#1}{#2}} -\SKV@pdef*\SKV@testopt#1#2{\SKV@ifbrack{#1}{#1[{#2}]}} +\SKV@pdef\SKV@ifchar#1#2#3{% + \SKV@ifnextchar#1{\begingroup + \def\SKV@tempa#1{\endgroup#2}\SKV@tempa}{#3}% +} +\SKV@pdef*\SKV@ifstar{\SKV@ifchar{*}} +\SKV@pdef*\SKV@ifplus{\SKV@ifchar{+}} +\SKV@pdef*\SKV@ifask{\SKV@ifchar{?}} +\SKV@pdef*\SKV@ifright{\SKV@ifchar{>}} +\SKV@pdef*\SKV@ifleft{\SKV@ifchar{<}} +\SKV@pdef*\SKV@if@brack#1#2{\SKV@ifnextchar[{#1}{#2}} +\SKV@pdef*\SKV@if@paren#1#2{\SKV@ifnextchar({#1}{#2}} +\SKV@pdef*\SKV@if@left#1#2{\SKV@ifnextchar<{#1}{#2}} +\SKV@pdef*\SKV@testopt#1#2{\SKV@if@brack{#1}{#1[{#2}]}} \SKV@pdef*\SKV@testopta#1{\SKV@t@stopta{\SKV@t@st@pta{#1}}} \SKV@pdef*\SKV@t@stopta#1{\SKV@ifstar{\SKV@sttrue#1}{\SKV@stfalse#1}} \SKV@pdef*\SKV@t@st@pta#1{\SKV@ifplus{\SKV@pltrue#1}{\SKV@plfalse#1}} @@ -403,27 +410,49 @@ \SKV@pdef*\SKV@testopte#1{\SKV@testoptb{\SKV@testopt#1{,}}} \SKV@pdef*\SKV@t@stopte#1{\SKV@t@stoptb{\SKV@testopt#1{,}}} \SKV@pdef*\SKV@testoptf#1{\SKV@testoptc{\SKV@testopt#1{,}}} +\SKV@pdef*\SKV@testoptg#1{\SKV@ifright{\SKV@rttrue#1}{\SKV@rtfalse#1}} +\SKV@pdef*\SKV@t@stoptg#1{\SKV@ifleft{\SKV@lttrue#1}{\SKV@ltfalse#1}} +\SKV@pdef*\SKV@testopth#1#2{\SKV@if@left{#1}{#1<{#2}>}} +\SKV@pdef*\SKV@testoptp#1#2{\SKV@if@paren{#1}{#1({#2})}} \SKV@def*\SKV@Test@pt#1{\@nameuse{SKV@\SKV@ifempty{#1}{1}{2}of2}} -\SKV@def*\SKV@TestOpt#1#2#3{\SKV@@TestOpt#1&[&{#2#1}{#2[{#3}]{#1}}} -\SKV@def*\SKV@@TestOpt#1[#2#{\SKV@Test@pt{#1#2}} -\SKV@def*\SKV@IfStar#1#2#3{\SKV@@IfStar#1&*&{#2}{#3{#1}}} -\SKV@def*\SKV@@IfStar#1*#2#{\SKV@Test@pt{#1#2}} -\SKV@def*\SKV@IfPlus#1#2#3{\SKV@@IfPlus#1&+&{#2}{#3{#1}}} -\SKV@def*\SKV@@IfPlus#1+#2#{\SKV@Test@pt{#1#2}} -\SKV@def*\SKV@IfAsk#1#2#3{\SKV@@IfAsk#1&?&{#2}{#3{#1}}} -\SKV@def*\SKV@@IfAsk#1?#2#{\SKV@Test@pt{#1#2}} +\SKV@def*\SKV@IfBrack#1#2#3{\SKV@IfBr@ck#1&[&{#2}{#3{#1}}} +\SKV@def*\SKV@IfBr@ck#1[#2#{\SKV@Test@pt{#1#2}} +\SKV@def*\SKV@TestOpt#1#2#3{\SKV@IfBr@ck#1&[&{#2#1}{#2[{#3}]{#1}}} +\SKV@def*\SKV@IfStar#1#2#3{\SKV@IfSt@r#1&*&{#2}{#3{#1}}} +\SKV@def*\SKV@IfSt@r#1*#2#{\SKV@Test@pt{#1#2}} +\SKV@def*\SKV@IfPlus#1#2#3{\SKV@IfPl@s#1&+&{#2}{#3{#1}}} +\SKV@def*\SKV@IfPl@s#1+#2#{\SKV@Test@pt{#1#2}} +\SKV@def*\SKV@IfAsk#1#2#3{\SKV@IfA@k#1&?&{#2}{#3{#1}}} +\SKV@def*\SKV@IfA@k#1?#2#{\SKV@Test@pt{#1#2}} +\SKV@def*\SKV@csalloc#1{\@nameuse{new#1\SKV@aftercs}} +\SKV@pdef*\csnewif{\SKV@csalloc{if}} +\SKV@pdef*\csnewtoks{\SKV@csalloc{toks}} +\SKV@pdef*\csnewcount{\SKV@csalloc{count}} +\SKV@pdef*\csnewdimen{\SKV@csalloc{dimen}} +\SKV@pdef*\csnewbox{\SKV@csalloc{box}} +\SKV@pdef*\csnewwrite{\SKV@csalloc{write}} +\SKV@pdef*\csnewread{\SKV@csalloc{read}} \SKV@pdef*\NewWrites{\SKV@testopt\SKV@NewWrites{}} -\SKV@pdef*\SKV@NewWrites[#1]#2{% +\SKV@def*\SKV@NewWrites[#1]#2{% + \SKV@for[,]{#2}\SKV@tempa{% + \SKV@expnext\SKV@ensurenoscape\SKV@tempa + \SKV@csifdefinable{#1\SKV@tempa}{% + \csnewwrite{#1\SKV@tempa}% + }% + }% +} +\SKV@pdef*\NewReads{\SKV@testopt\SKV@NewReads{}} +\SKV@def*\SKV@NewReads[#1]#2{% \SKV@for[,]{#2}\SKV@tempa{% \SKV@expnext\SKV@ensurenoscape\SKV@tempa \SKV@csifdefinable{#1\SKV@tempa}{% - \@nameuse{newwrite\SKV@aftercs}{#1\SKV@tempa}% + \csnewread{#1\SKV@tempa}% }% }% } \SKV@pdef*\NewIfs{\SKV@testopt\SKV@NewIfs{}} -\SKV@pdef*\SKV@NewIfs[#1]#2{\SKV@testopt{\SKV@New@Ifs[#1]{#2}}{false}} -\SKV@pdef*\SKV@New@Ifs[#1]#2[#3]{% +\SKV@def*\SKV@NewIfs[#1]#2{\SKV@testopt{\SKV@N@wIfs[#1]{#2}}{false}} +\SKV@def*\SKV@N@wIfs[#1]#2[#3]{% \SKV@for[,]{#2}\SKV@tempa{% \SKV@expnext\SKV@ensurenoscape\SKV@tempa \begingroup @@ -434,12 +463,12 @@ {\SKV@oifstrequal{\SKV@tempa}{switch}{\SKV@swnameerr{switch}}% {}}}}}\endgroup \SKV@csifdefinable{if#1\SKV@tempa}{% - \SKV@aftercs\SKV@New@If@{if#1\SKV@tempa}% + \SKV@aftercs\SKV@N@wIf@{if#1\SKV@tempa}% \@nameuse{#1\SKV@tempa#3}% }% }% } -\def\SKV@New@If@#1{% +\SKV@def*\SKV@N@wIf@#1{% \@tempcnta\escapechar\escapechar\m@ne \let#1\iffalse \SKV@If#1\iftrue @@ -454,15 +483,10 @@ \SKV@aftercs\def{\expandafter\@gobbletwo\string#1% \expandafter\@gobbletwo\string#2}{\let#1#2}% } -\SKV@pdef*\csnewif{\SKV@aftercs\newif} -\SKV@pdef*\csnewtoks{\SKV@aftercs\newtoks} -\SKV@pdef*\csnewcount{\SKV@aftercs\newcount} -\SKV@pdef*\csnewdimen{\SKV@aftercs\newdimen} -\SKV@pdef*\csnewbox{\SKV@aftercs\newbox} \SKV@pdef*\NewBooleans{\SKV@testopt\SKV@NewBooleans{}} -\SKV@pdef*\SKV@NewBooleans[#1]#2{% - \SKV@testopt{\SKV@New@Booleans[#1]{#2}}{false}} -\SKV@pdef*\SKV@New@Booleans[#1]#2[#3]{% +\SKV@def*\SKV@NewBooleans[#1]#2{% + \SKV@testopt{\SKV@N@wBooleans[#1]{#2}}{false}} +\SKV@def*\SKV@N@wBooleans[#1]#2[#3]{% \SKV@getswstate\NewBooleans{#3}% \SKV@for[,]{#2}\SKV@tempa{% \SKV@expnext\SKV@ensurenoscape\SKV@tempa @@ -480,8 +504,8 @@ }% } \SKV@pdef*\NewTogs{\SKV@testopt\SKV@NewTogs{}} -\SKV@pdef*\SKV@NewTogs[#1]#2{\SKV@testopt{\SKV@NewT@gs[#1]{#2}}{false}} -\SKV@pdef*\SKV@NewT@gs[#1]#2[#3]{% +\SKV@def*\SKV@NewTogs[#1]#2{\SKV@testopt{\SKV@NewT@gs[#1]{#2}}{false}} +\SKV@def*\SKV@NewT@gs[#1]#2[#3]{% \SKV@getswstate\NewTogs{#3}% \SKV@for[,]{#2}\SKV@tempa{% \SKV@expnext\SKV@ensurenoscape\SKV@tempa @@ -491,7 +515,7 @@ }% } \SKV@pdef*\NewToks{\SKV@testopt\SKV@NewToks{}} -\SKV@pdef*\SKV@NewToks[#1]#2{% +\SKV@def*\SKV@NewToks[#1]#2{% \SKV@for[,]{#2}\SKV@tempa{% \SKV@expnext\SKV@ensurenoscape\SKV@tempa \SKV@csifdefinable{#1\SKV@tempa}{% @@ -500,7 +524,7 @@ }% } \SKV@pdef*\NewCounts{\SKV@testopt\SKV@NewCounts{}} -\SKV@pdef*\SKV@NewCounts[#1]#2{% +\SKV@def*\SKV@NewCounts[#1]#2{% \SKV@for[,]{#2}\SKV@tempa{% \SKV@expnext\SKV@ensurenoscape\SKV@tempa \SKV@csifdefinable{#1\SKV@tempa}{% @@ -509,7 +533,7 @@ }% } \SKV@pdef*\NewDimens{\SKV@testopt\SKV@NewDimens{}} -\SKV@pdef*\SKV@NewDimens[#1]#2{% +\SKV@def*\SKV@NewDimens[#1]#2{% \SKV@for[,]{#2}\SKV@tempa{% \SKV@expnext\SKV@ensurenoscape\SKV@tempa \SKV@csifdefinable{#1\SKV@tempa}{% @@ -518,7 +542,7 @@ }% } \SKV@pdef*\NewBoxes{\SKV@testopt\SKV@NewBoxes{}} -\SKV@pdef*\SKV@NewBoxes[#1]#2{% +\SKV@def*\SKV@NewBoxes[#1]#2{% \SKV@for[,]{#2}\SKV@tempa{% \SKV@expnext\SKV@ensurenoscape\SKV@tempa \SKV@csifdefinable{#1\SKV@tempa}{% @@ -533,7 +557,7 @@ \SKV@ifblank{#2}{% \SKV@err{Arguments of '\string\SKV@expnext' can't be empty}\@ehc }{% - \SKV@iftest{}{@\detokenize\expandafter{\SKV@cdr#1\@nil}@}{% + \SKV@iftest{cat}{$\detokenize\expandafter{\SKV@cdr#1\@nil}$}{% \expandafter#1\expandafter{#2}% }{% \SKV@err{Invalid arguments '\string#1' for @@ -542,8 +566,8 @@ }% }% } -\SKV@pdef*\SKV@ifnew{\SKV@savstate\SKV@t@stopte\SKV@@ifnew} -\SKV@def*\SKV@@ifnew[#1]#2{% +\SKV@pdef*\SKV@ifnewcmd{\SKV@savstate\SKV@t@stopte\SKV@ifn@wcmd} +\SKV@def*\SKV@ifn@wcmd[#1]#2{% \ifSKV@st \ifSKV@pl \def\SKV@ndl{\SKV@for*[#1]#2}% @@ -559,9 +583,8 @@ \fi \SKV@ndl\SKV@ndl{% \ifSKV@pl - \SKV@despace\SKV@ndl - \SKV@expargs{1}\SKV@aftercs - \SKV@ifdefinable{\SKV@ndl}\@nil\relax + \SKV@despacectt\SKV@ndl + \SKV@csifdefinable\SKV@ndl\relax \else \expandafter\SKV@ifdefinable\SKV@ndl\relax \fi @@ -570,7 +593,8 @@ } \let\SKV@no\z@ \SKV@pdef*\SKV@aftergroup{% - \SKV@ifstar{\SKV@aft@rgroup\@firstofone}{\SKV@aft@rgroup\unexpanded}% + \SKV@ifstar{\SKV@aft@rgroup\@firstofone}% + {\SKV@aft@rgroup\unexpanded}% } \SKV@def\SKV@aft@rgroup#1#2{% \edef\SKV@no{\the\numexpr\SKV@no+1}% @@ -606,19 +630,21 @@ \SKV@def*\SKV@@sp@d@f#1{\romannumeral-`\q#1} \SKV@def*\SKV@expox#1{\unexpanded\expandafter{#1}} \SKV@def*\SKV@expcsox#1{\SKV@aftercs\SKV@expox{#1}} -\SKV@def*\SKV@exptx#1{\unexpanded\SKV@threeafter{#1}} +\SKV@def*\SKV@exptx#1{\unexpanded\SKV@threexp{#1}} \SKV@def*\SKV@expcstx#1{\SKV@aftercs\SKV@exptx{#1}} +\SKV@def\SKV@noexpcs#1{\unexpanded\expandafter{\csname#1\endcsname}} \SKV@pdef*\SKV@undef#1{\let#1\SKV@undefined} -\SKV@pdef\SKV@gundef{\global\SKV@undef} +\SKV@pdef*\SKV@gundef{\global\SKV@undef} \SKV@pdef*\SKV@csundef#1{\SKV@aftercs\SKV@undef{#1}} \SKV@pdef*\SKV@csgundef{\global\SKV@csundef} -\SKV@pdef*\SKV@undeflist/#1/#2/{% - \SKV@ifempty{#1}% - {\let\glob@lrel@x\relax}{\let\glob@lrel@x\global}% - \XKV@for@n{#2}\SKV@resvd{% +\SKV@def*\SKV@undeflist{\SKV@savstate\SKV@t@st@p@a\SKV@und@flist} +\SKV@def*\SKV@und@flist#1{% + \ifSKV@ask\let\glob@lrel@x\global\else\let\glob@lrel@x\relax\fi + \XKV@for@n{#1}\SKV@resvd{% \SKV@expnext\SKV@ensurescape\SKV@resvd \glob@lrel@x\expandafter\SKV@undef\SKV@resvd }% + \SKV@resstate } \SKV@pdef*\SKV@Undef{\SKV@savstate\SKV@testopte\SKV@@Undef} \SKV@def*\SKV@@Undef[#1]#2{% @@ -637,9 +663,9 @@ \fi \SKV@ndl\SKV@ndl{% \ifSKV@pl - \SKV@despace\SKV@ndl + \SKV@despacectt\SKV@ndl \ifSKV@ask\expandafter\global\fi - \SKV@threeafter\let + \SKV@threexp\let \expandafter\csname\SKV@ndl\endcsname\SKV@undefined \else \ifSKV@ask\expandafter\global\fi @@ -659,22 +685,28 @@ \relax{2}{1}of2}}\@secondoftwo } \SKV@def*\SKV@ifcsundef#1{\@nameuse{SKV@\SKV@ifcsdef{#1}{2}{1}of2}} -\SKV@pdef*\SKV@AtEndAfterPackageEnd#1{% - \AtEndOfPackage{\SKV@AfterPackageEnd{#1}}} +\SKV@def*\SKV@ifonedef#1{% + \def\SKV@resvda{#1}\SKV@tempswtrue + \XKV@whilist\SKV@resvda\SKV@resvdb\ifSKV@tempsw\fi{% + \SKV@oifdefined\SKV@resvdb\SKV@tempswfalse\SKV@tempswtrue + }% + \@nameuse{SKV@\ifSKV@tempsw2\else1\fi of2}% +} \SKV@def\DeclarePackageCommand#1#2{% \SKV@ensurescape{#2}% \SKV@ifdef#2{% \edef\resvd@a{\expandafter\@gobble\string#2}% \SKV@cslet{Saved\resvd@a}#2% - \edef\resvd@a##1{% - \SKV@AtEndAfterPackageEnd{##1Saved\resvd@a\noexpand\endcsname}}% + \edef\resvd@a##1{\SKV@AtEndAfterPackageEnd% + {##1Saved\resvd@a\noexpand\endcsname}}% \resvd@a{\expandafter\let\expandafter#2\csname}% \SKV@undef\resvd@a }{\SKV@AtEndAfterPackageEnd{\SKV@Undef?#2}}% #1#2% } -\SKV@pdef*\SKV@providedef{\@star@or@long\SKV@@providedef} -\SKV@def\SKV@@providedef#1{% +\SKV@pdef*\SKV@providedef{\@star@or@long\SKV@pr@videdef} +\SKV@def\SKV@pr@videdef#1{% + \SKV@ensurescape{#1}% \edef\SKV@prov@d{\expandafter\@gobble\string#1}% \SKV@aftercs\let{SKV@test@\SKV@prov@d}\SKV@undefined \SKV@ifdef#1{% @@ -690,8 +722,9 @@ \l@ngrel@x\def#1% }% } -\SKV@pdef*\SKV@providerobustdef{\@star@or@long\SKV@@providerobustdef} -\SKV@def\SKV@@providerobustdef#1{% +\SKV@pdef*\SKV@providerobustdef{\@star@or@long\SKV@pr@viderobustdef} +\SKV@def\SKV@pr@viderobustdef#1{% + \SKV@ensurescape{#1}% \edef\SKV@prov@d{\expandafter\@gobble\string#1}% \SKV@aftercs\let{SKV@test@\SKV@prov@d}\SKV@undefined \SKV@ifdef#1{% @@ -708,6 +741,7 @@ }% } \SKV@def\TestProvidedCommand#1{% + \SKV@ensurescape{#1}% \begingroup \SKV@ifmacro#1{% \edef\SKV@resvd@a{\expandafter\@gobble\string#1}% @@ -721,30 +755,25 @@ } \SKV@pdef*\SKV@newdef{\SKV@def} \SKV@providerobustdef*\newdef{\SKV@def} +\SKV@providerobustdef*\redef{\SKV@redef} \SKV@pdef*\SKV@robustdef{\SKV@pdef} \SKV@providerobustdef*\robustdef{\SKV@pdef} +\SKV@providerobustdef*\robustredef{\SKV@predef} \SKV@providerobustdef*\providedef{\SKV@providedef} \SKV@providerobustdef*\providerobustdef{\SKV@providerobustdef} +\SKV@providerobustdef*\aftercommission{\SKV@afterassignment} +\SKV@providerobustdef*\aftercoterie{\SKV@aftergroup} \SKV@def\SKV@ifmacro#1{% \begingroup - \edef\SKV@ifmacro##1{\def##1####1\detokenize{macro}:####2&}% - \SKV@ifmacro\@ifmacro{\expandafter\aftergroup + \edef\SKV@tempa##1{\def##1####1\detokenize{macro}:####2&}% + \SKV@tempa\SKV@tempa{\expandafter\aftergroup \csname SKV@\SKV@ifblank{##2}{2}{1}of2\endcsname}% - \edef\SKV@ifmacro##1{##1\detokenize{macro}:&}% - \SKV@ifmacro{\expandafter\@ifmacro\meaning#1}% + \edef\SKV@tempb##1{##1\detokenize{macro}:&}% + \SKV@tempb{\expandafter\SKV@tempa\meaning#1}% \endgroup } +\SKV@def\SKV@csifmacro{\SKV@aftercs\SKV@ifmacro} \SKV@def\SKV@ifnotmacro#1{\SKV@ifmacro{#1}\@secondoftwo\@firstoftwo} -\SKV@def\SKV@ifparamacro#1{% - \begingroup - \edef\SKV@ifparamacro##1{% - \def##1####1\detokenize{macro}:####2->####3&}% - \SKV@ifparamacro\@ifparam{\expandafter\aftergroup - \csname SKV@\SKV@ifblank{##2}{2}{1}of2\endcsname}% - \edef\SKV@ifparamacro##1{##1\detokenize{macro}:->&}% - \SKV@ifparamacro{\expandafter\@ifparam\meaning#1}% - \endgroup -} \SKV@def*\SKV@ifrelax#1{% \SKV@ensurescape{#1}% \SKV@ifdefined{#1}% @@ -767,12 +796,14 @@ {\@nameuse{SKV@\expandafter\SKV@ifx\csname#1\endcsname \relax{2}{1}of3}}\@thirdofthree } -\SKV@def*\SKV@despace#1{% +\SKV@def*\SKV@despacectt#1{% \SKV@ensurescape{#1}% \SKV@expnext\SKV@sp@def{#1}#1% } \SKV@def\SKV@detokdespace#1{% - \edef#1{\detokenize\expandafter{#1}}\SKV@despace#1} + \edef#1{\detokenize\expandafter{#1}}% + \SKV@despacectt#1% +} \SKV@def\SKV@ifblank#1{\SKV@ifbl@nk#1&&\@secondoftwo\@firstoftwo:} \SKV@def\SKV@ifbl@nk#1#2#4#5:{#4} \SKV@def\SKV@ifnotblank#1{\SKV@ifbl@nk#1&&\@firstoftwo\@secondoftwo:} @@ -786,7 +817,8 @@ \csname SKV@\SKV@ifx\resvd@a\resvd@b{1}{2}of2\endcsname \endgroup } -\SKV@def\SKV@ifstrnotequal#1#2{\SKV@ifstrequal{#1}{#2}\@secondoftwo\@firstoftwo} +\SKV@def\SKV@ifstrnotequal#1#2{% + \SKV@ifstrequal{#1}{#2}\@secondoftwo\@firstoftwo} \SKV@def\SKV@oifstrequal#1#2{% \@expandtwoargs\SKV@ifstrequal{\SKV@expox{#1}}{\SKV@expox{#2}}} \SKV@def\SKV@xifstrequal#1#2{\@expandtwoargs\SKV@ifstrequal{#1}{#2}} @@ -814,26 +846,27 @@ \fi \endgroup } -\SKV@pdef*\SKV@appto{\SKV@savstate\SKV@testoptb{\SKV@apprepto{appto}}} -\SKV@pdef*\SKV@prepto{\SKV@savstate\SKV@testoptb{\SKV@apprepto{prepto}}} +\SKV@pdef*\SKV@appto{\SKV@savstate\SKV@testoptb{\SKV@apprepto{>}}} +\SKV@pdef*\SKV@prepto{\SKV@savstate\SKV@testoptb{\SKV@apprepto{<}}} \SKV@def\SKV@apprepto#1#2#3{% - \def\tempa##1{\def\tempb####1{\SKV@aftercs##1{####1}}}% - \ifSKV@st\let\tempc\SKV@expox\else\let\tempc\unexpanded\fi + \def\SKV@tapa##1{\def\SKV@tapb####1{\SKV@aftercs##1{####1}}}% + \ifSKV@st\let\SKV@tapc\SKV@expox\else\let\SKV@tapc\unexpanded\fi \ifSKV@pl - \let\@ifundef\SKV@ifcsundef\let\tempd\SKV@expcsox - \ifSKV@ask\tempa\xdef\else\tempa\edef\fi + \let\@ifundef\SKV@ifcsundef\let\SKV@tapd\SKV@expcsox + \ifSKV@ask\SKV@tapa\xdef\else\SKV@tapa\edef\fi \else - \let\@ifundef\SKV@ifundef\let\tempd\SKV@expox - \ifSKV@ask\def\tempb##1{\xdef##1}\else\def\tempb##1{\edef##1}\fi + \let\@ifundef\SKV@ifundef\let\SKV@tapd\SKV@expox + \ifSKV@ask\def\SKV@tapb##1{\xdef##1}\else + \def\SKV@tapb##1{\edef##1}\fi \fi \@ifundef{#2}{% - \tempb{#2}{\tempc{#3}}% + \SKV@tapb{#2}{\SKV@tapc{#3}}% }{% - \SKV@ifstrequal{#1}{appto}% - {\tempb{#2}{\tempd{#2}\tempc{#3}}}% - {\tempb{#2}{\tempc{#3}\tempd{#2}}}% + \SKV@ifstrequal{#1}{>}% + {\SKV@tapb{#2}{\SKV@tapd{#2}\SKV@tapc{#3}}}% + {\SKV@tapb{#2}{\SKV@tapc{#3}\SKV@tapd{#2}}}% }% - \SKV@undeflist//\tempa,\tempb,\tempc,\tempd/% + \SKV@undeflist?{\SKV@tapa,\SKV@tapb,\SKV@tapc,\SKV@tapd}% \SKV@resstate } \SKV@pdef\apptomac#1#2{% @@ -850,27 +883,33 @@ \SKV@pdef*\gpreptomac{\global\preptomac} \SKV@pdef*\cspreptomac{\SKV@aftercs\preptomac} \SKV@pdef*\csgpreptomac{\global\cspreptomac} -\SKV@pdef*\SKV@addtolist{\SKV@savstate\SKV@testoptf\SKV@@addtolist} -\SKV@def*\SKV@@addtolist[#1]{% +\SKV@pdef*\SKV@addtolist{\SKV@savstate\SKV@testoptc{% + \SKV@t@stoptg{\SKV@testopt\SKV@addt@list{,}}}} +\SKV@def*\SKV@addt@list[#1]{% \def\parser{#1}% - \ifSKV@ask - \let\glob@l@or@def\xdef - \else - \let\glob@l@or@def\edef - \fi + \ifSKV@ask\let\glob@l@def\xdef\else\let\glob@l@def\edef\fi \ifSKV@pl - \def\SKV@next##1{\SKV@aftercs\SKV@addt@list{##1}}% + \def\SKV@next##1{\SKV@aftercs\SKV@addt@l@st{##1}}% \else - \let\SKV@next\SKV@addt@list + \let\SKV@next\SKV@addt@l@st \fi - \SKV@resstate\SKV@next + \SKV@next } -\SKV@def\SKV@addt@list#1#2{% +\SKV@def\SKV@addt@l@st#1#2{% \SKV@ifundef{#1}{% - \glob@l@or@def#1{\SKV@expox{#2}}% + \glob@l@def#1{\SKV@expox{#2}}% }{% - \glob@l@or@def#1{\SKV@expox{#1}\parser\SKV@expox{#2}}% + \SKV@ifx#1\@empty{% + \glob@l@def#1{\SKV@expox{#2}}% + }{% + \ifSKV@lt + \glob@l@def#1{\SKV@expox{#2}\parser\SKV@expox{#1}}% + \else + \glob@l@def#1{\SKV@expox{#1}\parser\SKV@expox{#2}}% + \fi + }% }% + \SKV@resstate } \SKV@pdef*\SKV@relax#1{\let#1\relax} \SKV@pdef*\SKV@grelax{\global\SKV@relax} @@ -1004,8 +1043,7 @@ } \SKV@pdef*\SKV@for@b{\SKV@testopt\SKV@@for@b{,}} \SKV@def\SKV@@for@b[#1]#2{% - \SKV@CommandGenParser{#1}% - \SKV@expnext\SKV@for@a{#2}% + \SKV@CommandGenParser{#1}\SKV@expnext\SKV@for@a{#2}% } \SKV@pdef*\SKV@tfor{\SKV@ifstar\SKV@tfor@b\SKV@tfor@a} \SKV@pdef*\SKV@tfor@a#1#2#3{% @@ -1063,7 +1101,7 @@ } \SKV@def*\SKV@CommandKeyParser#1{% \long\def\SKV@define@keylist##1{% - \SKV@undeflist/g/\skif,\skifx,\skifcase,\skor,\skelse,\skfi/% + \SKV@undeflist?{\skif,\skifx,\skifcase,\skor,\skelse,\skfi}% \ifswitchon{SKV@st}{% \long\edef\@keylist{\SKV@expox{##1}}% }{% @@ -1098,8 +1136,8 @@ \SKV@err{Erroneous value '#1' for key '#2'}% {Please use the correct value for key '#2'.}% } -\SKV@def*\SKV@despacelist{\SKV@savstate\SKV@testoptd\SKV@despac@list} -\SKV@def*\SKV@despac@list[#1]#2{% +\SKV@def*\SKV@despacelist{\SKV@savstate\SKV@testoptd\SKV@desp@celist} +\SKV@def*\SKV@desp@celist[#1]#2{% \begingroup \let\SKV@resa\@empty \ifSKV@st @@ -1108,7 +1146,7 @@ \def\SKV@dsl{\SKV@for[#1]{#2}}% \fi \SKV@dsl\SKV@dsl{% - \SKV@despace\SKV@dsl + \SKV@despacectt\SKV@dsl \SKV@appto*\SKV@resa{\expandafter#1\SKV@dsl}% }% \ifx\SKV@resa\@empty\else\SKV@remparser[#1]\SKV@resa\fi @@ -1117,7 +1155,7 @@ \SKV@resstate } \SKV@def*\SKV@tdespacelt#1{% - \SKV@tfor{#1}\SKV@dsl{\expandafter\SKV@despace\SKV@dsl}% + \SKV@tfor{#1}\SKV@dsl{\expandafter\SKV@despacectt\SKV@dsl}% } \SKV@pdef*\ReserveKeyPrefixNames{\SKV@ifstar\SKV@rkpn@mes\SKV@rkpn@m@s} \SKV@def*\SKV@rkpn@mes#1{\SKV@AfterPackageEnd{\gapptomac\SKV@rkpnames{,#1}}} @@ -1200,14 +1238,10 @@ \fi \SKV@resstate\SKV@next } -\SKV@pdef*\SKV@numdef{\SKV@savstate\SKV@testoptc{\SKV@numdimdef{num}}} -\SKV@pdef*\SKV@dimdef{\SKV@savstate\SKV@testoptc{\SKV@numdimdef{dim}}} -\SKV@def*\SKV@numdimdef#1{% - \ifSKV@ask - \let\glob@lrel@x\global - \else - \let\glob@lrel@x\relax - \fi +\SKV@pdef*\SKV@numdef{\SKV@savstate\SKV@testoptc{\SKV@expr{num}}} +\SKV@pdef*\SKV@dimdef{\SKV@savstate\SKV@testoptc{\SKV@expr{dim}}} +\SKV@def*\SKV@expr#1{% + \ifSKV@ask\let\glob@lrel@x\global\else\let\glob@lrel@x\relax\fi \ifSKV@pl \def\SKV@next##1{% \edef\resvd@a####1{####1{#1}\SKV@expcsox{##1}}% @@ -1220,11 +1254,8 @@ } \SKV@def*\SKV@numdimd@f#1#2#3{% \SKV@ensurescape@notempty{#2}{#3}% - \SKV@ifstrequal{#1}{num}{% - \def\resvd@a{count}% - }{% - \def\resvd@a{dimen}% - }% + \SKV@ifstrequal{#1}{num}% + {\def\resvd@a{count}}{\def\resvd@a{dimen}}% \SKV@ifundef{#2}{% \@nameuse{new\resvd@a}#2% \glob@lrel@x#2=\@nameuse{#1expr}#3\relax @@ -1234,7 +1265,8 @@ } \SKV@def*\SKV@ensurescape@notempty#1#2{% \SKV@ensurescape{#1}% - \SKV@ifempty{#2}{\SKV@err{Argument '\string#1' is empty}\@ehc}{}% + \SKV@ifempty{#2}% + {\SKV@err{Argument '\string#1' is empty}\@ehc}{}% } \SKV@def*\SKV@keylistparser@err{% \SKV@err{Key list parser '\SKV@keyparser' not allowed}% @@ -1245,13 +1277,13 @@ } \define@cmdkey[KV]{skeyval}[SKV@]{genparser}[,]{% \@onelevel@sanitize\SKV@genparser - \SKV@despace\SKV@genparser + \SKV@despacectt\SKV@genparser \SKV@expargs{0}\SKV@CommandGenParser\SKV@genparser\@nil } \define@cmdkey[KV]{skeyval}[SKV@]{keyparser}[;]{% \@onelevel@sanitize\SKV@keyparser \SKV@xifblank\SKV@keyparser\SKV@keylistparser@err\relax - \SKV@despace\SKV@keyparser + \SKV@despacectt\SKV@keyparser \begingroup \def\SKV@tempa{,}\SKV@detokdespace\SKV@tempa \SKV@ifx\SKV@keyparser\SKV@tempa @@ -1265,7 +1297,7 @@ } \define@cmdkey[KV]{skeyval}[SKV@]{keyprefix}[KV]{% \SKV@xifblank\SKV@keyprefix\SKV@keyprefix@err\relax - \SKV@despace\SKV@keyprefix + \SKV@despacectt\SKV@keyprefix \SKV@expargs{3}\XKV@checksanitizeb{{\SKV@rkpnames}}% \SKV@tempa\@nil \SKV@for*[,]\SKV@tempa\SKV@tempa{% @@ -1278,7 +1310,7 @@ } \define@cmdkey[KV]{skeyval}[SKV@]{keyfamily}[fam]{% \SKV@xifblank\SKV@keyfamily\SKV@keyfamily@err\relax - \SKV@despace\SKV@keyfamily + \SKV@despacectt\SKV@keyfamily \SKV@expargs{3}\XKV@checksanitizeb{{\SKV@rfnames}}% \SKV@tempa\@nil \SKV@for*[,]\SKV@tempa\SKV@tempa{% @@ -1291,7 +1323,7 @@ } \define@cmdkey[KV]{skeyval}[SKV@]{macroprefix}[mp@]{% \SKV@xifblank\SKV@macroprefix\SKV@macroprefix@err\relax - \SKV@despace\SKV@macroprefix + \SKV@despacectt\SKV@macroprefix \SKV@expargs{3}\XKV@checksanitizeb{{\SKV@rmpnames}}% \SKV@tempa\@nil \SKV@for*[,]\SKV@tempa\SKV@tempa{% @@ -1331,10 +1363,18 @@ \def\in@@##1#1##2##3\in@@{\ifx\in@##2\in@false\else\in@true\fi}% \in@@#2\@mil#1\in@\in@@ } -\SKV@pdef*\SKV@in@o#1#2{% +\SKV@pdef*\SKV@in@n#1#2{% \SKV@in@{#1}{#2}% \@nameuse{SKV@\ifin@1\else2\fi of2}% } +\SKV@pdef*\SKV@in@o#1#2{% + \@expandtwoargs\SKV@in@{\SKV@expox{#1}}{\SKV@expox{#2}}% + \@nameuse{SKV@\ifin@1\else2\fi of2}% +} +\SKV@pdef*\SKV@in@x#1#2{% + \@expandtwoargs\SKV@in@{#1}{#2}% + \@nameuse{SKV@\ifin@1\else2\fi of2}% +} \SKV@pdef*\in@tog#1#2{% \SKV@in@{#1}{#2}% \ifin@\togon{in@}\else\togoff{in@}\fi @@ -1373,7 +1413,7 @@ \SKV@ifdefined{#1}% {\CheckCommand\@star@or@none}{\newcommand\@star@or@none}{#1}% } -\def\@check@eq#1#2{% +\SKV@redef\@check@eq#1#2{% \SKV@ifx{#1}{#2}{}{% \SKV@vbsmsg{warn}{% Previous definition of '\string#1'\SKV@MB @@ -1389,9 +1429,9 @@ {\SKV@swvalerr{#1}{#2}}}}}% } \SKV@pdef*\newswitch{\SKV@testopt\SKV@newswitch{}} -\SKV@pdef*\SKV@newswitch[#1]#2{\SKV@testopt{\SKV@n@wswitch[#1]{#2}}{false}} -\SKV@pdef*\SKV@n@wswitch[#1]#2[#3]{% - \SKV@in@o{,}{#2}{% +\SKV@def*\SKV@newswitch[#1]#2{\SKV@testopt{\SKV@n@wswitch[#1]{#2}}{false}} +\SKV@def*\SKV@n@wswitch[#1]#2[#3]{% + \SKV@in@n{,}{#2}{% \SKV@err{Command '\string\newswitch' doesn't accept list}% {Please submit only one switch to '\string\newswitch' at a time.}% }{}% @@ -1407,10 +1447,10 @@ }% } \SKV@pdef*\defswitch{\SKV@testopt\SKV@defswitch{}} -\SKV@pdef*\SKV@defswitch[#1]#2{\SKV@testopt{\SKV@d@fswitch[#1]{#2}}{false}} -\SKV@pdef*\SKV@d@fswitch[#1]#2[#3]{% +\SKV@def*\SKV@defswitch[#1]#2{\SKV@testopt{\SKV@d@fswitch[#1]{#2}}{false}} +\SKV@def*\SKV@d@fswitch[#1]#2[#3]{% \SKV@ensurenoscape{#2}% - \SKV@in@o{,}{#2}{% + \SKV@in@n{,}{#2}{% \SKV@err{Command '\string\defswitch' doesn't accept list}% {Please submit only one switch to '\string\defswitch' at a time.}% }{}% @@ -1474,9 +1514,9 @@ {You need to first define '#1' before use.}% } \SKV@pdef*\newtog{\SKV@testopt\SKV@newtog{}} -\SKV@pdef*\SKV@newtog[#1]#2{\SKV@testopt{\SKV@n@wtog[#1]{#2}}{false}} -\SKV@pdef*\SKV@n@wtog[#1]#2[#3]{% - \SKV@in@o{,}{#2}{% +\SKV@def*\SKV@newtog[#1]#2{\SKV@testopt{\SKV@n@wtog[#1]{#2}}{false}} +\SKV@def*\SKV@n@wtog[#1]#2[#3]{% + \SKV@in@n{,}{#2}{% \SKV@err{Command '\string\newtog' doesn't accept list}% {Please submit only one tog to '\string\newtog' at a time.}% }{}% @@ -1487,9 +1527,9 @@ }{\SKV@csletcs{SKV@toggle@#1#2}{SKV@t@ggle#3}}% } \SKV@pdef*\deftog{\SKV@testopt\SKV@deftog{}} -\SKV@pdef*\SKV@deftog[#1]#2{\SKV@testopt{\SKV@d@ftog[#1]{#2}}{false}} -\SKV@pdef*\SKV@d@ftog[#1]#2[#3]{% - \SKV@in@o{,}{#2}{% +\SKV@def*\SKV@deftog[#1]#2{\SKV@testopt{\SKV@d@ftog[#1]{#2}}{false}} +\SKV@def*\SKV@d@ftog[#1]#2[#3]{% + \SKV@in@n{,}{#2}{% \SKV@err{Command '\string\deftog' doesn't accept list}% {Please submit only one tog to '\string\deftog' at a time.}% }{}% @@ -1640,7 +1680,7 @@ \SKV@expnext\SKV@definedkey@err\SKV@resa \begingroup \edef\SKV@tempa{\endgroup - \SKV@ifbrack{\noexpand\XKV@d@fine@key{\SKV@resa}}% + \SKV@if@brack{\noexpand\XKV@d@fine@key{\SKV@resa}}% {\noexpand\SKV@d@fine@key{\SKV@resa}}% }% \SKV@tempa @@ -1911,7 +1951,7 @@ \SKV@for*[,]#1\SKV@tempa{% \edef\SKV@tempa{\detokenize\expandafter{\SKV@tempa}\space}% \edef\SKV@tempa{\expandafter\zap@space\SKV@tempa\@empty}% - \SKV@csxdef{SKV@zsp@\expandafter\@gobble\SKV@tempa}% + \SKV@csxdef*{SKV@zsp@\expandafter\@gobble\SKV@tempa}% {\SKV@expox{\SKV@tempa}}% }% \endgroup @@ -1921,24 +1961,30 @@ \begingroup \SKV@for*[,]#1\SKV@tempa{% \edef\SKV@tempa{\detokenize\expandafter{\SKV@tempa}}% - \SKV@despace\SKV@tempa - \SKV@csxdef{SKV@dsp@\expandafter\@gobble\SKV@tempa}% + \SKV@despacectt\SKV@tempa + \SKV@csxdef*{SKV@dsp@\expandafter\@gobble\SKV@tempa}% {\SKV@expox{\SKV@tempa}}% }% \endgroup } -\SKV@def*\SKV@exceplist{\par,\if,\ifcase,\or,\else,\skif,\iftog,\ifswitch} +\SKV@def*\SKV@exceplist{% + \par,\if,\ifcase,\or,\else,\skif,\iftog,\ifswitch} \SKV@detok@dsp\SKV@exceplist \SKV@def*\SKV@noiferr#1#2{% - \SKV@err{You can't use '\@backslashchar #1' in key macro within keylist}% + \SKV@err{You can't use '\@backslashchar #1' in\SKV@MB + key macro within keylist}% {Use '\@backslashchar #2' instead of '\@backslashchar #1'.}% } +\SKV@pdef*\uservalue{\uservalue} +\SKV@pdef*\guservalue{\guservalue} +\SKV@pdef*\savevalue{\savevalue} +\SKV@pdef*\gsavevalue{\gsavevalue} \SKV@def\SKV@define@multkeys#1,#2,#3,#4\@nil{% \let\SKV@altlisterr\z@ \SKV@sp@def{#1}\SKV@tempa \SKV@checkchoice{\SKV@tempa}{ord,cmd,bool,tog,choice,menu}{% - \SKV@iftest{num}{\nr=6}{% - \edef\SKV@keytype{\the\numexpr\nr-1}% + \SKV@iftest{num}{\nr=5}{% + \let\SKV@keytype\nr }{% \edef\SKV@keytype{\the\numexpr\nr+1}% }% @@ -2109,7 +2155,7 @@ \SKV@expnext\SKV@suspkey@err\SKV@resa \begingroup \edef\SKV@tempa{\endgroup - \SKV@ifbrack{\noexpand\XKV@d@fine@key{\SKV@resa}}% + \SKV@if@brack{\noexpand\XKV@d@fine@key{\SKV@resa}}% {\noexpand\SKV@d@fine@key{\SKV@resa}}% }% \SKV@tempa @@ -2136,7 +2182,7 @@ \begingroup \def\SKV@tempa{% \expandafter\def\csname\XKV@header\SKV@resa\endcsname####1}% - \SKV@threeafter\endgroup\expandafter\SKV@tempa\expandafter% + \SKV@threexp\endgroup\expandafter\SKV@tempa\expandafter% {\expandafter\def\csname#1\SKV@resa\endcsname{##1}#4}% } \def\XKV@define@choicekey#1{% @@ -2239,7 +2285,7 @@ \SKV@MB In that case, you can use '\string\remove@keys'. }% }{% - \SKV@csedef{\XKV@header\SKV@tempa}{% + \SKV@csedef*{\XKV@header\SKV@tempa}{% \SKV@err{% Key '\SKV@tempa' with prefix '\SKV@pref' in family '\XKV@tfam'\SKV@MB was reserved\on@line @@ -2247,7 +2293,7 @@ Unreserve '\SKV@tempa' before use. }% }% - \@namedef{\XKV@header\SKV@tempa @reser}{}% + \SKV@csdef*{\XKV@header\SKV@tempa @reser}{}% }% }% } @@ -2453,7 +2499,7 @@ }{% \edef\SKV@suspkey{#1}% \global\SKV@csletcs{\XKV@header#1@susp}{\XKV@header#1}% - \SKV@csedef{\XKV@header#1}{\SKV@suspkey@e@r}% + \SKV@csedef*{\XKV@header#1}{\SKV@suspkey@e@r}% \SKV@vbsmsg{info}{Key '\SKV@suspkey' with prefix '\SKV@pref' in \SKV@MB family '\XKV@tfam' was suspended\on@line}% }% @@ -2546,7 +2592,7 @@ \XKV@header#1@reser }% \SKV@for@b\SKV@tempa\SKV@tempa{% - \SKV@despace\SKV@tempa + \SKV@despacectt\SKV@tempa \SKV@csgundef{\SKV@tempa}% }% \endgroup @@ -2558,12 +2604,19 @@ \SKV@def*\SKV@uservaluekeys#1{% \SKV@ifcsundef{SKV@\XKV@header uservalue}{% \XKV@checksanitizeb{#1}\SKV@tempa - \SKV@csxdef{SKV@\XKV@header uservalue}{\SKV@expox{\SKV@tempa}}% + \SKV@csxdef*{SKV@\XKV@header uservalue}{\SKV@expox{\SKV@tempa}}% }{% \SKV@aftercs\XKV@merge{SKV@\XKV@header uservalue}{#1}\XKV@getsg }% } -\protected\def\setkeys{% +\SKV@def*\SKV@undefinedkeys#1#2#3{% + \edef\SKV@resvd##1{\SKV@addtolist?[;]##1{(#1:#2:#3)}}% + \SKV@resvd\SKV@und@finedkeys +} +\SKV@predef*\ExecuteOptionsX{% + \SKV@sktrue\XKV@stfalse\XKV@plfalse\XKV@t@stopte\XKV@setkeys} +\SKV@predef*\setkeys{\SKV@sktrue\XKV@testopta{\XKV@testoptc\XKV@setkeys}} +\SKV@redef*\XKV@setkeys[#1]#2{% \def\skif##1{% \SKV@ensurenoscape{##1}% \SKV@ifcsdef{if##1}{}{% @@ -2574,9 +2627,7 @@ }% \let\skifx\ifx\let\skifcase\ifcase\let\skor\or \let\skelse\else\let\skfi\fi - \SKV@sktrue\XKV@testopta{\XKV@testoptc\XKV@setkeys}% -} -\def\XKV@setkeys[#1]#2{% + \let\SKV@und@finedkeys\@empty \XKV@checksanitizea{#2}\XKV@resb \SKV@normalizea\XKV@resb \let\XKV@naa\@empty @@ -2590,10 +2641,69 @@ \XKV@usepresetkeys{#1}{presett}% \let\CurrentOption\@empty \SKV@skfalse + \SKV@ifx\SKV@und@finedkeys\@empty{}{% + \SKV@warn{*** Unknown keys: \SKV@expox\SKV@und@finedkeys}% + \typein[\answer]{^^JThere were undefined keys: see list above. + ^^JEnter 'stop' or 'go' and <return> to continue.}% + \SKV@oifstrequal{\answer}{stop}{\stop}{}% + }% +} +\SKV@redef*\XKV@s@tk@ys#1=#2=#3\@nil{% + \XKV@g@tkeyname#1=\@nil\XKV@tkey + \SKV@expnext\SKV@sp@def\XKV@tkey\XKV@tkey + \SKV@ifx\XKV@tkey\@empty{% + \SKV@ifempty{#2}{}{% + \SKV@err{No key specified for value '#2'}% + {You have supplied a value '#2' without key name.\SKV@MB + This is certainly an error on your part.\SKV@MB + Please correct the error and rerun.} + }% + }{% + \@expandtwoargs\in@{,\XKV@tkey,}{,\XKV@na,}% + \unless\ifin@ + \XKV@knftrue + \SKV@sp@def{#2}\XKV@tempa + \ifXKV@preset + \XKV@s@tk@ys@{#3}% + \else + \ifXKV@pl + \XKV@for@eo\XKV@fams\XKV@tfam{% + \XKV@makehd\XKV@tfam\XKV@s@tk@ys@{#3}% + }% + \else + \XKV@whilist\XKV@fams\XKV@tfam\ifXKV@knf\fi{% + \XKV@makehd\XKV@tfam\XKV@s@tk@ys@{#3}% + }% + \fi + \fi + \ifXKV@knf + \ifXKV@inpox + \SKV@ifx\XKV@doxs\relax{% + \unless\ifx\@currext\@clsextension + \let\CurrentOption\XKV@tkey\@unknownoptionerror + \fi + }{% + \XKV@doxs + }% + \else + \ifXKV@st + \XKV@addtolist@o\XKV@rm\CurrentOption + \else + \SKV@undefinedkeys{\SKV@pref}{\XKV@fams}{\XKV@tkey}% + \fi + \fi + \else + \ifXKV@inpox\ifx\XKV@testclass\XKV@documentclass + \SKV@expnext\XKV@useoption\CurrentOption + \fi\fi + \fi + \fi + }% } -\def\XKV@s@tk@ys@#1{% +\SKV@redef*\XKV@s@tk@ys@#1{% \SKV@ifcsundef{\XKV@header\XKV@tkey}{% - \SKV@vbsmsg{warn}{No key macro for key '\XKV@tkey'}% + \SKV@vbsmsg{warn}{No key macro for key '\XKV@tkey'\SKV@MB + in families '\XKV@fams'}% }{% \XKV@knffalse \SKV@ifcsundef{SKV@\XKV@header uservalue}{}{% @@ -2602,8 +2712,11 @@ \ifSKV@uv \SKV@ifnotblank{#1}{}{% \SKV@err{You're required to supply a value\SKV@MB - for key '\XKV@tkey'}% - {Supply a value for key '\XKV@tkey' and rerun.}% + for key '\XKV@tkey' in families '\XKV@fams'}% + {Please supply a value for key '\XKV@tkey'\SKV@MB + of families '\XKV@fams' and rerun.\SKV@MB + The originator of this key meant it to\SKV@MB + require a user value.}% }% \fi }% @@ -2633,11 +2746,10 @@ }% } \SKV@def*\SKV@testuservaluekey#1#2{% - \let\SKV@staux\ifSKV@st\SKV@sttrue\SKV@uvfalse - \XKV@whilist#1\SKV@tempa\ifSKV@st\fi{% - \ifx#2\SKV@tempa\SKV@uvtrue\SKV@stfalse\fi + \SKV@tempswtrue\SKV@uvfalse + \XKV@whilist#1\SKV@tempa\ifSKV@tempsw\fi{% + \ifx#2\SKV@tempa\SKV@uvtrue\SKV@tempswfalse\fi }% - \let\ifSKV@st\SKV@staux\SKV@undef\SKV@staux } \SKV@def*\SKV@remspaceletter#1#2{% \begingroup @@ -2720,7 +2832,7 @@ \ifnum\escapechar<0\else \expandafter\expandafter \csname @gobble\ifnum\escapechar=32 space\fi - \SKV@threeafter\endcsname + \SKV@threexp\endcsname \fi\fi \string% } @@ -2767,13 +2879,13 @@ \SKV@cslet{##2@read}\@empty \let\SKV@inp@tfile\relax }{% - \typein[\Answer]{^^J! File '\string##2' does not exist.^^J + \typein[\answer]{^^J! File '\string##2' does not exist.^^J Enter filename or 'no' and <return> to continue.}% - \SKV@oifstrequal{\Answer}{no}{% + \SKV@oifstrequal{\answer}{no}{% \let\SKV@inp@tfile\relax }{% \def\SKV@inp@tfile{% - \SKV@expargs{0}{\SKV@InputFileOnce[##1]}\Answer\@nil + \SKV@expargs{0}{\SKV@InputFileOnce[##1]}\answer\@nil }}}}% \let\SKV@no\z@ \SKV@save\input@path @@ -2815,77 +2927,6 @@ \SKV@notloaded \global\let\SKV@do@b\@gobble } -\SKV@pdef*\DeclareKeyCommand{\@star@or@long\SKV@keycommand} -\SKV@def\SKV@keycommand#1{% - \SKV@ifdefinable#1\relax - \def\SKV@keycmdname{#1}% - \edef\resvd@a{\expandafter\@gobble\string#1}% - \edef\resvd@b{\expandafter\expandafter\expandafter\SKV@carcube - \expandafter\@gobble\string#1\@nil}% - \SKV@scantoksb\resvd@a - \SKV@scantoksb\resvd@b - \edef\resvd##1{\skvoptions{##1,keyfamily=\resvd@a,macroprefix=\resvd@b @}}% - \resvd{keyparser=;,keyprefix=KV}% - \SKV@testopt\SKV@k@ycommand{}% -} -\def\SKV@keycmdlist{}\def\SKV@k@ycmdlist{} -\SKV@def\SKV@k@ycommand[#1]{% - \SKV@ifnotempty{#1}{}{% - \SKV@err{\string\DeclareKeyCommand\space error: no keys declared}\@ehc - }% - \SKV@k@yc@mmand{#1}% - \define@keylist*\SKV@keycmdlist - \edef\resvd{\setkeys[KV]{\resvd@a}{\SKV@k@ycmdlist}}% - \resvd - \SKV@testopt\SKV@k@yc@mm@nd{1}% -} -\SKV@def\SKV@k@yc@mmand#1{% - \def\SKV@keycmdlist{}\def\SKV@k@ycmdlist{}% - \XKV@checksanitizea{#1}\SKV@tempa - \SKV@normalizea\SKV@tempa - \SKV@for*[,]\SKV@tempa\SKV@tempa{% - \expandafter\SKV@getkeyname\SKV@tempa==\@nil - \SKV@addtokeycmdlist\SKV@tkey\SKV@tval - }% -} -\SKV@def\SKV@k@yc@mm@nd[#1]#2{% - \edef\resvd##1##2{##1{\setkeys[KV]{\resvd@a}{####1}##2}}% - \ifx\l@ngrel@x\relax - \def\resvd@b{\newcommand*}% - \else - \let\resvd@b\newcommand - \fi - \resvd{\expandafter\resvd@b\SKV@keycmdname[#1][]}{#2}% -} -\SKV@def\SKV@getkeyname#1=#2=#3\@nil{% - \XKV@g@tkeyname#1=\@nil\SKV@tkey - \SKV@expnext\SKV@sp@def\SKV@tkey\SKV@tkey - \def\SKV@tval{#2}% - \ifx\SKV@tkey\@empty - \SKV@ifnotempty{#2}{}% - {\XKV@err{No key specified for value '#2'}\@ehc}% - \fi - \SKV@ifnotempty{#3}{}% - {\XKV@err{No value specified for key '#1'}\@ehc}% -} -\SKV@def\SKV@addtokeycmdlist#1#2{% - \SKV@oifstrequal{#2}{true}{% - \def\tempa{bool}% - }{% - \SKV@oifstrequal{#2}{false}{% - \def\tempa{bool}% - }{% - \def\tempa{cmd}% - }% - }% - \SKV@oifempty{#1}{}{% - \edef\resvd##1{\gapptomac##1{\tempa,\SKV@expox{#1},\SKV@expox{#2},;}}% - \resvd\SKV@keycmdlist - \edef\resvd##1{\gapptomac##1{\SKV@expox{#1}=\SKV@expox{#2},}}% - \resvd\SKV@k@ycmdlist - }% - \SKV@undef\tempa -} \SKV@onlypreamble{% \SKV@preamblecmds\SKV@onlypreamble \@afterpackageloaded\@ifpackagecurrent\@ifpackagenotcurrent @@ -2895,6 +2936,8 @@ \SKV@AfterLastPage\SKV@AfterDocumentEnd } +%\InputIfFileExists{skeyval-x.sty}{}{} + \endinput %%% End of file skeyval.sty %%% |