|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r68736 - in sandbox/SOC/2011: . boost boost/checks libs libs/checks libs/checks/doc libs/checks/doc/html libs/checks/doc/html/boost_checks libs/checks/example libs/checks/test
From: muriloufg_at_[hidden]
Date: 2011-02-08 18:55:30
Author: murilov
Date: 2011-02-08 18:55:23 EST (Tue, 08 Feb 2011)
New Revision: 68736
URL: http://svn.boost.org/trac/boost/changeset/68736
Log:
- First steps
Added:
sandbox/SOC/2011/Jamroot (contents, props changed)
sandbox/SOC/2011/boost/
sandbox/SOC/2011/boost.png (contents, props changed)
sandbox/SOC/2011/boost/checks/
sandbox/SOC/2011/boost/checks/isbn.hpp (contents, props changed)
sandbox/SOC/2011/libs/
sandbox/SOC/2011/libs/checks/
sandbox/SOC/2011/libs/checks/doc/
sandbox/SOC/2011/libs/checks/doc/Jamfile.v2 (contents, props changed)
sandbox/SOC/2011/libs/checks/doc/checks.qbk (contents, props changed)
sandbox/SOC/2011/libs/checks/doc/html/
sandbox/SOC/2011/libs/checks/doc/html/boost_checks/
sandbox/SOC/2011/libs/checks/doc/html/boost_checks/isbn_checking.html (contents, props changed)
sandbox/SOC/2011/libs/checks/doc/html/index.html (contents, props changed)
sandbox/SOC/2011/libs/checks/example/
sandbox/SOC/2011/libs/checks/test/
Added: sandbox/SOC/2011/Jamroot
==============================================================================
--- (empty file)
+++ sandbox/SOC/2011/Jamroot 2011-02-08 18:55:23 EST (Tue, 08 Feb 2011)
@@ -0,0 +1,704 @@
+# Copyright Vladimir Prus 2002-2006.
+# Copyright Dave Abrahams 2005-2006.
+# Copyright Rene Rivera 2005-2007.
+# Copyright Douglas Gregor 2005.
+#
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+# Usage:
+#
+# bjam [options] [properties] [install|stage]
+#
+# Builds and installs Boost.
+#
+# Targets and Related Options:
+#
+# install Install headers and compiled library files to the
+# ======= configured locations (below).
+#
+# --prefix=<PREFIX> Install architecture independent files here.
+# Default; C:\Boost on Win32
+# Default; /usr/local on Unix. Linux, etc.
+#
+# --exec-prefix=<EPREFIX> Install architecture dependent files here.
+# Default; <PREFIX>
+#
+# --libdir=<DIR> Install library files here.
+# Default; <EPREFIX>/lib
+#
+# --includedir=<HDRDIR> Install header files here.
+# Default; <PREFIX>/include
+#
+# stage Build and install only compiled library files
+# ===== to the stage directory.
+#
+# --stagedir=<STAGEDIR> Install library files here
+# Default; ./stage
+#
+# Other Options:
+#
+# --build-type=<type> Build the specified pre-defined set of variations
+# of the libraries. Note, that which variants get
+# built depends on what each library supports.
+#
+# minimal (default) - Builds a minimal set of
+# variants. On Windows, these are static
+# multithreaded libraries in debug and release
+# modes, using shared runtime. On Linux, these
+# are static and shared multithreaded libraries
+# in release mode.
+#
+# complete - Build all possible variations.
+#
+# --build-dir=DIR Build in this location instead of building
+# within the distribution tree. Recommended!
+#
+# --show-libraries Displays the list of Boost libraries that require
+# build and installation steps, then exit.
+#
+# --layout=<layout> Determines whether to choose library names
+# and header locations such that multiple
+# versions of Boost or multiple compilers can
+# be used on the same system.
+#
+# versioned - Names of boost binaries
+# include the Boost version number, name and
+# version of the compiler and encoded build
+# properties. Boost headers are installed in a
+# subdirectory of <HDRDIR> whose name contains
+# the Boost version number.
+#
+# tagged -- Names of boost binaries include the
+# encoded build properties such as variant and
+# threading, but do not including compiler name
+# and version, or Boost version. This option is
+# useful if you build several variants of Boost,
+# using the same compiler.
+#
+# system - Binaries names do not include the
+# Boost version number or the name and version
+# number of the compiler. Boost headers are
+# installed directly into <HDRDIR>. This option
+# is intended for system integrators who are
+# building distribution packages.
+#
+# The default value is 'versioned' on Windows, and
+# 'system' on Unix.
+#
+# --buildid=ID Adds the specified ID to the name of built
+# libraries. The default is to not add anything.
+#
+# --help This message.
+#
+# --with-<library> Build and install the specified <library>
+# If this option is used, only libraries
+# specified using this option will be built.
+#
+# --without-<library> Do not build, stage, or install the specified
+# <library>. By default, all libraries are built.
+#
+# Properties:
+#
+# toolset=toolset Indicates the toolset to build with.
+#
+# variant=debug|release Select the build variant
+#
+# link=static|shared Whether to build static or shared libraries
+#
+# threading=single|multi Whether to build single or multithreaded binaries
+#
+# runtime-link=static|shared
+# Whether to link to static or shared C and C++ runtime.
+#
+
+# TODO:
+# - handle boost version
+# - handle python options such as pydebug
+
+import generate ;
+import modules ;
+import set ;
+import stage ;
+import package ;
+import path ;
+import common ;
+import os ;
+import regex ;
+import errors ;
+import "class" : new ;
+import common ;
+import sequence ;
+import symlink ;
+import targets ;
+import project ;
+import option ;
+
+path-constant BOOST_ROOT : . ;
+constant BOOST_VERSION : 1.42.0 ;
+constant BOOST_JAMROOT_MODULE : $(__name__) ;
+
+local version-tag = [ MATCH "^([^.]+)[.]([^.]+)[.]([^.]+)" : $(BOOST_VERSION) ]
+ ;
+if $(version-tag[3]) = 0
+{
+ version-tag = $(version-tag[1-2]) ;
+}
+
+constant BOOST_VERSION_TAG : $(version-tag:J="_") ;
+
+# Option to choose how many variants to build. The default is "minimal".
+local build-type = [ MATCH "^--build-type=(.*)" : [ modules.peek : ARGV ] ] ;
+build-type ?= minimal ;
+if ! ( $(build-type) in minimal complete )
+{
+ ECHO "The value of the --build-type option should be either 'complete' or 'minimal'" ;
+ EXIT ;
+}
+
+rule handle-static-runtime ( properties * )
+{
+ # Using static runtime with shared libraries is impossible on Linux,
+ # and dangerous on Windows. Therefore, we disallow it. This might
+ # be drastic, but it was disabled for a while with nobody complaining.
+
+ # For CW, static runtime is needed so that std::locale works.
+ if <link>shared in $(properties) && <runtime-link>static in $(properties) &&
+ ! ( <toolset>cw in $(properties) )
+ {
+ ECHO "error: link=shared together with runtime-link=static is not allowed" ;
+ ECHO "error: such property combination is either impossible " ;
+ ECHO "error: or too dangerious to be of any use" ;
+ EXIT ;
+ }
+}
+
+
+project boost
+ : requirements <include>.
+ # Disable auto-linking for all targets here, primarily because it caused
+ # troubles with V2.
+ <define>BOOST_ALL_NO_LIB=1
+ # Used to encode variant in target name. See the 'tag' rule below.
+ <tag>@$(__name__).tag
+ <conditional>@handle-static-runtime
+ # The standard library Sun compilers use by default has no chance
+ # of working with Boost. Override it.
+ <toolset>sun:<stdlib>sun-stlport
+ : usage-requirements <include>.
+ : build-dir bin.v2
+ ;
+
+
+# Setup convenient aliases for all libraries.
+
+all-libraries = [ MATCH .*libs/(.*)/build/.* : [ glob libs/*/build/Jamfile.v2 ]
+ [ glob libs/*/build/Jamfile ] ]
+ ;
+
+all-libraries = [ sequence.unique $(all-libraries) ] ;
+# The function_types library has a Jamfile, but it's used for maintenance
+# purposes, there's no library to build and install.
+all-libraries = [ set.difference $(all-libraries) : function_types ] ;
+
+
+local rule explicit-alias ( id : targets + )
+{
+ alias $(id) : $(targets) ;
+ explicit $(id) ;
+}
+
+
+# First, the complicated libraries: where the target name in Jamfile is
+# different from its directory name.
+explicit-alias prg_exec_monitor : libs/test/build//boost_prg_exec_monitor ;
+explicit-alias test_exec_monitor : libs/test/build//boost_test_exec_monitor ;
+explicit-alias unit_test_framework : libs/test/build//boost_unit_test_framework ;
+explicit-alias bgl-vis : libs/graps/build//bgl-vis ;
+explicit-alias serialization : libs/serialization/build//boost_serialization ;
+explicit-alias wserialization : libs/serialization/build//boost_wserialization ;
+for local l in $(all-libraries)
+{
+ if ! $(l) in test graph serialization
+ {
+ explicit-alias $(l) : libs/$(l)/build//boost_$(l) ;
+ }
+}
+
+alias headers : : : : <include>. ;
+
+
+# Decides which libraries are to be installed by looking at --with-<library>
+# --without-<library> arguments. Returns the list of directories under "libs"
+# which must be built and installed.
+#
+rule libraries-to-install ( existing-libraries * )
+{
+ local argv = [ modules.peek : ARGV ] ;
+ local with-parameter = [ MATCH --with-(.*) : $(argv) ] ;
+ local without-parameter = [ MATCH --without-(.*) : $(argv) ] ;
+
+ if ! $(with-parameter) && ! $(without-parameter)
+ {
+ # Nothing is specified on command line. See if maybe
+ # project-config.jam has some choices.
+ local project-config-libs = [ modules.peek project-config : libraries ] ;
+ with-parameter = [ MATCH --with-(.*) : $(project-config-libs) ] ;
+ without-parameter = [ MATCH --without-(.*) : $(project-config-libs) ] ;
+ }
+
+ # Do some checks.
+ if $(with-parameter) && $(without-parameter)
+ {
+ ECHO "error: both --with-<library> and --without-<library> specified" ;
+ EXIT ;
+ }
+
+ local wrong = [ set.difference $(with-parameter) : $(existing-libraries) ] ;
+ if $(wrong)
+ {
+ ECHO "error: wrong library name '$(wrong[1])' in the --with-<library> option." ;
+ EXIT ;
+ }
+ local wrong = [ set.difference $(without-parameter) : $(existing-libraries) ] ;
+ if $(wrong)
+ {
+ ECHO "error: wrong library name '$(wrong[1])' in the --without-<library> option." ;
+ EXIT ;
+ }
+
+ if $(with-parameter)
+ {
+ return [ set.intersection $(existing-libraries) : $(with-parameter) ] ;
+ }
+ else
+ {
+ return [ set.difference $(existing-libraries) : $(without-parameter) ] ;
+ }
+}
+
+
+# What kind of layout are we doing?
+layout = [ option.get layout : "" ] ;
+# On Windows, we used versioned layout by default in order to
+# be compatible with autolink. On other systems, we use system
+# layout which is what every other program uses. Note that windows
+# check is static, and won't
+if ! $(layout)
+{
+ if [ modules.peek : NT ]
+ {
+ layout = versioned ;
+ }
+ else
+ {
+ layout = system ;
+ }
+}
+layout-$(layout) = true ;
+
+if $(layout) = system && $(build-type) = complete
+{
+ ECHO "error: Cannot use --layout=system with --build-type complete." ;
+ ECHO "error: Please used either --layout=versioned or --layout=tagged " ;
+ ECHO "error: if you wish to build multiple variants." ;
+ if ! [ modules.peek : NT ]
+ {
+ ECHO "error: Note that --layout=system is default on Unix starting with Boost 1.40." ;
+ }
+ EXIT ;
+}
+
+# Possible stage only location.
+local stage-locate = [ MATCH "^--stagedir=(.*)" : [ modules.peek : ARGV ] ] ;
+stage-locate ?= stage ;
+path-constant BOOST_STAGE_LOCATE : $(stage-locate) ;
+
+
+# Python location.
+local python-root = [ MATCH "^--with-python-root=(.*)" : [ modules.peek : ARGV ]
+ ] ;
+PYTHON_ROOT ?= $(python-root) ;
+
+
+# Select the libraries to install.
+libraries = [ libraries-to-install $(all-libraries) ] ;
+
+if --show-libraries in [ modules.peek : ARGV ]
+{
+ ECHO "The following libraries require building:" ;
+ for local l in $(libraries)
+ {
+ ECHO " - $(l)" ;
+ }
+ EXIT ;
+}
+
+# Custom build ID.
+local build-id = [ MATCH "^--buildid=(.*)" : [ modules.peek : ARGV ] ] ;
+if $(build-id)
+{
+ constant BUILD_ID : [ regex.replace $(build-id) "[*\\/:.\"\' ]" "_" ] ;
+}
+
+
+# This rule is called by Boost.Build to determine the name of target. We use it
+# to encode the build variant, compiler name and boost version in the target
+# name.
+#
+rule tag ( name : type ? : property-set )
+{
+ if $(type) in STATIC_LIB SHARED_LIB IMPORT_LIB
+ {
+ local result ;
+ if $(layout) = versioned
+ {
+ result = [ common.format-name
+ <base> <toolset> <threading> <runtime> -$(BOOST_VERSION_TAG)
+ -$(BUILD_ID)
+ : $(name) : $(type) : $(property-set) ] ;
+ }
+ else if $(layout) = tagged
+ {
+ result = [ common.format-name
+ <base> <threading> <runtime>
+ -$(BUILD_ID)
+ : $(name) : $(type) : $(property-set) ] ;
+ }
+ else if $(layout) = system
+ {
+ result = [ common.format-name
+ <base>
+ -$(BUILD_ID)
+ : $(name) : $(type) : $(property-set) ] ;
+ }
+ else
+ {
+ ECHO "error: invalid layout '$(layout)'" ;
+ EXIT ;
+ }
+
+ # Optionally add version suffix. On NT, library with version suffix
+ # will not be recognized by linkers. On CYGWIN, we get strage
+ # duplicate symbol errors when library is generated with version
+ # suffix. On OSX, version suffix is not needed -- the linker expects
+ # the libFoo.1.2.3.dylib format. AIX linkers do not accept version
+ # suffixes either. Pgi compilers can not accept library with version
+ # suffix.
+ if $(type) = SHARED_LIB &&
+ ( ! ( [ $(property-set).get <target-os> ] in windows cygwin darwin aix ) &&
+ ! ( [ $(property-set).get <toolset> ] in pgi ) )
+ {
+ result = $(result).$(BOOST_VERSION) ;
+ }
+
+ return $(result) ;
+ }
+}
+
+
+# Install to system location.
+
+install-requirements = <install-source-root>$(BOOST_ROOT)/boost ;
+
+if $(layout-versioned)
+{
+ install-requirements += <install-header-subdir>boost-$(BOOST_VERSION_TAG)/boost ;
+}
+else
+{
+ install-requirements += <install-header-subdir>boost ;
+}
+if [ modules.peek : NT ]
+{
+ install-requirements += <install-default-prefix>C:/Boost ;
+}
+else if [ modules.peek : UNIX ]
+{
+ install-requirements += <install-default-prefix>/usr/local ;
+}
+
+local headers =
+ # The .SUNWCCh files are present in tr1 include directory and have to be installed,
+ # see http://lists.boost.org/Archives/boost/2007/05/121430.php
+ [ path.glob-tree $(BOOST_ROOT)/boost : *.hpp *.ipp *.h *.inc *.SUNWCCh : CVS .svn ]
+ [ path.glob-tree $(BOOST_ROOT)/boost/compatibility/cpp_c_headers : c* : CVS .svn ]
+ [ path.glob boost/tr1/tr1 : * : bcc32 sun CVS .svn ]
+ ;
+
+# Complete install.
+package.install install-proper
+ : $(install-requirements) <install-no-version-symlinks>on
+ :
+ : libs/$(libraries)/build
+ : $(headers)
+ ;
+explicit install-proper ;
+
+# Install just library.
+install stage-proper
+ : libs/$(libraries)/build
+ : <location>$(stage-locate)/lib
+ <install-dependencies>on <install-type>LIB
+ <install-no-version-symlinks>on
+ ;
+explicit stage-proper ;
+
+
+if $(layout-versioned) && ( [ modules.peek : NT ] || [ modules.peek : UNIX ] )
+{
+ rule make-unversioned-links ( project name ? : property-set : sources * )
+ {
+ local result ;
+ local filtered ;
+ local pattern ;
+ local nt = [ modules.peek : NT ] ;
+
+ # Collect the libraries that have the version number in 'filtered'.
+ for local s in $(sources)
+ {
+ local m ;
+ if $(nt)
+ {
+ m = [ MATCH "(.*[.]lib)" : [ $(s).name ] ] ;
+ }
+ else
+ {
+ m = [ MATCH "(.*[.]so[.0-9]+)" "(.*[.]dylib)" "(.*[.]a)" :
+ [ $(s).name ] ] ;
+ }
+ if $(m)
+ {
+ filtered += $(s) ;
+ }
+ }
+
+ # Create links without version.
+ for local s in $(filtered)
+ {
+ local name = [ $(s).name ] ;
+ local ea = [ $(s).action ] ;
+ local ep = [ $(ea).properties ] ;
+ local a = [ new non-scanning-action $(s) : symlink.ln : $(ep) ] ;
+
+ local noversion-file ;
+ if $(nt)
+ {
+ noversion-file = [ MATCH "(.*)-[0-9_]+(.*[.]lib)" : $(name) ] ;
+ }
+ else
+ {
+ noversion-file =
+ [ MATCH "(.*)-[0-9_]+(.*[.]so)[.0-9]*" : $(name) ]
+ [ MATCH "(.*)-[0-9_]+(.*[.]dylib)" : $(name) ]
+ [ MATCH "(.*)-[0-9_]+(.*[.]a)" : $(name) ]
+ [ MATCH "(.*)-[0-9_]+(.*[.]dll[.]a)" : $(name) ] ;
+ }
+
+ local new-name =
+ $(noversion-file[1])$(noversion-file[2]) ;
+ result += [ new file-target $(new-name) exact : [ $(s).type ] : $(project)
+ : $(a) ] ;
+
+ }
+ return $(result) ;
+ }
+
+ generate stage-unversioned : stage-proper :
+ <generating-rule>@make-unversioned-links ;
+ explicit stage-unversioned ;
+
+ generate install-unversioned : install-proper :
+ <generating-rule>@make-unversioned-links ;
+ explicit install-unversioned ;
+}
+else
+{
+ # Create do-nothing aliases.
+ alias stage-unversioned ;
+ explicit stage-unversioned ;
+ alias install-unversioned ;
+ explicit install-unversioned ;
+}
+
+# This is a special metatarget class that handles the --build-type=complete
+# option.
+class top-level-target : alias-target-class
+{
+ import modules ;
+ import errors ;
+
+ rule __init__ ( name : project : sources * : requirements *
+ : default-build * : usage-requirements * )
+ {
+ alias-target-class.__init__ $(name) : $(project) : $(sources) :
+ $(requirements) : $(default-build) : $(usage-requirements) ;
+
+ local m = [ $(project).project-module ] ;
+ self.build-type = [ modules.peek $(m) : build-type ] ;
+ # On Linux, we build release variant by default, since few users will
+ # ever want to debug C++ Boost libraries, and there's no ABI
+ # incompatibility between debug and release variants. We build
+ # shared and static libraries since that's what most packages
+ # seem to provide (.so in libfoo and .a in libfoo-dev).
+ self.minimal-properties = [ property-set.create
+ <variant>release <threading>multi <link>shared <link>static <runtime-link>shared ] ;
+ # On Windows, new IDE projects use:
+ #
+ # runtime-link=dynamic, threading=multi, variant=(debug|release)
+ #
+ # and in addition, C++ Boost's autolink defaults to static linking.
+ self.minimal-properties-win = [ property-set.create
+ <variant>debug <variant>release <threading>multi <link>static <runtime-link>shared ] ;
+
+ self.complete-properties = [ property-set.create
+ <variant>debug <variant>release
+ <threading>single <threading>multi
+ <link>shared <link>static
+ <runtime-link>shared <runtime-link>static ] ;
+ }
+
+ rule generate ( property-set )
+ {
+ if $(self.build-type) = minimal
+ {
+ local expanded ;
+
+ local os = [ $(property-set).get <target-os> ] ;
+ # Because we completely override parent's 'generate'
+ # we need to check for default value of feature ourself.
+ if ! $(os)
+ {
+ os = [ feature.defaults <target-os> ] ;
+ os = $(os:G=) ;
+ }
+
+ if $(os) = windows
+ {
+ expanded = [ targets.apply-default-build $(property-set)
+ : $(self.minimal-properties-win) ] ;
+ }
+ else
+ {
+ expanded = [ targets.apply-default-build $(property-set)
+ : $(self.minimal-properties) ] ;
+ }
+ return [ build-multiple $(expanded) ] ;
+ }
+ else if $(self.build-type) = complete
+ {
+ local expanded = [ targets.apply-default-build $(property-set)
+ : $(self.complete-properties) ] ;
+
+ # Filter inappopriate combinations
+ local filtered ;
+ for local p in $(expanded)
+ {
+ # See comment in handle-static-runtime regarding this logic.
+ if [ $(p).get <link> ] = shared && [ $(p).get <runtime-link> ] = static
+ && [ $(p).get <toolset> ] != cw
+ {
+ # Skip this
+ }
+ else
+ {
+ filtered += $(p) ;
+ }
+ }
+ return [ build-multiple $(filtered) ] ;
+ }
+ else
+ {
+ errors.error "Unknown build type" ;
+ }
+ }
+
+ rule build-multiple ( property-sets * )
+ {
+ local usage-requirements = [ property-set.empty ] ;
+ local result ;
+ for local p in $(property-sets)
+ {
+ local r = [ alias-target-class.generate $(p) ] ;
+ if $(r)
+ {
+ usage-requirements = [ $(usage-requirements).add $(r[1]) ] ;
+ result += $(r[2-]) ;
+ }
+ }
+ return $(usage-requirements) [ sequence.unique $(result) ] ;
+ }
+
+}
+
+targets.create-metatarget top-level-target : [ project.current ]
+ : install
+ : install-proper install-unversioned
+ ;
+targets.create-metatarget top-level-target : [ project.current ]
+ : stage
+ : stage-proper stage-unversioned
+ ;
+
+explicit install ;
+explicit stage ;
+
+stage-abs = [ path.native [ path.root $(stage-locate)/lib [ path.pwd ] ] ] ;
+
+# This target is built by default, and will forward to 'stage'
+# after producing some explanations.
+targets.create-metatarget top-level-target : [ project.current ]
+ : forward
+ : explain stage
+ ;
+
+
+message explain :
+"\nBuilding the Boost C++ Libraries.
+
+After the build, the headers will be located at
+
+ $(BOOST_ROOT)
+
+The libraries will be located at
+
+ $(stage-abs)
+
+Use 'bjam install --prefix=<path>' if you wish to install headers and
+libraries to a different location and remove the source tree.\n\n"
+ ;
+
+# This rule should be called from libraries' Jamfiles and will create two
+# targets, "install" and "stage", that will install or stage that library. The
+# --prefix option is respected, but --with and --without options, naturally, are
+# ignored.
+#
+# - libraries -- list of library targets to install.
+#
+rule boost-install ( libraries * )
+{
+ package.install install
+ : <dependency>/boost//install-proper-headers $(install-requirements)
+ : # No binaries
+ : $(libraries)
+ : # No headers, it is handled by the dependency.
+ ;
+
+ install stage : $(libraries) : <location>$(BOOST_STAGE_LOCATE) ;
+
+ local c = [ project.current ] ;
+ local project-module = [ $(c).project-module ] ;
+ module $(project-module)
+ {
+ explicit stage ;
+ explicit install ;
+ }
+}
+
+
+# Make project ids of all libraries known.
+for local l in $(all-libraries)
+{
+ use-project /boost/$(l) : libs/$(l)/build ;
+}
Added: sandbox/SOC/2011/boost.png
==============================================================================
Binary file. No diff available.
Added: sandbox/SOC/2011/boost/checks/isbn.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2011/boost/checks/isbn.hpp 2011-02-08 18:55:23 EST (Tue, 08 Feb 2011)
@@ -0,0 +1,63 @@
+// Boost checks/isbn.hpp header file ------------------------------------//
+// (C) Copyright Murilo Adriano Vasconcelos 2011.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#ifndef BOOST_ISBN_INCLUDED
+#define BOOST_ISBN_INCLUDED
+
+#include <string>
+
+namespace boost {
+
+/**
+ * This function checks if a `isbn' is a valid ISBN
+ */
+bool is_isbn(const std::string& isbn)
+{
+ if (isbn.size() != 10) return false;
+
+ int check = 0;
+ for (int i = 0; i < 9; ++i) {
+ if (!isdigit(isbn[i])) {
+ return false;
+ }
+
+ check += (10 - i) * isbn[i];
+ }
+
+ check += (isbn[9] == 'x' || isbn[9] == 'X') ? 10 : isbn[9];
+
+ return (check % 11 == 0);
+}
+
+/**
+ * This function computes the check digit for a given ISBN in `isbn'
+ */
+char isbn_check_digit(const std::string& isbn)
+{
+ int check = 0;
+ for (int i = 0; i < 9; ++i) {
+ if (!isdigit(isbn[i])) {
+ return false;
+ }
+
+ check += (10 - i) * isbn[i];
+ }
+
+ check += (isbn[9] == 'x' || isbn[9] == 'X') ? 10 : isbn[9];
+ check %= 11;
+
+ if (check == 0) {
+ return '0';
+ }
+ check = 11 - check;
+
+ return (check == 10) ? 'X' : (check + '0');
+}
+
+} // namespace boost
+
+#endif
\ No newline at end of file
Added: sandbox/SOC/2011/libs/checks/doc/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/SOC/2011/libs/checks/doc/Jamfile.v2 2011-02-08 18:55:23 EST (Tue, 08 Feb 2011)
@@ -0,0 +1,55 @@
+# Copyright John Maddock 2005. Use, modification, and distribution are
+# subject to the Boost Software License, Version 1.0. (See accompanying
+# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+using quickbook ;
+
+xml checks : checks.qbk ;
+boostbook standalone
+ :
+ checks
+ :
+ # HTML options first:
+ # Use graphics not text for navigation:
+ <xsl:param>navig.graphics=1
+ # How far down we chunk nested sections, basically all of them:
+ <xsl:param>chunk.section.depth=1
+ # Don't put the first section on the same page as the TOC:
+ <xsl:param>chunk.first.sections=0
+ # How far down sections get TOC's
+ <xsl:param>toc.section.depth=1
+ # Max depth in each TOC:
+ <xsl:param>toc.max.depth=1
+ # How far down we go with TOC's
+ <xsl:param>generate.section.toc.level=4
+ # Path for links to Boost:
+ <xsl:param>boost.root=../../../..
+ # Path for libraries index:
+ <xsl:param>boost.libraries=../../../../libs/libraries.htm
+ # Use the main Boost stylesheet:
+ <xsl:param>html.stylesheet=../../../../doc/html/boostbook.css
+
+ # PDF Options:
+ # TOC Generation: this is needed for FOP-0.9 and later:
+ <xsl:param>fop1.extensions=0
+ # Or enable this if you're using XEP:
+ <xsl:param>xep.extensions=1
+ # TOC generation: this is needed for FOP 0.2, but must not be set to zero for FOP-0.9!
+ <xsl:param>fop.extensions=0
+ # No indent on body text:
+ <xsl:param>body.start.indent=0pt
+ # Margin size:
+ <xsl:param>page.margin.inner=0.5in
+ # Margin size:
+ <xsl:param>page.margin.outer=0.5in
+ # Yes, we want graphics for admonishments:
+ <xsl:param>admon.graphics=1
+ # Set this one for PDF generation *only*:
+ # default pnd graphics are awful in PDF form,
+ # better use SVG's instead:
+ <format>pdf:<xsl:param>admon.graphics.extension=".svg"
+ <format>pdf:<xsl:param>admon.graphics.path=$(boost-images)/
+ <format>pdf:<xsl:param>boost.url.prefix=http://www.boost.org/doc/libs/release/libs/regex/doc/html
+ ;
+
+install pdf-install : standalone : <location>. <install-type>PDF ;
Added: sandbox/SOC/2011/libs/checks/doc/checks.qbk
==============================================================================
--- (empty file)
+++ sandbox/SOC/2011/libs/checks/doc/checks.qbk 2011-02-08 18:55:23 EST (Tue, 08 Feb 2011)
@@ -0,0 +1,42 @@
+[article Boost.Checks
+ [quickbook 1.5]
+ [copyright 2011 Murilo Adriano Vasconcelos]
+ [purpose Creation and validation of check digits]
+ [license
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ [@http://www.boost.org/LICENSE_1_0.txt])
+ ]
+ [authors [Vasconcelos, Murilo Adriano]]
+ [/last-revision $Date: 2011-02-08 12:58:15 +0000 (Tue, 02 Feb 2011) $]
+]
+
+[template super[x]'''<superscript>'''[x]'''</superscript>''']
+
+[section:checks Boost.Checks]
+
+[section Overview]
+The intent of this library is to provide a collection of functions for validating and creating check digits.
+[endsect]
+
+[endsect]
+
+[section ISBN checking]
+The functions defined at [@../../../../boost/checks/isbn.hpp <boost/checks/isbn.hpp>] are for validating and computing check digits of [http://en.wikipedia.org/wiki/International_Standard_Book_Number ISBN] strings.
+
+[section Synopsis]
+ /**
+ * This function checks if a `isbn' is a valid ISBN
+ */
+ bool is_isbn(const std::string& isbn);
+
+ /**
+ * This function computes the check digit for a given ISBN in `isbn'
+ */
+ char isbn_check_digit(const std::string& isbn);
+
+[endsect]
+
+Both functions assume that `isbn` is a 10-digit ISBN
+
+[endsect]
\ No newline at end of file
Added: sandbox/SOC/2011/libs/checks/doc/html/boost_checks/isbn_checking.html
==============================================================================
--- (empty file)
+++ sandbox/SOC/2011/libs/checks/doc/html/boost_checks/isbn_checking.html 2011-02-08 18:55:23 EST (Tue, 08 Feb 2011)
@@ -0,0 +1,67 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>ISBN checking</title>
+<link rel="stylesheet" href="../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
+<link rel="home" href="../index.html" title="Boost.Checks">
+<link rel="up" href="../index.html" title="Boost.Checks">
+<link rel="prev" href="../index.html" title="Boost.Checks">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../index.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a>
+</div>
+<div class="section" title="ISBN checking">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="boost_checks.isbn_checking"></a><a class="link" href="isbn_checking.html" title="ISBN checking">ISBN checking</a>
+</h2></div></div></div>
+<div class="toc"><dl><dt><span class="section">Synopsis</span></dt></dl></div>
+<p>
+ The functions defined at <boost/checks/isbn.hpp>
+ are for validating and computing check digits of [http://en.wikipedia.org/wiki/International_Standard_Book_Number
+ ISBN] strings.
+ </p>
+<div class="section" title="Synopsis">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_checks.isbn_checking.synopsis"></a><a class="link" href="isbn_checking.html#boost_checks.isbn_checking.synopsis" title="Synopsis">Synopsis</a>
+</h3></div></div></div>
+<pre class="programlisting"><span class="comment">/**
+ * This function checks if a `isbn' is a valid ISBN
+ */</span>
+<span class="keyword">bool</span> <span class="identifier">is_isbn</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&</span> <span class="identifier">isbn</span><span class="special">);</span>
+
+<span class="comment">/**
+ * This function computes the check digit for a given ISBN in `isbn'
+ */</span>
+<span class="keyword">char</span> <span class="identifier">isbn_check_digit</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&</span> <span class="identifier">isbn</span><span class="special">);</span>
+</pre>
+</div>
+<p>
+ Both functions assume that <code class="computeroutput"><span class="identifier">isbn</span></code>
+ is a 10-digit ISBN
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2011 Murilo Adriano Vasconcelos<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../index.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a>
+</div>
+</body>
+</html>
Added: sandbox/SOC/2011/libs/checks/doc/html/index.html
==============================================================================
--- (empty file)
+++ sandbox/SOC/2011/libs/checks/doc/html/index.html 2011-02-08 18:55:23 EST (Tue, 08 Feb 2011)
@@ -0,0 +1,69 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Boost.Checks</title>
+<link rel="stylesheet" href="../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
+<link rel="home" href="index.html" title="Boost.Checks">
+<link rel="next" href="boost_checks/isbn_checking.html" title="ISBN checking">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav"><a accesskey="n" href="boost_checks/isbn_checking.html"><img src="../../../../doc/html/images/next.png" alt="Next"></a></div>
+<div class="article" title="Boost.Checks">
+<div class="titlepage">
+<div>
+<div><h2 class="title">
+<a name="boost_checks"></a>Boost.Checks</h2></div>
+<div><div class="authorgroup"><div class="author"><h3 class="author">
+<span class="firstname">Murilo Adriano</span> <span class="surname">Vasconcelos</span>
+</h3></div></div></div>
+<div><p class="copyright">Copyright © 2011 Murilo Adriano Vasconcelos</p></div>
+<div><div class="legalnotice" title="Legal Notice">
+<a name="id36182815"></a><p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></div>
+</div>
+<hr>
+</div>
+<div class="toc">
+<p><b>Table of Contents</b></p>
+<dl>
+<dt><span class="section"> Boost.Checks</span></dt>
+<dt><span class="section">ISBN checking</span></dt>
+</dl>
+</div>
+<div class="section" title="Boost.Checks">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="boost_checks.checks"></a><a class="link" href="index.html#boost_checks.checks" title="Boost.Checks"> Boost.Checks</a>
+</h2></div></div></div>
+<div class="toc"><dl><dt><span class="section">Overview</span></dt></dl></div>
+<div class="section" title="Overview">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_checks.checks.overview"></a><a class="link" href="index.html#boost_checks.checks.overview" title="Overview">Overview</a>
+</h3></div></div></div>
+<p>
+ The intent of this library is to provide a collection of functions for validating
+ and creating check digits.
+ </p>
+</div>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"><p><small>Last revised: February 08, 2011 at 23:26:27 GMT</small></p></td>
+<td align="right"><div class="copyright-footer"></div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav"><a accesskey="n" href="boost_checks/isbn_checking.html"><img src="../../../../doc/html/images/next.png" alt="Next"></a></div>
+</body>
+</html>
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