ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* checkparameters and current beta (20120802)
@ 2012-08-03 19:12 Daniel Schopper
  2012-08-03 20:44 ` Wolfgang Schuster
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Schopper @ 2012-08-03 19:12 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi,
\checkparameters seems broken in the current beta. The following example 
used to work at least with version 2012.06.13

---------------------------------------------------------------------------------
\def\myCom[#1]{%
	\checkparameters[#1]
	\ifparameters
		\getparameters[do][one=1,two=2,#1]
		\doone\ \dotwo
	\else
		#1
	\fi
}
\starttext
\myCom[one]

\myCom[one=one,two=two]
\stoptext
---------------------------------------------------------------------------------


… while with the current beta (2012.08.02) it results in:

system          > tex > error on line 11 in file 
testcheckparameters.tex: Undefined control sequence ...

  1     \def\myCom[#1]{%
  2     	\checkparameters[#1]
  3     	\ifparameters
  4     		\getparameters[do][one=1,two=2,#1]
  5     		\doone\ \dotwo
  6     	\else
  7     		#1
  8     	\fi
  9     }
10     \starttext
11 >>  \myCom[one]
12
13     \myCom[one=one,two=two]
14     \stoptext


\checkparameters ..._helpers_get_empty_parameters
                                                   #1=@@\_e_o_s_
\myCom [#1]->\checkparameters [#1]
                                    \ifparameters \getparameters 
[do][one=1,t...
l.11 \myCom[one]


Thanks in advance,
Daniel
___________________________________________________________________________________
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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: checkparameters and current beta (20120802)
  2012-08-03 19:12 checkparameters and current beta (20120802) Daniel Schopper
@ 2012-08-03 20:44 ` Wolfgang Schuster
  2012-08-04  9:30   ` Daniel Schopper
  0 siblings, 1 reply; 3+ messages in thread
From: Wolfgang Schuster @ 2012-08-03 20:44 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Hans Hagen


Am 03.08.2012 um 21:12 schrieb Daniel Schopper <daniel.schopper@aon.at>:

> Hi,
> \checkparameters seems broken in the current beta. The following example used to work at least with version 2012.06.13
> 
> ---------------------------------------------------------------------------------
> \def\myCom[#1]{%
> 	\checkparameters[#1]
> 	\ifparameters
> 		\getparameters[do][one=1,two=2,#1]
> 		\doone\ \dotwo
> 	\else
> 		#1
> 	\fi
> }
> \starttext
> \myCom[one]
> 
> \myCom[one=one,two=two]
> \stoptext

You have to change this on syst-aux.mkiv:

\unexpanded\def\checkparameters[#1]%
- {\syst_helpers_get_empty_parameters#1=@@\_e_o_s_}
+ {\syst_helpers_check_parameters#1=@@\_e_o_s_}

You can also use \doifassignmentelse to check the content of your macro.

\def\mycommand[#1]%
  {\doifassignmentelse{#1}
     {\getrawparameters[mycommand][one=1,two=2,#1]%
      \mycommandone\ \mycommandtwo}
     {#1}}

When you want to use \if… \else … \fi in your command you can use this:

\def\mycommand[#1]%
  {\doifassignmentelse{#1}\donetrue\donefalse
   \ifdone
     \getrawparameters[mycommand][one=1,two=2,#1]%
     \mycommandone\ \mycommandtwo
   \else
     #1%
   \fi}

Wolfgang
___________________________________________________________________________________
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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: checkparameters and current beta (20120802)
  2012-08-03 20:44 ` Wolfgang Schuster
@ 2012-08-04  9:30   ` Daniel Schopper
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Schopper @ 2012-08-04  9:30 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Great, thanks!


Am 03.08.12 22:44, schrieb Wolfgang Schuster:
>
> Am 03.08.2012 um 21:12 schrieb Daniel Schopper <daniel.schopper@aon.at>:
>
>> Hi,
>> \checkparameters seems broken in the current beta. The following example used to work at least with version 2012.06.13
>>
>> ---------------------------------------------------------------------------------
>> \def\myCom[#1]{%
>> 	\checkparameters[#1]
>> 	\ifparameters
>> 		\getparameters[do][one=1,two=2,#1]
>> 		\doone\ \dotwo
>> 	\else
>> 		#1
>> 	\fi
>> }
>> \starttext
>> \myCom[one]
>>
>> \myCom[one=one,two=two]
>> \stoptext
>
> You have to change this on syst-aux.mkiv:
>
> \unexpanded\def\checkparameters[#1]%
> - {\syst_helpers_get_empty_parameters#1=@@\_e_o_s_}
> + {\syst_helpers_check_parameters#1=@@\_e_o_s_}
>
> You can also use \doifassignmentelse to check the content of your macro.
>
> \def\mycommand[#1]%
>    {\doifassignmentelse{#1}
>       {\getrawparameters[mycommand][one=1,two=2,#1]%
>        \mycommandone\ \mycommandtwo}
>       {#1}}
>
> When you want to use \if… \else … \fi in your command you can use this:
>
> \def\mycommand[#1]%
>    {\doifassignmentelse{#1}\donetrue\donefalse
>     \ifdone
>       \getrawparameters[mycommand][one=1,two=2,#1]%
>       \mycommandone\ \mycommandtwo
>     \else
>       #1%
>     \fi}
>
> Wolfgang
> ___________________________________________________________________________________
> 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  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
>
___________________________________________________________________________________
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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-08-04  9:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-03 19:12 checkparameters and current beta (20120802) Daniel Schopper
2012-08-03 20:44 ` Wolfgang Schuster
2012-08-04  9:30   ` Daniel Schopper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).