%% %% This is file `expkv-def.tex', %% generated with the docstrip utility. %% %% The original source files were: %% %% expkv-def.dtx (with options: `tex') %% %% -------------------------------------------------------------- %% expkv-def -- a key-defining frontend for expkv %% E-mail: jspratte@yahoo.de %% Released under the LaTeX Project Public License v1.3c or later %% See http://www.latex-project.org/lppl.txt %% -------------------------------------------------------------- %% %% Copyright (C) 2020 Jonathan P. Spratte %% %% This work may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this license or %% (at your option) any later version. The latest version of this license is in %% the file: %% %% http://www.latex-project.org/lppl.txt %% %% This work is "maintained" (as per LPPL maintenance status) by %% Jonathan P. Spratte. %% %% This work consists of the file expkv-def.dtx %% and the derived files expkv-def.pdf %% expkv-def.sty %% expkv-def.tex %% \input expkv \expandafter\ifx\csname ekvdVersion\endcsname\relax \else \expandafter\endinput \fi \def\ekvdVersion{0.2a} \def\ekvdDate{2020-04-04} \csname ekvd@tmp\endcsname \expandafter\chardef\csname ekvd@tmp\endcsname=\catcode`\@ \catcode`\@=11 \def\ekvd@empty{} \protected\def\ekvd@clear@prefixes {% \let\ekvd@long\ekvd@empty \let\ekvd@prot\ekvd@empty } \ekvd@clear@prefixes \protected\def\ekvdefinekeys#1% {% \def\ekvd@set{#1}% \ekvparse\ekvd@noarg\ekvd@ } \protected\def\ekvd@noarg#1{\ekvd@{#1}\ekvd@noarg@mark} \protected\long\def\ekvd@#1#2% {% \ekvd@clear@prefixes \ekvd@ifspace{#1}% {\ekvd@prefix\ekv@mark#1\ekv@stop{#2}}% {\ekvd@err@missing@prefix{#1}}% } \protected\def\ekvd@prefix#1 {\ekv@strip{#1}\ekvd@prefix@\ekv@mark} \protected\def\ekvd@prefix@#1#2\ekv@stop {% \ekv@ifdefined{ekvd@t@#1}% {\ekv@strip{#2}{\csname ekvd@t@#1\endcsname}}% {% \ekv@ifdefined{ekvd@p@#1}% {\csname ekvd@p@#1\endcsname{#2}}% {\ekvd@err@undefined@prefix{#1}\@gobble}% }% } \protected\def\ekvd@prefix@after@p#1% {% \ekvd@ifspace{#1}% {\ekvd@prefix#1\ekv@stop}% {% \expandafter\ekvd@err@missing@prefix\expandafter{\ekv@gobble@mark#1}% \@gobble }% } \protected\def\ekvd@p@long{\let\ekvd@long\long\ekvd@prefix@after@p} \protected\def\ekvd@p@protected{\let\ekvd@prot\protected\ekvd@prefix@after@p} \let\ekvd@p@protect\ekvd@p@protected \protected\def\ekvd@t@set#1#2% {% \ekvd@assert@not@long{set #1}% \ekvd@assert@not@protected{set #1}% \ekvd@ifnoarg{#2}% {\ekvdefNoVal\ekvd@set{#1}{\ekvchangeset{#1}}}% {% \ekv@ifempty{#2}% {\ekvd@err@missing@definition{set #1}}% {\ekvdefNoVal\ekvd@set{#1}{\ekvchangeset{#2}}}% }% } \protected\long\def\ekvd@type@noval#1#2#3#4% {% \ekvd@assert@arg{#1noval #3}{#4}% {% \ekvd@assert@not@long{#1noval #3}% \ekvd@prot#2\ekvd@tmp{#4}% \ekvletNoVal\ekvd@set{#3}\ekvd@tmp }% } \protected\def\ekvd@t@noval{\ekvd@type@noval{}\def} \protected\def\ekvd@t@enoval{\ekvd@type@noval e\edef} \protected\long\def\ekvd@type@code#1#2#3#4% {% \ekvd@assert@arg{#1code #3}{#4} {% \ekvd@prot\ekvd@long#2\ekvd@tmp##1{#4}% \ekvlet\ekvd@set{#3}\ekvd@tmp }% } \protected\def\ekvd@t@code{\ekvd@type@code{}\def} \protected\def\ekvd@t@ecode{\ekvd@type@code e\edef} \protected\long\def\ekvd@type@default#1#2#3#4% {% \ekvd@assert@arg{#1default #3}{#4}% {% \ekvifdefined\ekvd@set{#3}% {% \ekvd@assert@not@long{#1default #3}% \ekvd@prot\edef\ekvd@tmp {% \unexpanded\expandafter#2% {\csname\ekv@name\ekvd@set{#3}\endcsname{#4}}% }% \ekvletNoVal\ekvd@set{#3}\ekvd@tmp }% {\ekvd@err@undefined@key{#3}}% }% } \protected\def\ekvd@t@default{\ekvd@type@default{}{}} \protected\def\ekvd@t@qdefault{\ekvd@type@default q{\expandafter\expandafter}} \protected\long\def\ekvd@t@edefault#1#2% {% \ekvd@assert@arg{edefault #1}{#2}% {% \ekvifdefined\ekvd@set{#1}% {% \ekvd@assert@not@long{edefault #1}% \ekvd@prot\edef\ekvd@tmp {\csname\ekv@name\ekvd@set{#1}\endcsname{#2}}% \ekvletNoVal\ekvd@set{#1}\ekvd@tmp }% {\ekvd@err@undefined@key{#1}}% }% } \long\def\ekvd@t@initial#1#2% {% \ekvd@assert@arg{initial #1}{#2}% {% \ekvifdefined\ekvd@set{#1}% {% \ekvd@assert@not@long{initial #1}% \ekvd@assert@not@protected{initial #1}% \csname\ekv@name\ekvd@set{#1}\endcsname{#2}% }% {\ekvd@err@undefined@key{#1}}% }% } \long\def\ekvd@t@oinitial#1#2% {% \ekvd@assert@arg{oinitial #1}{#2}% {% \ekvifdefined\ekvd@set{#1}% {% \ekvd@assert@not@long{oinitial #1}% \ekvd@assert@not@protected{oinitial #1}% \csname\ekv@name\ekvd@set{#1}\expandafter\endcsname\expandafter{#2}% }% {\ekvd@err@undefined@key{#1}}% }% } \long\def\ekvd@t@einitial#1#2% {% \ekvd@assert@arg{einitial #1}{#2}% {% \ekvifdefined\ekvd@set{#1}% {% \ekvd@assert@not@long{einitial #1}% \ekvd@assert@not@protected{einitial #1}% \edef\ekvd@tmp{#2}% \csname\ekv@name\ekvd@set{#1}\expandafter\endcsname\expandafter {\ekvd@tmp}% }% {\ekvd@err@undefined@key{#1}}% }% } \protected\def\ekvd@type@bool#1#2#3#4#5#6#7% {% \ekvd@assert@filledarg{#1bool#2 #6}{#7}% {% \ekvd@newlet#7#5% \ekvd@type@choice{#1bool#2}{#6}% \protected\ekvdefNoVal\ekvd@set{#6}{#3\let#7#4}% \protected\expandafter\def \csname\ekvd@choice@name\ekvd@set{#6}{true}\endcsname {#3\let#7#4}% \protected\expandafter\def \csname\ekvd@choice@name\ekvd@set{#6}{false}\endcsname {#3\let#7#5}% }% } \protected\def\ekvd@t@bool{\ekvd@type@bool{}{}{}\iftrue\iffalse} \protected\def\ekvd@t@gbool{\ekvd@type@bool g{}\global\iftrue\iffalse} \protected\def\ekvd@t@boolTF{\ekvd@type@bool{}{TF}{}\@firstoftwo\@secondoftwo} \protected\def\ekvd@t@gboolTF {\ekvd@type@bool g{TF}\global\@firstoftwo\@secondoftwo} \protected\def\ekvd@type@data#1#2#3#4#5#6#7% {% \ekvd@assert@filledarg{#1data#2 #6}{#7}% {% \ekvd@newlet#7#3% \protected\ekvd@long\ekvdef\ekvd@set{#6}{\long#4#7####1#5{####1{##1}}}% }% } \protected\def\ekvd@t@data{\ekvd@type@data{}{}\@secondoftwo\def{####2}} \protected\def\ekvd@t@edata{\ekvd@type@data e{}\@secondoftwo\edef{####2}} \protected\def\ekvd@t@gdata{\ekvd@type@data g{}\@secondoftwo\gdef{####2}} \protected\def\ekvd@t@xdata{\ekvd@type@data x{}\@secondoftwo\xdef{####2}} \protected\def\ekvd@t@dataT{\ekvd@type@data{}T\@gobble\def{}} \protected\def\ekvd@t@edataT{\ekvd@type@data eT\@gobble\edef{}} \protected\def\ekvd@t@gdataT{\ekvd@type@data gT\@gobble\gdef{}} \protected\def\ekvd@t@xdataT{\ekvd@type@data xT\@gobble\xdef{}} \protected\def\ekvd@type@box#1#2#3#4% {% \ekvd@assert@filledarg{#1box #3}{#4}% {% \ekvd@newreg#4{box}% \protected\ekvd@long\ekvdef\ekvd@set{#3}% {#2\setbox#4\hbox{\begingroup##1\endgroup}}% }% } \protected\def\ekvd@t@box{\ekvd@type@box{}{}} \protected\def\ekvd@t@gbox{\ekvd@type@box g\global} \protected\def\ekvd@type@toks#1#2#3#4% {% \ekvd@assert@filledarg{#1toks #3}{#4}% {% \ekvd@newreg#4{toks}% \protected\ekvd@long\ekvdef\ekvd@set{#3}{#2#4{##1}}% }% } \protected\def\ekvd@t@toks{\ekvd@type@toks{}{}} \protected\def\ekvd@t@gtoks{\ekvd@type@toks{g}\global} \protected\def\ekvd@type@apptoks#1#2#3#4% {% \ekvd@assert@filledarg{#1apptoks #3}{#4}% {% \ekvd@newreg#4{toks}% \protected\ekvd@long\ekvdef\ekvd@set{#3}{#2#4\expandafter{\the#4##1}}% }% } \protected\def\ekvd@t@apptoks{\ekvd@type@apptoks{}{}} \protected\def\ekvd@t@gapptoks{\ekvd@type@apptoks{g}\global} \protected\def\ekvd@type@reg#1#2#3#4#5#6#7% {% \ekvd@assert@filledarg{#1 #6}{#7}% {% \ekvd@newreg#7{#2}% \protected\ekvd@long\ekvdef\ekvd@set{#6}{#3#7=#4##1#5\relax}% }% } \protected\def\ekvd@t@int{\ekvd@type@reg{int}{count}{}{}{}} \protected\def\ekvd@t@eint{\ekvd@type@reg{eint}{count}{}\numexpr\relax} \protected\def\ekvd@t@gint{\ekvd@type@reg{gint}{count}\global{}{}} \protected\def\ekvd@t@xint{\ekvd@type@reg{xint}{count}\global\numexpr\relax} \protected\def\ekvd@t@dimen{\ekvd@type@reg{dimen}{dimen}{}{}{}} \protected\def\ekvd@t@edimen{\ekvd@type@reg{edimen}{dimen}{}\dimexpr\relax} \protected\def\ekvd@t@gdimen{\ekvd@type@reg{gdimen}{dimen}\global{}{}} \protected\def\ekvd@t@xdimen{\ekvd@type@reg{xdimen}{dimen}\global\dimexpr\relax} \protected\def\ekvd@t@skip{\ekvd@type@reg{skip}{skip}{}{}{}} \protected\def\ekvd@t@eskip{\ekvd@type@reg{eskip}{skip}{}\glueexpr\relax} \protected\def\ekvd@t@gskip{\ekvd@type@reg{gskip}{skip}\global{}{}} \protected\def\ekvd@t@xskip{\ekvd@type@reg{xskip}{skip}\global\glueexpr\relax} \protected\def\ekvd@type@store#1#2#3#4% {% \ekvd@assert@filledarg{#1store #3}{#4}% {% \unless\ifdefined#4\let#4\ekvd@empty\fi \protected\ekvd@long\ekvdef\ekvd@set{#3}{#2#4{\unexpanded{##1}}}% }% } \protected\def\ekvd@t@store{\ekvd@type@store{}\edef} \protected\def\ekvd@t@gstore{\ekvd@type@store{g}\xdef} \protected\def\ekvd@type@estore#1#2#3#4% {% \ekvd@assert@filledarg{#1store #3}{#4}% {% \ekvd@newlet#4\ekvd@empty \protected\ekvd@long\ekvdef\ekvd@set{#3}{#2#4{##1}}% }% } \protected\def\ekvd@t@estore{\ekvd@type@estore{e}\edef} \protected\def\ekvd@t@xstore{\ekvd@type@estore{x}\xdef} \protected\long\def\ekvd@type@meta#1#2#3#4#5% {% \ekvd@assert@filledarg{#1meta #4}{#5}% {% \edef\ekvd@tmp{\ekvd@set}% \expandafter\ekvd@type@meta@\expandafter{\ekvd@tmp}{#3}{#5}% #2\ekvd@set{#4}\ekvd@tmp }% } \protected\long\def\ekvd@type@meta@#1#2#3% {% \ekvd@prot\ekvd@long\def\ekvd@tmp#2{\ekvset{#1}{#3}}% } \protected\def\ekvd@t@meta{\ekvd@type@meta{}\ekvlet{##1}} \protected\long\def\ekvd@t@nmeta#1#2% {% \ekvd@assert@not@long{nmeta #1}% \ekvd@type@meta n\ekvletNoVal{}{#1}{#2}% } \protected\long\def\ekvd@type@smeta#1#2#3#4#5% {% \ekvd@assert@twoargs{s#1meta #4}{#5}% {% \expandafter\ekvd@type@smeta@\expandafter{\@secondoftwo#5}{#5}{#3} #2\ekvd@set{#4}\ekvd@tmp }% } \protected\long\def\ekvd@type@smeta@#1#2#3% {% \expandafter\ekvd@type@meta@\expandafter{\@firstoftwo#2}{#3}{#1}% } \protected\def\ekvd@t@smeta{\ekvd@type@smeta{}\ekvlet{##1}} \protected\long\def\ekvd@t@snmeta#1#2% {% \ekvd@assert@not@long{snmeta #1}% \ekvd@type@smeta n\ekvletNoVal{}{#1}{#2}% } \protected\def\ekvd@type@choice#1#2% {% \ekvd@assert@not@long{#1 #2}% \ekvd@prot\edef\ekvd@tmp##1% {% \unexpanded{\ekvd@h@choice}{\ekvd@choice@name\ekvd@set{#2}{##1}}% }% \ekvlet\ekvd@set{#2}\ekvd@tmp } \protected\def\ekvd@populate@choice {% \ekvparse\ekvd@populate@choice@noarg\ekvd@populate@choice@ } \protected\long\def\ekvd@populate@choice@noarg#1% {% \expandafter\ekvd@err@missing@definition\expandafter{\ekvd@set@choice : #1}% } \protected\long\def\ekvd@populate@choice@#1#2% {% \ekvd@clear@prefixes \expandafter\ekvd@assert@arg\expandafter{\ekvd@set@choice : #1}{#2}% {% \ekvd@ifspace{#1}% {\ekvd@choice@prefix\ekv@mark#1\ekv@stop}% {% \expandafter\def \csname\ekvd@choice@name\ekvd@set\ekvd@set@choice{#1}\endcsname }% {#2}% }% } \protected\def\ekvd@choice@prefix#1 {% \ekv@strip{#1}\ekvd@choice@prefix@\ekv@mark } \protected\def\ekvd@choice@prefix@#1#2\ekv@stop {% \ekv@ifdefined{ekvd@choice@p@#1}% {% \csname ekvd@choice@p@#1\endcsname \ekvd@ifspace{#2}% {\ekvd@choice@prefix#2\ekv@stop}% {% \ekvd@prot\expandafter\def \csname \ekv@strip{#2}{\ekvd@choice@name\ekvd@set\ekvd@set@choice}% \endcsname }% }% {\ekvd@err@undefined@prefix{#1}\@gobble}% } \protected\def\ekvd@choice@p@protected{\let\ekvd@prot\protected} \let\ekvd@choice@p@protect\ekvd@choice@p@protected \protected\def\ekvd@choice@p@long\ekvd@ifspace#1% {% \expandafter\ekvd@choice@p@long@\expandafter{\ekv@gobble@mark#1}% \ekvd@ifspace{#1}% } \protected\def\ekvd@choice@p@long@#1% {% \expandafter\ekvd@err@no@long\expandafter {\ekvd@set@choice : long #1}% } \protected\long\def\ekvd@t@choice#1#2% {% \ekvd@assert@arg{choice #1}{#2}% {% \ekvd@type@choice{choice}{#1}% \def\ekvd@set@choice{#1}% \ekvd@populate@choice{#2}% }% } \def\ekvd@h@choice#1% {% \expandafter\ekvd@h@choice@ \csname\ifcsname#1\endcsname#1\else relax\fi\endcsname {#1}% } \def\ekvd@h@choice@#1#2% {% \ifx#1\relax \ekvd@err@choice@invalid{#2}% \expandafter\@gobble \fi #1% } \def\ekvd@noarg@mark{\ekvd@noarg@mark} \long\def\ekvd@fi@firstoftwo\fi\@secondoftwo#1#2{\fi#1} \protected\def\ekvd@newlet#1#2% {% \unless\ifdefined#1\let#1#2\fi } \protected\def\ekvd@newreg#1#2% {% \unless\ifdefined#1\csname new#2\endcsname#1\fi } \long\def\ekvd@assert@twoargs#1#2% {% \ekvd@ifnottwoargs{#2}% {\ekvd@err@missing@definition{#1}}% } \long\def\ekvd@ifnottwoargs#1% {% \ekvd@ifempty@gtwo#1\ekv@ifempty@B \ekv@ifempty@false\ekv@ifempty@A\ekv@ifempty@B\@firstoftwo } \long\def\ekvd@ifempty@gtwo#1#2{\ekv@ifempty@\ekv@ifempty@A} \long\def\ekvd@assert@arg#1#2% {% \ekvd@ifnoarg{#2}% {\ekvd@err@missing@definition{#1}}% } \long\def\ekvd@ifnoarg#1% {% \ifx\ekvd@noarg@mark#1% \ekvd@fi@firstoftwo \fi \@secondoftwo } \long\def\ekvd@assert@filledarg#1#2% {% \ekvd@ifnoarg@or@empty{#2}% {\ekvd@err@missing@definition{#1}}% } \long\def\ekvd@ifnoarg@or@empty#1% {% \ekvd@ifnoarg{#1}% \@firstoftwo {\ekv@ifempty{#1}}% } \long\def\ekvd@assert@not@long#1% {% \ifx\ekvd@long\long\ekvd@err@no@long{#1}\fi } \long\def\ekvd@assert@not@protected#1% {% \ifx\ekvd@prot\protected\ekvd@err@no@protected{#1}\fi } \long\def\ekvd@ifspace#1% {% \ekvd@ifspace@#1 \ekv@ifempty@B \ekv@ifempty@false\ekv@ifempty@A\ekv@ifempty@B\@firstoftwo } \long\def\ekvd@ifspace@#1 % keep this space {% \ekv@ifempty@\ekv@ifempty@A } \protected\def\ekvd@err@missing@definition#1% {\errmessage{expkv-def Error: Missing definition for key `\unexpanded{#1}'}} \protected\def\ekvd@err@missing@prefix#1% {\errmessage{expkv-def Error: Missing prefix for key `\unexpanded{#1}'}} \protected\def\ekvd@err@undefined@prefix#1% {\errmessage{expkv-def Error: Undefined prefix `\unexpanded{#1}'}} \protected\def\ekvd@err@undefined@key#1% {\errmessage{expkv-def Error: Undefined key `\unexpanded{#1}'}} \protected\def\ekvd@err@no@protected#1% {% \errmessage {expkv-def Error: prefix `protected' not accepted for `\unexpanded{#1}'}% } \protected\def\ekvd@err@no@long#1% {% \errmessage {expkv-def Error: prefix `long' not accepted for `\unexpanded{#1}'}% } \def\ekvd@err@choice@invalid#1% {% \ekvd@err@choice@invalid@#1\ekv@stop } \begingroup \catcode40=8 \catcode41=8 \@firstofone{\endgroup \def\ekvd@choice@name#1#2#3% {% ekvd#1(#2)#3% } \def\ekvd@err@choice@invalid@ ekvd#1(#2)#3\ekv@stop% {% \ekvd@err{invalid choice `#3' (`#2', set `#1')}% } } \begingroup \edef\ekvd@err {% \endgroup \unexpanded{\long\def\ekvd@err}##1% {% \unexpanded{\expandafter\ekv@err@\@firstofone}% {\unexpanded\expandafter{\csname ! expkv-def Error:\endcsname}##1.}% \unexpanded{\ekv@stop}% }% } \ekvd@err \catcode`\@=\ekvd@tmp %% %% %% End of file `expkv-def.tex'.