Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r79620 - in trunk/tools/build/v2: build engine kernel test/generators-test
From: jurko.gospodnetic_at_[hidden]
Date: 2012-07-20 10:20:57


Author: jurko
Date: 2012-07-20 10:20:55 EDT (Fri, 20 Jul 2012)
New Revision: 79620
URL: http://svn.boost.org/trac/boost/changeset/79620

Log:
Boost Jam/Build code cleanup - minor stylistic changes.
Text files modified:
   trunk/tools/build/v2/build/generators.jam | 68 ++++++++++----------
   trunk/tools/build/v2/build/project.jam | 42 +++++++-----
   trunk/tools/build/v2/engine/builtins.c | 11 +-
   trunk/tools/build/v2/engine/modules.c | 81 +++++++++++-------------
   trunk/tools/build/v2/engine/modules.h | 23 +++---
   trunk/tools/build/v2/engine/subst.c | 132 ++++++++++++++++++++-------------------
   trunk/tools/build/v2/kernel/errors.jam | 26 ++++---
   trunk/tools/build/v2/kernel/modules.jam | 19 +++--
   trunk/tools/build/v2/test/generators-test/jamroot.jam | 2
   9 files changed, 207 insertions(+), 197 deletions(-)

Modified: trunk/tools/build/v2/build/generators.jam
==============================================================================
--- trunk/tools/build/v2/build/generators.jam (original)
+++ trunk/tools/build/v2/build/generators.jam 2012-07-20 10:20:55 EDT (Fri, 20 Jul 2012)
@@ -44,7 +44,6 @@
 # converting between given target types.
 
 import "class" : new ;
-import errors ;
 import property-set ;
 import sequence ;
 import set ;
@@ -162,17 +161,16 @@
 #
 class generator
 {
+ import "class" : new ;
+ import feature ;
     import generators : indent increase-indent decrease-indent generators.dout ;
- import set ;
     import utility ;
- import feature ;
- import errors ;
+ import path ;
+ import property ;
     import sequence ;
+ import set ;
     import type ;
     import virtual-target ;
- import "class" : new ;
- import property ;
- import path ;
 
     EXPORT class_at_generator : indent increase-indent decrease-indent
         generators.dout ;
@@ -262,17 +260,17 @@
     {
         return $(self.requirements) ;
     }
-
+
     rule set-rule-name ( rule-name )
     {
         self.rule-name = $(rule-name) ;
     }
-
+
     rule rule-name ( )
     {
         return $(self.rule-name) ;
     }
-
+
     # Returns a true value if the generator can be run with the specified
     # properties.
     #
@@ -319,7 +317,7 @@
             # Note: this does not remove any subfeatures of <toolset> which
             # might cause problems.
             [ property.change $(self.requirements) : <toolset> ]
- $(new-toolset-properties) ] ;
+ $(new-toolset-properties) ] ;
         return $(g) ;
     }
 
@@ -346,10 +344,10 @@
         local g = [ new $(__class__) $(self.id) $(self.composing) :
             $(self.source-types) : $(target-types) : $(self.requirements) ] ;
         if $(self.rule-name)
- {
+ {
             $(g).set-rule-name $(self.rule-name) ;
- }
- return $(g) ;
+ }
+ return $(g) ;
     }
 
     # Tries to invoke this generator on the given sources. Returns a list of
@@ -372,6 +370,7 @@
 
         if ! $(self.composing) && $(sources[2]) && $(self.source-types[2])
         {
+ import errors : error : errors.error ;
             errors.error "Unsupported source/source-type combination" ;
         }
 
@@ -471,23 +470,22 @@
     rule determine-target-name ( fullname : prefix ? : postfix ? )
     {
         # See if we need to add directory to the target name.
- local dir = $(fullname:D) ;
- local name = $(fullname:B) ;
-
+ local dir = $(fullname:D) ;
+ local name = $(fullname:B) ;
+
         name = $(prefix:E=)$(name) ;
         name = $(name)$(postfix:E=) ;
 
- if $(dir) &&
- # Never append '..' to target path.
- ! [ MATCH .*(\\.\\.).* : $(dir) ]
- &&
- ! [ path.is-rooted $(dir) ]
- {
- # Relative path is always relative to the source
- # directory. Retain it, so that users can have files
- # with the same name in two different subdirectories.
- name = $(dir)/$(name) ;
- }
+ if $(dir)
+ # Never append '..' to target path.
+ && ! [ MATCH .*(\\.\\.).* : $(dir) ]
+ && ! [ path.is-rooted $(dir) ]
+ {
+ # Relative path is always relative to the source directory. Retain
+ # it, so that users can have files with the same name in two
+ # different subdirectories.
+ name = $(dir)/$(name) ;
+ }
         return $(name) ;
     }
 
@@ -510,6 +508,7 @@
             local n2 = [ utility.basename [ $(s).name ] ] ;
             if $(n2) != $(name)
             {
+ import errors : error : errors.error ;
                 errors.error "$(self.id): source targets have different names: cannot determine target name" ;
             }
         }
@@ -697,7 +696,7 @@
 rule register ( g )
 {
     .all-generators += $(g) ;
-
+
     # A generator can produce several targets of the same type. We want unique
     # occurrence of that generator in .generators.$(t) in that case, otherwise,
     # it will be tried twice and we will get a false ambiguity.
@@ -1082,6 +1081,7 @@
     {
         if ! [ $(t).type ]
         {
+ import errors ;
             errors.error "target" [ $(t).str ] "has no type" ;
         }
     }
@@ -1194,7 +1194,7 @@
         else
         {
             generators.dout [ indent ] " generator " [ $(g).id ] "is active, discaring" ;
- }
+ }
     }
 
     # Generators which override 'all'.
@@ -1313,7 +1313,7 @@
         saved-active = $(.active-generators) ;
         .active-generators = ;
     }
-
+
     if (.construct-stack)
     {
         ensure-type $(sources) ;
@@ -1340,7 +1340,7 @@
     decrease-indent ;
 
     .construct-stack = $(.construct-stack[2-]) ;
-
+
     if $(top-level)
     {
         .active-generators = $(saved-active) ;
@@ -1374,7 +1374,7 @@
 {
     for local g in $(.all-generators)
     {
- ECHO [ $(g).id ] ":" [ $(g).source-types ] -> [ $(g).target-types ] ;
- }
+ ECHO [ $(g).id ] ":" [ $(g).source-types ] -> [ $(g).target-types ] ;
+ }
 }
 

Modified: trunk/tools/build/v2/build/project.jam
==============================================================================
--- trunk/tools/build/v2/build/project.jam (original)
+++ trunk/tools/build/v2/build/project.jam 2012-07-20 10:20:55 EDT (Fri, 20 Jul 2012)
@@ -35,7 +35,6 @@
 # their project id.
 
 import "class" : new ;
-import errors ;
 import modules ;
 import path ;
 import print ;
@@ -124,6 +123,7 @@
 {
     if [ module-name $(location) ] in $(.jamfile-modules)
     {
+ import errors ;
         errors.error "Jamfile was already loaded for '$(location)'" ;
     }
     # Set up non-default mapping from location to module.
@@ -207,8 +207,8 @@
 # directory given in it.
 #
 rule find-jamfile (
- dir # The directory(s) to look for a Jamfile.
- parent-root ? # Optional flag indicating to search for the parent Jamfile.
+ dir # The directory(s) to look for a Jamfile.
+ parent-root ? # Optional flag indicating to search for the parent Jamfile.
     : no-errors ?
     )
 {
@@ -261,6 +261,7 @@
     #
     if ! $(no-errors) && ! $(jamfile-to-load)
     {
+ import errors ;
         errors.error Unable to load Jamfile.
             : Could not find a Jamfile in directory '$(dir)'.
             : Attempted to find it with pattern '$(JAMFILE:J=" ")'.
@@ -290,8 +291,9 @@
 
     if $(jamfile-to-load[2])
     {
- errors.error "Multiple Jamfiles found at '$(dir)'"
- : "Filenames are: " $(jamfile-to-load:D=) ;
+ import errors ;
+ errors.error "Multiple Jamfiles found at '$(dir)'" :
+ "Filenames are: " $(jamfile-to-load:D=) ;
     }
 
     # Now load the Jamfile in it's own context.
@@ -327,12 +329,14 @@
             # Now do some checks.
             if $(.current-project) != $(saved-project)
             {
- errors.error "The value of the .current-project variable has magically"
- : "changed after loading a Jamfile. This means some of the targets"
- : "might be defined in the wrong project."
- : "after loading" $(jamfile-module)
- : "expected value" $(saved-project)
- : "actual value" $(.current-project) ;
+ import errors ;
+ errors.error
+ The value of the .current-project variable has magically
+ : changed after loading a Jamfile. This means some of the
+ : targets might be defined in the wrong project.
+ : after loading $(jamfile-module)
+ : expected value $(saved-project)
+ : actual value $(.current-project) ;
             }
 
             if $(.global-build-dir)
@@ -479,6 +483,7 @@
             local s = [ modules.binding $(module-name) ] ;
             if ! $(s)
             {
+ import errors ;
                 errors.error "Could not determine project location $(module-name)" ;
             }
             $(attributes).set source-location : $(s:D) : exact ;
@@ -584,7 +589,6 @@
 {
     import property ;
     import property-set ;
- import errors ;
     import path ;
     import print ;
     import sequence ;
@@ -615,13 +619,12 @@
 
             if $(result[1]) = "@error"
             {
+ import errors : error : errors.error ;
                 errors.error Requirements for project at '$(self.location)'
                     conflict with parent's. : Explanation: $(result[2-]) ;
             }
- else
- {
- self.requirements = $(result) ;
- }
+
+ self.requirements = $(result) ;
         }
         else if $(attribute) = "usage-requirements"
         {
@@ -636,6 +639,7 @@
             local non-free = [ property.remove free : $(unconditional) ] ;
             if $(non-free)
             {
+ import errors : error : errors.error ;
                 errors.error usage-requirements $(specification) have non-free
                     properties $(non-free) ;
             }
@@ -678,6 +682,7 @@
         else if ! $(attribute) in "default-build" "location" "parent"
             "projects-to-build" "project-root" "source-location"
         {
+ import errors : error : errors.error ;
             errors.error Invalid project attribute '$(attribute)' specified for
                 project at '$(self.location)' ;
         }
@@ -783,6 +788,7 @@
         if $($(id).jamfile-module) && ( $($(id).jamfile-module) !=
             $(project-module) )
         {
+ import errors ;
             errors.user-error Attempt to redeclare already existing project id
                 '$(id)'
                 location '$(location)' ;
@@ -921,7 +927,6 @@
 
     rule project ( id ? : options * : * )
     {
- import errors ;
         import path ;
         import project ;
 
@@ -969,6 +974,7 @@
                     if $(explicit-build-dir) &&
                         [ path.is-rooted $(explicit-build-dir) ]
                     {
+ import errors ;
                         errors.user-error Absolute directory specified via
                             'build-dir' project attribute : Do not know how to
                             combine that with the --build-dir option. ;
@@ -986,6 +992,7 @@
                 # Not Jamroot.
                 if $(explicit-build-dir)
                 {
+ import errors ;
                     errors.user-error When --build-dir is specified, the
                         'build-dir' project : attribute is allowed only for
                         top-level 'project' invocations ;
@@ -1080,6 +1087,7 @@
 
         if $(wildcards:D) || $(excludes:D)
         {
+ import errors ;
             errors.user-error The patterns to 'glob-tree' may not include
                 directory ;
         }

Modified: trunk/tools/build/v2/engine/builtins.c
==============================================================================
--- trunk/tools/build/v2/engine/builtins.c (original)
+++ trunk/tools/build/v2/engine/builtins.c 2012-07-20 10:20:55 EDT (Fri, 20 Jul 2012)
@@ -247,7 +247,6 @@
                        builtin_rulenames, 0, args );
     }
 
-
     {
         char const * args[] = { "module", "?", 0 };
         bind_builtin( "VARNAMES",
@@ -1473,11 +1472,11 @@
 
 LIST * builtin_import_module( FRAME * frame, int flags )
 {
- LIST * arg1 = lol_get( frame->args, 0 );
- LIST * arg2 = lol_get( frame->args, 1 );
- module_t * m = !list_empty( arg2 )
- ? bindmodule( list_front( arg2 ) )
- : root_module();
+ LIST * const arg1 = lol_get( frame->args, 0 );
+ LIST * const arg2 = lol_get( frame->args, 1 );
+ module_t * const m = list_empty( arg2 )
+ ? root_module()
+ : bindmodule( list_front( arg2 ) );
     import_module( arg1, m );
     return L0;
 }

Modified: trunk/tools/build/v2/engine/modules.c
==============================================================================
--- trunk/tools/build/v2/engine/modules.c (original)
+++ trunk/tools/build/v2/engine/modules.c 2012-07-20 10:20:55 EDT (Fri, 20 Jul 2012)
@@ -4,30 +4,29 @@
  * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  */
 #include "jam.h"
-
 #include "modules.h"
-#include "string.h"
+
 #include "hash.h"
-#include "object.h"
 #include "lists.h"
+#include "native.h"
+#include "object.h"
 #include "parse.h"
 #include "rules.h"
-#include "variable.h"
 #include "strings.h"
-#include "native.h"
+#include "variable.h"
+
 #include <assert.h>
+#include <string.h>
 
 static struct hash * module_hash = 0;
 static module_t root;
 
+
 module_t * bindmodule( OBJECT * name )
 {
-
     if ( !name )
- {
         return &root;
- }
- else
+
     {
         PROFILE_ENTER( BINDMODULE );
 
@@ -58,6 +57,7 @@
     }
 }
 
+
 /*
  * demand_rules() - Get the module's "rules" hash on demand.
  */
@@ -93,6 +93,7 @@
     object_free( *(OBJECT * *)xmodule_name );
 }
 
+
 static void free_fixed_variable( void * xvar, void * data );
 
 void delete_module( module_t * m )
@@ -258,7 +259,7 @@
         hashenumerate( class_hash, print_class_stats, (void *)0 );
         hash_free( class_hash );
     }
- hashenumerate( module_hash, delete_module_, (void *)0 );
+ hashenumerate( module_hash, delete_module_, (void *)0 );
     hashdone( module_hash );
     module_hash = 0;
     delete_module( &root );
@@ -275,22 +276,23 @@
     PROFILE_ENTER( IMPORT_MODULE );
 
     struct hash * h;
- LISTITER iter, end;
+ LISTITER iter;
+ LISTITER end;
 
     if ( !target_module->imported_modules )
- target_module->imported_modules = hashinit( sizeof( char * ), "imported" );
+ target_module->imported_modules = hashinit( sizeof( char * ), "imported"
+ );
     h = target_module->imported_modules;
 
- iter = list_begin( module_names ), end = list_end( module_names );
+ iter = list_begin( module_names );
+ end = list_end( module_names );
     for ( ; iter != end; iter = list_next( iter ) )
     {
         int found;
- OBJECT * s = list_item( iter );
- OBJECT * * ss = (OBJECT * *)hash_insert( h, s, &found );
- if( !found )
- {
+ OBJECT * const s = list_item( iter );
+ OBJECT * * const ss = (OBJECT * *)hash_insert( h, s, &found );
+ if ( !found )
             *ss = object_copy( s );
- }
     }
 
     PROFILE_EXIT( IMPORT_MODULE );
@@ -299,9 +301,8 @@
 
 static void add_module_name( void * r_, void * result_ )
 {
- OBJECT * * r = (OBJECT * *)r_;
- LIST * * result = (LIST * *)result_;
-
+ OBJECT * * const r = (OBJECT * *)r_;
+ LIST * * const result = (LIST * *)result_;
     *result = list_push_back( *result, object_copy( *r ) );
 }
 
@@ -315,8 +316,8 @@
 }
 
 
-FUNCTION * function_bind_variables( FUNCTION * f, module_t * module, int * counter );
-FUNCTION * function_unbind_variables( FUNCTION * f );
+FUNCTION * function_bind_variables( FUNCTION *, module_t *, int * counter );
+FUNCTION * function_unbind_variables( FUNCTION * );
 
 struct fixed_variable
 {
@@ -330,19 +331,23 @@
     int counter;
 };
 
+
 static void free_fixed_variable( void * xvar, void * data )
 {
     object_free( ( (struct fixed_variable *)xvar )->key );
 }
 
+
 static void bind_variables_for_rule( void * xrule, void * xdata )
 {
     RULE * rule = (RULE *)xrule;
     struct bind_vars_t * data = (struct bind_vars_t *)xdata;
     if ( rule->procedure && rule->module == data->module )
- rule->procedure = function_bind_variables( rule->procedure, data->module, &data->counter );
+ rule->procedure = function_bind_variables( rule->procedure,
+ data->module, &data->counter );
 }
 
+
 void module_bind_variables( struct module_t * m )
 {
     if ( m != root_module() && m->rules )
@@ -355,6 +360,7 @@
     }
 }
 
+
 int module_add_fixed_var( struct module_t * m, OBJECT * name, int * counter )
 {
     struct fixed_variable * v;
@@ -375,6 +381,7 @@
     return v->n;
 }
 
+
 LIST * var_get_and_clear_raw( module_t * m, OBJECT * name );
 
 static void load_fixed_variable( void * xvar, void * data )
@@ -382,11 +389,10 @@
     struct fixed_variable * var = (struct fixed_variable *)xvar;
     struct module_t * m = (struct module_t *)data;
     if ( var->n >= m->num_fixed_variables )
- {
         m->fixed_variables[ var->n ] = var_get_and_clear_raw( m, var->key );
- }
 }
 
+
 void module_set_fixed_variables( struct module_t * m, int n_variables )
 {
     /* Reallocate */
@@ -398,39 +404,26 @@
         BJAM_FREE( m->fixed_variables );
     }
     m->fixed_variables = fixed_variables;
- if ( m->class_module )
- {
- variable_indices = m->class_module->variable_indices;
- }
- else
- {
- variable_indices = m->variable_indices;
- }
+ variable_indices = m->class_module
+ ? m->class_module->variable_indices
+ : m->variable_indices;
     if ( variable_indices )
         hashenumerate( variable_indices, &load_fixed_variable, m );
     m->num_fixed_variables = n_variables;
 }
 
+
 int module_get_fixed_var( struct module_t * m_, OBJECT * name )
 {
     struct fixed_variable * v;
     struct module_t * m = m_;
 
     if ( m->class_module )
- {
         m = m->class_module;
- }
 
     if ( !m->variable_indices )
         return -1;
 
     v = (struct fixed_variable *)hash_find( m->variable_indices, name );
- if ( v && v->n < m_->num_fixed_variables )
- {
- return v->n;
- }
- else
- {
- return -1;
- }
+ return v && v->n < m_->num_fixed_variables ? v->n : -1;
 }

Modified: trunk/tools/build/v2/engine/modules.h
==============================================================================
--- trunk/tools/build/v2/engine/modules.h (original)
+++ trunk/tools/build/v2/engine/modules.h 2012-07-20 10:20:55 EDT (Fri, 20 Jul 2012)
@@ -4,10 +4,12 @@
  * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  */
 #ifndef MODULES_DWA10182001_H
-# define MODULES_DWA10182001_H
+#define MODULES_DWA10182001_H
 
 #include "lists.h"
+#include "object.h"
 
+typedef struct module_t module_t ;
 struct module_t
 {
     OBJECT * name;
@@ -17,37 +19,34 @@
     int num_fixed_variables;
     LIST * * fixed_variables;
     struct hash * imported_modules;
- struct module_t * class_module;
+ module_t * class_module;
     struct hash * native_rules;
     int user_module;
 };
 
-typedef struct module_t module_t ; /* MSVC debugger gets confused unless this is provided */
-
 module_t * bindmodule( OBJECT * name );
 module_t * root_module();
 void delete_module( module_t * );
 
 void import_module( LIST * module_names, module_t * target_module );
-LIST* imported_modules(module_t* module);
+LIST * imported_modules( module_t * );
 
 struct hash * demand_rules( module_t * );
 
-void module_bind_variables( struct module_t * m );
+void module_bind_variables( module_t * );
 
 /*
- * After calling module_add_fixed_var, module_set_fixed_variables
- * must be called before accessing any variables in the module.
+ * After calling module_add_fixed_var, module_set_fixed_variables must be called
+ * before accessing any variables in the module.
  */
-int module_add_fixed_var( struct module_t * m, OBJECT * name, int * n );
-void module_set_fixed_variables( struct module_t * m, int n );
+int module_add_fixed_var( module_t *, OBJECT * name, int * n );
+void module_set_fixed_variables( module_t *, int n );
 
 /*
  * Returns the index of the variable or -1 if none exists.
  */
-int module_get_fixed_var( struct module_t * m, OBJECT * name );
+int module_get_fixed_var( module_t *, OBJECT * name );
 
 void modules_done();
 
 #endif
-

Modified: trunk/tools/build/v2/engine/subst.c
==============================================================================
--- trunk/tools/build/v2/engine/subst.c (original)
+++ trunk/tools/build/v2/engine/subst.c 2012-07-20 10:20:55 EDT (Fri, 20 Jul 2012)
@@ -1,97 +1,103 @@
-#include <stddef.h>
 #include "jam.h"
-#include "regexp.h"
-#include "hash.h"
 
-#include "object.h"
-#include "lists.h"
+#include "builtins.h"
 #include "compile.h"
 #include "frames.h"
-#include "builtins.h"
+#include "hash.h"
+#include "lists.h"
+#include "object.h"
+#include "regexp.h"
+
+#include <stddef.h>
+
 
 struct regex_entry
 {
- OBJECT* pattern;
- regexp* regex;
+ OBJECT * pattern;
+ regexp * regex;
 };
 typedef struct regex_entry regex_entry;
 
-static struct hash* regex_hash;
+static struct hash * regex_hash;
+
 
-regexp* regex_compile( OBJECT* pattern )
+regexp * regex_compile( OBJECT * pattern )
 {
     int found;
     regex_entry * e ;
 
     if ( !regex_hash )
- regex_hash = hashinit(sizeof(regex_entry), "regex");
+ regex_hash = hashinit( sizeof( regex_entry ), "regex" );
 
     e = (regex_entry *)hash_insert( regex_hash, pattern, &found );
     if ( !found )
     {
         e->pattern = object_copy( pattern );
- e->regex = regcomp( (char*)pattern );
+ e->regex = regcomp( (char *)pattern );
     }
 
     return e->regex;
 }
 
+
 LIST * builtin_subst( FRAME * frame, int flags )
 {
- LIST* result = L0;
- LIST* arg1 = lol_get( frame->args, 0 );
- LISTITER iter = list_begin( arg1 ), end = list_end( arg1 );
-
- if ( iter != end && list_next( iter ) != end && list_next( list_next( iter ) ) != end )
- {
-
- const char* source = object_str( list_item( iter ) );
- OBJECT * pattern = list_item( list_next( iter ) );
- regexp* repat = regex_compile( pattern );
-
- if ( regexec( repat, (char*)source) )
- {
- LISTITER subst = list_next( iter );
-
- while ( ( subst = list_next( subst ) ) != end )
- {
-# define BUFLEN 4096
- char buf[BUFLEN + 1];
- const char* in = object_str( list_item( subst ) );
- char* out = buf;
-
- for ( ; *in && out < buf + BUFLEN; ++in )
- {
- if ( *in == '\\' || *in == '$' )
- {
- ++in;
- if ( *in == 0 )
- {
- break;
- }
- else if ( *in >= '0' && *in <= '9' )
- {
- unsigned n = *in - '0';
- const size_t srclen = repat->endp[n] - repat->startp[n];
- const size_t remaining = buf + BUFLEN - out;
- const size_t len = srclen < remaining ? srclen : remaining;
- memcpy( out, repat->startp[n], len );
- out += len;
- continue;
- }
- /* fall through and copy the next character */
- }
- *out++ = *in;
- }
- *out = 0;
+ LIST * result = L0;
+ LIST * const arg1 = lol_get( frame->args, 0 );
+ LISTITER iter = list_begin( arg1 );
+ LISTITER const end = list_end( arg1 );
+
+ if ( iter != end && list_next( iter ) != end && list_next( list_next( iter )
+ ) != end )
+ {
+ char const * const source = object_str( list_item( iter ) );
+ OBJECT * const pattern = list_item( list_next( iter ) );
+ regexp * const repat = regex_compile( pattern );
+
+ if ( regexec( repat, (char *)source) )
+ {
+ LISTITER subst = list_next( iter );
+
+ while ( ( subst = list_next( subst ) ) != end )
+ {
+#define BUFLEN 4096
+ char buf[ BUFLEN + 1 ];
+ char const * in = object_str( list_item( subst ) );
+ char * out = buf;
+
+ for ( ; *in && out < buf + BUFLEN; ++in )
+ {
+ if ( *in == '\\' || *in == '$' )
+ {
+ ++in;
+ if ( *in == 0 )
+ break;
+ if ( *in >= '0' && *in <= '9' )
+ {
+ unsigned int const n = *in - '0';
+ size_t const srclen = repat->endp[ n ] -
+ repat->startp[ n ];
+ size_t const remaining = buf + BUFLEN - out;
+ size_t const len = srclen < remaining
+ ? srclen
+ : remaining;
+ memcpy( out, repat->startp[ n ], len );
+ out += len;
+ continue;
+ }
+ /* fall through and copy the next character */
+ }
+ *out++ = *in;
+ }
+ *out = 0;
 
- result = list_push_back( result, object_new( buf ) );
+ result = list_push_back( result, object_new( buf ) );
 #undef BUFLEN
- }
- }
- }
+ }
+ }
+ }
 
- return result;
+ return result;
 }
 
 

Modified: trunk/tools/build/v2/kernel/errors.jam
==============================================================================
--- trunk/tools/build/v2/kernel/errors.jam (original)
+++ trunk/tools/build/v2/kernel/errors.jam 2012-07-20 10:20:55 EDT (Fri, 20 Jul 2012)
@@ -13,8 +13,8 @@
     local drop-elements = $(frame-skips[$(skip-frames)]) ;
     if ! ( $(skip-frames) in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 )
     {
- ECHO "warning: backtrace doesn't support skipping $(skip-frames) frames;"
- "using 1 instead." ;
+ ECHO "warning: backtrace doesn't support skipping $(skip-frames) "
+ "frames; using 1 instead." ;
         drop-elements = 5 ;
     }
 
@@ -25,7 +25,7 @@
         ECHO "$(prefix) at $(bt) " ;
         for local n in $(args)
         {
- if $($(n))-is-not-empty
+ if $($(n))-is-defined
             {
                 ECHO $(prefix) $($(n)) ;
             }
@@ -46,7 +46,7 @@
             # The first time through, print each argument on a separate line.
             for local n in $(args)
             {
- if $($(n))-is-not-empty
+ if $($(n))-is-defined
                 {
                     ECHO $(prefix) $($(n)) ;
                 }
@@ -89,7 +89,7 @@
 
     import sequence ;
 
- if ! $(.last-error-$(.args))-is-not-empty
+ if ! $(.last-error-$(.args))-is-defined
     {
         error-skip-frames 3 expected an error, but none occurred ;
     }
@@ -123,8 +123,8 @@
     {
         for local n in $(.args)
         {
- # Add an extra empty string so that we always have
- # something in the event of an error
+ # Add an extra empty string so that we always have something in the
+ # event of an error.
             .last-error-$(n) = $($(n)) "" ;
         }
     }
@@ -142,10 +142,11 @@
 {
     if $(.no-error-backtrace)
     {
+ local first-printed ;
         # Print each argument on a separate line.
         for local n in $(.args)
         {
- if $($(n))-is-not-empty
+ if $($(n))-is-defined
             {
                 if ! $(first-printed)
                 {
@@ -162,7 +163,8 @@
     }
     else
     {
- error-skip-frames 3 $(1) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ;
+ error-skip-frames 3 $(1) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) :
+ $(8) : $(9) ;
     }
 }
 
@@ -172,7 +174,8 @@
 rule user-error ( messages * : * )
 {
     .user-modules-only = 1 ;
- error-skip-frames 3 $(1) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ;
+ error-skip-frames 3 $(1) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) :
+ $(9) ;
 }
 
 
@@ -180,7 +183,8 @@
 #
 rule warning
 {
- backtrace 2 warning: $(1) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ;
+ backtrace 2 warning: $(1) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) :
+ $(9) ;
 }
 
 

Modified: trunk/tools/build/v2/kernel/modules.jam
==============================================================================
--- trunk/tools/build/v2/kernel/modules.jam (original)
+++ trunk/tools/build/v2/kernel/modules.jam 2012-07-20 10:20:55 EDT (Fri, 20 Jul 2012)
@@ -46,7 +46,8 @@
             }
 
             local test-module = __test-$(m)__ ;
- IMPORT $(m) : [ RULENAMES $(m) ] : $(test-module) : [ RULENAMES $(m) ] ;
+ IMPORT $(m) : [ RULENAMES $(m) ] : $(test-module) : [ RULENAMES $(m)
+ ] ;
             IMPORT $(m) : __test__ : $(test-module) : __test__ : LOCALIZE ;
             module $(test-module)
             {
@@ -260,8 +261,8 @@
     {
         if ! $(m) in $(.loaded)
         {
- # If the importing module isn't already in the BOOST_BUILD_PATH,
- # prepend it to the path. We don't want to invert the search order
+ # If the importing module is not already in the BOOST_BUILD_PATH,
+ # prepend it to the path. We do not want to invert the search order
             # of modules that are already there.
 
             local caller-location ;
@@ -269,7 +270,8 @@
             {
                 caller-location = [ binding $(caller) ] ;
                 caller-location = $(caller-location:D) ;
- caller-location = [ normalize-raw-paths $(caller-location:R=$(.cwd)) ] ;
+ caller-location = [ normalize-raw-paths
+ $(caller-location:R=$(.cwd)) ] ;
             }
 
             local search = [ peek : BOOST_BUILD_PATH ] ;
@@ -312,11 +314,10 @@
 #
 rule clone-rules ( source-module target-module )
 {
- local rules = [ RULENAMES $(source-module) ] ;
-
- IMPORT $(source-module) : $(rules) : $(target-module) : $(rules) : LOCALIZE ;
- EXPORT $(target-module) : $(rules) ;
- IMPORT $(target-module) : $(rules) : : $(target-module).$(rules) ;
+ local r = [ RULENAMES $(source-module) ] ;
+ IMPORT $(source-module) : $(r) : $(target-module) : $(r) : LOCALIZE ;
+ EXPORT $(target-module) : $(r) ;
+ IMPORT $(target-module) : $(r) : : $(target-module).$(r) ;
 }
 
 

Modified: trunk/tools/build/v2/test/generators-test/jamroot.jam
==============================================================================
--- trunk/tools/build/v2/test/generators-test/jamroot.jam (original)
+++ trunk/tools/build/v2/test/generators-test/jamroot.jam 2012-07-20 10:20:55 EDT (Fri, 20 Jul 2012)
@@ -66,7 +66,7 @@
 ################################################################################
 
 type.register X1 : x1 ;
-type.register X2 : x2 ;
+type.register X2 : x2 ;
 type.register X_PRO : x_pro ;
 
 appender.register x1-x2-to-cpp : X1 X2 : CPP ;


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