[dev-context] processing comma/assignmentlist
Hans Hagen
pragma at wxs.nl
Mon Jul 20 19:43:29 CEST 2009
Wolfgang Schuster wrote:
>
> Am 19.07.2009 um 13:09 schrieb Hans Hagen:
>
>>> 2. A command to access the keys and labels of a assignment list at
>>> user level, e.g.
>>> \def\myassignmentlist[#1]%
>>> {\def\dosomethingwithkeyandvalue##1##2##3{... ##2 ... ##3}% ##1 =
>>> namespace (not used here)
>>> \dogetparameter\dosomethingwithkeyandvalue[...][#1]}
>>> \myassignmentlist[..,..=..,..=..]
>>
>> is this the best name? maybe
>>
>> \getmyparameters[a=1,b=]\handler
>
> Looks good but in the form
>
> \processassignmentlist[a=1,b=2,...]\docommand
>
> and (as equivalent to \processcommacommand)
>
> \processassignmentcommand[\mylist]\docommand
>
> where \docommand is defined as
>
> \def\docommand#1#2{...} % #1 = key, #2 = value
>
i added
\def\processassignmentlist[#1]#2% #2 == \command{key}{value]
{\def\doprocessassignmententry##1{#2}% {##2}{##3} % namespace is ignored
\dogetparameters\doprocessassignmententry[][#1]}
\def\processassignmentcommand[#1]%
{\normalexpanded{\noexpand\processassignmentlist[][#1]}}
test case:
\def\showpair#1#2{key:#1, value:#2\par}
\processassignmentlist[a=1,b=2]\showpair
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------
More information about the dev-context
mailing list