Boost logo

Boost-Build :

From: Alexey Pakhunov (alexeypa_at_[hidden])
Date: 2005-09-13 14:24:35


Hi,

> If there are patches that requires my review, or comments, or
whatever > and block your work, just send them again

This is the patch implementing the configuration class.

Short explanation:

- The configuration class is used to keep track of toolset
configurations detected automatically or defined by a user. Typical
sequence is the following:

1. A toolset is imported;
1.1. Autodetection code is executed. It registers some configurations;
2. 'toolset.usage' (or its equivalent) is called;
2.1. If the parameters passed to 'init' define a new configuration
is is registered;
2.2. If the parameters refer to an existing configuration, already
registered configuration is used;
2.3. If the configuration is marked as used nothing happens.
2.3. Otherwise the configuration is marked as used and the rest of
initialization is performed.

Benefits of using 'configurations' class:
- Peacefully co-existing autodetection code and user-defined
configurations;
- Multiple identical 'using' are safely processed;

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

Index: common.jam
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/v2/tools/common.jam,v
retrieving revision 1.39
diff -c -3 -r1.39 common.jam
*** common.jam 6 Jun 2005 10:21:41 -0000 1.39
--- common.jam 31 Aug 2005 16:17:59 -0000
***************
*** 16,21 ****
--- 16,111 ----
import path ;
import sequence ;
import toolset ;
+ import regex ;
+
+
+ # Configurations
+ #
+ # The following class helps to manage toolset configurations. Each configuration
+ # used 'condition' as a key (for example '<toolset>msvc-8.0') and the list of
+ # options. Options may include any details about the configuration like
+ # 'command', 'path', etc. A configuration may be in one of two states:
+ #
+ # - registered - a configuration is listed but none of toolsets is using it yet;
+ # - used - a configuration is used by a toolset.
+ #
+ # 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
+ 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'
+ 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) ;
+ }
+
+ rule get ( id : param )
+ {
+ return $(self.$(param).$(id)) ;
+ }
+
+ rule set ( id : param : value * )
+ {
+ self.$(param).$(id) = $(value) ;
+ }
+ }

# The rule checks toolset parameters. Each trailing parameter
 --------------090105070105080804000803--


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