| # Copyright 2002, 2003, 2005 Vladimir Prus |
| # Distributed under the Boost Software License, Version 1.0. |
| # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) |
| |
| |
| import type ; |
| import generators ; |
| import "class" : new ; |
| import common ; |
| |
| type.register WHL : whl ; |
| type.register DLP : dlp ; |
| type.register WHL_LR0 : lr0 ; |
| type.register WD : wd ; |
| |
| generators.register-standard extra.whale : WHL : CPP WHL_LR0 H H(%_symbols) ; |
| generators.register-standard extra.dolphin : DLP : CPP ; |
| generators.register-standard extra.wd : WD : WHL(%_parser) DLP(%_lexer) ; |
| |
| class wd-to-cpp : generator |
| { |
| rule __init__ ( * : * : * ) |
| { |
| generator.__init__ $(1) : $(2) : $(3) ; |
| } |
| |
| rule run ( project name ? : property-set : source ) |
| { |
| local new-sources ; |
| if ! [ $(source).type ] in WHL DLP |
| { |
| local r1 = [ generators.construct $(project) $(name) |
| : WHL : $(property-set) : $(source) ] ; |
| local r2 = [ generators.construct $(project) $(name) |
| : DLP : $(property-set) : $(source) ] ; |
| |
| new-sources = [ sequence.unique $(r1[2-]) $(r2[2-]) ] ; |
| } |
| else |
| { |
| new-sources = $(source) ; |
| } |
| |
| local result ; |
| for local i in $(new-sources) |
| { |
| local t = [ generators.construct $(project) $(name) : CPP |
| : $(property-set) : $(i) ] ; |
| result += $(t[2-]) ; |
| } |
| return $(result) ; |
| } |
| } |
| generators.override extra.wd-to-cpp : extra.whale ; |
| generators.override extra.wd-to-cpp : extra.dolphin ; |
| |
| generators.register [ new wd-to-cpp extra.wd-to-cpp : : CPP ] ; |
| |
| rule whale ( targets * : sources * : properties * ) |
| { |
| } |
| |
| TOUCH = [ common.file-touch-command ] ; |
| |
| actions whale |
| { |
| echo "Whale consuming " $(>) |
| $(TOUCH) $(<[1]) |
| $(TOUCH) $(<[2]) |
| $(TOUCH) $(<[3]) |
| $(TOUCH) $(<[4]) |
| } |
| |
| rule dolphin ( targets * : source * : properties * ) |
| { |
| } |
| |
| actions dolphin |
| { |
| echo "Dolphin consuming" $(>) |
| $(TOUCH) $(<) |
| } |
| |
| rule wd ( targets * : source * : properties * ) |
| { |
| } |
| |
| actions wd |
| { |
| echo "WD consuming" $(>) |
| $(TOUCH) $(<[1]) |
| $(TOUCH) $(<[2]) |
| } |
| |
| rule x ( target * : source * : properties * ) |
| { |
| } |
| |
| |
| actions x |
| { |
| echo "X: source is " $(>) |
| $(TOUCH) $(<[1]) |
| } |
| |
| rule x_pro ( target * : source * : properties * ) |
| { |
| } |
| |
| |
| actions x_pro |
| { |
| echo "X_PRO: source is " $(>) |
| $(TOUCH) $(<[1]) |
| $(TOUCH) $(<[2]) |
| } |
| |
| |
| |
| |