Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2005-05-26 03:33:59


On Thursday 26 May 2005 12:22, Malcolm Cifuentes wrote:
> Hi All,
> if I echo $(var) and receive this:
> object(file-target)@3
>
> I think it means I have 3 x file-target objects, is this correct?

It means there three instances of file-target class were created, and your var
is the name of the third instance.

> Is there any way I can iterate over each element/object?

Element of what? What are you trying to accomplish?

> I have tried a 'for in loop' which doesn't appear to work.
>
> for local t in $(var)
> {
> echo "hi" ;
> }
>
> I was hoping to see "hi" displayed times.

$(var) is a name of a single instance -- it's basically a list of lenth 1.

> given $(var).length returns 1 I am starting to think I've got it
> wrong:)

What's $(var).length ? I don't think file-target class has any method by that
name.

> [ $(var).str ] iterates over all 3 but I'm clueless if I can repeat
> how it does it.

The 'str' of file-target method prints the sources of the target, if any, and
does this with this code:

local action = [ action ] ;
if $(action)
{
local sources = [ $(action).sources ] ;

for local s in $(sources)
{
......

If you want to iterate over source, that's how to do it. If you want something
else, what's that? I don't understand why you'd want to iterate over all
instances of file-target ever created.

- Volodya

-- 
Vladimir Prus
http://vladimir_prus.blogspot.com
Boost.Build V2: http://boost.org/boost-build2
 

Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk