On Sep 4, 2008, at 8:45 AM, Wolfgang Schuster wrote:

> \def\Commanda
>  {\doquadrupleempty\doCommanda}
>
> \def\doCommanda[#1][#2][#3][#4]%
>  {\iffourthargument
>     \def\next{\doCommandafive[#1][#2][#3][#4]}%
>   \else
>     \def\next{\doCommandafour[#1][#2][#3]}%
>   \fi\next}
>
> \def\doCommandafive[#1][#2][#3][#4]#5%
>  {five arguments}
>
> \def\doCommandafour[#1][#2][#3]#4%
>  {four arguments}
>
>
> \def\Commandb
>  {\doquadrupleempty\doCommandb}
>
> \def\doCommandb[#1][#2][#3][#4]%
>  {\iffourthargument
>     \def\next{\dodoCommandb[#1][#2][#3][#4]}%
>   \else
>     \def\next{\dodoCommandb[#1][#2][#3][]}%
>   \fi\next}
>
> \def\dodoCommandb[#1][#2][#3][#4]#5%
>  {\doifelsenothing{#4}
>     {four arguments}
>     {five arguments}}
>
> \starttext
>
> \Commanda[1][2][3][4]{5}
>
> \Commanda[1][2][3]{4}
>
> \Commandb[1][2][3][4]{5}
>
> \Commandb[1][2][3]4
>
> \Commandb[1][2][3][]{4} % feature
>
> \stoptext
>
> Wolfgang

YES! That's the end of my suffering!! Thanks a lot, Wolfgang, you're  
my hero. Makes sense, too, now that I look at it. Now I'm gonna find  
out what \next does...

Thanks!

Thomas

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to