Source

celluloid-presentation / xkeyval.tex

%%
%% This is file `xkeyval.tex',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% xkeyval.dtx  (with options: `tex')
%% 
%% ------------------------------------------
%% Copyright (C) 2003-2004 by Hendri Adriaens
%% ------------------------------------------
%%
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.2
%% of this license or (at your option) any later version.
%% The latest version of this license is in:
%%
%%    http://www.latex-project.org/lppl.txt
%%
%% and version 1.2 or later is part of all distributions of LaTeX
%% version 1999/12/01 or later.
%%
\edef\XKVAtCode{\the\catcode`\@}
\edef\XKVHatCode{\the\catcode`\^}
\catcode`\@=11\relax
\catcode`\^=12\relax
\ifx\XKeyValLoaded\@undefined
  \message{xkeyval: key=value parser, v1.4, 2004/08/24 (HA)}
  \input xkeyval.def
\fi
\expandafter\ifx\csname ver@keyval.sty\endcsname\relax
  \input keyval.tex
  \def\KV@errx#1{\XKV@err{#1}}
  \let\KV@err\KV@errx
  \expandafter\def\csname ver@keyval.sty\endcsname{1999/03/16}
\fi
\newif\ifXKV@st
\newif\ifXKV@pl
\newif\ifXKV@knf
\let\XKV@rm\empty
\newif\ifrecordkeyvals
\long\def\@ifnextcharacter#1#2#3{%
  \@ifnextchar\bgroup
  {\@ifnextchar{#1}{#2}{#3}}%
  {\@ifncharacter{#1}{#2}{#3}}%
}
\long\def\@ifncharacter#1#2#3#4{%
  \if\string#1\string#4%
    \expandafter\@firstoftwo
  \else
    \expandafter\@secondoftwo
  \fi
  {#2}{#3}#4%
}
\def\@selective@sanitize#1#2%
 {\begingroup
   \toks@\expandafter{#2}%
   \def#2{#1}\@onelevel@sanitize#2%
   \edef#2{{#2}{\the\toks@}}%
   \expandafter\@@selective@sanitize\expandafter#2#2%
  \expandafter\endgroup\expandafter\def\expandafter#2\expandafter{#2}}

\def\@@selective@sanitize#1#2#3%
 {\def\@i{\futurelet\@@tok\@ii}%
  \def\@ii
   {\expandafter\@iii\meaning\@@tok\relax
    \ifx\@@tok\@@selective@sanitize
      \let\@@cmd\@gobble
    \else
      \ifx\@@tok\@sptoken
        \toks@\expandafter{#1}\edef#1{\the\toks@\space}%
        \def\@@cmd{\afterassignment\@i\let\@@tok= }%
      \else
        \let\@@cmd\@iv
      \fi
    \fi\@@cmd}%
  \def\@iii##1##2\relax{\if##1\@backslashchar\let\@@tok\relax\fi}%
  \def\@iv##1%
   {\toks@\expandafter{#1}\@temptokena{##1}%
    \ifx\@@tok\bgroup
      \begingroup
       \def#1{\expandafter\@@selective@sanitize
        \csname\string#1\endcsname{#2}}%
       \expandafter#1\expandafter{\the\@temptokena}%
       \expandafter\@temptokena\expandafter\expandafter\expandafter
        {\csname\string#1\endcsname}%
      \expandafter\endgroup\edef#1{\the\toks@{\the\@temptokena}}%
      \let\@@cmd\@i
    \else
      \edef#1{\expandafter\string\the\@temptokena}%
      \expandafter\in@\expandafter{#1}{#2}%
      \edef#1{\the\toks@\ifin@#1\else
              \ifx\@@tok\@sptoken\space\else\the\@temptokena\fi\fi}%
      \edef\@@cmd{\noexpand\@i\ifx\@@tok\@sptoken\the\@temptokena\fi}%
    \fi
    \@@cmd}%
  \let#1\@empty \@i#3\@@selective@sanitize}%
\def\XKV@err#1{\errmessage{xkeyval error: #1}}
\def\XKV@ifstar#1{\@ifnextcharacter*{\@firstoftwo{#1}}}
\def\XKV@ifplus#1{\@ifnextcharacter+{\@firstoftwo{#1}}}
\def\XKV@@zs@def#1#2{\edef#1{\expandafter\zap@space#2 \empty}}
\long\def\XKV@whilist#1:=#2\do#3\fi#4{%
  \ifx\empty#2\empty\else
    #3\expandafter\XKV@wh@list#2,\@nil,\@nil\@@#1#3\fi{#4}\fi
  \fi
}
\long\def\XKV@wh@list#1,#2\@@#3#4\fi#5{%
  \def#3{#1}%
  \ifx#3\@nnil
    \expandafter\XKV@wh@l@st
  \else
    #4
      #5\expandafter\expandafter\expandafter\XKV@wh@list
    \else
      \expandafter\expandafter\expandafter\XKV@wh@l@st
    \fi
  \fi
  #2\@@#3#4\fi{#5}%
}
\long\def\XKV@wh@l@st#1\@@#2#3\fi#4{}
\def\XKV@makepf#1{%
  \XKV@@zs@def\XKV@prefix{#1}%
  \ifx\XKV@prefix\empty\else
    \edef\XKV@prefix{\XKV@prefix @}%
  \fi
}
\def\XKV@makehd#1{%
  \XKV@@zs@def\XKV@resa{#1}%
  \ifx\XKV@resa\empty
    \edef\XKV@header{\XKV@prefix}%
  \else
    \edef\XKV@header{\XKV@prefix\XKV@resa @}%
  \fi
}
\def\XKV@testopta#1{%
  \XKV@ifstar{\XKV@sttrue\XKV@t@stopta#1}{\XKV@stfalse\XKV@t@stopta#1}%
}
\def\XKV@t@stopta#1{%
  \XKV@ifplus{\XKV@pltrue\XKV@t@st@pta#1}{\XKV@plfalse\XKV@t@st@pta#1}%
}
\def\XKV@t@st@pta#1{\@ifnextchar[{\XKV@@t@st@pta#1}{\XKV@@t@st@pta#1[KV]}}
\def\XKV@@t@st@pta#1[#2]#3{%
  \XKV@makepf{#2}%
  \XKV@@zs@def\XKV@fams{#3}%
  \@ifnextchar[#1{#1[]}%
}
\def\define@key{\XKV@ifstar{\XKV@sttrue\XKV@define@key}{\XKV@stfalse\XKV@define@key}}
\def\XKV@define@key{\@ifnextchar[\XKV@d@fine@key{\XKV@d@fine@key[KV]}}
\def\XKV@d@fine@key[#1]#2#3{%
  \XKV@makepf{#1}%
  \XKV@makehd{#2}%
  \ifXKV@st
    \expandafter\ifx\csname\XKV@header#3\endcsname\relax\else
      \XKV@err{redefining existing macro `\@backslashchar\XKV@header#3'}%
    \fi
  \fi
  \@ifnextchar[{\XKV@d@fine@k@y{#3}}{%
    \expandafter\def\csname\XKV@header#3\endcsname####1}%
}
\def\XKV@d@fine@k@y#1[#2]{%
  \expandafter\def\csname\XKV@header#1@default\expandafter\endcsname
    \expandafter{\csname\XKV@header#1\endcsname{#2}}%
  \expandafter\def\csname\XKV@header#1\endcsname##1%
}
\def\setkeys{\XKV@testopta\XKV@setkeys}
\def\XKV@setkeys[#1]#2{%
  \XKV@@zs@def\XKV@keysnot{#1}%
  \let\XKV@rm\empty
  \def\XKV@tempa{#2}%
  \@selective@sanitize^\XKV@tempa
  \expandafter\XKV@s@tkeys\XKV@tempa,\@nil,%
}
\def\XKV@s@tkeys#1,{%
  \ifx\@nil#1\empty\else
    \XKV@knftrue
    \XKV@split#1==\@nil
    \ifXKV@knf
      \ifx\XKV@inpox\@undefined
        \ifXKV@st
          \ifx\XKV@rm\empty
            \toks@{#1}%
            \xdef\XKV@rm{\the\toks@}%
          \else
            \toks@\expandafter{\XKV@rm,#1}%
            \xdef\XKV@rm{\the\toks@}%
          \fi
        \else
          \XKV@err{`\XKV@tkey' undefined in families `\XKV@fams'}%
        \fi
      \else
        \ifx\XKV@doxs\relax
          \ifx\@currext\@clsextension\else
            \let\CurrentOption\XKV@tkey
            \@unknownoptionerror
          \fi
        \else
          \def\CurrentOption{#1}%
          \XKV@doxs
          \XKV@useoption\CurrentOption
        \fi
      \fi
    \else
      \ifx\XKV@inpox\@undefined\else\ifx\XKV@testclass\XKV@documentclass
        \XKV@useoption{#1}%
      \fi\fi
    \fi
    \expandafter\XKV@s@tkeys
  \fi
}
\def\XKV@split#1=#2=#3\@nil{%
  \XKV@@zs@def\XKV@tkey{#1}%
  \ifx\XKV@tkey\empty
    \ifx\empty#2\empty\else
      \toks@{#2}%
      \XKV@err{No key specified for value `\the\toks@'}%
    \fi
    \XKV@knffalse
  \else
    \in@{\expandafter,\XKV@tkey,}{\expandafter,\XKV@keysnot,}%
    \ifin@\XKV@knffalse\else
      \KV@@sp@def\XKV@tempa{#2}%
      \toks@\expandafter{\XKV@tempa}%
      \ifrecordkeyvals
        \expandafter\xdef\csname XKV@\XKV@tkey @value\endcsname{\the\toks@}%
      \fi
      \expandafter\XKV@replacepointers\the\toks@^{}\@nil
      \expandafter\XKV@lf@setkey@infam\the\toks@\@nil{#3}%
    \fi
  \fi
}
\def\XKV@replacepointers#1^#2#3\@nil{%
  \toks@{#1}%
  \ifx\empty#2\empty\else
    \expandafter\let\expandafter\XKV@resa\csname XKV@#2@value\endcsname
    \ifx\XKV@resa\relax
      \XKV@err{No value recorded for key `#2'}%
      \XKV@knffalse
    \else
      \edef\XKV@resb{\the\toks@}%
      \toks@\expandafter\expandafter\expandafter
        {\expandafter\XKV@resb\XKV@resa#3}%
      \expandafter\XKV@replacepointers\the\toks@\@nil
    \fi
  \fi
}
\def\XKV@lf@setkey@infam#1\@nil#2{%
  \ifx\XKV@fams\empty
    \XKV@makehd{}%
    \XKV@setkey@infam{#1}{#2}%
  \else
    \ifXKV@pl
      \@for\XKV@tfam:=\XKV@fams\do{%
        \XKV@makehd\XKV@tfam
        \XKV@setkey@infam{#1}{#2}%
      }%
    \else
      \XKV@whilist\XKV@tfam:=\XKV@fams\do\ifXKV@knf\fi{%
        \XKV@makehd\XKV@tfam
        \XKV@setkey@infam{#1}{#2}%
      }%
    \fi
  \fi
}
\def\XKV@setkey@infam#1#2{%
  \expandafter\let\expandafter\XKV@tempa
    \csname\XKV@header\XKV@tkey\endcsname
  \ifx\XKV@tempa\relax\else
    \XKV@knffalse
    \ifx\empty#2\empty
      \expandafter\let\expandafter\XKV@tempb
        \csname\XKV@header\XKV@tkey @default\endcsname
      \ifx\XKV@tempb\relax
        \XKV@err{No value specified for key `\XKV@tkey'}%
      \else
        \expandafter\XKV@default\XKV@tempb\@nil
      \fi
    \else
      \XKV@tempa{#1}\relax
    \fi
  \fi
}
\def\XKV@default#1#2\@nil{%
  \expandafter\edef\expandafter\XKV@resa\expandafter{\expandafter\@gobble\string#1}%
  \edef\XKV@resb{\XKV@header\XKV@tkey}%
  \@onelevel@sanitize\XKV@resb
  \ifx\XKV@resa\XKV@resb
    \begingroup
      \expandafter\def\csname\XKV@header\XKV@tkey\endcsname##1{%
        \global\toks@{##1}%
      }%
      \XKV@tempb
    \endgroup
    \edef\XKV@tempb{\the\toks@}%
    \@selective@sanitize^\XKV@tempb
    \ifrecordkeyvals
      \expandafter\expandafter\expandafter\gdef
        \expandafter\expandafter\csname XKV@\XKV@tkey @value\endcsname
        \expandafter{\XKV@tempb}%
    \fi
    \expandafter\XKV@replacepointers\XKV@tempb^{}\@nil
    \expandafter\XKV@tempa\expandafter{\the\toks@}%
  \else
    \XKV@tempb\relax
  \fi
}
\def\setrmkeys{\XKV@testopta\XKV@setrmkeys}
\def\XKV@setrmkeys[#1]{%
  \toks@\expandafter{\XKV@rm}%
  \edef\XKV@tempa{\noexpand\XKV@setkeys[#1]{\the\toks@}}%
  \XKV@tempa
}
\def\XKV@ifku{\@ifnextchar[\XKV@ifk@{\XKV@ifk@[KV]}}
\long\def\XKV@ifk@[#1]#2#3#4#5{%
  \XKV@knftrue
  \XKV@makepf{#1}%
  \XKV@@zs@def\XKV@fams{#2}%
  \ifx\XKV@fams\empty
    \XKV@makehd{}%
    \expandafter\ifx\csname\XKV@header#3\endcsname\relax\else
      \XKV@knffalse
    \fi
  \else
    \XKV@whilist\XKV@tfam:=\XKV@fams\do\ifXKV@knf\fi{%
      \XKV@makehd\XKV@tfam
      \expandafter\ifx\csname\XKV@header#3\endcsname\relax\else
        \XKV@knffalse
      \fi
    }%
  \fi
  \ifXKV@knf#4\else#5\fi
}
\catcode`\@=\XKVAtCode\relax
\catcode`\^=\XKVHatCode\relax
\endinput
%%
%% End of file `xkeyval.tex'.