[jamming] syntax rule rulename : vars - is it working ?

Ingo Weinhold bonefish at cs.tu-berlin.de
Fri Dec 29 16:20:38 PST 2006


On 2006-12-29 at 21:03:24 [+0100], Mildred <ml.mildred593 at online.fr> wrote:
> Somewhere, the manual (Jam.html) says
> 
> > rule rulename [ : vars ] { statements }
> > 
> >     Define a rule's procedure, replacing any previous definition. If
> >     vars are provided, they are assigned the values of the parameters
> >     ($(1) to $(9)) when statements are executed, as with the local
> >     statement.
> 
> Just a question. Is it supposed to work ?
> I tried but it does not.
> 
> My code :
> 
>     rule VarFile : basename { # line 103
>         Echo $(basename) ;
>     }

I'm absolutely stunned. I've used jam for quite a while and have never 
realized there's a parameter naming feature. According to the grammar 
(jamgram.yy) the colon only separates the parameter names, but there's none 
between the rule name and the first parameter name.

Just tested:
-----
Jamfile:

rule Test a : b : c {
	Echo a: $(a) ;
	Echo b: $(b) ;
	Echo c: $(c) ;
}

Test Wow, we have : named : parameters! ;


-----
Shell:

$ jam
a: Wow, we have
b: named
c: parameters!
...found 7 target(s)...


CU, Ingo


More information about the jamming mailing list