Boost logo

Boost-Build :

From: Rene Rivera (grafikrobot_at_[hidden])
Date: 2006-09-08 14:25:53


FYI... I'm only bugging you about the interface because I hate to add to
many extra builtins. The simpler that interface is the better for users.
So I'm not objecting to needing the functionality :-)

Bojan Resnik wrote:
>>>> Bojan Resnik wrote:
>>>>
>> Could this one be done by modifying the existing W32_GETREG to return
>> subkeys? ... Hm, I guess that wouldn't since registry entries always
>> have a value.
>
> W32_GETREG already allows its second argument to be omitted, in
> which case it returns the "default" value for the given key.

Yes, that's what I meant by always having a value :-)

>>>>> for local value in [ W32_REGVALUES "HKCU\\Environment" ]
>>>>> {
>>>>> ECHO $(value) ;
>>>>> }
>> Maybe it's this particular example, but that one seems problematic. Does
>> it return the "Data" part, the "Name" part, or both?
>
> Just like W32_REGKEYS, it returns the names of values. To retrieve
> data, one can use W32_GETREG with a returned name:
>
> for local value in [ W32_REGVALUES "HKCU\\Environment" ]
> {
> ECHO $(value) "=" [ W32_GETREG "HKCU\\Environment" : "$(value)" ] ;
> }
>
>> I'd think that both of the above could be covered by just adding a
>> single new rule W32_GETREG_KEYS to return the names and subkeys of the
>> given entry.
>
> Value names and subkeys are two different beasts - a registry key
> has both, so how can you know which of the returned strings is a
> subkey name and which is a value name?

Well to Windows they may be different beasts, but is there a conceptual
difference between them? That is isn't the key/name=value equivalent to
key/name/value. For example, one that intentionally has both values and
subkeys. With you functions:

appearance =
   [ W32_REGVALUES "HKCU\\Control Panel\\Appearance" ]
   [ W32_REGKEYS "HKCU\\Control Panel\\Appearance" ] ;
for a in $(appearance) {
   ECHO $(a) == [ W32_GETREG $(a) ] ;
}

Vs. a single function that returns both subkeys and value names (the
name is only illustrative):

appearance =
   [ W32_REGVALUEKEYS "HKCU\\Control Panel\\Appearance" ] ;
for a in $(appearance) {
   ECHO $(a) == [ W32_GETREG $(a) ] ;
}

So I guess I don't personally see a difference between value names and
subkeys. Is there a use case when you really need to know the difference?

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

-- 
-- 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