diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/amsrefs/rkeyval.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/amsrefs/rkeyval.sty | 460 |
1 files changed, 460 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/amsrefs/rkeyval.sty b/Master/texmf-dist/tex/latex/amsrefs/rkeyval.sty new file mode 100644 index 00000000000..c7306c9d11b --- /dev/null +++ b/Master/texmf-dist/tex/latex/amsrefs/rkeyval.sty @@ -0,0 +1,460 @@ +%% +%% This is file `rkeyval.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% rkeyval.dtx +%% +%%% ==================================================================== +%%% @LaTeX-doc-source-file{ +%%% filename = "rkeyval.dtx", +%%% version = "2.00", +%%% date = "2004/06/28", +%%% time = "15:19:29 EDT", +%%% author = "Michael J Downes and David M. Jones", +%%% address = "American Mathematical Society, +%%% Publications Technical Group, +%%% PO Box 6248, +%%% Providence, RI 02940, +%%% USA", +%%% email = "tech-support@ams.org", +%%% URL = "http://www.ams.org/", +%%% abstract = "Key-value scanning functions with more restrictive +%%% syntax than the standard keyval package. This permits +%%% some improvements in the error-checking.", +%%% copyright = "Copyright 2001 American Mathematical Society.", +%%% license = "Unlimited copying and redistribution of this file +%%% are permitted as long as this file is not +%%% modified. Modifications, and distribution of +%%% modified versions, are permitted, but only if +%%% the resulting file is renamed.", +%%% checksum = "44721 1116 3178 30537", +%%% docstring = "The checksum field, produced by Robert Solovay's +%%% checksum utility, gives CRC-16 checksum, lines, +%%% words, and characters.", +%%% } +%%% ==================================================================== +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{rkeyval}[2004/05/05 v1.08] +\let\@xp\expandafter +\let\@nx\noexpand +\long\def\@gobblethree#1#2#3{} +\long\def\@nilgobble#1\@nil{} +\@ifundefined{@emptytoks}{\csname newtoks\endcsname\@emptytoks}{} +\@ifundefined{@temptokenb}{\csname newtoks\endcsname\@temptokenb}{} +\def\@append#1#2#3{\@xp\def\@xp#2\@xp{#2#1{#3}}} +\def\star@#1#2{% + \def\star@a##1{#1}% + \def\star@b{#1{#2}}% + \futurelet\@let@token\star@test +} + +\def\star@test{\ifx*\@let@token \let\star@b\star@a\fi \star@b} +\@ifundefined{NormalCatcodes}{\RequirePackage{pcatcode}\relax}{} +\PushCatcodes\NormalCatcodes +\def\extract@group#1{% + \@xp\extract@group@a\string#1\@nil +} +\def\extract@group@a#1#2'{#2\@nilgobble} +\def\set@property#1{% + \begingroup + \edef\@tempa{\extract@group#1}% + \edef\@tempa{% + \@nx\@append\@nx#1\@xp\@nx\csname \@tempa,aux\endcsname + }% + \@xp\endgroup + \@tempa +} +\def\get@property#1#2{% + \get@nth@property#1#2\m@ne +} +\def\get@nth@property#1#2#3{% + \begingroup + \edef\@tempa{\extract@group#2}% + \@tempcnta#3\relax + \@tempcntb\z@ + \@xp\scan@properties\@xp#2\csname \@tempa,aux\endcsname + \edef\@tempa{\def\@nx#1{\@tempa}}% + \@xp\endgroup + \@tempa +} +\def\scan@properties#1#2{% + \begingroup + \def\@tempa{#1}% + \let\@tempc\@empty + \@xp\find@property #2 \@nil\@nil + \edef\@tempa{\def\@nx\@tempa{\@tempc}}% + \@xp\endgroup + \@tempa +} +\def\find@property#1#2{% + \ifx\@nil#1% + \else + \def\@tempb{#1}% + \ifx\@tempa\@tempb + \ifnum\@tempcnta<\z@ + \def\@tempc{#2}% + \else + \advance\@tempcntb\@ne + \ifnum\@tempcntb=\@tempcnta + \def\@tempc{#2}% + \fi + \fi + \fi + \@xp\find@property + \fi +} +\def\reset@property#1#2{% + \reset@nth@property#1\m@ne{#2}% +} +\def\reset@nth@property#1#2#3{% + \begingroup + \edef\@tempa{\extract@group#1}% + \@tempcnta#2\relax + \@temptokena{#3}% + \toks@\@emptytoks + \@tempcntb\z@ + \@xp\reset@scan\@xp#1\csname \@tempa,aux\endcsname + \edef\@tempa{% + \def\@xp\@nx\csname \@tempa,aux\endcsname{\the\toks@}% + }% + \@xp\endgroup + \@tempa +} +\def\reset@scan#1#2{% + \begingroup + \def\@tempa{#1}% + \@xp\reset@scan@a #2 \@nil\@nil + \edef\@tempa{\toks@{\the\toks@}}% + \@xp\endgroup + \@tempa +} +\def\reset@scan@a#1#2{% + \ifx\@nil#1% + \else + \def\@tempb{#1}% + \ifx\@tempa\@tempb + \ifnum\@tempcnta<\z@ + \@temptokenb\@temptokena + \else + \advance\@tempcntb\@ne + \ifnum\@tempcntb=\@tempcnta + \@temptokenb\@temptokena + \fi + \fi + \else + \@temptokenb{#2}% + \fi + \edef\@tempb{% + \toks@{\the\toks@ \@nx#1{\the\@temptokenb}}% + }% + \@tempb + \@xp\reset@scan@a + \fi +} +\def\fsa@l{\futurelet\@let@token\fsa@t} +\def\fsa@b{\afterassignment\fsa@l \let\@let@token= } +\def\fsa@c#1{\aftergroup#1\fsa@l} +\let\fsa@n\@empty +\let\fsa@t\@empty +\newtoks\rsk@toks +\def\rkvIfEmpty#1#2{% + \@xp\ifx\csname#1'#2\endcsname\@empty + \@xp\@firstoftwo + \else + \@xp\@secondoftwo + \fi +} +\def\rkvIfAdditive#1{% + \@xp\let\@xp\@let@token \csname \rkv@setter#1\endcsname + \afterassignment\@nilgobble + \@xp\let\@xp\@let@token \@let@token \@empty\@empty\@nil + \ifx\@let@token\DSK@append + \@xp\@firstoftwo + \else + \@xp\@secondoftwo + \fi +} +\def\rkv@setter#1{set:\@xp\@gobble\string#1} +\def\rkv@DSAK#1#2{% + \addto@group@reset#1{\let#1\@empty}% + \edef\@tempa{\def\csname \rkv@setter#1\endcsname}% + \@tempa{#2#1}% +} +\def\rkv@DDK#1{% + \addto@group@reset#1{\def#1{\@empty}}% + \@xp\let\csname \rkv@setter#1\endcsname\@gobble +} +\def\DSK@def#1{% + \ifx#1\@empty\else + \PackageWarningNoLine{rkeyval}% + {Key \string#1 should not be repeated}% + \fi + \DSK@redef#1% +} +\def\DSK@redef#1#2{% + \@ifempty{#2}{\@gobble}{% + \def#1{#2}% + \set@property#1 + }% +} +\def\init@group@reset#1{% + \begingroup + \edef\@tempb{\@xp\@nx\csname #1@reset\endcsname}% + \@xp\ifx\@tempb\relax + \@xp\xdef\@tempb{\let \csname #1,aux\endcsname\@nx\@empty} + \fi + \endgroup +} +\def\addto@group@reset#1{% + \begingroup + \edef\@tempa{\extract@group#1}% + \init@group@reset\@tempa + \edef\@tempa{% + \@nx\g@addto@macro\@xp\@nx\csname\@tempa @reset\endcsname + }% + \@xp\endgroup + \@tempa +} +\newcommand{\DefineSimpleKey}[2]{% + \@xp\rkv@DSAK + \csname #1'#2\endcsname + {\DSK@def}% +} +\newcommand{\DefineSupersedingKey}[2]{% + \@xp\rkv@DSAK + \csname #1'#2\endcsname + {\DSK@redef}% +} +\newcommand{\DefineAdditiveKey}[3]{% + \@xp\rkv@DSAK + \csname #1'#2\endcsname + {\DSK@append#3}% +} +\def\DSK@append#1#2#3{% + \@ifempty{#3}{\@gobble}{% + \@append#1#2{#3}% + \set@property#2 + }% +} +\newcommand{\DefineDummyKey}[2]{% + \@xp\rkv@DDK \csname #1'#2\endcsname +} +\newcommand{\RestrictedSetKeys}[3]{% + \global\rsk@toks\@xp{\csname #2@reset\endcsname}% + \def\rsk@finish{#3}% + \gdef\rsk@set{\@xp\rsk@set@a\csname#2'}% + #1\relax + \begingroup + \rsk@changecase + \aftergroup\rsk@set + \let\fsa@t\rsk@z + \fsa@l +} +\def\rsk@unknown@key#1{% + \PackageWarning{rkeyval}{Unknown key: \string#1}% + \@xp\def\csname\rkv@setter#1\endcsname {\DSK@redef#1}% +} +\def\rsk@z{% + \ifx\bgroup\@let@token + \let\fsa@t\rsk@b + \let\fsa@n\fsa@b + \else + \ifx\@sptoken\@let@token + \let\fsa@n\fsa@b + \else + \rsk@errf + \fi + \fi + \fsa@n +} +\def\rsk@a{% + \ifx\@let@token\@sptoken + \let\fsa@n\fsa@b + \else + \ifx\@let@token\par + \let\fsa@n\fsa@b + \else + \ifx,\@let@token + \endgroup + \let\fsa@t\rsk@b + \let\fsa@n\fsa@b + \else + \ifx\egroup\@let@token + \endgroup + \let\fsa@n\rsk@end + \else + \endgroup + \let\fsa@n\rsk@erraa + \fi + \fi + \fi + \fi + \fsa@n +} +\def\rsk@b{% + \ifcat\@nx\@let@token A% + \let\fsa@t\rsk@c + \let\fsa@n\fsa@c + \else + \ifx\@sptoken\@let@token + \let\fsa@n\fsa@b + \else + \rsk@bb + \fi + \fi + \fsa@n +} +\def\rsk@bb{% + \ifx,\@let@token + \let\fsa@n\fsa@b + \else + \ifx\bgroup\@let@token + \let\fsa@n\rsk@errb + \else + \ifx\egroup\@let@token + \let\fsa@n\rsk@end + \else + \ifx\par\@let@token + \let\fsa@n\fsa@b + \else + \let\fsa@n\rsk@errc + \fi + \fi + \fi + \fi +} +\def\rsk@c{% + \ifcat\@nx\@let@token A% + \let\fsa@n\fsa@c + \else + \ifx\@sptoken\@let@token + \let\fsa@t\rsk@d + \let\fsa@n\fsa@b + \else + \ifx=\@let@token + \let\saw@equal T% + \let\fsa@t\rsk@d + \let\fsa@n\fsa@b + \else + \rsk@cb + \fi + \fi + \fi + \fsa@n +} +\def\rsk@cb{% + \ifx,\@let@token + \let\fsa@n\rsk@errc + \else + \ifcat\@nx\@let@token .% + \let\fsa@n\fsa@c + \else + \ifx\bgroup\@let@token + \let\fsa@n\rsk@noequal + \else + \ifx\egroup\@let@token + \let\fsa@n\rsk@noequal + \else + \let\fsa@n\rsk@errc + \fi + \fi + \fi + \fi +} +\let\saw@equal=F +\def\rsk@d{% + \ifx\bgroup\@let@token + \ifx\saw@equal T% + \aftergroup\endcsname + \rsk@endcase + \let\fsa@n\endgroup + \else + \let\saw@equal T% + \let\fsa@n\rsk@noequal + \fi + \else + \ifx\@sptoken\@let@token + \let\fsa@n\fsa@b + \else + \ifx=\@let@token + \let\saw@equal T% + \let\fsa@n\fsa@b + \else + \let\fsa@n\rsk@erre + \fi + \fi + \fi + \fsa@n +} +\def\rsk@casesensitive{% + \let\rsk@changecase\@empty + \let\rsk@endcase\@empty +} +\def\rsk@startlc{\aftergroup\lowercase\aftergroup{\iffalse}\fi} +\def\rsk@endlc{\iffalse{\fi\aftergroup}} +\def\rsk@lowercase{% + \let\rsk@changecase\rsk@startlc + \let\rsk@endcase\rsk@endlc +} +\rsk@lowercase +\def\rsk@resume{% + \begingroup + \rsk@changecase + \aftergroup\rsk@set + \let\fsa@t\rsk@a + \begingroup + \catcode\endlinechar=\active + \lccode`\~=\endlinechar + \lowercase{\let~\par}% + \fsa@l +} +\def\rsk@set@a#1#2{% + \star@{\rsk@set@b#1{#2}}{}% +} +\def\rsk@set@b#1#2#3{% + \@xp\ifx \csname\rkv@setter#1\endcsname \relax + \rsk@unknown@key#1% + \fi + \edef\@tempa{\@xp\@nx\csname \rkv@setter#1\endcsname}% + \toks@\@xp{\@tempa{#2}{#3}}% + \edef\@tempa{% + \global\rsk@toks{\the\rsk@toks \the\toks@}% + }% + \@tempa + \rsk@resume +} +\def\rsk@end{% + \global\let\rsk@set\rsk@terminate + \rsk@endcase + \endgroup + \endcsname + \afterassignment\rsk@finish + \toks@\bgroup +} +\def\rsk@terminate{\@xp\@gobble\csname} +\def\NoCommaWarning{\PackageWarning{rkeyval}{Missing comma}}% +%% % \begin{macro}{\NoCommaError} +%% % \begin{macrocode} +%% \def\NoCommaError{\rsk@err{Missing comma}\@ehc} +%% % \end{macrocode} +%% % \end{macro} +\def\rsk@nocomma{\NoCommaWarning} +\def\rsk@err{\PackageError{rkeyval}} +\def\rsk@errf{\rsk@err{Missing open brace}\@ehc\rsk@b} +\long\def\rsk@erraa{\rsk@nocomma \let\fsa@t\rsk@b \fsa@l} +\def\rsk@errb{\rsk@err{Missing key name}\@ehc\rsk@d} +\def\rsk@errc{\rsk@err{Invalid key name character}\@ehc\fsa@b} +\def\rsk@noequal{\rsk@err{Missing equal sign}\@ehc\rsk@d} +\def\rsk@erre#1,{% + \rsk@err{Missing open brace for key value}\@ehc + \iffalse{\fi + \endgroup + \endcsname + \rsk@endcase }{#1},% +} +\PopCatcodes +\endinput +%% +%% End of file `rkeyval.sty'. |