Boost logo

Boost-Build :

From: Alexey Pakhunov (alexeypa_at_[hidden])
Date: 2005-09-14 14:52:33


Vladimir Prus wrote:
> What I don't understand in your patch is the "registered" state. Is that a
> state where toolset is known to Boost.Build internals but not usable by the
> user? Or is it state where toolset is already usable by the user, but maybe
> be still reconfigured?

This is the state when a toolset configuration is detected (by
autodetection code) but 'toolset.using' for this configuration wasn't
yet called.

> In class docs, your talk about "condition". Here you use "id" without saying
> what it is.

I removed the word 'condition'. It can be any kind of unique ID. Toolset
conditions one of possible options.

Other comments were added as well. The updated patch is attached.

> Everything else looks fine, but can be roughly outline the further direction?

Andrey posted quite detailed roadmap. :-) So I can add only that the
next changes will be:

> 5. new configure rule
> 6. "configure all" syntax
> 7. "version registration" framework
> 13. registry-based autodetection

Best regards/Venlig hilsen,
Alexey Pakhunov.
 --------------050609010103010708030908 Content-Type: text/plain;
name="common.jam.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="common.jam.diff"

Index: common.jam
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/v2/tools/common.jam,v
retrieving revision 1.40
diff -c -3 -r1.40 common.jam
*** common.jam 14 Sep 2005 10:01:23 -0000 1.40
--- common.jam 14 Sep 2005 19:42:59 -0000
***************
*** 18,23 ****
--- 18,126 ----
import toolset ;

+ # Configurations
+ #
+ # The following class helps to manage toolset configurations. Each configuration
+ # has unique ID and one or more parameters. A typical example of unique ID is
+ # a condition generated by 'common.check-init-parameters' rule. Other kinds of
+ # ID can be used. Parameters may include any details about the configuration like
+ # 'command', 'path', etc.
+ #
+ # A configuration may be in one of two states:
+ #
+ # - registered - a toolset configuration is registered (by autodetection code
+ # for instance) but is not used. I.e. 'toolset.using' wasn't yet been called
+ # for this configuration.
+ # - used - once called 'toolset.using' marks the configuration as 'used'.
+ #
+ # The main difference between the states is that while a configuration is
+ # 'registered' its options can be freely changed. This is useful in particular
+ # for autodetection code - all detected configurations may be safely overwritten
+ # by a user.
+
+ class configurations
+ {
+ import errors : error ;
+
+ rule __init__ ( )
+ {
+ }
+
+ # Registers a configuration.
+ #
+ # Returns 'true' if the configuration has been added and an empty value if
+ # it already exists. Reports an error if the configuration is 'used'.
+ rule register ( id )
+ {
+ if $(id) in $(self.used)
+ {
+ error "common: the configuration '$(id)' is in use" ;
+ }
+
+ local retval ;
+
+ if ! $(id) in $(self.all)
+ {
+ self.all += $(id) ;
+
+ # indicate that a new configuration has been added
+ retval = true ;
+ }
+
+ return $(retval) ;
+ }
+
+ # Mark a configuration as 'used'.
+ #
+ # Returns 'true' if the state of the configuration has been changed to
+ # 'used' and an empty value if it the state wasn't changed. Reports an error
+ # if the configuration isn't known.
+ rule use ( id )
+ {
+ if ! $(id) in $(self.all)
+ {
+ error "common: the configuration '$(id)' is not known" ;
+ }
+
+ local retval ;
+
+ if ! $(id) in $(self.used)
+ {
+ self.used += $(id) ;
+
+ # indicate that the configuration has been marked as 'used'
+ retval = true ;
+ }
+
+ return $(retval) ;
+ }
+
+ # Return all registered configurations.
+ rule all ( )
+ {
+ return $(self.all) ;
+ }
+
+ # Return all used configurations.
+ rule used ( )
+ {
+ return $(self.used) ;
+ }
+
+ # Returns the value of a configuration parameter.
+ rule get ( id : param )
+ {
+ return $(self.$(param).$(id)) ;
+ }
+
+ # Sets the value of a configuration parameter.
+ rule set ( id : param : value * )
+ {
+ self.$(param).$(id) = $(value) ;
+ }
+ }
+
+
# The rule checks toolset parameters. Each trailing parameter
# should be a pair of parameter name and parameter value.
# The rule will check that each parameter either has value in
 --------------050609010103010708030908--


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