parameter mechanism
Hello all, I have problems to understand the command (parameter) mechanism of context. My experiments with \getparameters didn't work, so I used \xdescgetparameters from Giuseppe Bilotta (t-xdesc.tex). In my eyes they look the same, but \xdescgetparameters works with my sample code, \getparameters don't. Mhhh.... % t-xdesc.tex \def\xdescsetvalue#1#2{\expandafter\def\csname#1#2\endcsname} \def\xdescgetparameters{\dogetparameters\xdescsetvalue} % syst-gen.tex \def\dosetvalue#1#2% #3 {\@EA\def\csname#1#2\endcsname} % {#3}} \def\getparameters {\dogetparameters\dosetvalue} This leads me to my two questions: What must I change, to make my test example run with \getparameters? Where is the error in my \docommand? All parameters but [height] work and the tracing output at this parameter (\OTRSETshowstatus) says nothing to me. Thanks for any help, Peter P.S.: using miktex 2.3, context version 21.08.2003
Wednesday, August 27, 2003 Peter Rolf wrote: PR> Hello all, PR> I have problems to understand the command (parameter) mechanism of context. PR> My experiments with \getparameters didn't work, so I used PR> \xdescgetparameters PR> from Giuseppe Bilotta (t-xdesc.tex). PR> In my eyes they look the same, but \xdescgetparameters works with my sample PR> code, \getparameters don't. Mhhh.... PR> % t-xdesc.tex PR> \def\xdescsetvalue#1#2{\expandafter\def\csname#1#2\endcsname} PR> \def\xdescgetparameters{\dogetparameters\xdescsetvalue} PR> % syst-gen.tex PR> \def\dosetvalue#1#2% #3 PR> {\@EA\def\csname#1#2\endcsname} % {#3}} PR> \def\getparameters {\dogetparameters\dosetvalue} PR> This leads me to my two questions: PR> What must I change, to make my test example run with \getparameters? The trick is in mult-ini.tex, which redefines dosetvalue & co to support the multilingual interface; this is a problem when you want to get raw (unconverted) keyword/value sets, which is why it fails. ConTeXt used to have "raw" version of the do..value commands, but they disappeared at one point. Yes, they should be re-introduced. -- Giuseppe "Oblomov" Bilotta
At 16:56 27/08/2003 +0200, you wrote:
The trick is in mult-ini.tex, which redefines dosetvalue & co to support the multilingual interface; this is a problem when you want to get raw (unconverted) keyword/value sets, which is why it fails. ConTeXt used to have "raw" version of the do..value commands, but they disappeared at one point. Yes, they should be re-introduced.
i dunno what grep you have but mine gives: syst-new.tex:\def\getrawparameters {\dogetparameters\dosetrawvalue } syst-new.tex:\def\getraweparameters {\dogetparameters\dosetrawevalue} syst-new.tex:\def\getrawgparameters {\dogetparameters\dosetrawgvalue} syst-new.tex:\def\getrawxparameters {\dogetparameters\dosetrawxvalue} Hans ------------------------------------------------------------------------- Hans Hagen | PRAGMA ADE | pragma@wxs.nl Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com ------------------------------------------------------------------------- information: http://www.pragma-ade.com/roadmap.pdf documentation: http://www.pragma-ade.com/showcase.pdf -------------------------------------------------------------------------
Wednesday, August 27, 2003 Hans Hagen wrote: HH> At 16:56 27/08/2003 +0200, you wrote:
The trick is in mult-ini.tex, which redefines dosetvalue & co to support the multilingual interface; this is a problem when you want to get raw (unconverted) keyword/value sets, which is why it fails. ConTeXt used to have "raw" version of the do..value commands, but they disappeared at one point. Yes, they should be re-introduced.
HH> i dunno what grep you have but mine gives: HH> syst-new.tex:\def\getrawparameters HH> {\dogetparameters\dosetrawvalue } HH> syst-new.tex:\def\getraweparameters HH> {\dogetparameters\dosetrawevalue} HH> syst-new.tex:\def\getrawgparameters HH> {\dogetparameters\dosetrawgvalue} HH> syst-new.tex:\def\getrawxparameters HH> {\dogetparameters\dosetrawxvalue} I can't believe I missed them! What was I looking for? -- Giuseppe "Oblomov" Bilotta
Wednesday, August 27, 2003 Giuseppe Bilotta wrote: GB> Wednesday, August 27, 2003 Hans Hagen wrote: HH>> At 16:56 27/08/2003 +0200, you wrote:
The trick is in mult-ini.tex, which redefines dosetvalue & co to support the multilingual interface; this is a problem when you want to get raw (unconverted) keyword/value sets, which is why it fails. ConTeXt used to have "raw" version of the do..value commands, but they disappeared at one point. Yes, they should be re-introduced.
HH>> i dunno what grep you have but mine gives: HH>> syst-new.tex:\def\getrawparameters HH>> {\dogetparameters\dosetrawvalue } HH>> syst-new.tex:\def\getraweparameters HH>> {\dogetparameters\dosetrawevalue} HH>> syst-new.tex:\def\getrawgparameters HH>> {\dogetparameters\dosetrawgvalue} HH>> syst-new.tex:\def\getrawxparameters HH>> {\dogetparameters\dosetrawxvalue} GB> I can't believe I missed them! What was I looking for? BTW is there any difference between this and the variables system? -- Giuseppe "Oblomov" Bilotta
At 19:22 27/08/2003 +0200, you wrote:
Wednesday, August 27, 2003 Giuseppe Bilotta wrote:
GB> Wednesday, August 27, 2003 Hans Hagen wrote:
HH>> At 16:56 27/08/2003 +0200, you wrote:
The trick is in mult-ini.tex, which redefines dosetvalue & co to support the multilingual interface; this is a problem when you want to get raw (unconverted) keyword/value sets, which is why it fails. ConTeXt used to have "raw" version of the do..value commands, but they disappeared at one point. Yes, they should be re-introduced.
HH>> i dunno what grep you have but mine gives:
HH>> syst-new.tex:\def\getrawparameters HH>> {\dogetparameters\dosetrawvalue } HH>> syst-new.tex:\def\getraweparameters HH>> {\dogetparameters\dosetrawevalue} HH>> syst-new.tex:\def\getrawgparameters HH>> {\dogetparameters\dosetrawgvalue} HH>> syst-new.tex:\def\getrawxparameters HH>> {\dogetparameters\dosetrawxvalue}
GB> I can't believe I missed them! What was I looking for?
BTW is there any difference between this and the variables system?
the difference is that an undefined variable gives an empty string instead of \relax Hans ------------------------------------------------------------------------- Hans Hagen | PRAGMA ADE | pragma@wxs.nl Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com ------------------------------------------------------------------------- information: http://www.pragma-ade.com/roadmap.pdf documentation: http://www.pragma-ade.com/showcase.pdf -------------------------------------------------------------------------
First of all thank you to all of you who aswered. My test command works now, so the days of stuff like \def\mymacro#1#2#3... are counted :) I still have problems changing from \xdescgetparameters to the \rawgetparameters command (I'll try to fix this later). Regards, Peter P.S.: my grep version is 2.4.2 ;)
At 15:32 27/08/2003 +0200, you wrote:
Hello all,
I have problems to understand the command (parameter) mechanism of context. My experiments with \getparameters didn't work, so I used \xdescgetparameters from Giuseppe Bilotta (t-xdesc.tex). In my eyes they look the same, but \xdescgetparameters works with my sample code, \getparameters don't. Mhhh....
% t-xdesc.tex \def\xdescsetvalue#1#2{\expandafter\def\csname#1#2\endcsname} \def\xdescgetparameters{\dogetparameters\xdescsetvalue}
% syst-gen.tex \def\dosetvalue#1#2% #3 {\@EA\def\csname#1#2\endcsname} % {#3}} \def\getparameters {\dogetparameters\dosetvalue}
This leads me to my two questions: What must I change, to make my test example run with \getparameters?
Where is the error in my \docommand? All parameters but [height] work and the tracing output at this parameter (\OTRSETshowstatus) says nothing to me.
for that purpose there is: \setvariables[namespace][key=value,...] along with the nicely expandable \getvariable{namespace}{key} that's the one i use in styles. Hans ------------------------------------------------------------------------- Hans Hagen | PRAGMA ADE | pragma@wxs.nl Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com ------------------------------------------------------------------------- information: http://www.pragma-ade.com/roadmap.pdf documentation: http://www.pragma-ade.com/showcase.pdf -------------------------------------------------------------------------
Hello Peter, I am not so sure if I can help you, but I'll give it a try. The examples are taken from my t-layout module. I wanted to have \ShowLayout[a=b,c=d] but with the possibility to say \ShowLayout without [ ]. So I define \ShowLayout as \def\ShowLayout{\dosingleempty\doShowLayout} and \doShowLayout as \def\doShowLayout[#1]{% \getparameters[ShowLayout][#1] (some not important stuff) } to access a value, just use \getvalue{ShowLayout....} where ... is your keyword. I hope I did not forget anything. Patrick -- Silent is the goldfish in its bowl
On Wed, Aug 27, 2003 at 06:55:05PM +0200, Patrick Gundlach wrote:
Hello Peter,
I am not so sure if I can help you, but I'll give it a try.
The examples are taken from my t-layout module.
I wanted to have
\ShowLayout[a=b,c=d]
but with the possibility to say \ShowLayout without [ ]. So I define \ShowLayout as
\def\ShowLayout{\dosingleempty\doShowLayout}
and \doShowLayout as
\def\doShowLayout[#1]{% \getparameters[ShowLayout][#1]
(some not important stuff)
}
to access a value, just use \getvalue{ShowLayout....} where ... is your keyword.
I hope I did not forget anything.
There is a translation step for the keywords. For example, if a user would say \ShowLayout[command=\xxx], you would have to retrieve it as \getvalue{ShowLayoutcommando} (note the Dutch translation commando). Translation is done for all keywords that are used in Context's core; language variants are mapped to a canonical value, often but not always the Dutch form of the keyword. I do not remember where to look this up; usually I just look into the trace log to find out. Regards, Simon -- Simon Pepping email: spepping@scaprea.hobby.nl home page: scaprea.hobby.nl
Hello Simon,
Simon Pepping
There is a translation step for the keywords. For example, if a user would say \ShowLayout[command=\xxx], you would have to retrieve it as
Oh, I am lucky that this did not hit me yet. Now I'll be careful. Thanks for the information. Patrick -- Silent is the goldfish in its bowl
participants (5)
-
Giuseppe Bilotta
-
Hans Hagen
-
Patrick Gundlach
-
Peter Rolf
-
Simon Pepping