$include_dir="/home/hyper-archives/boost-build/include"; include("$include_dir/msg-header.inc") ?>
From: Rene Rivera (grafik.list_at_[hidden])
Date: 2005-06-04 16:51:39
Jonathan Turkanis wrote:
> Among other thing, I realized I don't really know how to return a value from a
> Jam rule.
[...]
> I just discovered that the return statement does not seem to prevent control
> from continuing past the "if" block to the line marked "...".
[...]
> I really have no idea what's going on here.
It's simple ;-) "return 1 ;" sets the return value to the strings ["1"]
(all values Jam are string lists). When the rule finishes, by getting to
the last statement, the return value is passed back to the caller. So this:
rule x ( )
{
if $(_X_)
{
return 1 ;
}
else
{
return 2 ;
}
}
Is equivalent to... in C++:
std::vector<std::string> x()
{
std::vector<std::string> r;
if ( _X_.size() > 0 )
{
r.assign(1,"1");
}
else
{
r.assign(1,"2");
}
return r;
}
-- -- Grafik - Don't Assume Anything -- Redshift Software, Inc. - http://redshift-software.com -- rrivera/acm.org - grafik/redshift-software.com -- 102708583/icq - grafikrobot/aim - Grafik/jabber.org