Am 21.04.2011 um 12:28 schrieb Verhaag, G.C.H.M.:
Hi,
I try this example from the wiki page System Macros/Argument handling:
\def\dodefinesomething[#1][#2]%
{\getparameters[\??xx#1][#2]}
\def\definesomething%
{\dodoubleargumentwithset\dodefinesomething}
\starttext
\definesomething[alfa][variable=test]
\stoptext
Running this yields
! Undefined control sequence
I'm trying to write a few macros with optional delimited arguments with key-value sets and started reading the appropriate pages, but can't figure out why this example fails to run.
Anybody any idea?
I guess the message comes from your namespace which is in this form
only allowed in unprotected mode, to enter you need \unprotect before
and \protect after your command declarations. Another problem is that
you use a system namespace (two “?” and two letters) but for modules
we use now four “?” and also more than two letter, e.g.
\def\????something{@@@@something}
\def\definesomething
{\dodoubleargumentwithset\dodefinesomething}
\def\dodefinesomething[#1][#2]%
{\getparameters[\????something#1][#2]}
You should also take a look at the \definenamespace command which
creates the \define… and \setup… commands for you:
Wolfgang