From 24034a43443dd6506e6a93bb7a128e1c2b91feec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jurko=20Gospodneti=C4=87?= Date: Sat, 12 Jul 2008 11:33:16 +0000 Subject: [PATCH] Minor stylistic changes in different Boost Build scripts. [SVN r47344] --- v2/build/property.jam | 17 +++++++++------- v2/util/set.jam | 47 ++++++++++++++++++++++--------------------- 2 files changed, 34 insertions(+), 30 deletions(-) diff --git a/v2/build/property.jam b/v2/build/property.jam index fafc3d50a..714a89f3f 100644 --- a/v2/build/property.jam +++ b/v2/build/property.jam @@ -28,7 +28,7 @@ rule refine ( properties * : requirements * ) # them so that we can handle 'properties'. for local r in $(requirements) { - # Don't consider conditional requirements. + # Do not consider conditional requirements. if ! [ MATCH (:) : $(r:G=) ] { # Note: cannot use a local variable here, so use an ugly name. @@ -149,9 +149,12 @@ rule expand-subfeatures-in-conditions ( properties * ) # passing 'true' as the second parameter. e += [ feature.expand-subfeatures $(c) : true ] ; } - if $(e) = $(condition) { + # (todo) + # This is just an optimization and possibly a premature one at + # that. + # (todo) (12.07.2008.) (Jurko) result += $(p) ; } else @@ -229,10 +232,10 @@ rule as-path ( properties * ) if ! $($(entry)) { - # trim redundancy + # Trim redundancy. properties = [ feature.minimize $(properties) ] ; - # sort according to path-order + # Sort according to path-order. properties = [ sequence.insertion-sort $(properties) : path-order ] ; local components ; @@ -510,7 +513,7 @@ rule translate-indirect ( specification * : context-module ) } -# Class which maintains a property set -> string mapping. +# Class maintaining a property set -> string mapping. # class property-map { @@ -536,7 +539,7 @@ class property-map # Returns the value associated with 'properties' or any subset of it. If # more than one subset has a value assigned to it, returns the value for the - # longest subset, if it's unique. + # longest subset, if it is unique. # rule find ( properties + ) { @@ -548,7 +551,7 @@ class property-map # rule find-replace ( properties + : value ? ) { - # First find all matches + # First find all matches. local matches ; local match-ranks ; for local i in $(self.all-flags) diff --git a/v2/util/set.jam b/v2/util/set.jam index 6e75546be..9562a164f 100644 --- a/v2/util/set.jam +++ b/v2/util/set.jam @@ -1,17 +1,17 @@ -# Copyright 2001, 2002 Dave Abrahams -# Copyright 2003 Vladimir Prus -# Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) +# Copyright 2001, 2002 Dave Abrahams +# Copyright 2003 Vladimir Prus +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) -# difference -# returns the elements of B that are not in A -rule difference ( B * : A * ) + +# Returns the elements of set1 that are not in set2. +# +rule difference ( set1 * : set2 * ) { local result = ; - local element ; - for element in $(B) + for local element in $(set1) { - if ! ( $(element) in $(A) ) + if ! ( $(element) in $(set2) ) { result += $(element) ; } @@ -21,9 +21,9 @@ rule difference ( B * : A * ) NATIVE_RULE set : difference ; -# intersection set1 : set2 + +# Removes all the items appearing in both set1 & set2. # -# Removes from set1 any items which don't appear in set2 and returns the result. rule intersection ( set1 * : set2 * ) { local result ; @@ -37,6 +37,10 @@ rule intersection ( set1 * : set2 * ) return $(result) ; } + +# Returns whether set1 & set2 contain the same elements. Note that this ignores +# any element ordering differences as well as any element duplication. +# rule equal ( set1 * : set2 * ) { if $(set1) in $(set2) && ( $(set2) in $(set1) ) @@ -45,18 +49,15 @@ rule equal ( set1 * : set2 * ) } } + rule __test__ ( ) { import assert ; - - assert.result 0 1 4 6 8 9 - : difference 0 1 2 3 4 5 6 7 8 9 : 2 3 5 7 ; - - assert.result 2 5 7 : intersection 0 1 2 4 5 6 7 8 9 : 2 3 5 7 ; - - assert.true equal 1 1 2 3 : 3 2 2 1 ; - - assert.false equal 2 3 : 3 2 2 1 ; + + assert.result 0 1 4 6 8 9 : difference 0 1 2 3 4 5 6 7 8 9 : 2 3 5 7 ; + assert.result 2 5 7 : intersection 0 1 2 4 5 6 7 8 9 : 2 3 5 7 ; + + assert.true equal : ; + assert.true equal 1 1 2 3 : 3 2 2 1 ; + assert.false equal 2 3 : 3 2 2 1 ; } - -