Boost logo

Boost-Build :

From: Rene Rivera (grafikrobot_at_[hidden])
Date: 2006-09-08 16:39:19


Bojan Resnik wrote:
>> appearance =
>> [ W32_REGVALUES "HKCU\\Control Panel\\Appearance" ]
>> [ W32_REGKEYS "HKCU\\Control Panel\\Appearance" ] ;
>> for a in $(appearance) {
>> ECHO $(a) == [ W32_GETREG $(a) ] ;
>
> Should be:
> ECHO $(a) == [ W32_GETREG "HKCU\\Control Panel\\Appearance" : $(a) ] ;

Oops :-\

>> }
>
> In the above example, what would
> [ W32_GETREG "HKCU\\Control Panel\\Appearance" : "x" ]
> return: data contained in value "x" of HKCU\Control Panel\Appearance
> registry key, or the default value of HKCU\Control Panel\Appearance\x
> key?
> As Phillip mentioned, a registry key can have a subkey and a value
> with the same name. For this reason, they need to be separated
> somehow.

Yea, I was unaware that was a possibility. Hand it to Microsoft to make
confusing interfaces ;-) So I guess a coalescing of the two results is
not possible.

>> That said... I'm not against having three different types of results
>> made available, i.e. values, value names, and subkeys. But if it's
>> really needed I'd rather have a single builtin rule that handles all
>> those case. For example like I did the SHELL rule. In this case I'd prefer:
>>
>> rule W32_GETREG ( path : default ? : result-type ? )
>> # result-type = <empty> | keys | value-names
>
> In this case, the "result-type" and "default" parameters are
> mutually exclusive and using the rule could become more complex:
> W32_GETREG "HKCU\\Environment" : keys
> would return the data contained in the value "keys" of registry key
> "HKCU\Environment" while
> W32_GETREG "HKCU\\Environment" : : keys
> would return list of subkeys of that element. On the other hand, something like
> W32_GETREG "HKCU\\Environment" : a : keys
> would be an error

OK, the other alternative for that style of interface is to put the
result-type as part of the first arg:

rule W32_GETREG ( path result-type ? : data ? )

I think that cleans up all those use case...

[ W32_GETREG "HKCU\\Environment" : keys ]
[ W32_GETREG "HKCU\\Environment" keys ]
[ W32_GETREG "HKCU\\Environment" keys : a ]

But I can see that's still a bit confusing.

> How about a rule like:
> W32_GETREGNAMES ( path : result-type )
> # result-type = subkeys | values
>
> which adds only one new builtin?

Sure, that seems clear enough. Note, I'll also need a documentation
patch ;-)

-- 
-- Grafik - Don't Assume Anything
-- Redshift Software, Inc. - http://redshift-software.com
-- rrivera/acm.org - grafik/redshift-software.com
-- 102708583/icq - grafikrobot/aim - grafikrobot/yahoo

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