diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..9c0099f --- /dev/null +++ b/.travis.yml @@ -0,0 +1,47 @@ +language: cpp + +branches: + only: + - develop + +notifications: + email: + recipients: + - grafikrobot@gmail.com + on_success: change + on_failure: change + irc: + channels: + - "chat.freenode.net#boost" + template: + - "%{repository}/%{branch} (%{commit} - %{author}): %{build_url}: %{message}" + on_success: change + on_failure: change + +os: + - linux + +matrix: + include: + - compiler: clang + env: TOOLSET=clang-3.4 + - compiler: clang + env: TOOLSET=clang-3.5 + - compiler: clang + env: TOOLSET=clang-3.6 + - compiler: gcc + env: TOOLSET=gcc-4.7 + - compiler: gcc + env: TOOLSET=gcc-4.8 + - compiler: gcc + env: TOOLSET=gcc-4.9 + - compiler: gcc + env: TOOLSET=gcc-5.1 + +before_install: wget "https://raw.githubusercontent.com/boostorg/regression/develop/ci/src/script.py" +install: python script.py install +before_script: python script.py before_script +script: python script.py script +after_success: python script.py after_success +after_failure: python script.py after_failure +after_script: python script.py after_script diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..4a5af02 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,46 @@ +branches: + only: + - develop + +skip_tags: true + +notifications: + - provider: Email + to: + - grafikrobot@gmail.com + on_build_status_changed: true + +environment: + matrix: + - TOOLSET: vs-2008 + platform: 32 + - TOOLSET: vs-2010 + platform: 32 + - TOOLSET: vs-2012 + platform: 32 + - TOOLSET: vs-2012 + platform: 64 + - TOOLSET: vs-2013 + platform: 32 + - TOOLSET: vs-2013 + platform: 64 + +configuration: + - debug + - release + +init: + - cd %APPVEYOR_BUILD_FOLDER%/.. + - appveyor DownloadFile "https://raw.githubusercontent.com/boostorg/regression/develop/ci/src/script.py" + - dir + - cd %APPVEYOR_BUILD_FOLDER% +install: python ../script.py install +before_build: python ../script.py before_build +build_script: python ../script.py build_script +after_build: python ../script.py after_build +before_test: python ../script.py before_test +test_script: python ../script.py test_script +after_test: python ../script.py after_test +on_success: python ../script.py on_success +on_failure: python ../script.py on_failure +on_finish: python ../script.py on_finish diff --git a/check/predef.jam b/check/predef.jam index 0638703..795c333 100644 --- a/check/predef.jam +++ b/check/predef.jam @@ -13,6 +13,7 @@ import string ; import toolset ; import modules ; import path ; +import "class" : new ; # Create a project for our targets. project.extension predef check ; @@ -54,35 +55,42 @@ rule check ( expressions + : language ? : true-properties * : false-properties * local project_target = [ project.target $(__name__) ] ; project.push-current $(project_target) ; + local terms ; local result ; for expression in $(expressions) { - # The check program to use. - local exe_target = [ $(_check_exe_($(language))).name ] ; - exe_target = /check/predef//$(exe_target) ; - - # Create the check run if we don't have one yet. - local key = [ MD5 $(language)::$(expression) ] ; - if ! ( $(key) in $(_checks_) ) + if $(expression:L) in "and" "or" { - _checks_ += $(key) ; - make - $(key).txt : - $(exe_target) : - @$(__name__).predef_check_action : - $(expression) ; - explicit - $(key).txt ; + terms += $(expression:L) ; + } + else + { + # The check program to use. + local exe_target = [ $(_check_exe_($(language))).name ] ; + exe_target = /check/predef//$(exe_target) ; + + # Create the check run if we don't have one yet. + local key = [ MD5 $(language)::$(expression) ] ; + if ! ( $(key) in $(_checks_) ) + { + _checks_ += $(key) ; + _message_(/check/predef//$(key).txt) = $(expression) ; + make + $(key).txt : + $(exe_target) : + @$(__name__).predef_check_action : + $(expression) ; + explicit + $(key).txt ; + } + + terms += /check/predef//$(key).txt ; } - - local check_target = [ check-target-builds - /check/predef//$(key).txt $(expression) - : $(true-properties) - : $(false-properties) ] ; - - result += $(check_target) ; } - project.pop-current ; + local instance = [ new check-expression-evaluator + $(terms) : $(true-properties) : $(false-properties) ] ; + result = @$(instance).check ; + project.pop-current ; return $(result) ; } @@ -104,3 +112,95 @@ actions predef_check_action bind PREDEF_CHECK_EXPRESSION { $(>) "$(PREDEF_CHECK_EXPRESSION)" > $(<) } + +class check-expression-evaluator +{ + import configure ; + + rule __init__ ( expression + : true-properties * : false-properties * ) + { + self.expression = $(expression) ; + self.true-properties = $(true-properties) ; + self.false-properties = $(false-properties) ; + } + + rule check ( properties * ) + { + local to-eval ; + local tokens = "and" "or" ; + # Go through the expression and: eval the target values, + # and normalize to a full expression. + for local term in $(self.expression) + { + if ! ( $(term:L) in $(tokens) ) + { + # A value is a target reference that will evan to "true" + # or "false". + if $(to-eval[-1]:L) && ! ( $(to-eval[-1]:L) in $(tokens) ) + { + # Default to "and" operation. + to-eval += "and" ; + } + local message = [ modules.peek predef : _message_($(term)) ] ; + if [ configure.builds $(term) : $(properties) : $(message) ] + { + to-eval += "true" ; + } + else + { + to-eval += "false" ; + } + } + else + { + to-eval += $(term) ; + } + } + # Eval full the expression. + local eval-result = [ eval $(to-eval) ] ; + # And resolve true/false properties. + if $(eval-result) = "true" + { + return $(self.true-properties) ; + } + else + { + return $(self.false-properties) ; + } + } + + rule eval ( e * ) + { + local r ; + if $(e[1]) && $(e[2]) && $(e[3]) + { + if $(e[2]) = "and" + { + if $(e[1]) = "true" && $(e[3]) = "true" + { + r = [ eval "true" $(e[4-]) ] ; + } + else + { + r = [ eval "false" $(e[4-]) ] ; + } + } + else if $(e[2]) = "or" + { + if $(e[1]) = "true" || $(e[3]) = "true" + { + r = [ eval "true" $(e[4-]) ] ; + } + else + { + r = [ eval "false" $(e[4-]) ] ; + } + } + } + else + { + r = $(e[1]) ; + } + return $(r) ; + } +} diff --git a/check/predef_check.h b/check/predef_check.h new file mode 100644 index 0000000..a6917c1 --- /dev/null +++ b/check/predef_check.h @@ -0,0 +1,98 @@ +/* +Copyright Rene Rivera 2011-2015 +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) +*/ +#include + +const char * str_token(const char ** str, const char * space) +{ + unsigned span; + char * token; + for (; **str != 0; *str += 1) + { + if (0 == strchr(space, **str)) + { + break; + } + } + span = strcspn(*str, space); + token = (char *)malloc(span+1); + strncpy(token, *str, span); + token[span] = 0; + for (*str += span; **str != 0; *str += 1) + { + if (0 == strchr(space, **str)) + { + break; + } + } + return token; +} + +const char * whitespace = " "; +const char * dot = "."; + +int main(int argc, const char ** argv) +{ + unsigned x = 0; + int argi = 1; + create_predef_entries(); +#if 0 + qsort(generated_predef_info,generated_predef_info_count, + sizeof(predef_info),predef_info_compare); + for (x = 0; x < generated_predef_info_count; ++x) + { + printf("%s: %d\n", generated_predef_info[x].name, generated_predef_info[x].value); + } +#endif + int result = -1; + for (argi = 1; argi < argc; ++argi) + { + const char * exp = argv[argi]; + const char * exp_name = str_token(&exp, whitespace); + const char * exp_op = str_token(&exp, whitespace); + const char * exp_val = str_token(&exp, whitespace); + unsigned exp_version = 0; + if (*exp_val != 0) + { + exp = exp_val; + const char * exp_val_a = str_token(&exp, dot); + const char * exp_val_b = str_token(&exp, dot); + const char * exp_val_c = str_token(&exp, dot); + exp_version = BOOST_VERSION_NUMBER(atoi(exp_val_a), atoi(exp_val_b),atoi(exp_val_c)); + } + for (x = 0; x < generated_predef_info_count; ++x) + { + if (*exp_op == 0 && + generated_predef_info[x].value > 0 && + strcmp(exp_name, generated_predef_info[x].name) == 0) + { + /* Expression of the form "BOOST_x_yy" is true. */ + result = 0; + break; + } + else if (*exp_op == 0 && + generated_predef_info[x].value == 0 && + strcmp(exp_name, generated_predef_info[x].name) == 0) + { + /* Expression of the form "BOOST_x_yy" is false. */ + return argi; + } + else if (*exp_op != 0 && *exp_val != 0 && + strcmp(exp_name, generated_predef_info[x].name) == 0) + { + /* Expression of the form "BOOST_x_yy op val". */ + result = 0; + if (0 == strcmp(">",exp_op) && !(generated_predef_info[x].value > exp_version)) return argi; + if (0 == strcmp("<",exp_op) && !(generated_predef_info[x].value < exp_version)) return argi; + if (0 == strcmp(">=",exp_op) && !(generated_predef_info[x].value >= exp_version)) return argi; + if (0 == strcmp("<=",exp_op) && !(generated_predef_info[x].value <= exp_version)) return argi; + if (0 == strcmp("==",exp_op) && !(generated_predef_info[x].value == exp_version)) return argi; + if (0 == strcmp("!=",exp_op) && !(generated_predef_info[x].value != exp_version)) return argi; + } + } + } + return result; +} diff --git a/check/predef_check_as_c.c b/check/predef_check_as_c.c index dcb7d6a..352c18b 100644 --- a/check/predef_check_as_c.c +++ b/check/predef_check_as_c.c @@ -4,116 +4,4 @@ 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) */ -#include -#include -#include - -#define BOOST_PREDEF_INTERNAL_GENERATE_TESTS - -typedef struct predef_info -{ - unsigned tag; - const char * name; - const char * description; - unsigned value; -} predef_info; - -predef_info first_predef_info = { 0x43210DEF , "-" , "-" , 0xFFFFFFFF }; - -#define BOOST_PREDEF_DECLARE_TEST(x,s) \ - predef_info x##_predef_info = { 0x67890DEF , #x , s , x }; -#include - -predef_info last_predef_info = { 0xFFFFFFFF , "-" , "-" , 0x43210DEF }; - -int predef_info_compare(const void * a, const void * b) -{ - const predef_info ** i = (const predef_info **)a; - const predef_info ** j = (const predef_info **)b; - return strcmp((*i)->name,(*j)->name); -} - -const char * str_token(const char ** str, const char * space) -{ - unsigned span; - char * token; - for (; **str != 0; *str += 1) - { - if (0 == strchr(space, **str)) - { - break; - } - } - span = strcspn(*str, space); - token = (char *)malloc(span+1); - strncpy(token, *str, span); - token[span] = 0; - for (*str += span; **str != 0; *str += 1) - { - if (0 == strchr(space, **str)) - { - break; - } - } - return token; -} - -const char * whitespace = " "; -const char * dot = "."; - -int main(int argc, const char ** argv) -{ - unsigned x = 0; - int argi = 1; - predef_info ** predefs = 0; - unsigned predef_count = 0; - unsigned * i = &first_predef_info.tag; - unsigned * e = &last_predef_info.tag; - while (i < e) - { - i += 1; - if (*i == 0x67890DEF) - { - predef_count += 1; - predefs = (predef_info**)realloc(predefs,predef_count*sizeof(predef_info*)); - predefs[predef_count-1] = (predef_info*)i; - } - } - qsort(predefs,predef_count,sizeof(predef_info*),predef_info_compare); - for (argi = 1; argi < argc; ++argi) - { - const char * exp = argv[argi]; - const char * exp_name = str_token(&exp, whitespace); - const char * exp_op = str_token(&exp, whitespace); - const char * exp_val = str_token(&exp, whitespace); - unsigned exp_version = 0; - if (*exp_val != 0) - { - exp = exp_val; - const char * exp_val_a = str_token(&exp, dot); - const char * exp_val_b = str_token(&exp, dot); - const char * exp_val_c = str_token(&exp, dot); - exp_version = BOOST_VERSION_NUMBER(atoi(exp_val_a), atoi(exp_val_b),atoi(exp_val_c)); - } - for (x = 0; x < predef_count; ++x) - { - if (*exp_op == 0 && - predefs[x]->value == 0 && - strcmp(exp_name, predefs[x]->name) == 0) - { - return argi; - } - else if (*exp_op != 0 && *exp_val != 0 && - strcmp(exp_name, predefs[x]->name) == 0) - { - if (0 == strcmp(">",exp_op) && !(predefs[x]->value > exp_version)) return argi; - if (0 == strcmp("<",exp_op) && !(predefs[x]->value < exp_version)) return argi; - if (0 == strcmp(">=",exp_op) && !(predefs[x]->value >= exp_version)) return argi; - if (0 == strcmp("<=",exp_op) && !(predefs[x]->value <= exp_version)) return argi; - if (0 == strcmp("==",exp_op) && !(predefs[x]->value == exp_version)) return argi; - if (0 == strcmp("!=",exp_op) && !(predefs[x]->value != exp_version)) return argi; - } - } - } - return 0; -} +#include "predef_check.h" diff --git a/check/predef_check_as_cpp.cpp b/check/predef_check_as_cpp.cpp index c58abe7..352c18b 100644 --- a/check/predef_check_as_cpp.cpp +++ b/check/predef_check_as_cpp.cpp @@ -1 +1,7 @@ -#include "predef_check_as_c.c" +/* +Copyright Rene Rivera 2011-2015 +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) +*/ +#include "predef_check.h" diff --git a/check/predef_check_as_objc.m b/check/predef_check_as_objc.m index c58abe7..352c18b 100644 --- a/check/predef_check_as_objc.m +++ b/check/predef_check_as_objc.m @@ -1 +1,7 @@ -#include "predef_check_as_c.c" +/* +Copyright Rene Rivera 2011-2015 +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) +*/ +#include "predef_check.h" diff --git a/check/predef_check_as_objcpp.mm b/check/predef_check_as_objcpp.mm index c58abe7..352c18b 100644 --- a/check/predef_check_as_objcpp.mm +++ b/check/predef_check_as_objcpp.mm @@ -1 +1,7 @@ -#include "predef_check_as_c.c" +/* +Copyright Rene Rivera 2011-2015 +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) +*/ +#include "predef_check.h" diff --git a/doc/history.qbk b/doc/history.qbk index 5df5bf1..4c8833f 100644 --- a/doc/history.qbk +++ b/doc/history.qbk @@ -7,6 +7,15 @@ http://www.boost.org/LICENSE_1_0.txt) [section History] +[heading 1.3] + +* Fix many problems with `predef_check` functionality. +* Update SunPro detection to accomodate latest version of compiler from Oracle. +* Addition of Travis-CI and Appveyor testing. +* Add `and` and `or` logical operators for `predef_check` expression on the Boost Build side. +* Fix `BOOST_ARCH_PARISC` to correctly spelled name (from Graham Hanson). +* Fix `MAKE_YYYYM` macros to correctly limit the month (from rick68). + [heading 1.2] * Account for skip in Visual Studio product version vs. compiler version. diff --git a/doc/html/boostbook.css b/doc/html/boostbook.css index d42b3c0..28f8935 100644 --- a/doc/html/boostbook.css +++ b/doc/html/boostbook.css @@ -289,6 +289,22 @@ Tables border: none !important; } +/*============================================================================= +Suppress margins in tables +=============================================================================*/ + + table th > *:first-child, + table td > *:first-child + { + margin-top: 0; + } + + table th > *:last-child, + table td > *:last-child + { + margin-bottom: 0; + } + /*============================================================================= Blurbs =============================================================================*/ diff --git a/doc/html/index.html b/doc/html/index.html index 8a4dde7..4e9d22c 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -1,10 +1,10 @@ -Predef 1.2 +Predef 1.3 - + @@ -13,11 +13,12 @@

-Predef 1.2

+Predef 1.3

Rene Rivera

-
+

Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -53,7 +54,7 @@

- +

Last revised: January 29, 2015 at 21:39:36 GMT

Last revised: July 01, 2015 at 22:17:15 GMT


diff --git a/doc/html/predef/acknoledgements.html b/doc/html/predef/acknoledgements.html index 9f73605..1a97b32 100644 --- a/doc/html/predef/acknoledgements.html +++ b/doc/html/predef/acknoledgements.html @@ -4,8 +4,8 @@ Acknoledgements - - + + @@ -35,7 +35,8 @@
-
-
-

+ 1.3 +

+
    +
  • + Fix many problems with predef_check + functionality. +
  • +
  • + Update SunPro detection to accomodate latest version of compiler from Oracle. +
  • +
  • + Addition of Travis-CI and Appveyor testing. +
  • +
  • + Add and and or logical operators for predef_check + expression on the Boost Build side. +
  • +
  • + Fix BOOST_ARCH_PARISC to + correctly spelled name (from Graham Hanson). +
  • +
  • + Fix MAKE_YYYYM macros to + correctly limit the month (from rick68). +
  • +
+

+ 1.2

    @@ -42,7 +70,7 @@

- + 1.1

    @@ -84,7 +112,8 @@
-
-
-
-
-
-
-
-
-
-
-
-
-