List Info

Thread: template processing ruleset for generating variable file types




template processing ruleset for generating variable file types
user name
2006-07-25 06:39:57
On Monday 24 July 2006 14:30, Klaus Nowikow wrote:

> type.register RCTPL : rc_t ;
> type.register CPPTPL : cpp_t ;
>
> generators.register-standard template.rc : RCTPL : RC ;
> generators.register-standard template.cpp : CPPTPL :
CPP ;
...
> rule template.rc ( target : sources * : properties * )
> {
>      process-template $(target) : $(sources[1]) ;
> }
>
> rule template.cpp ( target : sources * : properties * )
> {
>      process-template $(target) : $(sources[1]) ;
> }
>
> actions process-template
> {
>      python template.py -i$(>:W) -o$(<:W)
-I"$(INCLUDES:W)"
> "$(SUBSTITUTES)" }
> </code>
>
......
> I searched through the sources a bit and found that
"rule register" in
> generators.jam adds the new generator to a list of
generators for the
> respective target types ( <code>
> for local t in [ sequence.unique [ $(g).target-types ]
]
> {
>      .generators.$(t) += $(g) ;
> }
> </code>), which is then used to determine the
correct generator for a given
> source/target type pair. And this implies that the
source/target type pair
> must be known when register is called.
> So I don't think that would be easily doable. Or is
it?

Hi Klaus,
it is right that each instance of 'generator' class (or a
derived type), has a 
certain set of target type, and that set is queried in the
code above.
On the other hand, that's generator instance, and it's
possible to make two 
generator instances use one 'action'. Something like that
should work:

  generators.register-standard template.process-template :
RCTPL : RC ;
  generators.register-standard template.process-template :
CPPTPL : CPP ;

 actions process-template
 {
      python template.py -i$(>:W) -o$(<:W)
-I"$(INCLUDES:W)"
      "$(SUBSTITUTES)" 
 }

I have not tested this, so report any issues you run into.

- Volodya

-- 
Vladimir Prus
http://vladimir_pru
s.blogspot.com
Boost.Build V2: http://boost.org/boost-
build2
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
template processing ruleset for generating variable file types
user name
2006-07-25 07:31:50
Hi Volodya,

Vladimir Prus wrote:
> On Monday 24 July 2006 14:30, Klaus Nowikow wrote:
[..]
> 
>   generators.register-standard
template.process-template : RCTPL : RC ;
>   generators.register-standard
template.process-template : CPPTPL : CPP ;
> 
>  actions process-template
>  {
>       python template.py -i$(>:W) -o$(<:W)
-I"$(INCLUDES:W)"
>       "$(SUBSTITUTES)" 
>  }
> 
> I have not tested this, so report any issues you run
into.

This makes adding a new instance of source->target
transformation
much easier, I just have to add another line
"generators.register-standard ..." to the code.
I just tried it, and it works - no problems. I only replaced
"-i$(>:W)" with "-i$(>[1]:W)",
but that has nothing to do with
the solution itself.

Thank you,

Klaus

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )