summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/skeyval
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-05-05 22:44:01 +0000
committerKarl Berry <karl@freefriends.org>2010-05-05 22:44:01 +0000
commit2efa87d7787e87488d8fee8defb98eecd0dd6054 (patch)
treed2b1b3310a10a25c38c99453c02660f17f6716d1 /Master/texmf-dist/tex/latex/skeyval
parenta6e8956148fe576baa6235b67812daa9cfd899f7 (diff)
skeyval 0.7 (4may10)
git-svn-id: svn://tug.org/texlive/trunk@18113 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/skeyval')
-rw-r--r--Master/texmf-dist/tex/latex/skeyval/skeyval.sty994
1 files changed, 528 insertions, 466 deletions
diff --git a/Master/texmf-dist/tex/latex/skeyval/skeyval.sty b/Master/texmf-dist/tex/latex/skeyval/skeyval.sty
index 203a412dbc4..3178e0be5e4 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.6. %
+% This is file 'skeyval.sty', version 0.7. %
% %
% This package and accompanying files may be distributed and/or %
% modified under the conditions of the LaTeX Project Public License, %
@@ -71,7 +71,7 @@
\SKV@setcode{126}{13}% ~
\def\SKV@rcsid$#1: #2 #3 #4 #5${#4 v#3}
\ProvidesPackage{skeyval}%
- [\SKV@rcsid $Id: skeyval.sty,v 0.6 2010/04/20 09:00:00 Ahmed Musa $
+ [\SKV@rcsid $Id: skeyval.sty,v 0.7 2010/05/05 09:00:00 Ahmed Musa $
Extensions to the xkeyval parser (AM)]
\NeedsTeXFormat{LaTeX2e}[1996/12/01]
\ifnum0=0%
@@ -83,17 +83,18 @@
\fi
\newtoks\SKV@toks
\newcount\SKV@depth
-\def\@nil{\@unexpandable@protect\@nil}
+\protected\def\@nil{\@nil}
\def\@nnil{\@nil}
+\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}
-\newcommand*\@threeexpafter{\expandafter\expandafter\expandafter}
+\def\SKV@threeafter{\expandafter\expandafter\expandafter}
\def\SKV@aftercs#1#2{\expandafter#1\csname#2\endcsname}
-\def\SKV@xaftercs#1#2{\@threeexpafter#1\csname#2\endcsname}
+\def\SKV@xaftercs#1#2{\SKV@threeafter#1\csname#2\endcsname}
\SKV@aftercs\let{SKV@1of1}\@firstofone
\SKV@aftercs\let{SKV@1of2}\@firstoftwo
\SKV@aftercs\let{SKV@2of2}\@secondoftwo
@@ -111,10 +112,11 @@
\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@unifdefined#1{\@nameuse{SKV@\ifdefined#12\else1\fi 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@\ifcsname#1\endcsname2\else1\fi of2}}
-\def\SKV@iftest#1#2{\@nameuse{SKV@\@nameuse{#1}#21\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}}
\begingroup
\def\SKV@tempa{%
\def\SKV@nodocerr{%
@@ -153,6 +155,12 @@
\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{}{%
+ \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
}{%
@@ -161,34 +169,33 @@
{\SKV@ifx\reserved@a\@qrelax\@notdefinable\@firstofone}%
}%
}
+\def\SKV@csifdefinable#1{\begingroup\expandafter\endgroup
+ \expandafter\SKV@ifdefinable\csname#1\endcsname}
\newcommand*\@ifpackagecurrent[2]{%
- \@nameuse{SKV@\SKV@iftest{ifnum}{\@threeexpafter\@parse@version
+ \@nameuse{SKV@\SKV@iftest{num}{\SKV@threeafter\@parse@version
\csname ver@#1.\@pkgextension\endcsname//00\@nil
<\expandafter\@parse@version#2//00\@nil}{2}{1}of2}}
\newcommand*\@ifpackagenotcurrent[2]{%
\@nameuse{SKV@\@ifpackagecurrent{#1}{#2}{2}{1}of2}}
\@ifpackageloaded{xkeyval}{%
\@ifpackagecurrent{xkeyval}{2008/08/13}{}{%
- \PackageError{skeyval}{%
- Your loaded version of xkeyval package is not current
- }{%
- You need version 2.6a (or higher) of xkeyval package.
+ \PackageError{skeyval}{Your loaded version of xkeyval
+ package is not current}{You need version 2.6a
+ (or higher) of xkeyval package.
}%
\endinput
}%
}{\RequirePackage{xkeyval}[2008/08/13]}
-\SKV@ifdefinable\SKV@ifdefinable@n\relax
-\protected\def\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{\@threeexpafter\SKV@car
+ \edef\resvd@a{\SKV@threeafter\SKV@car
\expandafter\string\SKV@tempa\@nil}%
- \ifx\resvd@a\@backslashchar
+ \SKV@unifx\resvd@a\@backslashchar{}{%
\PackageError{skeyval}{Backslash not allowed}{Backslash not
allowed in argument of '\string\SKV@ifdefinable@n'.}%
- \fi
- \@threeexpafter\SKV@ifdefinable
- \expandafter\csname\SKV@tempa\endcsname\relax
+ }%
+ \SKV@csifdefinable\SKV@tempa\relax
}%
}
\SKV@ifdefinable@n{SKV@def,SKV@@def,SKV@pdef,SKV@@pdef,
@@ -283,7 +290,7 @@
\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@scantoks#1#2{%
+\def\SKV@scantoksa#1#2{%
\begingroup
\edef\SKV@tempa{\endgroup
\unexpanded{%
@@ -296,47 +303,34 @@
}%
\SKV@tempa
}
-\SKV@def\SKV@newcs#1#2{%
+\def\SKV@scantoksb#1{%
+ \begingroup
+ \everyeof{\noexpand}%
+ \endlinechar\m@ne
+ \xdef#1{\scantokens\expandafter{#1}}%
+ \endgroup
+}
+\SKV@def*\SKV@newcs#1#2{%
\SKV@ifcsname{#2}{%
\SKV@csifx{#2}\relax{}{\def\reserved@a{#2}\@notdefinable}%
}{\SKV@aftercs{#1}{#2}}%
}
-\SKV@pdef*\SKV@csdef{\SKV@savstate\SKV@t@st@pta\SKV@@csdef}
-\SKV@def*\SKV@@csdef#1{%
+\SKV@def*\SKV@n@wcs#1#2{%
\ifSKV@pl
- \let\SKV@n@xt\SKV@newcs
+ \let\SKV@next\SKV@newcs
\else
- \let\SKV@n@xt\SKV@aftercs
+ \let\SKV@next\SKV@aftercs
\fi
- \SKV@resstate\SKV@n@xt\def{#1}%
+ \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{%
- \ifSKV@pl
- \let\SKV@n@xt\SKV@newcs
- \else
- \let\SKV@n@xt\SKV@aftercs
- \fi
- \SKV@resstate\SKV@n@xt\gdef{#1}%
-}
+\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{%
- \ifSKV@pl
- \let\SKV@n@xt\SKV@newcs
- \else
- \let\SKV@n@xt\SKV@aftercs
- \fi
- \SKV@resstate\SKV@n@xt\edef{#1}%
-}
+\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{%
- \ifSKV@pl
- \let\SKV@n@xt\SKV@newcs
- \else
- \let\SKV@n@xt\SKV@aftercs
- \fi
- \SKV@resstate\SKV@n@xt\xdef{#1}%
-}
+\SKV@def*\SKV@@csxdef#1{\SKV@n@wcs\xdef{#1}}
\SKV@def*\SKV@csuse#1{\SKV@ifcsname{#1}{\@nameuse{#1}}{}}
\SKV@pdef\SKV@expargs#1#2#3#4\@nil{%
\begingroup
@@ -397,7 +391,7 @@
}
\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@ifnextchar[{#1}{#1[{#2}]}}
+\SKV@pdef*\SKV@testopt#1#2{\SKV@ifbrack{#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}}
@@ -422,38 +416,86 @@
\SKV@pdef*\SKV@NewWrites[#1]#2{%
\SKV@for[,]{#2}\SKV@tempa{%
\SKV@expnext\SKV@ensurenoscape\SKV@tempa
- \SKV@aftercs\SKV@ifdefinable{#1\SKV@tempa}{%
+ \SKV@csifdefinable{#1\SKV@tempa}{%
\@nameuse{newwrite\SKV@aftercs}{#1\SKV@tempa}%
}%
}%
}
\SKV@pdef*\NewIfs{\SKV@testopt\SKV@NewIfs{}}
-\SKV@pdef*\SKV@NewIfs[#1]#2{\SKV@testopt{\SKV@NewIf@[#1]{#2}}{false}}
-\SKV@pdef*\SKV@NewIf@[#1]#2[#3]{%
+\SKV@pdef*\SKV@NewIfs[#1]#2{\SKV@testopt{\SKV@New@Ifs[#1]{#2}}{false}}
+\SKV@pdef*\SKV@New@Ifs[#1]#2[#3]{%
+ \SKV@for[,]{#2}\SKV@tempa{%
+ \SKV@expnext\SKV@ensurenoscape\SKV@tempa
+ \begingroup
+ \SKV@oifstrequal{\SKV@tempa}{x}{\SKV@swnameerr{x}}%
+ {\SKV@oifstrequal{\SKV@tempa}{on}{\SKV@swnameerr{on}}%
+ {\SKV@oifstrequal{\SKV@tempa}{off}{\SKV@swnameerr{off}}%
+ {\SKV@oifstrequal{\SKV@tempa}{tog}{\SKV@swnameerr{tog}}%
+ {\SKV@oifstrequal{\SKV@tempa}{switch}{\SKV@swnameerr{switch}}%
+ {}}}}}\endgroup
+ \SKV@csifdefinable{if#1\SKV@tempa}{%
+ \SKV@aftercs\SKV@New@If@{if#1\SKV@tempa}%
+ \@nameuse{#1\SKV@tempa#3}%
+ }%
+ }%
+}
+\def\SKV@New@If@#1{%
+ \@tempcnta\escapechar\escapechar\m@ne
+ \let#1\iffalse
+ \SKV@If#1\iftrue
+ \SKV@If#1\iffalse
+ \let\ifon\iftrue
+ \let\ifoff\iffalse
+ \SKV@If#1\ifon
+ \SKV@If#1\ifoff
+ \escapechar\@tempcnta
+}
+\def\SKV@If#1#2{%
+ \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@getswstate\NewBooleans{#3}%
\SKV@for[,]{#2}\SKV@tempa{%
\SKV@expnext\SKV@ensurenoscape\SKV@tempa
- \SKV@aftercs\SKV@ifdefinable{if#1\SKV@tempa}{%
- \@nameuse{newif\SKV@aftercs}{if#1\SKV@tempa}%
- \@nameuse{#1\SKV@tempa#3}%
+ \SKV@oifstrequal{\SKV@tempa}{tog}{%
+ \SKV@err{'tog' not allowed as a boolean name}\@ehc
+ }{%
+ \SKV@oifstrequal{\SKV@tempa}{switch}{%
+ \SKV@err{'switch' not allowed as a boolean name}\@ehc
+ }{}%
+ }%
+ \SKV@csifdefinable{if#1\SKV@tempa}{%
+ \csnewif{if#1\SKV@tempa}%
+ \@nameuse{#1\SKV@tempa\SKV@resvd}%
}%
}%
}
\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@getswstate\NewTogs{#3}%
\SKV@for[,]{#2}\SKV@tempa{%
\SKV@expnext\SKV@ensurenoscape\SKV@tempa
\edef\SKV@tempa{#1\SKV@tempa}%
\SKV@expnext\newtog\SKV@tempa
- \@nameuse{tog#3\SKV@expnext}\SKV@tempa
+ \@nameuse{tog\SKV@resvd\SKV@expnext}\SKV@tempa
}%
}
\SKV@pdef*\NewToks{\SKV@testopt\SKV@NewToks{}}
\SKV@pdef*\SKV@NewToks[#1]#2{%
\SKV@for[,]{#2}\SKV@tempa{%
\SKV@expnext\SKV@ensurenoscape\SKV@tempa
- \SKV@aftercs\SKV@ifdefinable{#1\SKV@tempa}{%
- \@nameuse{newtoks\SKV@aftercs}{#1\SKV@tempa}%
+ \SKV@csifdefinable{#1\SKV@tempa}{%
+ \csnewtoks{#1\SKV@tempa}%
}%
}%
}
@@ -461,8 +503,8 @@
\SKV@pdef*\SKV@NewCounts[#1]#2{%
\SKV@for[,]{#2}\SKV@tempa{%
\SKV@expnext\SKV@ensurenoscape\SKV@tempa
- \SKV@aftercs\SKV@ifdefinable{#1\SKV@tempa}{%
- \@nameuse{newcount\SKV@aftercs}{#1\SKV@tempa}%
+ \SKV@csifdefinable{#1\SKV@tempa}{%
+ \csnewcount{#1\SKV@tempa}%
}%
}%
}
@@ -470,8 +512,8 @@
\SKV@pdef*\SKV@NewDimens[#1]#2{%
\SKV@for[,]{#2}\SKV@tempa{%
\SKV@expnext\SKV@ensurenoscape\SKV@tempa
- \SKV@aftercs\SKV@ifdefinable{#1\SKV@tempa}{%
- \@nameuse{newdimen\SKV@aftercs}{#1\SKV@tempa}%
+ \SKV@csifdefinable{#1\SKV@tempa}{%
+ \csnewdimen{#1\SKV@tempa}%
}%
}%
}
@@ -479,8 +521,8 @@
\SKV@pdef*\SKV@NewBoxes[#1]#2{%
\SKV@for[,]{#2}\SKV@tempa{%
\SKV@expnext\SKV@ensurenoscape\SKV@tempa
- \SKV@aftercs\SKV@ifdefinable{#1\SKV@tempa}{%
- \@nameuse{newbox\SKV@aftercs}{#1\SKV@tempa}%
+ \SKV@csifdefinable{#1\SKV@tempa}{%
+ \csnewbox{#1\SKV@tempa}%
}%
}%
}
@@ -491,33 +533,15 @@
\SKV@ifblank{#2}{%
\SKV@err{Arguments of '\string\SKV@expnext' can't be empty}\@ehc
}{%
- \SKV@iftest{if}{@\detokenize\expandafter{\SKV@cdr#1\@nil}@}{%
+ \SKV@iftest{}{@\detokenize\expandafter{\SKV@cdr#1\@nil}@}{%
\expandafter#1\expandafter{#2}%
}{%
\SKV@err{Invalid arguments '\string#1' for
- '\string\SKV@expnext'\SKV@MB}\@ehc
+ '\string\SKV@expnext'}\@ehc
}%
}%
}%
}
-\SKV@pdef*\SKV@DelayedAfterPackageEnd#1{%
- \AtEndOfPackage{\SKV@AfterPackageEnd{#1}}}
-\SKV@def\DeclarePackageCommand#1#2{%
- \SKV@ensurescape{#2}%
- \SKV@ifdefined#2{%
- \edef\resvd@a{\expandafter\@gobble\string#2}%
- \SKV@aftercs\let{Saved\resvd@a}#2%
- \edef\resvd@a##1{%
- \SKV@DelayedAfterPackageEnd{##1Saved\resvd@a\noexpand\endcsname}%
- }%
- \resvd@a{\expandafter\let\expandafter#2\csname}%
- \let\resvd@a\relax
- }{\SKV@DelayedAfterPackageEnd{\SKV@gundef#2}}%
- #1#2%
-}
-\DeclarePackageCommand{\protected\def}\@namegdef{\SKV@aftercs\gdef}
-\DeclarePackageCommand{\protected\def}\@nameedef{\SKV@aftercs\edef}
-\DeclarePackageCommand{\protected\def}\@namexdef{\SKV@aftercs\xdef}
\SKV@pdef*\SKV@ifnew{\SKV@savstate\SKV@t@stopte\SKV@@ifnew}
\SKV@def*\SKV@@ifnew[#1]#2{%
\ifSKV@st
@@ -570,26 +594,28 @@
\expandafter\endgroup\expandafter\afterassignment
\csname SKV@aft@rassignm@nt\SKV@no\endcsname
}
-\SKV@def*\SKV@trailead#1#2{%
- \edef\SKV@trail{\the\SKV@toks}%
- \SKV@toks\expandafter{\romannumeral-`\q\SKV@tr@ilead\noexpand#1& &}%
+\SKV@def*\SKV@sp@def#1#2{%
+ \edef\@sp@def{\the\SKV@toks}%
+ \SKV@toks\expandafter{%
+ \romannumeral-`\q\SKV@@sp@def\noexpand\noexpand#1& &}%
\edef#2{\the\SKV@toks}%
- \SKV@toks\expandafter{\SKV@trail}%
- \SKV@undef\SKV@trail
+ \SKV@toks\expandafter{\@sp@def}%
+ \SKV@undef\@sp@def
}
-\SKV@def*\SKV@tr@ilead#1 &{\SKV@tr@ile@d#1&}
-\SKV@def*\SKV@tr@ile@d#1&#2{\romannumeral-`\q#1}
+\SKV@def*\SKV@@sp@def#1 &{\SKV@@sp@d@f#1&}
+\SKV@def*\SKV@@sp@d@f#1&#2{\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\@threeexpafter{#1}}
+\SKV@def*\SKV@exptx#1{\unexpanded\SKV@threeafter{#1}}
\SKV@def*\SKV@expcstx#1{\SKV@aftercs\SKV@exptx{#1}}
\SKV@pdef*\SKV@undef#1{\let#1\SKV@undefined}
\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@undeflt#1#2{%
- \SKV@ifempty{#1}{\let\glob@lrel@x\relax}{\let\glob@lrel@x\global}%
- \SKV@for[,]{#2}\SKV@resvd{%
+\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@expnext\SKV@ensurescape\SKV@resvd
\glob@lrel@x\expandafter\SKV@undef\SKV@resvd
}%
@@ -613,7 +639,7 @@
\ifSKV@pl
\SKV@despace\SKV@ndl
\ifSKV@ask\expandafter\global\fi
- \@threeexpafter\let
+ \SKV@threeafter\let
\expandafter\csname\SKV@ndl\endcsname\SKV@undefined
\else
\ifSKV@ask\expandafter\global\fi
@@ -633,6 +659,20 @@
\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\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}}%
+ \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{%
\edef\SKV@prov@d{\expandafter\@gobble\string#1}%
@@ -729,9 +769,10 @@
}
\SKV@def*\SKV@despace#1{%
\SKV@ensurescape{#1}%
- \SKV@expnext\SKV@trailead{#1}#1%
+ \SKV@expnext\SKV@sp@def{#1}#1%
}
-\SKV@def\SKV@detokdespace#1#2{\edef#2{\detokenize{#1}}\SKV@despace#2}
+\SKV@def\SKV@detokdespace#1{%
+ \edef#1{\detokenize\expandafter{#1}}\SKV@despace#1}
\SKV@def\SKV@ifblank#1{\SKV@ifbl@nk#1&&\@secondoftwo\@firstoftwo:}
\SKV@def\SKV@ifbl@nk#1#2&#3#4#5:{#4}
\SKV@def\SKV@ifnotblank#1{\SKV@ifbl@nk#1&&\@firstoftwo\@secondoftwo:}
@@ -739,7 +780,8 @@
\SKV@def\SKV@xifblank#1{\SKV@expargs{0}\SKV@ifblank{#1}\@nil}
\SKV@def\SKV@ifstrequal#1#2{%
\begingroup
- \SKV@detokdespace{#1}\resvd@a\SKV@detokdespace{#2}\resvd@b
+ \def\resvd@a{#1}\def\resvd@b{#2}%
+ \SKV@detokdespace\resvd@a\SKV@detokdespace\resvd@b
\expandafter\aftergroup
\csname SKV@\SKV@ifx\resvd@a\resvd@b{1}{2}of2\endcsname
\endgroup
@@ -762,7 +804,7 @@
}%
\def\SKV@t@mp##1\@nil{%
\ifx\@temptoks\@sptoken
- \SKV@expnext\SKV@trailead{#2}#2%
+ \SKV@expnext\SKV@sp@def{#2}#2%
\expandafter\SKV@tempa\expandafter#1#2\@nil
\else
\if#1\@temptoks\expandafter\SKV@tempa#2\@nil\fi
@@ -772,76 +814,28 @@
\fi
\endgroup
}
-\SKV@pdef*\SKV@appto{\SKV@savstate\SKV@testoptb\SKV@@appto}
-\SKV@def\SKV@@appto#1#2{%
- \ifSKV@st
- \let\@unexp@expox\SKV@expox
- \else
- \let\@unexp@expox\unexpanded
- \fi
- \SKV@ap@to{#1}{#2}%
- \SKV@resstate
-}
-\SKV@def*\SKV@ap@to#1#2{%
+\SKV@pdef*\SKV@appto{\SKV@savstate\SKV@testoptb{\SKV@apprepto{appto}}}
+\SKV@pdef*\SKV@prepto{\SKV@savstate\SKV@testoptb{\SKV@apprepto{prepto}}}
+\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
\ifSKV@pl
- \ifSKV@ask
- \let\SKV@n@xt\SKV@csxdef
- \else
- \let\SKV@n@xt\SKV@csedef
- \fi
- \SKV@ifcsundef{#1}{%
- \SKV@n@xt{#1}{\@unexp@expox{#2}}%
- }{%
- \SKV@n@xt{#1}{\SKV@expcsox{#1}\@unexp@expox{#2}}%
- }%
+ \let\@ifundef\SKV@ifcsundef\let\tempd\SKV@expcsox
+ \ifSKV@ask\tempa\xdef\else\tempa\edef\fi
\else
- \ifSKV@ask
- \let\SKV@n@xt\xdef
- \else
- \let\SKV@n@xt\edef
- \fi
- \SKV@ifundef{#1}{%
- \SKV@n@xt#1{\@unexp@expox{#2}}%
- }{%
- \SKV@n@xt#1{\SKV@expox{#1}\@unexp@expox{#2}}%
- }%
+ \let\@ifundef\SKV@ifundef\let\tempd\SKV@expox
+ \ifSKV@ask\def\tempb##1{\xdef##1}\else\def\tempb##1{\edef##1}\fi
\fi
-}
-\SKV@pdef*\SKV@prepto{\SKV@savstate\SKV@testoptb\SKV@@prepto}
-\SKV@def\SKV@@prepto#1#2{%
- \ifSKV@st
- \let\@unexp@expox\SKV@expox
- \else
- \let\@unexp@expox\unexpanded
- \fi
- \SKV@pr@pto{#1}{#2}%
+ \@ifundef{#2}{%
+ \tempb{#2}{\tempc{#3}}%
+ }{%
+ \SKV@ifstrequal{#1}{appto}%
+ {\tempb{#2}{\tempd{#2}\tempc{#3}}}%
+ {\tempb{#2}{\tempc{#3}\tempd{#2}}}%
+ }%
+ \SKV@undeflist//\tempa,\tempb,\tempc,\tempd/%
\SKV@resstate
}
-\SKV@def*\SKV@pr@pto#1#2{%
- \ifSKV@pl
- \ifSKV@ask
- \let\SKV@n@xt\SKV@csxdef
- \else
- \let\SKV@n@xt\SKV@csedef
- \fi
- \SKV@ifcsundef{#1}{%
- \SKV@n@xt{#1}{\@unexp@expox{#2}}%
- }{%
- \SKV@n@xt{#1}{\@unexp@expox{#2}\SKV@expcsox{#1}}%
- }%
- \else
- \ifSKV@ask
- \let\SKV@n@xt\xdef
- \else
- \let\SKV@n@xt\edef
- \fi
- \SKV@ifundef{#1}{%
- \SKV@n@xt#1{\@unexp@expox{#2}}%
- }{%
- \SKV@n@xt#1{\@unexp@expox{#2}\SKV@expox{#1}}%
- }%
- \fi
-}
\SKV@pdef\apptomac#1#2{%
\SKV@ifundef{#1}{\edef#1{\unexpanded{#2}}}%
{\edef#1{\SKV@expox{#1}\unexpanded{#2}}}%
@@ -859,22 +853,17 @@
\SKV@pdef*\SKV@addtolist{\SKV@savstate\SKV@testoptf\SKV@@addtolist}
\SKV@def*\SKV@@addtolist[#1]{%
\def\parser{#1}%
+ \ifSKV@ask
+ \let\glob@l@or@def\xdef
+ \else
+ \let\glob@l@or@def\edef
+ \fi
\ifSKV@pl
- \def\SKV@n@xt##1{\SKV@aftercs\SKV@addt@list{##1}}%
- \ifSKV@ask
- \let\glob@l@or@def\xdef
- \else
- \let\glob@l@or@def\edef
- \fi
+ \def\SKV@next##1{\SKV@aftercs\SKV@addt@list{##1}}%
\else
- \let\SKV@n@xt\SKV@addt@list
- \ifSKV@ask
- \let\glob@l@or@def\xdef
- \else
- \let\glob@l@or@def\edef
- \fi
+ \let\SKV@next\SKV@addt@list
\fi
- \SKV@resstate\SKV@n@xt
+ \SKV@resstate\SKV@next
}
\SKV@def\SKV@addt@list#1#2{%
\SKV@ifundef{#1}{%
@@ -974,22 +963,22 @@
}%
}
\SKV@ifcsdef{ver@#1.\@pkgextension}{%
- \let\SKV@n@xt\@firstofone
+ \let\SKV@next\@firstofone
}{%
- \def\SKV@n@xt{\SKV@appto+{#1.\@pkgextension-skvh@@k}}%
+ \def\SKV@next{\SKV@appto+{#1.\@pkgextension-skvh@@k}}%
}%
- \SKV@n@xt
+ \SKV@next
}
\let\SKV@steno\z@
\SKV@pdef*\SKV@for{\SKV@savstate\SKV@testoptd\SKV@@for}
\SKV@pdef*\SKV@@for[#1]{%
\let\SKV@steno\@ne
\ifSKV@st
- \def\SKV@n@xt{\SKV@for@b[#1]}%
+ \def\SKV@next{\SKV@for@b[#1]}%
\else
- \def\SKV@n@xt{\SKV@CommandGenParser{#1}\SKV@for@a}%
+ \def\SKV@next{\SKV@CommandGenParser{#1}\SKV@for@a}%
\fi
- \SKV@n@xt
+ \SKV@next
}
\SKV@pdef*\SKV@CommandGenParser#1{%
\def\parser{#1}%
@@ -1034,15 +1023,15 @@
\SKV@def\SKV@tforloop#1#2&#3#4{%
\long\def#3{#1}%
\SKV@ifstrequal{#1}{\listbreak}{%
- \let\SKV@n@xt\SKV@tforrema
+ \let\SKV@next\SKV@tforrema
}{%
\SKV@ifstrequal{#1}{\@nil}{%
- \let\SKV@n@xt\SKV@tfornoop
+ \let\SKV@next\SKV@tfornoop
}{%
- #4\relax\let\SKV@n@xt\SKV@tforloop
+ #4\relax\let\SKV@next\SKV@tforloop
}%
}%
- \SKV@n@xt#2&#3{#4}%
+ \SKV@next#2&#3{#4}%
}
\SKV@def\SKV@tfornoop#1&#2#3{}
\SKV@pdef*\SKV@tforrema#1\@nil\@nil&#2#3{%
@@ -1053,8 +1042,8 @@
\SKV@pdef*\SKV@onlypreamble#1{%
\SKV@tfor{#1}\SKV@resvd{%
\SKV@expnext\SKV@ensurescape\SKV@resvd
- \expandafter\gapptomac\expandafter\SKV@preamblecmds
- \expandafter{\expandafter\SKV@do@a\SKV@resvd}%
+ \edef\SKV@resvd##1##2{\SKV@appto?##1{##2\SKV@expox{\SKV@resvd}}}%
+ \SKV@resvd\SKV@preamblecmds\SKV@do@a
}%
}
\SKV@AfterDocumentStart{%
@@ -1074,7 +1063,7 @@
}
\SKV@def*\SKV@CommandKeyParser#1{%
\long\def\SKV@define@keylist##1{%
- \SKV@undeflt{g}{\skif,\skifx,\skifcase,\skor,\skelse,\skfi}%
+ \SKV@undeflist/g/\skif,\skifx,\skifcase,\skor,\skelse,\skfi/%
\ifswitchon{SKV@st}{%
\long\edef\@keylist{\SKV@expox{##1}}%
}{%
@@ -1106,8 +1095,8 @@
\SKV@expargs{3}{\XKV@checkchoice[\val\nr]}{{#1}{#2}}{{#3}{#4}}\@nil
}
\SKV@pdef*\SKV@inputerr#1#2{%
- \SKV@err{Erroneous value '#1' for key '#2'}{%
- Please use the correct value for key '#2'.}%
+ \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{%
@@ -1160,9 +1149,9 @@
\SKV@pdef*\SKV@cslet{\SKV@savstate\SKV@t@stopta\SKV@@cslet}
\SKV@def*\SKV@@cslet#1#2{%
\ifSKV@st
- \def\SKV@n@xt{\SKV@aftercs\let{#1}#2}%
+ \def\SKV@next{\SKV@aftercs\let{#1}#2}%
\else
- \def\SKV@n@xt{%
+ \def\SKV@next{%
\SKV@ifdef{#2}{%
\SKV@aftercs\let{#1}#2%
}{%
@@ -1171,17 +1160,17 @@
}%
}%
\fi
- \SKV@resstate\SKV@n@xt
+ \SKV@resstate\SKV@next
}
\SKV@pdef*\SKV@letcs{\SKV@savstate\SKV@t@stopta\SKV@@letcs}
\SKV@def*\SKV@@letcs#1#2{%
\ifSKV@st
- \def\SKV@n@xt{%
+ \def\SKV@next{%
\begingroup\expandafter\endgroup
\expandafter\let\expandafter#1\csname#2\endcsname
}%
\else
- \def\SKV@n@xt{%
+ \def\SKV@next{%
\SKV@ifcsdef{#2}{%
\expandafter\let\expandafter#1\csname#2\endcsname
}{%
@@ -1190,17 +1179,17 @@
}%
}%
\fi
- \SKV@resstate\SKV@n@xt
+ \SKV@resstate\SKV@next
}
\SKV@pdef*\SKV@csletcs{\SKV@savstate\SKV@t@stopta\SKV@@csletcs}
\SKV@def*\SKV@@csletcs#1#2{%
\ifSKV@st
- \def\SKV@n@xt{%
+ \def\SKV@next{%
\begingroup\expandafter\endgroup
\expandafter\let\csname#1\SKV@aftercs\endcsname{#2}%
}%
\else
- \def\SKV@n@xt{%
+ \def\SKV@next{%
\SKV@ifcsdef{#2}{%
\SKV@aftercs\let{#1\SKV@aftercs}{#2}%
}{%
@@ -1209,60 +1198,38 @@
}%
}%
\fi
- \SKV@resstate\SKV@n@xt
+ \SKV@resstate\SKV@next
}
-\SKV@pdef*\SKV@numdef{\SKV@savstate\SKV@testoptc\SKV@@numdef}
-\SKV@pdef*\SKV@@numdef{%
- \ifSKV@pl
- \def\SKV@n@xt##1{\SKV@aftercs\SKV@numd@f{##1}}%
- \ifSKV@ask
- \let\glob@lrel@x\global
- \else
- \let\glob@lrel@x\relax
- \fi
+\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\SKV@n@xt\SKV@numd@f
- \ifSKV@ask
- \let\glob@lrel@x\global
- \else
- \let\glob@lrel@x\relax
- \fi
+ \let\glob@lrel@x\relax
\fi
- \SKV@resstate\SKV@n@xt
-}
-\SKV@pdef*\SKV@numd@f#1#2{%
- \SKV@ensurescape@notempty{#1}{#2}%
- \SKV@ifundef{#1}{%
- \newcount#1\glob@lrel@x#1=\numexpr#2\relax
- }{%
- \glob@lrel@x#1=\numexpr#2\relax
- }%
-}
-\SKV@pdef*\SKV@dimdef{\SKV@savstate\SKV@testoptc\SKV@@dimdef}
-\SKV@pdef*\SKV@@dimdef{%
\ifSKV@pl
- \def\SKV@n@xt##1{\SKV@aftercs\SKV@dimd@f{##1}}%
- \ifSKV@ask
- \let\glob@lrel@x\global
- \else
- \let\glob@lrel@x\relax
- \fi
+ \def\SKV@next##1{%
+ \edef\resvd@a####1{####1{#1}\SKV@expcsox{##1}}%
+ \resvd@a\SKV@numdimd@f
+ }%
\else
- \let\SKV@n@xt\SKV@dimd@f
- \ifSKV@ask
- \let\glob@lrel@x\global
- \else
- \let\glob@lrel@x\relax
- \fi
+ \def\SKV@next{\SKV@numdimd@f{#1}}%
\fi
- \SKV@resstate\SKV@n@xt
+ \SKV@resstate\SKV@next
}
-\SKV@pdef*\SKV@dimd@f#1#2{%
- \SKV@ensurescape@notempty{#1}{#2}%
- \SKV@ifundef{#1}{%
- \newdimen#1\glob@lrel@x#1=\dimexpr#2\relax
+\SKV@def*\SKV@numdimd@f#1#2#3{%
+ \SKV@ensurescape@notempty{#2}{#3}%
+ \SKV@ifstrequal{#1}{num}{%
+ \def\resvd@a{count}%
}{%
- \glob@lrel@x#1=\dimexpr#2\relax
+ \def\resvd@a{dimen}%
+ }%
+ \SKV@ifundef{#2}{%
+ \@nameuse{new\resvd@a}#2%
+ \glob@lrel@x#2=\@nameuse{#1expr}#3\relax
+ }{%
+ \glob@lrel@x#2=\@nameuse{#1expr}#3\relax
}%
}
\SKV@def*\SKV@ensurescape@notempty#1#2{%
@@ -1286,7 +1253,7 @@
\SKV@xifblank\SKV@keyparser\SKV@keylistparser@err\relax
\SKV@despace\SKV@keyparser
\begingroup
- \SKV@detokdespace{,}\SKV@tempa
+ \def\SKV@tempa{,}\SKV@detokdespace\SKV@tempa
\SKV@ifx\SKV@keyparser\SKV@tempa
{\aftergroup\SKV@keylistparser@err}{}%
\endgroup
@@ -1335,8 +1302,8 @@
\define@boolkey+[KV]{skeyval}[SKV@]{draft}[true]{%
\ifSKV@draft
\setkeys[KV]{skeyval}{final=false}%
- \SKV@AtPackageEnd{\ifSKV@draft\togtrue{draft}\else
- \togfalse{draft}\fi}%
+ \SKV@AtPackageEnd{\ifSKV@draft\togon{draft}\else
+ \togoff{draft}\fi}%
\fi
}{%
\SKV@inputerr{#1}{draft}%
@@ -1344,8 +1311,8 @@
\define@boolkey+[KV]{skeyval}[SKV@]{final}[true]{%
\ifSKV@final
\setkeys[KV]{skeyval}{draft=false}%
- \SKV@AtPackageEnd{\ifSKV@final\togtrue{final}\else
- \togfalse{final}\fi}%
+ \SKV@AtPackageEnd{\ifSKV@final\togon{final}\else
+ \togoff{final}\fi}%
\fi
}{%
\SKV@inputerr{#1}{final}%
@@ -1355,11 +1322,32 @@
keyfamily,macroprefix,final}
\ProcessOptionsX*[KV]<skeyval>\relax
\SKV@pdef*\skvoptions#1{\setkeys[KV]{skeyval}{#1}}
-\SKV@pdef*\SKV@ifdraft{\@nameuse{@\ifSKV@draft first\else second\fi oftwo}}
-\SKV@pdef*\SKV@iffinal{\@nameuse{@\ifSKV@final first\else second\fi oftwo}}
-\SKV@pdef*\SKV@ifnotdraft{\SKV@ifdraft\@secondoftwo\@firstoftwo}
-\SKV@pdef*\SKV@ifnotfinal{\SKV@iffinal\@secondoftwo\@firstoftwo}
+\SKV@pdef*\SKV@ifdraft{\@nameuse{SKV@\ifSKV@draft1\else2\fi of2}}
+\SKV@pdef*\SKV@iffinal{\@nameuse{SKV@\ifSKV@final1\else2\fi of2}}
+\SKV@pdef*\SKV@ifnotdraft{\@nameuse{SKV@\SKV@ifdraft2\else1\fi of2}}
+\SKV@pdef*\SKV@ifnotfinal{\@nameuse{SKV@\SKV@iffinal2\else1\fi of2}}
\def\SKV@useinfo#1{Not using '\@backslashchar#1' of 'skyeval' package}
+\SKV@pdef*\SKV@in@#1#2{%
+ \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@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
+}
+\AtEndOfPackage{\deftog{in@}}
+\SKV@pdef*\in@tok#1#2{%
+ \begingroup
+ \SKV@expnext\SKV@sp@def{\detokenize{#1}}\SKV@tempa
+ \SKV@expnext\SKV@sp@def{\detokenize{#2}}\SKV@tempb
+ \@expandtwoargs\SKV@in@\SKV@tempa\SKV@tempb
+ \global\let\ifin@\ifin@
+ \endgroup
+}
\AtBeginDocument{%
\SKV@ifundef\ifdraft
{\SKV@pdef*\ifdraft{\SKV@ifdraft}}%
@@ -1393,37 +1381,57 @@
* I haven't redefined '\string#1' *}%
}%
}
-\SKV@pdef*\newswitch#1#2{%
- \SKV@ensurenoscape{#1}%
- \SKV@ifstrequal{#2}{true}{\def\SKV@resvd{true}}{%
- \SKV@ifstrequal{#2}{false}{\def\SKV@resvd{false}}{%
- \SKV@ifstrequal{#2}{on}{\def\SKV@resvd{true}}{%
- \SKV@ifstrequal{#2}{off}{\def\SKV@resvd{false}}{%
- \SKV@swvalerr{#1}{#2}%
- }%
- }%
- }%
+\SKV@def*\SKV@getswstate#1#2{%
+ \SKV@ifstrequal{#2}{true}{\def\SKV@resvd{true}}%
+ {\SKV@ifstrequal{#2}{false}{\def\SKV@resvd{false}}%
+ {\SKV@ifstrequal{#2}{on}{\def\SKV@resvd{true}}%
+ {\SKV@ifstrequal{#2}{off}{\def\SKV@resvd{false}}%
+ {\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@err{Command '\string\newswitch' doesn't accept list}%
+ {Please submit only one switch to '\string\newswitch' at a time.}%
+ }{}%
+ \SKV@ensurenoscape{#2}%
+ \SKV@ifstrnotequal{#1#2}{x}{}{%
+ \SKV@err{'\string\ifx' is a TeX primitive}%
+ {You can't redefine '\string\ifx'? This is dangerous.}%
+ }%
+ \SKV@getswstate\newswitch{#3}%
+ \SKV@csifdefinable{if#1#2}{%
+ \csnewif{if#1#2}%
+ \@nameuse{#1#2\SKV@resvd}%
+ }%
+}
+\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@ensurenoscape{#2}%
+ \SKV@in@o{,}{#2}{%
+ \SKV@err{Command '\string\defswitch' doesn't accept list}%
+ {Please submit only one switch to '\string\defswitch' at a time.}%
+ }{}%
+ \SKV@ifcsundef{if#1#2}{}{%
+ \SKV@vbsmsg{warn}{Switch '\@backslashchar if#1#2' redefined\on@line}%
}%
- \expandafter\SKV@ifdefinable\csname if#1\endcsname{%
- \csname newif\expandafter\endcsname\csname if#1\endcsname
- \csname #1\SKV@resvd\endcsname
+ \SKV@ifstrnotequal{#1#2}{x}{}{%
+ \SKV@err{'\string\ifx' is a TeX primitive}%
+ {Why do you want to redefine '\string\ifx'? This is dangerous.}%
}%
+ \SKV@getswstate\defswitch{#3}%
+ \csnewif{if#1#2}%
+ \@nameuse{#1#2\SKV@resvd}%
}
-\SKV@newlet\NewSwitches\NewIfs
+\SKV@newlet\NewSwitches\NewBooleans
\SKV@def*\setswitch#1#2{%
\SKV@ensurenoscape{#1}%
\SKV@ifcsundef{if#1}{%
\SKV@noswerr{#1}%
}{%
- \SKV@ifstrequal{#2}{true}{\def\SKV@resvd{true}}{%
- \SKV@ifstrequal{#2}{false}{\def\SKV@resvd{false}}{%
- \SKV@ifstrequal{#2}{on}{\def\SKV@resvd{true}}{%
- \SKV@ifstrequal{#2}{off}{\def\SKV@resvd{false}}{%
- \SKV@swvalerr{#1}{#2}%
- }%
- }%
- }%
- }%
+ \SKV@getswstate\setswitch{#2}%
\csname#1\SKV@resvd\endcsname
}%
}
@@ -1440,86 +1448,107 @@
\SKV@def*\ifswitchon#1{%
\SKV@ensurenoscape{#1}%
\SKV@ifcsundef{if#1}{\SKV@noswerr{#1}\@gobbletwo}%
- {\@nameuse{@\@nameuse{if#1}first\else second\fi oftwo}}%
+ {\@nameuse{SKV@\@nameuse{if#1}1\else2\fi of2}}%
}
\SKV@newlet\ifswitchtrue\ifswitchon
\SKV@def*\ifswitchoff#1{%
\SKV@ensurenoscape{#1}%
\SKV@ifcsundef{if#1}{\SKV@noswerr{#1}\@gobbletwo}%
- {\@nameuse{@\@nameuse{if#1}second\else first\fi oftwo}}%
+ {\@nameuse{SKV@\@nameuse{if#1}2\else1\fi of2}}%
}
\SKV@newlet\ifswitchfalse\ifswitchoff
\SKV@pdef*\SKV@noswerr#1{%
\SKV@err{Switch '\string#1' is undefined}%
{You need to first define the switch '\string#1'.}%
}
+\SKV@pdef*\SKV@swnameerr#1{%
+ \SKV@err{'\string\if#1' not allowed as a boolean}%
+ {Invalid boolean name '\string#1'.}%
+}
\SKV@def*\SKV@swvalerr#1#2{%
- \SKV@err{Invalid switch value '#2' for switch '\string#1'}%
- {Valid switch values are 'true', 'on', 'false', and 'off'.}%
+ \SKV@err{\string#1\space error: invalid boolean value '#2'}%
+ {Valid boolean values are 'true', 'on', 'false', and 'off'.}%
}
\SKV@pdef*\SKV@undeftog@err#1{%
\SKV@err{Toggle '#1' undefined}%
{You need to first define '#1' before use.}%
}
-\SKV@pdef*\deftog#1{%
- \SKV@ifcsundef{SKV@toggle@#1}{}{%
- \SKV@vbsmsg{warn}{Toggle '#1' redefined\on@line}%
+\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@err{Command '\string\newtog' doesn't accept list}%
+ {Please submit only one tog to '\string\newtog' at a time.}%
+ }{}%
+ \SKV@ensurenoscape{#2}%
+ \SKV@ifcsdef{SKV@toggle@#1#2}{%
+ \SKV@err{Toggle '#1#2' already defined}%
+ {Please provide a new toggle or redefine '#1#2'.}%
+ }{\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@err{Command '\string\deftog' doesn't accept list}%
+ {Please submit only one tog to '\string\deftog' at a time.}%
+ }{}%
+ \SKV@ensurenoscape{#2}%
+ \SKV@ifcsundef{SKV@toggle@#1#2}{}{%
+ \SKV@vbsmsg{warn}{Toggle '#1#2' redefined\on@line}%
}%
- \SKV@aftercs\let{SKV@toggle@#1}\@secondoftwo
-}
-\SKV@pdef*\newtog#1{%
- \SKV@ifcsdef{SKV@toggle@#1}{%
- \SKV@err{Toggle '#1' already defined}%
- {Please provide a new toggle or redefine '#1'.}%
- }{\SKV@aftercs\let{SKV@toggle@#1}\@secondoftwo}%
+ \SKV@csletcs{SKV@toggle@#1#2}{SKV@t@ggle#3}
}
\SKV@pdef*\providetog#1{%
\SKV@ifcsdef{SKV@toggle@#1}{%
\SKV@vbsmsg{info}%
{Toggle '#1' already defined.\SKV@MB Not redefined\on@line}%
- }{\SKV@aftercs\let{SKV@toggle@#1}\@secondoftwo}%
+ }{\SKV@cslet{SKV@toggle@#1}\@secondoftwo}%
}
\SKV@pdef*\requiretog#1{\SKV@aftercs\requirecmd{SKV@toggle@#1}[2]{##2}}
\SKV@def*\settog#1#2{%
\SKV@ifcsdef{SKV@toggle@#1}{%
\SKV@ifcsdef{SKV@t@ggle#2}{%
- \SKV@aftercs\let{SKV@toggle@#1\expandafter}%
- \csname SKV@t@ggle#2\endcsname
+ \SKV@csletcs{SKV@toggle@#1}{SKV@t@ggle#2}%
}{%
\SKV@err{Inadmissible value '#2' for toggle '#1'}%
- {Valid values for toggles are 'true' and 'false'.}%
+ {Valid values for toggles are 'true', 'or', 'false', and 'off'.}%
}%
}{\SKV@undeftog@err{#1}}%
}
-\SKV@def*\togtrue#1{%
+\SKV@def*\togon#1{%
\SKV@ifcsdef{SKV@toggle@#1}{%
- \expandafter\let\csname SKV@toggle@#1\endcsname\SKV@t@ggletrue
+ \SKV@cslet{SKV@toggle@#1}\SKV@t@ggleon
}{\SKV@undeftog@err{#1}}%
}
-\SKV@def*\togfalse#1{%
+\SKV@def*\togoff#1{%
\SKV@ifcsdef{SKV@toggle@#1}{%
- \expandafter\let\csname SKV@toggle@#1\endcsname\SKV@t@gglefalse
- }{%
- \SKV@undeftog@err{#1}%
- }%
+ \SKV@cslet{SKV@toggle@#1}\SKV@t@ggleoff
+ }{\SKV@undeftog@err{#1}}%
}
+\SKV@newlet\togtrue\togon
+\SKV@newlet\togfalse\togoff
+\SKV@newlet\SKV@t@ggleon\@firstoftwo
+\SKV@newlet\SKV@t@ggleoff\@secondoftwo
\SKV@newlet\SKV@t@ggletrue\@firstoftwo
\SKV@newlet\SKV@t@gglefalse\@secondoftwo
-\SKV@def*\iftog#1{%
+\SKV@def*\iftogon#1{%
\SKV@ifcsdef{SKV@toggle@#1}{\@nameuse{SKV@toggle@#1}}%
{\SKV@undeftog@err{#1}}%
}
-\SKV@def*\ifnottog#1{%
+\SKV@def*\iftogoff#1{%
\SKV@ifcsdef{SKV@toggle@#1}{%
\@nameuse{SKV@toggle@#1}\@secondoftwo\@firstoftwo}%
{\SKV@undeftog@err{#1}\@gobbletwo}%
}
+\SKV@newlet\iftogtrue\iftogon
+\SKV@newlet\iftogfalse\iftogoff
\deftog{pdf}
\SKV@ifundef\pdfoutput{}{%
\ifnum\pdfoutput<\@ne
\SKV@pdef*\SKV@ifpdf{\@secondoftwo}%
\else
- \togtrue{pdf}%
+ \togon{pdf}%
\SKV@pdef*\SKV@ifpdf{\@firstoftwo}%
\fi
\SKV@pdef*\SKV@ifnotpdf{\SKV@ifpdf\@secondoftwo\@firstoftwo}%
@@ -1539,49 +1568,49 @@
}%
}
\SKV@pdef*\define@menukey{\define@choicekey}
-\SKV@pdef*\define@togkey{\XKV@t@stopta{\XKV@testoptd\SKV@define@togkey{}}}
+\SKV@pdef*\define@togkey{%
+ \XKV@t@stopta{\XKV@testoptd\SKV@define@togkey{}}}
\SKV@def*\SKV@define@togkey#1#2[#3]{%
\SKV@findkeypointers{#2}%
\SKV@ifcsundef{\XKV@header\SKV@resa}{}{%
\SKV@vbsmsg{warn}{%
Key '\SKV@resa' in family '\XKV@tfam' with\SKV@MB
prefix '\SKV@pref' redefined\on@line}
- \SKV@csundef{\XKV@header\SKV@resa}%
- \SKV@csundef{SKV@toggle@#1\SKV@resa}%
+ \SKV@Undef+{\XKV@header\SKV@resa,SKV@toggle@#1\SKV@resa}%
}%
\SKV@expnext\SKV@reservkey@err\SKV@resa
\SKV@expnext\SKV@suspkey@err\SKV@resa
\ifXKV@pl
- \def\SKV@n@xt{\SKV@aftercs\SKV@d@f@ne@togkey}%
+ \def\SKV@next{\SKV@aftercs\SKV@d@f@ne@togkey}%
\else
- \def\SKV@n@xt{\SKV@aftercs\SKV@d@fine@togkey}%
+ \def\SKV@next{\SKV@aftercs\SKV@d@fine@togkey}%
\fi
\begingroup
\edef\SKV@tempa{\endgroup
{\XKV@header\SKV@resa}{\SKV@resa}{#1\SKV@resa}{#3}}%
- \aftergroup\SKV@n@xt\SKV@tempa
+ \aftergroup\SKV@next\SKV@tempa
}
\SKV@def*\SKV@d@fine@togkey#1#2#3#4#5{%
- \SKV@d@f@ne@t@gkey#1{#2}{#3}{#4}{{\settog{#3}{\XKV@resa}#5}}%
+ \SKV@d@f@ne@t@gkey#1{#2}{#3}{#4}%
+ {{\SKV@expargs{0}{\SKV@getswstate{}}\XKV@resa\@nil
+ \settog{#3}{\SKV@resvd}#5}}%
}
\SKV@def*\SKV@d@f@ne@togkey#1#2#3#4#5#6{%
\SKV@d@f@ne@t@gkey#1{#2}{#3}{#4}%
- {{\settog{#3}{\XKV@resa}#5}{#6}}%
+ {{\SKV@expargs{0}{\SKV@getswstate{}}\XKV@resa\@nil
+ \settog{#3}{\SKV@resvd}#5}{#6}}%
}
\SKV@def*\SKV@d@f@ne@t@gkey#1#2#3#4#5{%
\deftog{#3}%
\ifXKV@st\XKV@define@default{#2}{#4}\fi
- \ifXKV@pl
- \def#1##1{\XKV@pltrue\XKV@sttrue
- \XKV@checkchoice[\XKV@resa]{##1}{true,false}#5%
- }%
- \else
- \def#1##1{\XKV@plfalse\XKV@sttrue
- \XKV@checkchoice[\XKV@resa]{##1}{true,false}#5%
- }%
- \fi
+ \def#1##1{%
+ \def#1####1{##1\XKV@sttrue
+ \XKV@checkchoice[\XKV@resa]{####1}{true,false,on,off}#5}%
+ }%
+ \ifXKV@pl#1\XKV@pltrue\else#1\XKV@plfalse\fi
}
-\SKV@pdef*\define@togkeys{\XKV@plfalse\XKV@testoptd\SKV@define@togkeys{}}
+\SKV@pdef*\define@togkeys{%
+ \XKV@plfalse\XKV@testoptd\SKV@define@togkeys{}}
\SKV@def*\SKV@define@togkeys#1#2[#3]{%
\SKV@despacelist{#2}%
\SKV@for*[,]\SKV@resa\SKV@tempa{%
@@ -1595,17 +1624,15 @@
\SKV@vbsmsg{warn}{%
Key '\SKV@resa' in family '\XKV@tfam' with\SKV@MB
prefix '\SKV@pref' redefined\on@line}
- \SKV@csundef{\XKV@header\SKV@resa}%
- \SKV@csundef{SKV@toggle@#2\SKV@resa}%
+ \SKV@Undef+{\XKV@header\SKV@resa,SKV@toggle@#2\SKV@resa}%
}%
\SKV@expnext\SKV@reservkey@err\SKV@resa
\SKV@expnext\SKV@suspkey@err\SKV@resa
- \edef\SKV@tempa{%
- \noexpand\SKV@d@f@ne@t@gkey\@nameuse{\XKV@header\SKV@resa}%
- {\SKV@resa}{#2\SKV@resa}{#3}%
- {{\noexpand\settog{#2\SKV@resa}{\noexpand\XKV@resa}}}%
+ \edef\SKV@tempa##1##2##3{%
+ ##1\@nameuse{\XKV@header\SKV@resa}%
+ {\SKV@resa}{#2\SKV@resa}{#3}{{##2{#2\SKV@resa}{##3}}}%
}%
- \SKV@tempa
+ \SKV@tempa\SKV@d@f@ne@t@gkey\settog\XKV@resa
}
\SKV@pdef*\newordkey{\XKV@testoptb\SKV@newordkey}
\SKV@def*\SKV@newordkey#1{%
@@ -1655,12 +1682,12 @@
\SKV@findkeypointers{#2}%
\SKV@expnext\SKV@definedkey@err\SKV@resa
\ifXKV@pl
- \def\SKV@n@xt{\SKV@aftercs\XKV@d@f@ne@boolkey}%
+ \def\SKV@next{\SKV@aftercs\XKV@d@f@ne@boolkey}%
\else
- \def\SKV@n@xt{\SKV@aftercs\XKV@d@fine@boolkey}%
+ \def\SKV@next{\SKV@aftercs\XKV@d@fine@boolkey}%
\fi
\edef\SKV@tempa{{\XKV@header\SKV@resa}{\SKV@resa}{#1\SKV@resa}{#3}}%
- \expandafter\SKV@n@xt\SKV@tempa
+ \expandafter\SKV@next\SKV@tempa
}
\SKV@pdef*\newboolkeys{\XKV@plfalse\XKV@testoptd\SKV@newboolkeys{}}
\SKV@def*\SKV@newboolkeys#1#2[#3]{%
@@ -1676,14 +1703,14 @@
\SKV@findkeypointers{#2}%
\SKV@expnext\SKV@definedkey@err\SKV@resa
\ifXKV@pl
- \def\SKV@n@xt{\SKV@aftercs\SKV@d@f@ne@togkey}%
+ \def\SKV@next{\SKV@aftercs\SKV@d@f@ne@togkey}%
\else
- \def\SKV@n@xt{\SKV@aftercs\SKV@d@fine@togkey}%
+ \def\SKV@next{\SKV@aftercs\SKV@d@fine@togkey}%
\fi
\begingroup
\edef\SKV@tempa{\endgroup
{\XKV@header\SKV@resa}{\SKV@resa}{#1\SKV@resa}{#3}}%
- \aftergroup\SKV@n@xt\SKV@tempa
+ \aftergroup\SKV@next\SKV@tempa
}
\SKV@pdef*\newtogkeys{\XKV@plfalse\XKV@testoptd\SKV@newtogkeys{}}
\SKV@def*\SKV@newtogkeys#1#2[#3]{%
@@ -1777,22 +1804,22 @@
\SKV@def*\SKV@bitogkeys[#1]#2[#3]#4[#5]#6#7#8{%
\@namedef{#1@#2@#4@func}{%
#7\relax
- \iftog{#3#4}{\togfalse{#3#6}}{\togtrue{#3#6}#8\relax}%
+ \iftogon{#3#4}{\togoff{#3#6}}{\togon{#3#6}#8\relax}%
}%
\@namedef{#1@#2@#6@func}{%
#8\relax
- \iftog{#3#6}{\togfalse{#3#4}}{\togtrue{#3#4}#7\relax}%
+ \iftogon{#3#6}{\togoff{#3#4}}{\togon{#3#4}#7\relax}%
}%
\SKV@compk@y{#1}{#2}{#3}{#4}{#5}{#6}%
}
\SKV@def*\SKV@unitogkeys[#1]#2[#3]#4[#5]#6#7#8{%
\@namedef{#1@#2@#4@func}{%
#7\relax
- \iftog{#3#4}{\togtrue{#3#6}#8\relax}{\togfalse{#3#6}}%
+ \iftogon{#3#4}{\togon{#3#6}#8\relax}{\togoff{#3#6}}%
}%
\@namedef{#1@#2@#6@func}{%
#8\relax
- \iftog{#3#6}{\togtrue{#3#4}#7\relax}{\togfalse{#3#4}}%
+ \iftogon{#3#6}{\togon{#3#4}#7\relax}{\togoff{#3#4}}%
}%
\SKV@compk@y{#1}{#2}{#3}{#4}{#5}{#6}%
}
@@ -1801,21 +1828,21 @@
\ifswitchon{SKV@st}{%
\ifswitchon{SKV@pl}{%
\@namedef{#1@#2@#4@func}{%
- #7\relax\ifnottog{#3#4}{\togfalse{#3#6}}{}%
+ #7\relax\iftogoff{#3#4}{\togoff{#3#6}}{}%
}%
}{%
\@namedef{#1@#2@#4@func}{%
- #7\relax\ifnottog{#3#4}{\togtrue{#3#6}#8\relax}{}%
+ #7\relax\iftogoff{#3#4}{\togon{#3#6}#8\relax}{}%
}%
}%
}{%
\ifswitchon{SKV@pl}{%
\@namedef{#1@#2@#4@func}{%
- #7\relax\iftog{#3#4}{\togfalse{#3#6}}{}%
+ #7\relax\iftogon{#3#4}{\togoff{#3#6}}{}%
}%
}{%
\@namedef{#1@#2@#4@func}{%
- #7\relax\iftog{#3#4}{\togtrue{#3#6}#8\relax}{}%
+ #7\relax\iftogon{#3#4}{\togon{#3#6}#8\relax}{}%
}%
}%
}%
@@ -1868,7 +1895,7 @@
{Problem with \string\choicekeyvalues\space for key '#3'}%
{You have attempted to set two \string\choicekeyvalues\SKV@MB
for choice key '#3' in the same family '#2'\SKV@MB
- with the same prefix '#1'. You can only do\SKV@MB
+ with the same prefix '#1'. You can only do\SKV@MB
that if you use the starred variant of \string\choicekeyvalues.}%
}%
\fi
@@ -1884,8 +1911,8 @@
\SKV@for*[,]#1\SKV@tempa{%
\edef\SKV@tempa{\detokenize\expandafter{\SKV@tempa}\space}%
\edef\SKV@tempa{\expandafter\zap@space\SKV@tempa\@empty}%
- \SKV@aftercs\xdef{SKV@zsp@\expandafter
- \@gobble\SKV@tempa}{\SKV@expox{\SKV@tempa}}%
+ \SKV@csxdef{SKV@zsp@\expandafter\@gobble\SKV@tempa}%
+ {\SKV@expox{\SKV@tempa}}%
}%
\endgroup
}
@@ -1895,8 +1922,8 @@
\SKV@for*[,]#1\SKV@tempa{%
\edef\SKV@tempa{\detokenize\expandafter{\SKV@tempa}}%
\SKV@despace\SKV@tempa
- \SKV@aftercs\xdef{SKV@dsp@\expandafter
- \@gobble\SKV@tempa}{\SKV@expox{\SKV@tempa}}%
+ \SKV@csxdef{SKV@dsp@\expandafter\@gobble\SKV@tempa}%
+ {\SKV@expox{\SKV@tempa}}%
}%
\endgroup
}
@@ -1908,16 +1935,20 @@
}
\SKV@def\SKV@define@multkeys#1,#2,#3,#4\@nil{%
\let\SKV@altlisterr\z@
- \SKV@trailead{#1}\SKV@tempa
+ \SKV@sp@def{#1}\SKV@tempa
\SKV@checkchoice{\SKV@tempa}{ord,cmd,bool,tog,choice,menu}{%
- \edef\SKV@keytype{\the\numexpr\nr+1}%
+ \SKV@iftest{num}{\nr=6}{%
+ \edef\SKV@keytype{\the\numexpr\nr-1}%
+ }{%
+ \edef\SKV@keytype{\the\numexpr\nr+1}%
+ }%
}{%
\SKV@checkchoice{\SKV@tempa}{1,2,3,4,5}{%
\edef\SKV@keytype{\the\numexpr\nr+1}%
}{%
\SKV@err{Unknown key type/identifier '\string#1'}%
{Valid key types are 'ord', 'cmd', 'bool', 'tog',
- 'choice', 'menu'\SKV@MB and '1', '2', '3', '4', '5'}%
+ 'choice', 'menu',\SKV@MB and '1', '2', '3', '4', '5'}%
}%
}%
\SKV@ifnotempty{#2}{}{%
@@ -1970,13 +2001,6 @@
[\unexpanded{\val\nr}]{%
\SKV@csuse{\SKV@keyprefix @\SKV@keyfamily @#2@altlist}%
}[#3]{\unexpanded{#4}}{\unexpanded{\SKV@inputerr{##1}{#2}}}%
- \or
- \SKV@ifcsdef{\SKV@keyprefix @\SKV@keyfamily @#2@altlist}{}%
- {\let\SKV@altlisterr\@ne}%
- \noexpand\SKV@def@choicekey*+[\SKV@keyprefix]{\SKV@keyfamily}{#2}%
- [\unexpanded{\val\nr}]{%
- \SKV@csuse{\SKV@keyprefix @\SKV@keyfamily @#2@altlist}%
- }[#3]{\unexpanded{#4}}{\unexpanded{\SKV@inputerr{##1}{#2}}}%
\fi
}%
\SKV@tempa
@@ -1992,25 +2016,8 @@
}%
\fi
}
-\SKV@pdef*\SKV@in@#1#2{%
- \def\in@@##1#1##2##3\in@@{\ifx\in@##2\in@false\else\in@true\fi}%
- \in@@#2\@mil#1\in@\in@@
-}
-\SKV@pdef*\in@tog#1#2{%
- \SKV@in@{#1}{#2}%
- \ifin@\togtrue{in@}\else\togfalse{in@}\fi
-}
-\deftog{in@}
-\SKV@pdef*\in@tok#1#2{%
- \begingroup
- \SKV@expnext\SKV@trailead{\detokenize{#1}}\SKV@tempa
- \SKV@expnext\SKV@trailead{\detokenize{#2}}\SKV@tempb
- \@expandtwoargs\SKV@in@\SKV@tempa\SKV@tempb
- \global\let\ifin@\ifin@
- \endgroup
-}
\def\XKV@makepf#1{%
- \SKV@trailead{#1}\XKV@prefix
+ \SKV@sp@def{#1}\XKV@prefix
\ifSKV@sk\else
\SKV@expnext\XKV@checksanitizeb\SKV@rkpnames\SKV@tempa
\SKV@despacelist*\SKV@tempa
@@ -2028,7 +2035,7 @@
\edef\XKV@prefix{\ifx\XKV@prefix\@empty\else\XKV@prefix @\fi}%
}
\def\XKV@makehd#1{%
- \SKV@expargs{3}\SKV@trailead{{#1}}\XKV@header\@nil
+ \SKV@expargs{3}\SKV@sp@def{{#1}}\XKV@header\@nil
\ifSKV@sk\else
\SKV@expnext\XKV@checksanitizeb\SKV@rfnames\SKV@tempa
\SKV@despacelist*\SKV@tempa
@@ -2069,54 +2076,26 @@
}
\SKV@def*\SKV@findkeypointers#1{%
\SKV@resolvekey{#1}\uservalue\savevalue\@nil\SKV@resa
- {%
- \SKV@addtouserval\SKV@addtosave
- }{%
- \SKV@resolvekey{#1}\guservalue\savevalue\@nil\SKV@resa
- {%
- \SKV@gaddtouserval\SKV@addtosave
- }{%
- \SKV@resolvekey{#1}\savevalue\uservalue\@nil\SKV@resa
- {%
- \SKV@addtouserval\SKV@addtosave
- }{%
- \SKV@resolvekey{#1}\gsavevalue\uservalue\@nil\SKV@resa
- {%
- \SKV@addtouserval\SKV@gaddtosave
- }{%
- \SKV@resolvekey{#1}\guservalue\gsavevalue\@nil\SKV@resa
- {%
- \SKV@gaddtouserval\SKV@gaddtosave
- }{%
- \SKV@resolvekey{#1}\gsavevalue\guservalue\@nil\SKV@resa
- {%
- \SKV@gaddtouserval\SKV@gaddtosave
- }{%
- \SKV@resolvekey{#1}\uservalue\@nil\SKV@resa
- {%
- \SKV@addtouserval
- }{%
- \SKV@resolvekey{#1}\guservalue\@nil\SKV@resa
- {%
- \SKV@gaddtouserval
- }{%
- \SKV@resolvekey{#1}\savevalue\@nil\SKV@resa
- {%
- \SKV@addtosave
- }{%
- \SKV@resolvekey{#1}\gsavevalue\@nil\SKV@resa
- {%
- \SKV@gaddtosave
- }{}%
- }%
- }%
- }%
- }%
- }%
- }%
- }%
- }%
- }%
+ {\SKV@addtouserval\SKV@addtosave}%
+ {\SKV@resolvekey{#1}\guservalue\savevalue\@nil\SKV@resa
+ {\SKV@gaddtouserval\SKV@addtosave}%
+ {\SKV@resolvekey{#1}\savevalue\uservalue\@nil\SKV@resa
+ {\SKV@addtouserval\SKV@addtosave}%
+ {\SKV@resolvekey{#1}\gsavevalue\uservalue\@nil\SKV@resa
+ {\SKV@addtouserval\SKV@gaddtosave}%
+ {\SKV@resolvekey{#1}\guservalue\gsavevalue\@nil\SKV@resa
+ {\SKV@gaddtouserval\SKV@gaddtosave}%
+ {\SKV@resolvekey{#1}\gsavevalue\guservalue\@nil\SKV@resa
+ {\SKV@gaddtouserval\SKV@gaddtosave}%
+ {\SKV@resolvekey{#1}\uservalue\@nil\SKV@resa
+ {\SKV@addtouserval}%
+ {\SKV@resolvekey{#1}\guservalue\@nil\SKV@resa
+ {\SKV@gaddtouserval}%
+ {\SKV@resolvekey{#1}\savevalue\@nil\SKV@resa
+ {\SKV@addtosave}%
+ {\SKV@resolvekey{#1}\gsavevalue\@nil\SKV@resa
+ {\SKV@gaddtosave}%
+ {}}}}}}}}}}%
}
\def\XKV@define@key#1{%
\SKV@findkeypointers{#1}%
@@ -2146,8 +2125,7 @@
\SKV@vbsmsg{warn}{%
Key '\SKV@resa' in family '\XKV@tfam' with\SKV@MB
prefix '\SKV@pref' redefined\on@line}
- \SKV@csundef{\XKV@header\SKV@resa}%
- \SKV@csundef{#1\SKV@resa}%
+ \SKV@Undef+{\XKV@header\SKV@resa,#1\SKV@resa}%
}%
\SKV@expnext\SKV@reservkey@err\SKV@resa
\SKV@expnext\SKV@suspkey@err\SKV@resa
@@ -2158,7 +2136,7 @@
\begingroup
\def\SKV@tempa{%
\expandafter\def\csname\XKV@header\SKV@resa\endcsname####1}%
- \@threeexpafter\endgroup\expandafter\SKV@tempa\expandafter%
+ \SKV@threeafter\endgroup\expandafter\SKV@tempa\expandafter%
{\expandafter\def\csname#1\SKV@resa\endcsname{##1}#4}%
}
\def\XKV@define@choicekey#1{%
@@ -2182,19 +2160,37 @@
\SKV@ifcsundef{\XKV@header\SKV@resa}{}{%
\SKV@vbsmsg{warn}{%
Key '\SKV@resa' in family '\XKV@tfam' with\SKV@MB
- prefix '\SKV@pref' redefined\on@line}
- \SKV@csundef{\XKV@header\SKV@resa}%
- \SKV@csundef{#1\SKV@resa}%
+ prefix '\SKV@pref' redefined\on@line}%
+ \SKV@Undef+{\XKV@header\SKV@resa,#1\SKV@resa}%
}%
\SKV@expnext\SKV@reservkey@err\SKV@resa
\SKV@expnext\SKV@suspkey@err\SKV@resa
\ifXKV@pl
- \def\SKV@n@xt{\SKV@aftercs\XKV@d@f@ne@boolkey}%
+ \def\SKV@next{\SKV@aftercs\XKV@d@f@ne@boolkey}%
\else
- \def\SKV@n@xt{\SKV@aftercs\XKV@d@fine@boolkey}%
+ \def\SKV@next{\SKV@aftercs\XKV@d@fine@boolkey}%
\fi
\edef\SKV@tempa{{\XKV@header\SKV@resa}{\SKV@resa}{#1\SKV@resa}{#3}}%
- \expandafter\SKV@n@xt\SKV@tempa
+ \expandafter\SKV@next\SKV@tempa
+}
+\def\XKV@d@fine@boolkey#1#2#3#4#5{%
+ \XKV@d@f@ne@b@olkey#1{#2}{#3}{#4}%
+ {{\SKV@expargs{0}{\SKV@getswstate{}}\XKV@resa\@nil
+ \csname#3\SKV@resvd\endcsname#5}}%
+}
+\def\XKV@d@f@ne@boolkey#1#2#3#4#5#6{%
+ \XKV@d@f@ne@b@olkey#1{#2}{#3}{#4}%
+ {{\SKV@expargs{0}{\SKV@getswstate{}}\XKV@resa\@nil
+ \csname#3\SKV@resvd\endcsname#5}{#6}}%
+}
+\def\XKV@d@f@ne@b@olkey#1#2#3#4#5{%
+ \csnewif{if#3}%
+ \ifXKV@st\XKV@define@default{#2}{#4}\fi
+ \def#1##1{%
+ \def#1####1{##1\XKV@sttrue
+ \XKV@checkchoice[\XKV@resa]{####1}{true,false,on,off}#5}%
+ }%
+ \ifXKV@pl#1\XKV@pltrue\else#1\XKV@plfalse\fi
}
\def\XKV@d@fine@boolkeys#1#2#3{%
\SKV@findkeypointers{#1}%
@@ -2202,17 +2198,15 @@
\SKV@vbsmsg{warn}{%
Key '\SKV@resa' in family '\XKV@tfam' with\SKV@MB
prefix '\SKV@pref' redefined\on@line}
- \SKV@csundef{\XKV@header\SKV@resa}%
- \SKV@csundef{#2\SKV@resa}%
+ \SKV@Undef+{\XKV@header\SKV@resa,#2\SKV@resa}%
}%
\SKV@expnext\SKV@reservkey@err\SKV@resa
\SKV@expnext\SKV@suspkey@err\SKV@resa
- \edef\SKV@tempa{%
- \noexpand\XKV@d@f@ne@b@olkey\@nameuse{\XKV@header\SKV@resa}%
- {\SKV@resa}{#2\SKV@resa}{#3}{{\noexpand\@nameuse{#2\SKV@resa
- \noexpand\XKV@resa}}}%
+ \edef\SKV@tempa##1##2##3{%
+ ##1\@nameuse{\XKV@header\SKV@resa}{\SKV@resa}%
+ {#2\SKV@resa}{#3}{{##2{#2\SKV@resa##3}}}%
}%
- \SKV@tempa
+ \SKV@tempa\XKV@d@f@ne@b@olkey\@nameuse\XKV@resa
}
\SKV@pdef*\reserve@keys{\@testopt\SKV@reserve@keys{KV}}
\SKV@def*\SKV@reserve@keys[#1]#2#3{%
@@ -2276,7 +2270,7 @@
\XKV@makepf{#1}%
\XKV@checksanitizeb{#2}\XKV@fams
\SKV@despacelist*\XKV@fams
- \SKV@trailead{#3}\XKV@tkey
+ \SKV@sp@def{#3}\XKV@tkey
\XKV@whilist\XKV@fams\XKV@tfam\ifXKV@knf\fi{%
\XKV@makehd\XKV@tfam
\SKV@ifcsdef{\XKV@header\XKV@tkey @reser}{\XKV@knffalse}{}%
@@ -2296,7 +2290,7 @@
\XKV@makepf{#1}%
\XKV@checksanitizeb{#2}\XKV@fams
\SKV@despacelist*\XKV@fams
- \SKV@trailead{#3}\XKV@tkey
+ \SKV@sp@def{#3}\XKV@tkey
\XKV@whilist\XKV@fams\XKV@tfam\ifXKV@knf\fi{%
\XKV@makehd\XKV@tfam
\SKV@ifcsdef{\XKV@header\XKV@tkey @susp}{\XKV@knffalse}{}%
@@ -2316,7 +2310,7 @@
\XKV@makepf{#1}%
\XKV@checksanitizeb{#2}\XKV@fams
\SKV@despacelist*\XKV@fams
- \SKV@trailead{#3}\XKV@tkey
+ \SKV@sp@def{#3}\XKV@tkey
\XKV@whilist\XKV@fams\XKV@tfam\ifXKV@knf\fi{%
\XKV@makehd\XKV@tfam
\SKV@ifcsdef{\XKV@header\XKV@tkey}{\XKV@knffalse}{}%
@@ -2569,12 +2563,12 @@
\SKV@aftercs\XKV@merge{SKV@\XKV@header uservalue}{#1}\XKV@getsg
}%
}
-\def\setkeys{%
+\protected\def\setkeys{%
\def\skif##1{%
\SKV@ensurenoscape{##1}%
\SKV@ifcsdef{if##1}{}{%
\SKV@err{Undefined boolean '##1'}%
- {Boolean '##1' undefined: This is an '\string\skif' error.}%
+ {'\string\skif' error: boolean '##1' undefined.}%
}%
\csname if##1\endcsname
}%
@@ -2609,7 +2603,7 @@
\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' before continuing.}%
+ {Supply a value for key '\XKV@tkey' and rerun.}%
}%
\fi
}%
@@ -2639,11 +2633,11 @@
}%
}
\SKV@def*\SKV@testuservaluekey#1#2{%
- \let\SKV@st@aux\ifSKV@st\SKV@sttrue\SKV@uvfalse
+ \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
}%
- \let\ifSKV@st\SKV@st@aux\SKV@relax\SKV@st@aux
+ \let\ifSKV@st\SKV@staux\SKV@undef\SKV@staux
}
\SKV@def*\SKV@remspaceletter#1#2{%
\begingroup
@@ -2726,7 +2720,7 @@
\ifnum\escapechar<0\else
\expandafter\expandafter
\csname @gobble\ifnum\escapechar=32 space\fi
- \@threeexpafter\endcsname
+ \SKV@threeafter\endcsname
\fi\fi
\string%
}
@@ -2753,7 +2747,7 @@
\SKV@ensurescape{#1}%
\edef\SKV@tempa{saved\SKV@gobblescape#1}%
\SKV@ifcsdef\SKV@tempa{%
- \def\SKV@n@xt{\SKV@letcs#1\SKV@tempa\SKV@csundef\SKV@tempa}%
+ \def\SKV@next{\SKV@letcs#1\SKV@tempa\SKV@csundef\SKV@tempa}%
}{%
\SKV@err{%
'\@nameuse\SKV@tempa' is undefined:\SKV@MB
@@ -2764,13 +2758,13 @@
undefines\SKV@MB the saved command.
}%
}%
- \SKV@n@xt
+ \SKV@next
}
\SKV@providedef*\input@path{}
\SKV@pdef*\InputFileOnce{%
\def\SKV@inputfile##1##2{%
\InputIfFileExists{##2}{%
- \SKV@aftercs\let{##2@read}\@empty
+ \SKV@cslet{##2@read}\@empty
\let\SKV@inp@tfile\relax
}{%
\typein[\Answer]{^^J! File '\string##2' does not exist.^^J
@@ -2780,10 +2774,7 @@
}{%
\def\SKV@inp@tfile{%
\SKV@expargs{0}{\SKV@InputFileOnce[##1]}\Answer\@nil
- }%
- }%
- }%
- }%
+ }}}}%
\let\SKV@no\z@
\SKV@save\input@path
\SKV@t@stopta{\SKV@testopt\SKV@InputFileOnce{.}}%
@@ -2806,10 +2797,10 @@
\ifnum\SKV@no=\z@\SKV@restore\input@path\fi
\let\SKV@no\@ne
}
-\SKV@pdef\SKV@notloaded@err#1{%
+\SKV@pdef*\SKV@notloadederr#1{%
\SKV@ifcsdef{ver@#1.\@pkgextension}{}{%
\SKV@err{Package '#1' wasn't loaded}%
- {Document has started and package '#1' wasn't loaded.}%
+ {Document has begun and package '#1' wasn't loaded.}%
}%
}
\SKV@def*\SKV@notloaded{}
@@ -2820,10 +2811,81 @@
}%
}
\SKV@AtDocumentStart{%
- \let\SKV@do@b\SKV@notloaded@err
+ \let\SKV@do@b\SKV@notloadederr
\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