Using variable modifiers problem

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Using variable modifiers problem

Boost - Build mailing list
I seem to be missing some aspect of variable modifiers. In
http://www.boost.org/build/doc/html/jam/language.html#jam.language.variables
it gives tells me that variable modifiers must be in the form of $(vm),
where v is the variable name and m is the modifier. Yet in feature.jam I
see this code:

rule values ( feature )
{
     return $($(:E=:G=$(feature)).values) ;
}

and I do not understand how it can be syntactically correct since the :E
does not follow a variable name AFAICS. Clearly I am missing how such an
expression is being parsed.

This is not a vain inquiry. I am trying to determine why some code is
failing when a call to feature.values with a particular parameter is
returning an empty result, but I cannot do so unless I understand what
is happening in the above jam code.





_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Using variable modifiers problem

Boost - Build mailing list
AMDG

On 02/19/2017 11:40 AM, Edward Diener via Boost-build wrote:

> I seem to be missing some aspect of variable modifiers. In
> http://www.boost.org/build/doc/html/jam/language.html#jam.language.variables
>
> it gives tells me that variable modifiers must be in the form of $(vm),
> where v is the variable name and m is the modifier. Yet in feature.jam I
> see this code:
>
> rule values ( feature )
> {
>     return $($(:E=:G=$(feature)).values) ;
> }
>
> and I do not understand how it can be syntactically correct since the :E
> does not follow a variable name AFAICS. Clearly I am missing how such an
> expression is being parsed.
>

The variable name in this case is the empty string.

> This is not a vain inquiry. I am trying to determine why some code is
> failing when a call to feature.values with a particular parameter is
> returning an empty result, but I cannot do so unless I understand what
> is happening in the above jam code.
>

The purpose of $(:E=:G=$(feature)) is to wrap $(feature)
with <>.

In Christ,
Steven Watanabe

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Using variable modifiers problem

Boost - Build mailing list
On 2/19/2017 1:49 PM, Steven Watanabe via Boost-build wrote:

> AMDG
>
> On 02/19/2017 11:40 AM, Edward Diener via Boost-build wrote:
>> I seem to be missing some aspect of variable modifiers. In
>> http://www.boost.org/build/doc/html/jam/language.html#jam.language.variables
>>
>> it gives tells me that variable modifiers must be in the form of $(vm),
>> where v is the variable name and m is the modifier. Yet in feature.jam I
>> see this code:
>>
>> rule values ( feature )
>> {
>>     return $($(:E=:G=$(feature)).values) ;
>> }
>>
>> and I do not understand how it can be syntactically correct since the :E
>> does not follow a variable name AFAICS. Clearly I am missing how such an
>> expression is being parsed.
>>
>
> The variable name in this case is the empty string.
>
>> This is not a vain inquiry. I am trying to determine why some code is
>> failing when a call to feature.values with a particular parameter is
>> returning an empty result, but I cannot do so unless I understand what
>> is happening in the above jam code.
>>
>
> The purpose of $(:E=:G=$(feature)) is to wrap $(feature)
> with <>.

There used to be an obscure C programming contest in DDJ. I think
obscure jam code outdoes any obscure C code easily, but thanks for the
explanation, and I was finally able to solve my particular problem. But
if you will help me further in understanding some more syntax related to
the rule above I would highly appreciate it. Let us say I pass:

<toolset-msvc:version>

to the feature.values rule. This then resolves to:

return $(<toolset-msvc:version>.values)

What is '<toolset-msvc:version>.values' and how does that get resolved ?
I know my questions seem easy to someone who understands what is
happening in jam code, but although I think I understand the language I
am still baffled by its use and trying to figure out what it is doing. I
would assume that '<toolset-msvc:version>.values' would be the name of
some variable, but I cannot find any such variable name in the Boost
Build jam files.

>
> In Christ,
> Steven Watanabe


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Using variable modifiers problem

Boost - Build mailing list
AMDG

On 02/19/2017 07:02 PM, Edward Diener via Boost-build wrote:
> <snip>Let us say I pass:
>
> <toolset-msvc:version>
>
> to the feature.values rule. This then resolves to:
>
> return $(<toolset-msvc:version>.values)
>

Yep.

> What is '<toolset-msvc:version>.values' and how does that get resolved ?
> I know my questions seem easy to someone who understands what is
> happening in jam code, but although I think I understand the language I
> am still baffled by its use and trying to figure out what it is doing. I
> would assume that '<toolset-msvc:version>.values' would be the name of
> some variable, but I cannot find any such variable name in the Boost
> Build jam files.
>

It's set in feature.extend-feature:
    $(feature).values += $(values) ;

In general
  map.$(key) = value ;
  ...
  result = $(map.$(key)) ;
is the idiomatic way to express a map in Jam.
In this case, feature.jam is using a postfix instead
of a prefix to identify the map, but it's essentially
the same.

In Christ,
Steven Watanabe

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
Loading...