2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-16 01:12:13 +00:00

Convert remaining classes.

[SVN r19429]
This commit is contained in:
Vladimir Prus
2003-08-04 09:25:34 +00:00
parent fe09f7e4fe
commit 3bb6fbed85
36 changed files with 506 additions and 456 deletions

View File

@@ -20,7 +20,7 @@ import feature ;
import property-set ;
import build-request ;
import errors : error ;
import class : new ;
import class : xnew ;
import builtin ;
import make ;
@@ -143,7 +143,7 @@ virtual-targets = ;
if $(expanded)
{
local dr-adjuster = [ new directly-requested-properties-adjuster ] ;
local dr-adjuster = [ xnew directly-requested-properties-adjuster ] ;
for local p in $(expanded)
{
$(dr-adjuster).add-requested-property-set $(p) ;

View File

@@ -249,11 +249,17 @@ local rule convert-command-line-element ( e )
#
# will cause a release version of 'b' to be compiled and linked into 'a'. The
# release version will be compiled without "define=MACROS".
rule directly-requested-properties-adjuster
{
xclass directly-requested-properties-adjuster
{
import property-set ;
self.empty-request-requirements = ;
self.all-requests = [ new property-map ] ;
import class : xnew ;
rule __init__ ( )
{
self.empty-request-requirements = ;
self.all-requests = [ xnew property-map ] ;
}
rule add-requested-property-set ( property-set )
{
local base = [ $(property-set).base ] ;
@@ -294,9 +300,6 @@ rule directly-requested-properties-adjuster
}
}
class directly-requested-properties-adjuster ;
rule __test__ ( )
{
import assert feature ;

View File

@@ -317,12 +317,16 @@ actions quietly piecemeal response-file-2
}
#####
rule c-scanner ( includes * )
xclass c-scanner : scanner
{
scanner.__init__ ;
import regex virtual-target path scanner ;
import regex virtual-target path scanner ;
self.includes = $(includes) ;
rule __init__ ( includes * )
{
scanner.__init__ ;
self.includes = $(includes) ;
}
rule pattern ( )
{
@@ -370,7 +374,6 @@ rule c-scanner ( includes * )
}
}
class c-scanner : scanner ;
scanner.register c-scanner : include ;
type.set-scanner CPP : c-scanner ;
@@ -484,7 +487,6 @@ xclass searched-lib-generator : generator
generators.register [ xnew searched-lib-generator ] ;
xclass compile-action : action
{
import sequence ;

View File

@@ -252,7 +252,7 @@ xclass generator
# - value to <toolset> feature in properties
rule clone ( new-id : new-toolset-name )
{
return [ new $(__class__) $(new-id)
return [ xnew $(__class__) $(new-id)
: $(self.source-types)
: $(self.target-types-and-names)
: [ property.change $(self.requirements)

View File

@@ -88,25 +88,29 @@ rule print ( )
# Class encapsulating settings for a single project root.
#
rule project-root-object (
location # The root location.
)
xclass project-root-object
{
import path ;
import set ;
import set ;
import sequence : insertion-sort ;
# The module name of the project-root.
self.module = project-root<$(location)> ;
rule __init__ (
location # The root location.
)
{
# The module name of the project-root.
self.module = project-root<$(location)> ;
# The location of the project-root, as a path.
self.location = $(location) ;
# The location of the project-root, as a path.
self.location = $(location) ;
# The set of projects registered in this project-root.
self.projects = ;
# The set of interned constants for this project-root.
self.constants = ;
# The set of projects registered in this project-root.
self.projects = ;
# The set of interned constants for this project-root.
self.constants = ;
}
# Accessor, the module of the project root.
rule get-module ( )
{
@@ -204,6 +208,24 @@ rule project-root-object (
}
}
# Needed to get deterministic order of output, which makes testing simpler
rule compare-projects ( p1 p2 )
{
local id1 = [ project.attribute $(p1) id ] ;
local id2 = [ project.attribute $(p2) id ] ;
if $(id1) < $(id2)
{
return true ;
}
else
{
if $(id1) = $(id2) && $(p1) < $(p2)
{
return true ;
}
}
}
# Print out info about this project root. Calls print on the
# individual projects in this project-root.
#
@@ -213,23 +235,6 @@ rule project-root-object (
import print ;
import project ;
# Needed to get deterministic order of output, which makes testing simpler
local rule compare-projects ( p1 p2 )
{
local id1 = [ project.attribute $(p1) id ] ;
local id2 = [ project.attribute $(p2) id ] ;
if $(id1) < $(id2)
{
return true ;
}
else
{
if $(id1) = $(id2) && $(p1) < $(p2)
{
return true ;
}
}
}
print.section "'"$(self.location)"'" Module for project-root is "'"$(self.module)"'" ;
if $(self.constants)
@@ -246,7 +251,7 @@ rule project-root-object (
if $(self.projects)
{
print.section Projects ;
local projects = [ sequence.insertion-sort $(self.projects) : compare-projects ] ;
local projects = [ insertion-sort $(self.projects) : compare-projects ] ;
for local p in $(projects)
{
local attributes = [ project.attributes $(p) ] ;
@@ -255,7 +260,6 @@ rule project-root-object (
}
}
}
class.class project-root-object ;
# Rules callable by the user in the context of the project-root.jam of a project.
#

View File

@@ -43,7 +43,7 @@ rule load (
{
# Create the project-root, and remember it.
#
local root = [ class.new project-root-object $(location) ] ;
local root = [ class.xnew project-root-object $(location) ] ;
modules.poke $(module-name) : .project-root : $(root) ;
.roots += $(root) ;
@@ -97,24 +97,30 @@ rule print ( )
# Class encapsulating settings for a single project root.
#
rule project-root-object (
location # The root location.
)
xclass project-root-object
{
import path ;
import set ;
import set ;
import sequence ;
import print ;
import project ;
rule __init__ (
location # The root location.
)
{
# The module name of the project-root.
self.module = project-root<$(location)> ;
# The module name of the project-root.
self.module = project-root<$(location)> ;
# The location of the project-root, as a path.
self.location = $(location) ;
# The location of the project-root, as a path.
self.location = $(location) ;
# The set of projects registered in this project-root.
self.projects = ;
# The set of projects registered in this project-root.
self.projects = ;
# The set of interned constants for this project-root.
self.constants = ;
# The set of interned constants for this project-root.
self.constants = ;
}
# Accessor, the module of the project root.
rule get-module ( )
@@ -213,33 +219,30 @@ rule project-root-object (
}
}
# Needed to get deterministic order of output, which makes testing simpler
local rule compare-projects ( p1 p2 )
{
local id1 = [ project.attribute $(p1) id ] ;
local id2 = [ project.attribute $(p2) id ] ;
if $(id1) < $(id2)
{
return true ;
}
else
{
if $(id1) = $(id2) && $(p1) < $(p2)
{
return true ;
}
}
}
# Print out info about this project root. Calls print on the
# individual projects in this project-root.
#
rule print ( )
{
import sequence ;
import print ;
import project ;
# Needed to get deterministic order of output, which makes testing simpler
local rule compare-projects ( p1 p2 )
{
local id1 = [ project.attribute $(p1) id ] ;
local id2 = [ project.attribute $(p2) id ] ;
if $(id1) < $(id2)
{
return true ;
}
else
{
if $(id1) = $(id2) && $(p1) < $(p2)
{
return true ;
}
}
}
{
print.section "'"$(self.location)"'" Module for project-root is "'"$(self.module)"'" ;
if $(self.constants)
{
@@ -264,7 +267,6 @@ rule project-root-object (
}
}
}
class.class project-root-object ;
# Rules callable by the user in the context of the project-root.jam of a project.
#

View File

@@ -301,7 +301,7 @@ rule initialize (
module $(module-name)
{
}
$(module-name).attributes = [ new project-attributes $(location) ] ;
$(module-name).attributes = [ xnew project-attributes $(location) ] ;
local attributes = $($(module-name).attributes) ;
$(attributes).set source-location : $(location) : exact ;
@@ -381,20 +381,25 @@ rule register-id ( id : module )
#
# The standard attributes are "id", "location", "project-root", "parent"
# "requirements", "default-build", "source-location" and "projects-to-build".
rule project-attributes ( location )
xclass project-attributes
{
import property ;
import property-set ;
import errors ;
import path ;
self.location = $(location) ;
import print ;
import sequence ;
rule __init__ ( location )
{
self.location = $(location) ;
}
# Set the named attribute from the specification given by the user.
# The value actually set may be different.
rule set ( attribute : specification *
: exact ? # Sets value from 'specification' without any processing
)
: exact ? # Sets value from 'specification' without any processing
)
{
if $(exact)
{
@@ -487,9 +492,6 @@ rule project-attributes ( location )
# Prints the project attributes.
rule print ( )
{
import sequence ;
import print ;
local id = $(self.id) ; id ?= (none) ;
local parent = $(self.parent) ; parent ?= (none) ;
print.section "'"$(id)"'" ;
@@ -505,8 +507,6 @@ rule project-attributes ( location )
}
class project-attributes ;
# Returns the project-attribute instance for the specified jamfile module.
rule attributes ( project )
{

View File

@@ -3,7 +3,7 @@
# all copies. This software is provided "as is" without express or implied
# warranty, and with no claim as to its suitability for any purpose.
import class : class new ;
import class : class xnew ;
import feature ;
import property ;
import sequence ;
@@ -20,43 +20,47 @@ import sequence ;
# - several operations, like and refine and as-path are provided. They all use
# caching whenever possible.
#
local rule property-set ( raw-properties * )
xclass property-set
{
import feature ;
import property-set ;
import property ;
self.raw = $(raw-properties) ;
for local p in $(raw-properties)
{
local att = [ feature.attributes $(p:G) ] ;
if incidental in $(att)
{
self.incidental += $(p) ;
}
else if free in $(att)
{
if dependency in $(att)
{
self.dependency += $(p) ;
}
else
{
self.free += $(p) ;
}
}
else
{
self.base += $(p) ;
}
rule __init__ ( raw-properties * )
{
self.raw = $(raw-properties) ;
if propagated in $(att)
for local p in $(raw-properties)
{
self.propagated += $(p) ;
}
local att = [ feature.attributes $(p:G) ] ;
if incidental in $(att)
{
self.incidental += $(p) ;
}
else if free in $(att)
{
if dependency in $(att)
{
self.dependency += $(p) ;
}
else
{
self.free += $(p) ;
}
}
else
{
self.base += $(p) ;
}
if propagated in $(att)
{
self.propagated += $(p) ;
}
}
}
# Returns Jam list of stored properties
rule raw ( )
{
@@ -187,8 +191,6 @@ local rule property-set ( raw-properties * )
}
class property-set ;
# Creates new 'property-set' instance for the given raw properties,
# or returns an already existing ones.
rule create ( raw-properties * )
@@ -200,7 +202,7 @@ rule create ( raw-properties * )
if ! $(.ps.$(key))
{
.ps.$(key) = [ new property-set $(raw-properties) ] ;
.ps.$(key) = [ xnew property-set $(raw-properties) ] ;
}
return $(.ps.$(key)) ;
}

View File

@@ -386,14 +386,17 @@ rule translate-paths ( properties * : path )
# Class which maintains a property set -> string
# mapping
rule property-map ( )
xclass property-map
{
import numbers ;
import sequence ;
import errors : error ;
self.next-flag = 1 ;
rule __init__ ( )
{
self.next-flag = 1 ;
}
# Associate 'value' with 'properties'
rule insert ( properties + : value )
{
@@ -445,9 +448,6 @@ rule property-map ( )
}
}
class property-map ;
local rule __test__ ( )
{
import errors : try catch ;
@@ -472,7 +472,7 @@ local rule __test__ ( )
compose <variant>release : <define>NDEBUG <optimization>on ;
import assert ;
import class : new ;
import class : xnew ;
validate gcc gcc-3.0.1 : $(test-space) ;
validate <toolset>gcc <toolset>gcc-3.0.1 : $(test-space) ;
@@ -559,7 +559,7 @@ local rule __test__ ( )
assert.result <toolset>kylix <include>a
: change <toolset>gcc <include>a : toolset kylix ;
pm = [ new property-map ] ;
pm = [ xnew property-map ] ;
$(pm).insert <toolset>gcc : o ;
$(pm).insert <toolset>gcc <os>NT : obj ;
$(pm).insert <toolset>gcc <os>CYGWIN : obj ;

View File

@@ -26,12 +26,16 @@
# actual targets. However, actions can also create scanners in a special
# way, instead of relying on just target type.
import class : class new ;
import class : class xnew ;
import property virtual-target ;
# Base scanner class.
rule scanner ( )
xclass scanner
{
rule __init__ ( )
{
}
# Returns a pattern to use for scanning
rule pattern ( )
{
@@ -47,8 +51,6 @@ rule scanner ( )
}
}
class scanner ;
# Registers a new generator class, specifying a set of
# properties relevant to this scanner. Ctor for that class
# should have one parameter: list of properties.
@@ -74,7 +76,7 @@ rule get ( scanner-class : properties * )
}
if ! $(scanner.$(scanner-class).$(r:J=-))
{
scanner.$(scanner-class).$(r:J=-) = [ new $(scanner-class) $(r) ] ;
scanner.$(scanner-class).$(r:J=-) = [ xnew $(scanner-class) $(r) ] ;
}
return $(scanner.$(scanner-class).$(r:J=-)) ;
}

View File

@@ -983,7 +983,7 @@ xclass basic-target : abstract-target
# is created.
local all-targets =
[ sequence.transform virtual-target.traverse : $(targets) ] ;
local dg = [ new subvariant-dg $(__name__) : $(build-request)
local dg = [ xnew subvariant-dg $(__name__) : $(build-request)
: $(rproperties) : $(all-targets) ] ;
for local v in $(all-targets)
{

View File

@@ -15,8 +15,8 @@ import toolset ;
# lanch test programs.
feature.feature testing.launcher : : optional free ;
xclass unit-test-target-class : basic-target
{
xclass unit-test-target-class : typed-target
{
rule __init__ ( name : project : sources * : requirements *
: default-build * )
{
@@ -40,8 +40,6 @@ xclass unit-test-target-class : basic-target
}
}
class unit-test-target-class : typed-target ;
toolset.flags testing.run LAUNCHER <testing.launcher> ;

View File

@@ -28,7 +28,7 @@ feature.feature base-target-type : : composite optional free ;
# feature.feature main-target-type : : composite optional incidental ;
# Store suffixes for generated targets
.suffixes = [ new property-map ] ;
.suffixes = [ xnew property-map ] ;
# Registers a target type, possible derived from a 'base-type'.
# If 'suffixes' are provided, they given all the suffixes that mean a file is of 'type'.

View File

@@ -99,13 +99,17 @@ rule apply-default-suffix ( suffix : list * )
local rule __test__ ( )
{
import assert ;
import class : class new ;
import class : xnew ;
assert.result foo bar : ungrist <foo> <bar> ;
assert.result 123 : str 123 ;
local rule test-class__ ( )
xclass test-class__
{
rule __init__ ( )
{
}
rule str ( )
{
return "str-test-class" ;
@@ -121,15 +125,14 @@ local rule __test__ ( )
return "not sure" ;
}
}
class test-class__ ;
assert.result "str-test-class" : str [ new test-class__ ] ;
assert.result "str-test-class" : str [ xnew test-class__ ] ;
assert.true less 1 2 ;
assert.false less 2 1 ;
assert.result "yes, of course!" : less [ new test-class__ ] 1 ;
assert.result "yes, of course!" : less [ xnew test-class__ ] 1 ;
assert.true equal 1 1 ;
assert.false equal 1 2 ;
assert.result "not sure" : equal [ new test-class__ ] 1 ;
assert.result "not sure" : equal [ xnew test-class__ ] 1 ;
assert.result foo.lib foo.a : apply-default-suffix .lib : foo foo.a ;
}

View File

@@ -921,42 +921,46 @@ local rule clone-action-template ( action from cloned-from : new-source )
return $(cloned) ;
}
local rule subvariant-dg ( main-target # The instance of main-target class
: property-set # Properties requested for this target
: actual-properties # Actual used properties
: virtual-targets * )
xclass subvariant-dg
{
import sequence ;
import sequence ;
self.main-target = $(main-target) ;
self.properties = $(property-set) ;
self.actual-properties = $(actual-properties) ;
self.virtual-targets = $(virtual-targets) ;
rule __init__ ( main-target # The instance of main-target class
: property-set # Properties requested for this target
: actual-properties # Actual used properties
: virtual-targets * )
{
self.main-target = $(main-target) ;
self.properties = $(property-set) ;
self.actual-properties = $(actual-properties) ;
self.virtual-targets = $(virtual-targets) ;
# Pre-compose the list of other dependency graphs, on which this one
# depends
local deps = [ $(actual-properties).dependency ] ;
for local d in $(deps)
{
self.other-dg += [ $(d:G=).dg ] ;
}
for local t in $(virtual-targets)
{
local a = [ $(t).action ] ;
if $(a)
# Pre-compose the list of other dependency graphs, on which this one
# depends
local deps = [ $(actual-properties).dependency ] ;
for local d in $(deps)
{
for local s in [ $(a).sources ]
self.other-dg += [ $(d:G=).dg ] ;
}
for local t in $(virtual-targets)
{
local a = [ $(t).action ] ;
if $(a)
{
if [ $(s).root ]
for local s in [ $(a).sources ]
{
self.other-dg += [ $(s).dg ] ;
if [ $(s).root ]
{
self.other-dg += [ $(s).dg ] ;
}
}
}
}
}
self.other-dg = [ sequence.unique $(self.other-dg) ] ;
self.other-dg = [ sequence.unique $(self.other-dg) ] ;
}
rule main-target ( )
{
@@ -992,5 +996,3 @@ local rule subvariant-dg ( main-target # The instance of main-target class
}
}
class subvariant-dg ;

View File

@@ -165,13 +165,16 @@ rule docbook-to-fo ( target : source : properties * )
xslt $(target) : $(source) $(stylesheet) : $(properties) ;
}
rule xml-catalog-action ( target : property-set ? : catalog-entries * )
xclass xml-catalog-action : action
{
import boostbook ;
import print ;
action.__init__ $(target) : : generate-xml-catalog : $(property-set) ;
import boostbook ;
import print ;
rule __init__ ( target : property-set ? : catalog-entries * )
{
action.__init__ $(target) : : generate-xml-catalog : $(property-set) ;
}
rule actualize ( )
{
if ! $(self.actualized)
@@ -230,24 +233,26 @@ rule xml-catalog-action ( target : property-set ? : catalog-entries * )
}
}
class xml-catalog-action : action ;
rule boostbook-target-class ( name : project : sources * : requirements *
: default-build * : catalog-entries * )
xclass boostbook-target-class : basic-target
{
import feature ;
import virtual-target ;
import generators ;
basic-target.__init__ $(name) : $(project) : $(sources) : $(requirements)
: $(default-build) ;
self.catalog-entries = $(catalog-entries) ;
import feature ;
import virtual-target ;
import generators ;
rule __init__ ( name : project : sources * : requirements *
: default-build * : catalog-entries * )
{
basic-target.__init__ $(name) : $(project) : $(sources) : $(requirements)
: $(default-build) ;
self.catalog-entries = $(catalog-entries) ;
}
rule construct ( source-targets * : property-set )
{
local path = [ project.attribute $(self.project) location ] ;
local catalog = [ new file-target catalog : XML : $(self.project) ] ;
$(catalog).action [ new xml-catalog-action $(catalog) : $(property-set)
local catalog = [ xnew file-target catalog : XML : $(self.project) ] ;
$(catalog).action [ xnew xml-catalog-action $(catalog) : $(property-set)
: $(self.catalog-entries) ] ;
$(catalog).set-path $(path) ;
@@ -313,14 +318,12 @@ rule boostbook-target-class ( name : project : sources * : requirements *
}
}
class boostbook-target-class : basic-target ;
rule boostbook ( target-name : sources * : requirements * : default-build * )
{
local project = [ CALLER_MODULE ] ;
targets.main-target-alternative
[ new boostbook-target-class $(target-name) : $(project)
[ xnew boostbook-target-class $(target-name) : $(project)
: [ targets.main-target-sources $(sources) : $(target-name) ]
: [ targets.main-target-requirements $(requirements) : $(project) ]
: [ targets.main-target-default-build $(default-build) : $(project) ]

View File

@@ -9,7 +9,7 @@
# version of Doxygen that can output a single XML file instead of a
# set of XML files.
import class : class new ;
import class : xnew ;
import targets ;
import feature ;
import property ;
@@ -90,17 +90,21 @@ rule xml-to-boostbook ( target : source : properties * )
;
}
rule doxygen-xml-target-class ( name : project : sources * : requirements *
: default-build * )
xclass doxygen-xml-target-class : basic-target
{
basic-target.__init__ $(name) : $(project) : $(sources) : $(requirements)
: $(default-build) ;
rule __init__ ( name : project : sources * : requirements *
: default-build * )
{
basic-target.__init__ $(name) : $(project) : $(sources) : $(requirements)
: $(default-build) ;
}
rule construct ( source-targets * : property-set )
{
local target =
[ new file-target $(self.name) : DOXYGEN_XML : $(self.project) ] ;
local a = [ new action $(target) : $(source-targets) : doxygen.extract-xml
[ xnew file-target $(self.name) : DOXYGEN_XML : $(self.project) ] ;
local a = [ xnew action $(target) : $(source-targets) : doxygen.extract-xml
: $(property-set) ] ;
$(target).action $(a) ;
@@ -108,13 +112,11 @@ rule doxygen-xml-target-class ( name : project : sources * : requirements *
}
}
class doxygen-xml-target-class : basic-target ;
rule doxygen ( target-name : sources * : requirements * : default-build * )
{
local project = [ CALLER_MODULE ] ;
targets.main-target-alternative
[ new doxygen-xml-target-class $(target-name) : $(project) : $(sources)
[ xnew doxygen-xml-target-class $(target-name) : $(project) : $(sources)
: [ targets.main-target-requirements $(requirements) : $(project) ]
: [ targets.main-target-default-build $(default-build) : $(project) ]
] ;

View File

@@ -47,7 +47,7 @@
import targets ;
import property-set ;
import virtual-target ;
import class : class new ;
import class : class xnew ;
import project ;
import type ;
import generators ;
@@ -89,7 +89,7 @@ rule update ( name : existing-translation sources + : requirements * )
local project = [ CALLER_MODULE ] ;
targets.main-target-alternative
[ new update-translations-class $(name) : $(project) :
[ xnew update-translations-class $(name) : $(project) :
$(existing-translation) $(sources)
: [ targets.main-target-requirements $(requirements) : $(project) ]
] ;
@@ -115,13 +115,16 @@ feature gettext.types : : free ;
generators.register-standard gettext.compile : gettext.PO : gettext.catalog ;
rule update-translations-class ( name : project : sources * : requirements )
xclass update-translations-class : basic-target
{
basic-target.__init__ $(name) : $(project) : $(sources) : $(requirements)
: $(default-build) ;
IMPORT gettext : regex.split : $(__name__) : regex.split ;
import regex : split ;
rule __init__ ( name : project : sources * : requirements )
{
basic-target.__init__ $(name) : $(project) : $(sources) : $(requirements)
: $(default-build) ;
}
rule construct ( source-targets * : property-set )
{
local types = [ $(property-set).get <gettext.types> ] ;
@@ -149,13 +152,13 @@ rule update-translations-class ( name : project : sources * : requirements )
if $(right-sources)
{
local new-messages = [ new file-target $(self.name) : gettext.POT : $(self.project) ] ;
local new-messages = [ xnew file-target $(self.name) : gettext.POT : $(self.project) ] ;
local extract =
[ new action $(new-messages) : $(right-sources) : gettext.extract ] ;
[ xnew action $(new-messages) : $(right-sources) : gettext.extract ] ;
$(new-messages).action $(extract) ;
local r = [ new notfile-target $(self.name) : $(self.project) ] ;
local a = [ new action $(r) : $(source-targets[1]) $(new-messages)
local r = [ xnew notfile-target $(self.name) : $(self.project) ] ;
local a = [ xnew action $(r) : $(source-targets[1]) $(new-messages)
: gettext.update-po-dispatch ] ;
$(r).action $(a) ;
.constructed = [ virtual-target.register $(r) ] ;
@@ -172,7 +175,6 @@ rule update-translations-class ( name : project : sources * : requirements )
{
}
}
class update-translations-class : basic-target ;
flags gettext.extract KEYWORD <gettext.keyword> ;
actions extract

View File

@@ -20,7 +20,7 @@ import feature ;
import property-set ;
import build-request ;
import errors : error ;
import class : new ;
import class : xnew ;
import builtin ;
import make ;
@@ -143,7 +143,7 @@ virtual-targets = ;
if $(expanded)
{
local dr-adjuster = [ new directly-requested-properties-adjuster ] ;
local dr-adjuster = [ xnew directly-requested-properties-adjuster ] ;
for local p in $(expanded)
{
$(dr-adjuster).add-requested-property-set $(p) ;

View File

@@ -249,11 +249,17 @@ local rule convert-command-line-element ( e )
#
# will cause a release version of 'b' to be compiled and linked into 'a'. The
# release version will be compiled without "define=MACROS".
rule directly-requested-properties-adjuster
{
xclass directly-requested-properties-adjuster
{
import property-set ;
self.empty-request-requirements = ;
self.all-requests = [ new property-map ] ;
import class : xnew ;
rule __init__ ( )
{
self.empty-request-requirements = ;
self.all-requests = [ xnew property-map ] ;
}
rule add-requested-property-set ( property-set )
{
local base = [ $(property-set).base ] ;
@@ -294,9 +300,6 @@ rule directly-requested-properties-adjuster
}
}
class directly-requested-properties-adjuster ;
rule __test__ ( )
{
import assert feature ;

View File

@@ -252,7 +252,7 @@ xclass generator
# - value to <toolset> feature in properties
rule clone ( new-id : new-toolset-name )
{
return [ new $(__class__) $(new-id)
return [ xnew $(__class__) $(new-id)
: $(self.source-types)
: $(self.target-types-and-names)
: [ property.change $(self.requirements)

View File

@@ -43,7 +43,7 @@ rule load (
{
# Create the project-root, and remember it.
#
local root = [ class.new project-root-object $(location) ] ;
local root = [ class.xnew project-root-object $(location) ] ;
modules.poke $(module-name) : .project-root : $(root) ;
.roots += $(root) ;
@@ -97,24 +97,30 @@ rule print ( )
# Class encapsulating settings for a single project root.
#
rule project-root-object (
location # The root location.
)
xclass project-root-object
{
import path ;
import set ;
import set ;
import sequence ;
import print ;
import project ;
rule __init__ (
location # The root location.
)
{
# The module name of the project-root.
self.module = project-root<$(location)> ;
# The module name of the project-root.
self.module = project-root<$(location)> ;
# The location of the project-root, as a path.
self.location = $(location) ;
# The location of the project-root, as a path.
self.location = $(location) ;
# The set of projects registered in this project-root.
self.projects = ;
# The set of projects registered in this project-root.
self.projects = ;
# The set of interned constants for this project-root.
self.constants = ;
# The set of interned constants for this project-root.
self.constants = ;
}
# Accessor, the module of the project root.
rule get-module ( )
@@ -213,33 +219,30 @@ rule project-root-object (
}
}
# Needed to get deterministic order of output, which makes testing simpler
local rule compare-projects ( p1 p2 )
{
local id1 = [ project.attribute $(p1) id ] ;
local id2 = [ project.attribute $(p2) id ] ;
if $(id1) < $(id2)
{
return true ;
}
else
{
if $(id1) = $(id2) && $(p1) < $(p2)
{
return true ;
}
}
}
# Print out info about this project root. Calls print on the
# individual projects in this project-root.
#
rule print ( )
{
import sequence ;
import print ;
import project ;
# Needed to get deterministic order of output, which makes testing simpler
local rule compare-projects ( p1 p2 )
{
local id1 = [ project.attribute $(p1) id ] ;
local id2 = [ project.attribute $(p2) id ] ;
if $(id1) < $(id2)
{
return true ;
}
else
{
if $(id1) = $(id2) && $(p1) < $(p2)
{
return true ;
}
}
}
{
print.section "'"$(self.location)"'" Module for project-root is "'"$(self.module)"'" ;
if $(self.constants)
{
@@ -264,7 +267,6 @@ rule project-root-object (
}
}
}
class.class project-root-object ;
# Rules callable by the user in the context of the project-root.jam of a project.
#

View File

@@ -301,7 +301,7 @@ rule initialize (
module $(module-name)
{
}
$(module-name).attributes = [ new project-attributes $(location) ] ;
$(module-name).attributes = [ xnew project-attributes $(location) ] ;
local attributes = $($(module-name).attributes) ;
$(attributes).set source-location : $(location) : exact ;
@@ -381,20 +381,25 @@ rule register-id ( id : module )
#
# The standard attributes are "id", "location", "project-root", "parent"
# "requirements", "default-build", "source-location" and "projects-to-build".
rule project-attributes ( location )
xclass project-attributes
{
import property ;
import property-set ;
import errors ;
import path ;
self.location = $(location) ;
import print ;
import sequence ;
rule __init__ ( location )
{
self.location = $(location) ;
}
# Set the named attribute from the specification given by the user.
# The value actually set may be different.
rule set ( attribute : specification *
: exact ? # Sets value from 'specification' without any processing
)
: exact ? # Sets value from 'specification' without any processing
)
{
if $(exact)
{
@@ -487,9 +492,6 @@ rule project-attributes ( location )
# Prints the project attributes.
rule print ( )
{
import sequence ;
import print ;
local id = $(self.id) ; id ?= (none) ;
local parent = $(self.parent) ; parent ?= (none) ;
print.section "'"$(id)"'" ;
@@ -505,8 +507,6 @@ rule project-attributes ( location )
}
class project-attributes ;
# Returns the project-attribute instance for the specified jamfile module.
rule attributes ( project )
{

View File

@@ -3,7 +3,7 @@
# all copies. This software is provided "as is" without express or implied
# warranty, and with no claim as to its suitability for any purpose.
import class : class new ;
import class : class xnew ;
import feature ;
import property ;
import sequence ;
@@ -20,43 +20,47 @@ import sequence ;
# - several operations, like and refine and as-path are provided. They all use
# caching whenever possible.
#
local rule property-set ( raw-properties * )
xclass property-set
{
import feature ;
import property-set ;
import property ;
self.raw = $(raw-properties) ;
for local p in $(raw-properties)
{
local att = [ feature.attributes $(p:G) ] ;
if incidental in $(att)
{
self.incidental += $(p) ;
}
else if free in $(att)
{
if dependency in $(att)
{
self.dependency += $(p) ;
}
else
{
self.free += $(p) ;
}
}
else
{
self.base += $(p) ;
}
rule __init__ ( raw-properties * )
{
self.raw = $(raw-properties) ;
if propagated in $(att)
for local p in $(raw-properties)
{
self.propagated += $(p) ;
}
local att = [ feature.attributes $(p:G) ] ;
if incidental in $(att)
{
self.incidental += $(p) ;
}
else if free in $(att)
{
if dependency in $(att)
{
self.dependency += $(p) ;
}
else
{
self.free += $(p) ;
}
}
else
{
self.base += $(p) ;
}
if propagated in $(att)
{
self.propagated += $(p) ;
}
}
}
# Returns Jam list of stored properties
rule raw ( )
{
@@ -187,8 +191,6 @@ local rule property-set ( raw-properties * )
}
class property-set ;
# Creates new 'property-set' instance for the given raw properties,
# or returns an already existing ones.
rule create ( raw-properties * )
@@ -200,7 +202,7 @@ rule create ( raw-properties * )
if ! $(.ps.$(key))
{
.ps.$(key) = [ new property-set $(raw-properties) ] ;
.ps.$(key) = [ xnew property-set $(raw-properties) ] ;
}
return $(.ps.$(key)) ;
}

View File

@@ -386,14 +386,17 @@ rule translate-paths ( properties * : path )
# Class which maintains a property set -> string
# mapping
rule property-map ( )
xclass property-map
{
import numbers ;
import sequence ;
import errors : error ;
self.next-flag = 1 ;
rule __init__ ( )
{
self.next-flag = 1 ;
}
# Associate 'value' with 'properties'
rule insert ( properties + : value )
{
@@ -445,9 +448,6 @@ rule property-map ( )
}
}
class property-map ;
local rule __test__ ( )
{
import errors : try catch ;
@@ -472,7 +472,7 @@ local rule __test__ ( )
compose <variant>release : <define>NDEBUG <optimization>on ;
import assert ;
import class : new ;
import class : xnew ;
validate gcc gcc-3.0.1 : $(test-space) ;
validate <toolset>gcc <toolset>gcc-3.0.1 : $(test-space) ;
@@ -559,7 +559,7 @@ local rule __test__ ( )
assert.result <toolset>kylix <include>a
: change <toolset>gcc <include>a : toolset kylix ;
pm = [ new property-map ] ;
pm = [ xnew property-map ] ;
$(pm).insert <toolset>gcc : o ;
$(pm).insert <toolset>gcc <os>NT : obj ;
$(pm).insert <toolset>gcc <os>CYGWIN : obj ;

View File

@@ -26,12 +26,16 @@
# actual targets. However, actions can also create scanners in a special
# way, instead of relying on just target type.
import class : class new ;
import class : class xnew ;
import property virtual-target ;
# Base scanner class.
rule scanner ( )
xclass scanner
{
rule __init__ ( )
{
}
# Returns a pattern to use for scanning
rule pattern ( )
{
@@ -47,8 +51,6 @@ rule scanner ( )
}
}
class scanner ;
# Registers a new generator class, specifying a set of
# properties relevant to this scanner. Ctor for that class
# should have one parameter: list of properties.
@@ -74,7 +76,7 @@ rule get ( scanner-class : properties * )
}
if ! $(scanner.$(scanner-class).$(r:J=-))
{
scanner.$(scanner-class).$(r:J=-) = [ new $(scanner-class) $(r) ] ;
scanner.$(scanner-class).$(r:J=-) = [ xnew $(scanner-class) $(r) ] ;
}
return $(scanner.$(scanner-class).$(r:J=-)) ;
}

View File

@@ -983,7 +983,7 @@ xclass basic-target : abstract-target
# is created.
local all-targets =
[ sequence.transform virtual-target.traverse : $(targets) ] ;
local dg = [ new subvariant-dg $(__name__) : $(build-request)
local dg = [ xnew subvariant-dg $(__name__) : $(build-request)
: $(rproperties) : $(all-targets) ] ;
for local v in $(all-targets)
{

View File

@@ -28,7 +28,7 @@ feature.feature base-target-type : : composite optional free ;
# feature.feature main-target-type : : composite optional incidental ;
# Store suffixes for generated targets
.suffixes = [ new property-map ] ;
.suffixes = [ xnew property-map ] ;
# Registers a target type, possible derived from a 'base-type'.
# If 'suffixes' are provided, they given all the suffixes that mean a file is of 'type'.

View File

@@ -921,42 +921,46 @@ local rule clone-action-template ( action from cloned-from : new-source )
return $(cloned) ;
}
local rule subvariant-dg ( main-target # The instance of main-target class
: property-set # Properties requested for this target
: actual-properties # Actual used properties
: virtual-targets * )
xclass subvariant-dg
{
import sequence ;
import sequence ;
self.main-target = $(main-target) ;
self.properties = $(property-set) ;
self.actual-properties = $(actual-properties) ;
self.virtual-targets = $(virtual-targets) ;
rule __init__ ( main-target # The instance of main-target class
: property-set # Properties requested for this target
: actual-properties # Actual used properties
: virtual-targets * )
{
self.main-target = $(main-target) ;
self.properties = $(property-set) ;
self.actual-properties = $(actual-properties) ;
self.virtual-targets = $(virtual-targets) ;
# Pre-compose the list of other dependency graphs, on which this one
# depends
local deps = [ $(actual-properties).dependency ] ;
for local d in $(deps)
{
self.other-dg += [ $(d:G=).dg ] ;
}
for local t in $(virtual-targets)
{
local a = [ $(t).action ] ;
if $(a)
# Pre-compose the list of other dependency graphs, on which this one
# depends
local deps = [ $(actual-properties).dependency ] ;
for local d in $(deps)
{
for local s in [ $(a).sources ]
self.other-dg += [ $(d:G=).dg ] ;
}
for local t in $(virtual-targets)
{
local a = [ $(t).action ] ;
if $(a)
{
if [ $(s).root ]
for local s in [ $(a).sources ]
{
self.other-dg += [ $(s).dg ] ;
if [ $(s).root ]
{
self.other-dg += [ $(s).dg ] ;
}
}
}
}
}
self.other-dg = [ sequence.unique $(self.other-dg) ] ;
self.other-dg = [ sequence.unique $(self.other-dg) ] ;
}
rule main-target ( )
{
@@ -992,5 +996,3 @@ local rule subvariant-dg ( main-target # The instance of main-target class
}
}
class subvariant-dg ;

View File

@@ -88,25 +88,29 @@ rule print ( )
# Class encapsulating settings for a single project root.
#
rule project-root-object (
location # The root location.
)
xclass project-root-object
{
import path ;
import set ;
import set ;
import sequence : insertion-sort ;
# The module name of the project-root.
self.module = project-root<$(location)> ;
rule __init__ (
location # The root location.
)
{
# The module name of the project-root.
self.module = project-root<$(location)> ;
# The location of the project-root, as a path.
self.location = $(location) ;
# The location of the project-root, as a path.
self.location = $(location) ;
# The set of projects registered in this project-root.
self.projects = ;
# The set of interned constants for this project-root.
self.constants = ;
# The set of projects registered in this project-root.
self.projects = ;
# The set of interned constants for this project-root.
self.constants = ;
}
# Accessor, the module of the project root.
rule get-module ( )
{
@@ -204,6 +208,24 @@ rule project-root-object (
}
}
# Needed to get deterministic order of output, which makes testing simpler
rule compare-projects ( p1 p2 )
{
local id1 = [ project.attribute $(p1) id ] ;
local id2 = [ project.attribute $(p2) id ] ;
if $(id1) < $(id2)
{
return true ;
}
else
{
if $(id1) = $(id2) && $(p1) < $(p2)
{
return true ;
}
}
}
# Print out info about this project root. Calls print on the
# individual projects in this project-root.
#
@@ -213,23 +235,6 @@ rule project-root-object (
import print ;
import project ;
# Needed to get deterministic order of output, which makes testing simpler
local rule compare-projects ( p1 p2 )
{
local id1 = [ project.attribute $(p1) id ] ;
local id2 = [ project.attribute $(p2) id ] ;
if $(id1) < $(id2)
{
return true ;
}
else
{
if $(id1) = $(id2) && $(p1) < $(p2)
{
return true ;
}
}
}
print.section "'"$(self.location)"'" Module for project-root is "'"$(self.module)"'" ;
if $(self.constants)
@@ -246,7 +251,7 @@ rule project-root-object (
if $(self.projects)
{
print.section Projects ;
local projects = [ sequence.insertion-sort $(self.projects) : compare-projects ] ;
local projects = [ insertion-sort $(self.projects) : compare-projects ] ;
for local p in $(projects)
{
local attributes = [ project.attributes $(p) ] ;
@@ -255,7 +260,6 @@ rule project-root-object (
}
}
}
class.class project-root-object ;
# Rules callable by the user in the context of the project-root.jam of a project.
#

View File

@@ -165,13 +165,16 @@ rule docbook-to-fo ( target : source : properties * )
xslt $(target) : $(source) $(stylesheet) : $(properties) ;
}
rule xml-catalog-action ( target : property-set ? : catalog-entries * )
xclass xml-catalog-action : action
{
import boostbook ;
import print ;
action.__init__ $(target) : : generate-xml-catalog : $(property-set) ;
import boostbook ;
import print ;
rule __init__ ( target : property-set ? : catalog-entries * )
{
action.__init__ $(target) : : generate-xml-catalog : $(property-set) ;
}
rule actualize ( )
{
if ! $(self.actualized)
@@ -230,24 +233,26 @@ rule xml-catalog-action ( target : property-set ? : catalog-entries * )
}
}
class xml-catalog-action : action ;
rule boostbook-target-class ( name : project : sources * : requirements *
: default-build * : catalog-entries * )
xclass boostbook-target-class : basic-target
{
import feature ;
import virtual-target ;
import generators ;
basic-target.__init__ $(name) : $(project) : $(sources) : $(requirements)
: $(default-build) ;
self.catalog-entries = $(catalog-entries) ;
import feature ;
import virtual-target ;
import generators ;
rule __init__ ( name : project : sources * : requirements *
: default-build * : catalog-entries * )
{
basic-target.__init__ $(name) : $(project) : $(sources) : $(requirements)
: $(default-build) ;
self.catalog-entries = $(catalog-entries) ;
}
rule construct ( source-targets * : property-set )
{
local path = [ project.attribute $(self.project) location ] ;
local catalog = [ new file-target catalog : XML : $(self.project) ] ;
$(catalog).action [ new xml-catalog-action $(catalog) : $(property-set)
local catalog = [ xnew file-target catalog : XML : $(self.project) ] ;
$(catalog).action [ xnew xml-catalog-action $(catalog) : $(property-set)
: $(self.catalog-entries) ] ;
$(catalog).set-path $(path) ;
@@ -313,14 +318,12 @@ rule boostbook-target-class ( name : project : sources * : requirements *
}
}
class boostbook-target-class : basic-target ;
rule boostbook ( target-name : sources * : requirements * : default-build * )
{
local project = [ CALLER_MODULE ] ;
targets.main-target-alternative
[ new boostbook-target-class $(target-name) : $(project)
[ xnew boostbook-target-class $(target-name) : $(project)
: [ targets.main-target-sources $(sources) : $(target-name) ]
: [ targets.main-target-requirements $(requirements) : $(project) ]
: [ targets.main-target-default-build $(default-build) : $(project) ]

View File

@@ -317,12 +317,16 @@ actions quietly piecemeal response-file-2
}
#####
rule c-scanner ( includes * )
xclass c-scanner : scanner
{
scanner.__init__ ;
import regex virtual-target path scanner ;
import regex virtual-target path scanner ;
self.includes = $(includes) ;
rule __init__ ( includes * )
{
scanner.__init__ ;
self.includes = $(includes) ;
}
rule pattern ( )
{
@@ -370,7 +374,6 @@ rule c-scanner ( includes * )
}
}
class c-scanner : scanner ;
scanner.register c-scanner : include ;
type.set-scanner CPP : c-scanner ;
@@ -484,7 +487,6 @@ xclass searched-lib-generator : generator
generators.register [ xnew searched-lib-generator ] ;
xclass compile-action : action
{
import sequence ;

View File

@@ -9,7 +9,7 @@
# version of Doxygen that can output a single XML file instead of a
# set of XML files.
import class : class new ;
import class : xnew ;
import targets ;
import feature ;
import property ;
@@ -90,17 +90,21 @@ rule xml-to-boostbook ( target : source : properties * )
;
}
rule doxygen-xml-target-class ( name : project : sources * : requirements *
: default-build * )
xclass doxygen-xml-target-class : basic-target
{
basic-target.__init__ $(name) : $(project) : $(sources) : $(requirements)
: $(default-build) ;
rule __init__ ( name : project : sources * : requirements *
: default-build * )
{
basic-target.__init__ $(name) : $(project) : $(sources) : $(requirements)
: $(default-build) ;
}
rule construct ( source-targets * : property-set )
{
local target =
[ new file-target $(self.name) : DOXYGEN_XML : $(self.project) ] ;
local a = [ new action $(target) : $(source-targets) : doxygen.extract-xml
[ xnew file-target $(self.name) : DOXYGEN_XML : $(self.project) ] ;
local a = [ xnew action $(target) : $(source-targets) : doxygen.extract-xml
: $(property-set) ] ;
$(target).action $(a) ;
@@ -108,13 +112,11 @@ rule doxygen-xml-target-class ( name : project : sources * : requirements *
}
}
class doxygen-xml-target-class : basic-target ;
rule doxygen ( target-name : sources * : requirements * : default-build * )
{
local project = [ CALLER_MODULE ] ;
targets.main-target-alternative
[ new doxygen-xml-target-class $(target-name) : $(project) : $(sources)
[ xnew doxygen-xml-target-class $(target-name) : $(project) : $(sources)
: [ targets.main-target-requirements $(requirements) : $(project) ]
: [ targets.main-target-default-build $(default-build) : $(project) ]
] ;

View File

@@ -47,7 +47,7 @@
import targets ;
import property-set ;
import virtual-target ;
import class : class new ;
import class : class xnew ;
import project ;
import type ;
import generators ;
@@ -89,7 +89,7 @@ rule update ( name : existing-translation sources + : requirements * )
local project = [ CALLER_MODULE ] ;
targets.main-target-alternative
[ new update-translations-class $(name) : $(project) :
[ xnew update-translations-class $(name) : $(project) :
$(existing-translation) $(sources)
: [ targets.main-target-requirements $(requirements) : $(project) ]
] ;
@@ -115,13 +115,16 @@ feature gettext.types : : free ;
generators.register-standard gettext.compile : gettext.PO : gettext.catalog ;
rule update-translations-class ( name : project : sources * : requirements )
xclass update-translations-class : basic-target
{
basic-target.__init__ $(name) : $(project) : $(sources) : $(requirements)
: $(default-build) ;
IMPORT gettext : regex.split : $(__name__) : regex.split ;
import regex : split ;
rule __init__ ( name : project : sources * : requirements )
{
basic-target.__init__ $(name) : $(project) : $(sources) : $(requirements)
: $(default-build) ;
}
rule construct ( source-targets * : property-set )
{
local types = [ $(property-set).get <gettext.types> ] ;
@@ -149,13 +152,13 @@ rule update-translations-class ( name : project : sources * : requirements )
if $(right-sources)
{
local new-messages = [ new file-target $(self.name) : gettext.POT : $(self.project) ] ;
local new-messages = [ xnew file-target $(self.name) : gettext.POT : $(self.project) ] ;
local extract =
[ new action $(new-messages) : $(right-sources) : gettext.extract ] ;
[ xnew action $(new-messages) : $(right-sources) : gettext.extract ] ;
$(new-messages).action $(extract) ;
local r = [ new notfile-target $(self.name) : $(self.project) ] ;
local a = [ new action $(r) : $(source-targets[1]) $(new-messages)
local r = [ xnew notfile-target $(self.name) : $(self.project) ] ;
local a = [ xnew action $(r) : $(source-targets[1]) $(new-messages)
: gettext.update-po-dispatch ] ;
$(r).action $(a) ;
.constructed = [ virtual-target.register $(r) ] ;
@@ -172,7 +175,6 @@ rule update-translations-class ( name : project : sources * : requirements )
{
}
}
class update-translations-class : basic-target ;
flags gettext.extract KEYWORD <gettext.keyword> ;
actions extract

View File

@@ -15,8 +15,8 @@ import toolset ;
# lanch test programs.
feature.feature testing.launcher : : optional free ;
xclass unit-test-target-class : basic-target
{
xclass unit-test-target-class : typed-target
{
rule __init__ ( name : project : sources * : requirements *
: default-build * )
{
@@ -40,8 +40,6 @@ xclass unit-test-target-class : basic-target
}
}
class unit-test-target-class : typed-target ;
toolset.flags testing.run LAUNCHER <testing.launcher> ;

View File

@@ -99,13 +99,17 @@ rule apply-default-suffix ( suffix : list * )
local rule __test__ ( )
{
import assert ;
import class : class new ;
import class : xnew ;
assert.result foo bar : ungrist <foo> <bar> ;
assert.result 123 : str 123 ;
local rule test-class__ ( )
xclass test-class__
{
rule __init__ ( )
{
}
rule str ( )
{
return "str-test-class" ;
@@ -121,15 +125,14 @@ local rule __test__ ( )
return "not sure" ;
}
}
class test-class__ ;
assert.result "str-test-class" : str [ new test-class__ ] ;
assert.result "str-test-class" : str [ xnew test-class__ ] ;
assert.true less 1 2 ;
assert.false less 2 1 ;
assert.result "yes, of course!" : less [ new test-class__ ] 1 ;
assert.result "yes, of course!" : less [ xnew test-class__ ] 1 ;
assert.true equal 1 1 ;
assert.false equal 1 2 ;
assert.result "not sure" : equal [ new test-class__ ] 1 ;
assert.result "not sure" : equal [ xnew test-class__ ] 1 ;
assert.result foo.lib foo.a : apply-default-suffix .lib : foo foo.a ;
}