ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* parameter mechanism
@ 2003-08-27 13:32 Peter Rolf
  2003-08-27 14:56 ` Giuseppe Bilotta
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Peter Rolf @ 2003-08-27 13:32 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 925 bytes --]

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

[-- Attachment #2: Cmd.tex --]
[-- Type: application/x-tex, Size: 1373 bytes --]

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

* Re: parameter mechanism
  2003-08-27 13:32 parameter mechanism Peter Rolf
@ 2003-08-27 14:56 ` Giuseppe Bilotta
  2003-08-27 16:53   ` Hans Hagen
  2003-08-27 16:54 ` Hans Hagen
  2003-08-27 16:55 ` Patrick Gundlach
  2 siblings, 1 reply; 11+ messages in thread
From: Giuseppe Bilotta @ 2003-08-27 14:56 UTC (permalink / raw)


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

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

* Re: parameter mechanism
  2003-08-27 14:56 ` Giuseppe Bilotta
@ 2003-08-27 16:53   ` Hans Hagen
  2003-08-27 17:03     ` Re[2]: " Giuseppe Bilotta
  0 siblings, 1 reply; 11+ messages in thread
From: Hans Hagen @ 2003-08-27 16:53 UTC (permalink / raw)


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
-------------------------------------------------------------------------

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

* Re: parameter mechanism
  2003-08-27 13:32 parameter mechanism Peter Rolf
  2003-08-27 14:56 ` Giuseppe Bilotta
@ 2003-08-27 16:54 ` Hans Hagen
  2003-08-27 16:55 ` Patrick Gundlach
  2 siblings, 0 replies; 11+ messages in thread
From: Hans Hagen @ 2003-08-27 16:54 UTC (permalink / raw)


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
-------------------------------------------------------------------------

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

* Re: parameter mechanism
  2003-08-27 13:32 parameter mechanism Peter Rolf
  2003-08-27 14:56 ` Giuseppe Bilotta
  2003-08-27 16:54 ` Hans Hagen
@ 2003-08-27 16:55 ` Patrick Gundlach
  2003-08-27 19:18   ` Simon Pepping
  2 siblings, 1 reply; 11+ messages in thread
From: Patrick Gundlach @ 2003-08-27 16:55 UTC (permalink / raw)


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

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

* Re[2]: parameter mechanism
  2003-08-27 16:53   ` Hans Hagen
@ 2003-08-27 17:03     ` Giuseppe Bilotta
  2003-08-27 17:22       ` Re[3]: " Giuseppe Bilotta
  0 siblings, 1 reply; 11+ messages in thread
From: Giuseppe Bilotta @ 2003-08-27 17:03 UTC (permalink / raw)


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

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

* Re[3]: parameter mechanism
  2003-08-27 17:03     ` Re[2]: " Giuseppe Bilotta
@ 2003-08-27 17:22       ` Giuseppe Bilotta
  2003-08-28  8:38         ` Hans Hagen
  0 siblings, 1 reply; 11+ messages in thread
From: Giuseppe Bilotta @ 2003-08-27 17:22 UTC (permalink / raw)


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

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

* Re: Re: parameter mechanism
  2003-08-27 16:55 ` Patrick Gundlach
@ 2003-08-27 19:18   ` Simon Pepping
  2003-08-27 20:33     ` Patrick Gundlach
  0 siblings, 1 reply; 11+ messages in thread
From: Simon Pepping @ 2003-08-27 19:18 UTC (permalink / raw)


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

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

* Re: parameter mechanism
  2003-08-27 19:18   ` Simon Pepping
@ 2003-08-27 20:33     ` Patrick Gundlach
  0 siblings, 0 replies; 11+ messages in thread
From: Patrick Gundlach @ 2003-08-27 20:33 UTC (permalink / raw)


Hello Simon,

Simon Pepping <spepping@scaprea.hobby.nl> writes:

> 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

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

* Re[3]: parameter mechanism
  2003-08-27 17:22       ` Re[3]: " Giuseppe Bilotta
@ 2003-08-28  8:38         ` Hans Hagen
  2003-08-28 10:49           ` Peter Rolf
  0 siblings, 1 reply; 11+ messages in thread
From: Hans Hagen @ 2003-08-28  8:38 UTC (permalink / raw)


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
-------------------------------------------------------------------------

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

* Re: parameter mechanism
  2003-08-28  8:38         ` Hans Hagen
@ 2003-08-28 10:49           ` Peter Rolf
  0 siblings, 0 replies; 11+ messages in thread
From: Peter Rolf @ 2003-08-28 10:49 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 316 bytes --]

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 ;)


[-- Attachment #2: Cmd.tex --]
[-- Type: application/x-tex, Size: 1234 bytes --]

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

end of thread, other threads:[~2003-08-28 10:49 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-27 13:32 parameter mechanism Peter Rolf
2003-08-27 14:56 ` Giuseppe Bilotta
2003-08-27 16:53   ` Hans Hagen
2003-08-27 17:03     ` Re[2]: " Giuseppe Bilotta
2003-08-27 17:22       ` Re[3]: " Giuseppe Bilotta
2003-08-28  8:38         ` Hans Hagen
2003-08-28 10:49           ` Peter Rolf
2003-08-27 16:54 ` Hans Hagen
2003-08-27 16:55 ` Patrick Gundlach
2003-08-27 19:18   ` Simon Pepping
2003-08-27 20:33     ` Patrick Gundlach

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).