|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r83298 - in sandbox/contract/libs/contract/generate/boost: . contract/detail/preprocessor/array contract/detail/preprocessor/facilities contract/detail/preprocessor/keyword contract/detail/preprocessor/traits/aux_ contract/detail/preprocessor/traits/func contract/detail/preprocessor/tuple
From: lorcaminiti_at_[hidden]
Date: 2013-03-04 17:41:10
Author: lcaminiti
Date: 2013-03-04 17:41:09 EST (Mon, 04 Mar 2013)
New Revision: 83298
URL: http://svn.boost.org/trac/boost/changeset/83298
Log:
Updated automatic code generation scripts.
Added:
sandbox/contract/libs/contract/generate/boost/contract-generate.py
- copied, changed from r83221, /sandbox/contract/libs/contract/generate/boost/generate.py
sandbox/contract/libs/contract/generate/boost/contract/detail/preprocessor/keyword/
sandbox/contract/libs/contract/generate/boost/contract/detail/preprocessor/keyword/generate.py (contents, props changed)
Removed:
sandbox/contract/libs/contract/generate/boost/generate.py
Text files modified:
sandbox/contract/libs/contract/generate/boost/contract-generate.py | 18 +
sandbox/contract/libs/contract/generate/boost/contract/detail/preprocessor/array/first_n-generate.py | 34 ++-
sandbox/contract/libs/contract/generate/boost/contract/detail/preprocessor/array/rest_n-generate.py | 34 ++-
sandbox/contract/libs/contract/generate/boost/contract/detail/preprocessor/facilities/is_digit-generate.py | 41 +++-
sandbox/contract/libs/contract/generate/boost/contract/detail/preprocessor/traits/aux_/apply-generate.py | 55 ++++--
sandbox/contract/libs/contract/generate/boost/contract/detail/preprocessor/traits/aux_/list-generate.py | 217 +++++++++++++++-----------
sandbox/contract/libs/contract/generate/boost/contract/detail/preprocessor/traits/aux_/select_assertion_-generate.py | 141 +++++++++--------
sandbox/contract/libs/contract/generate/boost/contract/detail/preprocessor/traits/func/catches-generate.py | 123 ++++++++------
sandbox/contract/libs/contract/generate/boost/contract/detail/preprocessor/traits/func/postconditions-generate.py | 319 +++++++++++++++++++++------------------
sandbox/contract/libs/contract/generate/boost/contract/detail/preprocessor/tuple/split-generate.py | 26 ++-
10 files changed, 562 insertions(+), 446 deletions(-)
Copied: sandbox/contract/libs/contract/generate/boost/contract-generate.py (from r83221, /sandbox/contract/libs/contract/generate/boost/generate.py)
==============================================================================
--- /sandbox/contract/libs/contract/generate/boost/generate.py (original)
+++ sandbox/contract/libs/contract/generate/boost/contract-generate.py 2013-03-04 17:41:09 EST (Mon, 04 Mar 2013)
@@ -7,6 +7,7 @@
import os
+boost_dir = "../../../../boost"
scripts = [
("contract/detail/preprocessor/array", "first_n-generate.py"),
("contract/detail/preprocessor/array", "rest_n-generate.py"),
@@ -18,17 +19,22 @@
("contract/detail/preprocessor/traits/func", "catches-generate.py"),
("contract/detail/preprocessor/traits/func", "postconditions-generate.py"),
("contract/detail/preprocessor/tuple", "split-generate.py"),
+ ("contract/detail/preprocessor/keyword", "generate.py"),
]
-root = os.getcwd()
+this_dir = os.getcwd()
for s in scripts:
- dir = s[0]
- cmd = "python " + s[1]
+ py_dir = s[0]
+ py_name = s[1]
+ header_dir = os.path.join(boost_dir, py_dir)
+ for i in range(0, py_dir.count("/") + 1):
+ header_dir = os.path.join("..", header_dir)
+ cmd = "python " + py_name + " " + header_dir
print
- print dir + "$ " + cmd
- os.chdir(dir)
+ print "[" + py_dir + "]$ " + cmd
+ os.chdir(py_dir)
os.system(cmd)
- os.chdir(root)
+ os.chdir(this_dir)
print
print "Done. (Add any missing generation Python script to this script.)",
Modified: sandbox/contract/libs/contract/generate/boost/contract/detail/preprocessor/array/first_n-generate.py
==============================================================================
--- sandbox/contract/libs/contract/generate/boost/contract/detail/preprocessor/array/first_n-generate.py (original)
+++ sandbox/contract/libs/contract/generate/boost/contract/detail/preprocessor/array/first_n-generate.py 2013-03-04 17:41:09 EST (Mon, 04 Mar 2013)
@@ -6,8 +6,13 @@
# Home at http://sourceforge.net/projects/contractpp
import sys
+import os
import shutil
+# $ python <NAME>-generate.py [DIR]
+header = sys.argv[0].replace("-generate.py", ".hpp", 1)
+if(len(sys.argv) > 1): header = os.path.join(sys.argv[1], header)
+
def placeholders(start, stop):
(s, comma) = ('', '')
for i in range(start, stop):
@@ -19,32 +24,33 @@
for size in range(1, max_size + 1):
for index in range(1, size + 1):
s = s + '''
-#define CONTRACT_DETAIL_PP_ARRAY_FIRST_N_{0}_{1}({2}) \\
+#define BOOST_CONTRACT_DETAIL_PP_ARRAY_FIRST_N_{0}_{1}({2}) \\
({1}, ({3})) \
'''.format(size, index, placeholders(0, size), placeholders(0, index))
return s
BOOST_PP_LIMIT_TUPLE = raw_input("BOOST_PP_LIMIT_TUPLE" +
- " from <boost/preprocessor/limits.hpp> [64] = ")
+ " (as in <boost/preprocessor/limits.hpp>) [64] = ")
if BOOST_PP_LIMIT_TUPLE == "": BOOST_PP_LIMIT_TUPLE = 64
else: BOOST_PP_LIMIT_TUPLE = int(BOOST_PP_LIMIT_TUPLE)
-header = sys.argv[0].replace("-generate.py", ".hpp", 1)
-shutil.copyfile(header, header + ".bak")
+try: shutil.copyfile(header, header + ".bak")
+except: pass
h = open(header, 'w')
h.write('''
-#ifndef CONTRACT_DETAIL_PP_ARRAY_FIRST_N_HPP_
-#define CONTRACT_DETAIL_PP_ARRAY_FIRST_N_HPP_
-
-// WARNING: FILE AUTOMATICALLY GENERATED, DO NOT MODIFY IT!
-// Instead modify the generation script "<FILE>-generate.py" and run
-// `$ python <FILE_NAME>-generate.py > FILE_NAME.hpp`.
+/*************************************************************/
+/* WARNING: FILE AUTOMATICALLY GENERATED, DO NOT MODIFY IT! */
+/* Instead modify the generation script "<FILE>-generate.py" */
+/*************************************************************/
// Used: #define BOOST_PP_LIMIT_TUPLE {0}
+#ifndef BOOST_CONTRACT_DETAIL_PP_ARRAY_FIRST_N_HPP_
+#define BOOST_CONTRACT_DETAIL_PP_ARRAY_FIRST_N_HPP_
+
#include <boost/preprocessor/limits.hpp>
#if BOOST_PP_LIMIT_TUPLE != {0}
-#error "Code generation used incorrect BOOST_PP_LIMIT_TUPLE"
+# error "Code generation used incorrect BOOST_PP_LIMIT_TUPLE"
#endif
#include <boost/preprocessor/cat.hpp>
@@ -53,8 +59,8 @@
// PUBLIC //
-#define CONTRACT_DETAIL_PP_ARRAY_FIRST_N(n, array) \\
- BOOST_PP_CAT(CONTRACT_DETAIL_PP_ARRAY_FIRST_N_, \\
+#define BOOST_CONTRACT_DETAIL_PP_ARRAY_FIRST_N(n, array) \\
+ BOOST_PP_CAT(BOOST_CONTRACT_DETAIL_PP_ARRAY_FIRST_N_, \\
BOOST_PP_CAT(BOOST_PP_ARRAY_SIZE(array), BOOST_PP_CAT(_, n))) \\
BOOST_PP_ARRAY_DATA(array)
@@ -66,5 +72,5 @@
'''.format(BOOST_PP_LIMIT_TUPLE, data(BOOST_PP_LIMIT_TUPLE)))
h.close()
-print "Written", header
+print "Generated:", header
Modified: sandbox/contract/libs/contract/generate/boost/contract/detail/preprocessor/array/rest_n-generate.py
==============================================================================
--- sandbox/contract/libs/contract/generate/boost/contract/detail/preprocessor/array/rest_n-generate.py (original)
+++ sandbox/contract/libs/contract/generate/boost/contract/detail/preprocessor/array/rest_n-generate.py 2013-03-04 17:41:09 EST (Mon, 04 Mar 2013)
@@ -6,8 +6,13 @@
# Home at http://sourceforge.net/projects/contractpp
import sys
+import os
import shutil
+# $ python <NAME>-generate.py [DIR]
+header = sys.argv[0].replace("-generate.py", ".hpp", 1)
+if(len(sys.argv) > 1): header = os.path.join(sys.argv[1], header)
+
def placeholders(start, stop):
(s, comma) = ('', '')
for i in range(start, stop):
@@ -19,33 +24,34 @@
for size in range(1, max_size + 1):
for index in range(1, size):
s = s + '''
-#define CONTRACT_DETAIL_PP_ARRAY_REST_N_{0}_{1}({2}) \\
+#define BOOST_CONTRACT_DETAIL_PP_ARRAY_REST_N_{0}_{1}({2}) \\
({3}, ({4})) \
'''.format(size, index, placeholders(0, size), str(size - index),
placeholders(index, size))
return s
BOOST_PP_LIMIT_TUPLE = raw_input("BOOST_PP_LIMIT_TUPLE" +
- " from <boost/preprocessor/limits.hpp> [64] = ")
+ " (as in <boost/preprocessor/limits.hpp>) [64] = ")
if BOOST_PP_LIMIT_TUPLE == "": BOOST_PP_LIMIT_TUPLE = 64
else: BOOST_PP_LIMIT_TUPLE = int(BOOST_PP_LIMIT_TUPLE)
-header = sys.argv[0].replace("-generate.py", ".hpp", 1)
-shutil.copyfile(header, header + ".bak")
+try: shutil.copyfile(header, header + ".bak")
+except: pass
h = open(header, 'w')
h.write('''
-#ifndef CONTRACT_DETAIL_PP_ARRAY_REST_N_HPP_
-#define CONTRACT_DETAIL_PP_ARRAY_REST_N_HPP_
-
-// WARNING: FILE AUTOMATICALLY GENERATED, DO NOT MODIFY IT!
-// Instead modify the generation script "<FILE>-generate.py" and run
-// `$ python <FILE_NAME>-generate.py > FILE_NAME.hpp`.
+/*************************************************************/
+/* WARNING: FILE AUTOMATICALLY GENERATED, DO NOT MODIFY IT! */
+/* Instead modify the generation script "<FILE>-generate.py" */
+/*************************************************************/
// Used: #define BOOST_PP_LIMIT_TUPLE {0}
+#ifndef BOOST_CONTRACT_DETAIL_PP_ARRAY_REST_N_HPP_
+#define BOOST_CONTRACT_DETAIL_PP_ARRAY_REST_N_HPP_
+
#include <boost/preprocessor/limits.hpp>
#if BOOST_PP_LIMIT_TUPLE != {0}
-#error "Code generation used incorrect BOOST_PP_LIMIT_TUPLE"
+# error "Code generation used incorrect BOOST_PP_LIMIT_TUPLE"
#endif
#include <boost/preprocessor/cat.hpp>
@@ -54,8 +60,8 @@
// PUBLIC //
-#define CONTRACT_DETAIL_PP_ARRAY_REST_N(n, array) \\
- BOOST_PP_CAT(CONTRACT_DETAIL_PP_ARRAY_REST_N_, \\
+#define BOOST_CONTRACT_DETAIL_PP_ARRAY_REST_N(n, array) \\
+ BOOST_PP_CAT(BOOST_CONTRACT_DETAIL_PP_ARRAY_REST_N_, \\
BOOST_PP_CAT(BOOST_PP_ARRAY_SIZE(array), BOOST_PP_CAT(_, n))) \\
BOOST_PP_ARRAY_DATA(array)
@@ -67,5 +73,5 @@
'''.format(BOOST_PP_LIMIT_TUPLE, data(BOOST_PP_LIMIT_TUPLE)))
h.close()
-print "Written", header
+print "Generated:", header
Modified: sandbox/contract/libs/contract/generate/boost/contract/detail/preprocessor/facilities/is_digit-generate.py
==============================================================================
--- sandbox/contract/libs/contract/generate/boost/contract/detail/preprocessor/facilities/is_digit-generate.py (original)
+++ sandbox/contract/libs/contract/generate/boost/contract/detail/preprocessor/facilities/is_digit-generate.py 2013-03-04 17:41:09 EST (Mon, 04 Mar 2013)
@@ -6,41 +6,52 @@
# Home at http://sourceforge.net/projects/contractpp
import sys
+import os
import shutil
+# $ python <NAME>-generate.py [DIR]
+header = sys.argv[0].replace("-generate.py", ".hpp", 1)
+if(len(sys.argv) > 1): header = os.path.join(sys.argv[1], header)
+
def data(max_size):
s = ''
for i in range(0, max_size + 1): # 0 and max_size included in range.
s = s + '''
-#define CONTRACT_DETAIL_PP_IS_DIGIT_{0} (1) /* unary */ \
+#define BOOST_CONTRACT_DETAIL_PP_IS_DIGIT_{0} (1) /* unary */ \
'''.format(i)
return s
BOOST_PP_LIMIT_MAG = raw_input("BOOST_PP_LIMIT_MAG" +
- " from <boost/preprocessor/limits.hpp> [256] = ")
+ " (as in <boost/preprocessor/limits.hpp>) [256] = ")
if BOOST_PP_LIMIT_MAG == "": BOOST_PP_LIMIT_MAG = 256
else: BOOST_PP_LIMIT_MAG = int(BOOST_PP_LIMIT_MAG)
-header = sys.argv[0].replace("-generate.py", ".hpp", 1)
-shutil.copyfile(header, header + ".bak")
+try: shutil.copyfile(header, header + ".bak")
+except: pass
h = open(header, 'w')
h.write('''
-#ifndef CONTRACT_DETAIL_PP_IS_DIGIT_HPP_
-#define CONTRACT_DETAIL_PP_IS_DIGIT_HPP_
-
-// WARNING: FILE AUTOMATICALLY GENERATED, DO NOT MODIFY IT!
-// Instead modify the generation script "<FILE>-generate.py" and run
-// `$ python <FILE_NAME>-generate.py > FILE_NAME.hpp`.
+/*************************************************************/
+/* WARNING: FILE AUTOMATICALLY GENERATED, DO NOT MODIFY IT! */
+/* Instead modify the generation script "<FILE>-generate.py" */
+/*************************************************************/
// Used: #define BOOST_PP_LIMIT_MAG {0}
-#include <contract/detail/preprocessor/keyword/facilities/is.hpp>
+#ifndef BOOST_CONTRACT_DETAIL_PP_IS_DIGIT_HPP_
+#define BOOST_CONTRACT_DETAIL_PP_IS_DIGIT_HPP_
+
+#include <boost/contract/detail/preprocessor/keyword/facilities/is.hpp>
+
+#include <boost/preprocessor/limits.hpp>
+#if BOOST_PP_LIMIT_MAG != {0}
+# error "Code generation used incorrect BOOST_PP_LIMIT_MAG"
+#endif
// PUBLIC //
-#define CONTRACT_DETAIL_PP_IS_DIGIT(tokens) \\
- CONTRACT_DETAIL_PP_KEYWORD_FACILITY_IS_FRONT(tokens, \\
- CONTRACT_DETAIL_PP_IS_DIGIT_)
+#define BOOST_CONTRACT_DETAIL_PP_IS_DIGIT(tokens) \\
+ BOOST_CONTRACT_DETAIL_PP_KEYWORD_FACILITY_IS_FRONT(tokens, \\
+ BOOST_CONTRACT_DETAIL_PP_IS_DIGIT_)
// DATA //
{1}
@@ -50,5 +61,5 @@
'''.format(BOOST_PP_LIMIT_MAG, data(BOOST_PP_LIMIT_MAG)))
h.close()
-print "Written", header
+print "Generated:", header
Added: sandbox/contract/libs/contract/generate/boost/contract/detail/preprocessor/keyword/generate.py
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/generate/boost/contract/detail/preprocessor/keyword/generate.py 2013-03-04 17:41:09 EST (Mon, 04 Mar 2013)
@@ -0,0 +1,183 @@
+
+# Copyright (C) 2008-2012 Lorenzo Caminiti
+# Distributed under the Boost Software License, Version 1.0
+# (see accompanying file LICENSE_1_0.txt or a copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+# Home at http://sourceforge.net/projects/contractpp
+
+import sys
+import os
+import shutil
+
+keywords = [
+ ("", "and")
+ , ("", "and_eq")
+ , ("", "asm")
+ , ("", "auto")
+ , ("", "bitand")
+ , ("", "bitor")
+ , ("", "bool")
+ , ("", "break")
+ , ("", "case")
+ , ("", "catch")
+ , ("", "char")
+ , ("", "class")
+ , ("", "compl")
+ , ("", "const")
+ , ("", "const_cast")
+ , ("", "continue")
+ , ("", "default")
+ , ("", "delete")
+ , ("", "do")
+ , ("", "double")
+ , ("", "dynamic_cast")
+ , ("", "else")
+ , ("", "enum")
+ , ("", "explicit")
+ , ("", "export")
+ , ("", "extern")
+ , ("", "false")
+ , ("", "float")
+ , ("", "for")
+ , ("", "friend")
+ , ("", "goto")
+ , ("", "if")
+ , ("", "inline")
+ , ("", "int")
+ , ("", "long")
+ , ("", "mutable")
+ , ("", "namespace")
+ , ("", "new")
+ , ("", "not")
+ , ("", "not_eq")
+ , ("", "operator")
+ , ("", "or")
+ , ("", "or_eq")
+ , ("", "private")
+ , ("", "protected")
+ , ("", "public")
+ , ("", "register")
+ , ("", "reinterpret_cast")
+ , ("", "return")
+ , ("", "short")
+ , ("", "signed")
+ , ("", "sizeof")
+ , ("", "static")
+ , ("", "static_cast")
+ , ("", "struct")
+ , ("", "switch")
+ , ("", "template")
+ , ("", "this")
+ , ("", "throw")
+ , ("", "true")
+ , ("", "try")
+ , ("", "typedef")
+ , ("", "typeid")
+ , ("", "typename")
+ , ("", "union")
+ , ("", "unsigned")
+ , ("", "using")
+ , ("", "virtual")
+ , ("", "void")
+ , ("", "volatile")
+ , ("", "wchar_t")
+ , ("", "while")
+ , ("", "xor")
+ , ("", "xor_eq")
+ , ("cstddef", "ptrdiff_t")
+ , ("cstddef", "size_t")
+ , ("cxx11", "char16_t")
+ , ("cxx11", "char32_t")
+ , ("cxx11", "constexpr")
+ , ("cxx11", "decltype")
+ , ("cxx11", "final")
+ , ("cxx11", "nullptr")
+ , ("cxx11", "override")
+ , ("cxx11", "static_assert")
+ , ("cxx11/cstddef", "nullptr_t")
+ , ("contract", "comma")
+ , ("contract", "deduce")
+ , ("contract", "extends")
+ , ("contract", "in")
+ , ("contract", "initialize")
+ , ("contract", "out")
+ , ("contract", "postcondition")
+ , ("contract", "precondition")
+ , ("contract", "requires")
+]
+
+for k in keywords:
+ dir = k[0]
+ keyword = k[1]
+
+ # $ python generate.py [DIR]
+ header = keyword + ".hpp"
+ if(dir != ""): header = os.path.join(dir, header)
+ if(len(sys.argv) > 1): header = os.path.join(sys.argv[1], header)
+
+ try: shutil.copyfile(header, header + ".bak")
+ except: pass
+ h = open(header, 'w')
+
+ h.write('''
+/**************************************************************/
+/* WARNING: FILE AUTOMATICALLY GENERATED, DO NOT MODIFY IT! */
+/* Instead modify the generation script "keyword/generate.py" */
+/**************************************************************/
+
+#ifndef BOOST_CONTRACT_DETAIL_PP_KEYWORD_{0}_HPP_
+#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_{0}_HPP_
+
+#include <boost/contract/detail/preprocessor/keyword/facilities/is.hpp>
+#include <boost/contract/detail/preprocessor/keyword/facilities/add.hpp>
+#include <boost/contract/detail/preprocessor/keyword/facilities/remove.hpp>
+
+// PRIVATE //
+
+// These are not local macros -- DO NOT #UNDEF.
+#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_{0}_IS_{1} (1) /* unary */
+#define {1}_BOOST_CONTRACT_DETAIL_PP_KEYWORD_{0}_IS (1) /* unary */
+#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_{0}_REMOVE_{1} /* nothing */
+#define {1}_BOOST_CONTRACT_DETAIL_PP_KEYWORD_{0}_REMOVE /* nothing */
+
+// PUBLIC //
+
+// Is.
+
+#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_IS_{0}_FRONT(tokens) \\
+ BOOST_CONTRACT_DETAIL_PP_KEYWORD_FACILITY_IS_FRONT(tokens, \\
+ BOOST_CONTRACT_DETAIL_PP_KEYWORD_{0}_IS_)
+
+#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_IS_{0}_BACK(token) \\
+ BOOST_CONTRACT_DETAIL_PP_KEYWORD_FACILITY_IS_BACK(token, \\
+ _BOOST_CONTRACT_DETAIL_PP_KEYWORD_{0}_IS)
+
+// Remove.
+
+#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_{0}_REMOVE_FRONT(tokens) \\
+ BOOST_CONTRACT_DETAIL_PP_KEYWORD_FACILITY_REMOVE_FRONT(tokens, \\
+ BOOST_CONTRACT_DETAIL_PP_KEYWORD_IS_{0}_FRONT, \\
+ BOOST_CONTRACT_DETAIL_PP_KEYWORD_{0}_REMOVE_)
+
+#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_{0}_REMOVE_BACK(tokens) \\
+ BOOST_CONTRACT_DETAIL_PP_KEYWORD_FACILITY_REMOVE_BACK(tokens, \\
+ BOOST_CONTRACT_DETAIL_PP_KEYWORD_IS_{0}_BACK, \\
+ _BOOST_CONTRACT_DETAIL_PP_KEYWORD_{0}_REMOVE)
+
+// Add.
+
+#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_{0}_ADD_FRONT(tokens) \\
+ BOOST_CONTRACT_DETAIL_PP_KEYWORD_FACILITY_ADD_FRONT(tokens, \\
+ BOOST_CONTRACT_DETAIL_PP_KEYWORD_IS_{0}_FRONT, {1})
+
+#define BOOST_CONTRACT_DETAIL_PP_KEYWORD_{0}_ADD_BACK(tokens) \\
+ BOOST_CONTRACT_DETAIL_PP_KEYWORD_FACILITY_ADD_BACK(tokens, \\
+ BOOST_CONTRACT_DETAIL_PP_KEYWORD_IS_{0}_BACK, {1})
+
+#endif // #include guard
+
+'''.format(keyword.upper(), keyword))
+
+ h.close()
+ print "Generated:", header
+
Modified: sandbox/contract/libs/contract/generate/boost/contract/detail/preprocessor/traits/aux_/apply-generate.py
==============================================================================
--- sandbox/contract/libs/contract/generate/boost/contract/detail/preprocessor/traits/aux_/apply-generate.py (original)
+++ sandbox/contract/libs/contract/generate/boost/contract/detail/preprocessor/traits/aux_/apply-generate.py 2013-03-04 17:41:09 EST (Mon, 04 Mar 2013)
@@ -6,9 +6,10 @@
# Home at http://sourceforge.net/projects/contractpp
import sys
+import os
import shutil
-iterations = raw_input("maximum iterations [1] = ")
+iterations = raw_input("Maximum number of iterations [1] = ")
if iterations == "": iterations = 1
else: iterations = int(iterations)
@@ -16,19 +17,24 @@
if i == 0: p = ''
else: p = '_' + str(i)
+ # $ python <NAME>-generate.py [DIR]
header = sys.argv[0].replace("-generate.py", p + ".hpp", 1)
- shutil.copyfile(header, header + ".bak")
+ if(len(sys.argv) > 1): header = os.path.join(sys.argv[1], header)
+
+ try: shutil.copyfile(header, header + ".bak")
+ except: pass
h = open(header, 'w')
h.write('''
-#ifndef CONTRACT_DETAIL_PP_TRAITS_AUX_APPLY{0}_HPP_
-#define CONTRACT_DETAIL_PP_TRAITS_AUX_APPLY{0}_HPP_
-
-// WARNING: FILE AUTOMATICALLY GENERATED, DO NOT MODIFY IT!
-// Instead modify the generation script "<FILE>-generate.py" and run
-// `$ python <FILE_NAME>-generate.py > FILE_NAME.hpp`.
+/*************************************************************/
+/* WARNING: FILE AUTOMATICALLY GENERATED, DO NOT MODIFY IT! */
+/* Instead modify the generation script "<FILE>-generate.py" */
+/*************************************************************/
// Used maximum number of iterations: {1}
+#ifndef BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_APPLY{0}_HPP_
+#define BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_APPLY{0}_HPP_
+
#include <boost/preprocessor/config/config.hpp>
#include <boost/preprocessor/arithmetic/inc.hpp>
#include <boost/preprocessor/array/data.hpp>
@@ -42,23 +48,30 @@
// From BOOST_PP_ARRAY_PUSH_BACK.
#if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
-# define CONTRACT_DETAIL_PP_TRAITS_AUX_ARRAY_PUSH_BACK{0}_(array, elem) \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_ARRAY_PUSH_BACK_I_( \\
+# define BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_ARRAY_PUSH_BACK{0}_( \\
+ array, elem) \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_ARRAY_PUSH_BACK_I_( \\
BOOST_PP_ARRAY_SIZE(array), BOOST_PP_ARRAY_DATA(array), elem)
#else
-# define CONTRACT_DETAIL_PP_TRAITS_AUX_ARRAY_PUSH_BACK{0}_(array, elem) \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_ARRAY_PUSH_BACK_D{0}_(array, elem)
-# define CONTRACT_DETAIL_PP_TRAITS_AUX_ARRAY_PUSH_BACK_D{0}_(array, elem) \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_ARRAY_PUSH_BACK_I_( \\
+# define BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_ARRAY_PUSH_BACK{0}_( \\
+ array, elem) \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_ARRAY_PUSH_BACK_D{0}_(array, elem)
+# define BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_ARRAY_PUSH_BACK_D{0}_( \\
+ array, elem) \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_ARRAY_PUSH_BACK_I_( \\
BOOST_PP_ARRAY_SIZE(array), BOOST_PP_ARRAY_DATA(array), elem)
#endif
-#define CONTRACT_DETAIL_PP_TRAITS_AUX_ARRAY_PUSH_BACK_I{0}_(size, data, elem) \\
- (BOOST_PP_INC(size), \\
- (BOOST_PP_TUPLE_REM(size) data BOOST_PP_COMMA_IF(size) elem))
+#define BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_ARRAY_PUSH_BACK_I{0}_( \\
+ size, data, elem) \\
+ ( \\
+ BOOST_PP_INC(size) \\
+ , \\
+ (BOOST_PP_TUPLE_REM(size) data BOOST_PP_COMMA_IF(size) elem) \\
+ )
// PROTECTED //
-#define CONTRACT_DETAIL_PP_TRAITS_AUX_APPLY_INIT{0}( \\
+#define BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_APPLY_INIT{0}( \\
traits_sign, trait_macro, sign_macro) \\
( \\
( 1 /* create 1-array */, ( trait_macro( \\
@@ -69,10 +82,10 @@
// Expand to next `traits_sign` applying `trait_macro(sign)` and
// `sign_macro(macro)`.
-#define CONTRACT_DETAIL_PP_TRAITS_AUX_APPLY{0}( \\
+#define BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_APPLY{0}( \\
traits_sign, trait_macro, sign_macro) \\
( \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_ARRAY_PUSH_BACK{0}_( \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_ARRAY_PUSH_BACK{0}_( \\
BOOST_PP_TUPLE_ELEM(2, 0, traits_sign), \\
trait_macro(BOOST_PP_TUPLE_ELEM(2, 1, traits_sign))) \\
, \\
@@ -84,5 +97,5 @@
'''.format(p, iterations))
h.close()
- print "Written:", header
+ print "Generated:", header
Modified: sandbox/contract/libs/contract/generate/boost/contract/detail/preprocessor/traits/aux_/list-generate.py
==============================================================================
--- sandbox/contract/libs/contract/generate/boost/contract/detail/preprocessor/traits/aux_/list-generate.py (original)
+++ sandbox/contract/libs/contract/generate/boost/contract/detail/preprocessor/traits/aux_/list-generate.py 2013-03-04 17:41:09 EST (Mon, 04 Mar 2013)
@@ -6,9 +6,10 @@
# Home at http://sourceforge.net/projects/contractpp
import sys
+import os
import shutil
-iterations = raw_input("maximum iterations [1] = ")
+iterations = raw_input("Maximum number of iterations [1] = ")
if iterations == "": iterations = 1
else: iterations = int(iterations)
@@ -16,25 +17,30 @@
if i == 0: p = ''
else: p = '_' + str(i)
+ # $ python <NAME>-generate.py [DIR]
header = sys.argv[0].replace("-generate.py", p + ".hpp", 1)
- shutil.copyfile(header, header + ".bak")
+ if(len(sys.argv) > 1): header = os.path.join(sys.argv[1], header)
+
+ try: shutil.copyfile(header, header + ".bak")
+ except: pass
h = open(header, 'w')
h.write('''
-#ifndef CONTRACT_DETAIL_PP_TRAITS_AUX_LIST{0}_HPP_
-#define CONTRACT_DETAIL_PP_TRAITS_AUX_LIST{0}_HPP_
-
-// WARNING: FILE AUTOMATICALLY GENERATED, DO NOT MODIFY IT!
-// Instead modify the generation script "<FILE>-generate.py" and run
-// `$ python <FILE_NAME>-generate.py > FILE_NAME.hpp`.
+/*************************************************************/
+/* WARNING: FILE AUTOMATICALLY GENERATED, DO NOT MODIFY IT! */
+/* Instead modify the generation script "<FILE>-generate.py" */
+/*************************************************************/
// Used maximum number of iterations: {1}
-#include <contract/aux_/config.hpp>
-#include <contract/detail/preprocessor/punctuation/has_paren.hpp>
-#include <contract/detail/preprocessor/keyword/default.hpp>
-#include <contract/detail/preprocessor/keyword/void.hpp>
-#include <contract/detail/preprocessor/keyword/facilities/is.hpp>
-#include <contract/detail/preprocessor/keyword/facilities/remove.hpp>
+#ifndef BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_LIST{0}_HPP_
+#define BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_LIST{0}_HPP_
+
+#include <boost/contract/aux_/config.hpp>
+#include <boost/contract/detail/preprocessor/punctuation/has_paren.hpp>
+#include <boost/contract/detail/preprocessor/keyword/default.hpp>
+#include <boost/contract/detail/preprocessor/keyword/void.hpp>
+#include <boost/contract/detail/preprocessor/keyword/facilities/is.hpp>
+#include <boost/contract/detail/preprocessor/keyword/facilities/remove.hpp>
#include <boost/preprocessor/config/config.hpp>
#include <boost/preprocessor/control/iif.hpp>
#include <boost/preprocessor/tuple/elem.hpp>
@@ -46,45 +52,51 @@
// PRIVATE //
-#define CHECK_CONTRACT_DETAIL_PP_TRAITS_AUX_TAGGED_LIST_REMOVE{0} (1)
-#define ERASE_CONTRACT_DETAIL_PP_TRAITS_AUX_TAGGED_LIST_REMOVE{0} /* nothing */
-
-#define CONTRACT_DETAIL_PP_TRAITS_AUX_TAGGED_LIST_REMOVE_CHECK{0}_(tokens) \\
- BOOST_PP_IIF(CONTRACT_DETAIL_PP_HAS_PAREN(tokens), \\
+#define CHECK_BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_TAGGED_LIST_REMOVE{0} (1)
+#define ERASE_BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_TAGGED_LIST_REMOVE{0} \\
+ /* nothing */
+
+#define BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_TAGGED_LIST_REMOVE_CHECK{0}_( \\
+ tokens) \\
+ BOOST_PP_IIF(BOOST_CONTRACT_DETAIL_PP_HAS_PAREN(tokens), \\
0 BOOST_PP_TUPLE_EAT(2) \\
, \\
- CONTRACT_DETAIL_PP_KEYWORD_FACILITY_IS_FRONT \\
+ BOOST_CONTRACT_DETAIL_PP_KEYWORD_FACILITY_IS_FRONT \\
)(tokens, CHECK_)
-#define CONTRACT_DETAIL_PP_TRAITS_AUX_TAGGED_LIST_REMOVE_ERASE{0}_(tokens) \\
- CONTRACT_DETAIL_PP_KEYWORD_FACILITY_REMOVE_FRONT(tokens, \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_TAGGED_LIST_REMOVE_CHECK{0}_, ERASE_)
+#define BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_TAGGED_LIST_REMOVE_ERASE{0}_( \\
+ tokens) \\
+ BOOST_CONTRACT_DETAIL_PP_KEYWORD_FACILITY_REMOVE_FRONT(tokens, \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_TAGGED_LIST_REMOVE_CHECK{0}_, \\
+ ERASE_)
// From PP_EXPAND (my own reentrant version).
-#if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() && ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_DMC()
-# define CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_EXPAND{0}_(x) \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_EXPAND_I{0}_(x)
+#if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() && \\
+ ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_DMC()
+# define BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_EXPAND{0}_(x) \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_EXPAND_I{0}_(x)
#else
-# define CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_EXPAND{0}_(x) \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_EXPAND_OO{0}_((x))
-# define CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_EXPAND_OO{0}_(par) \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_EXPAND_I{0}_ ## par
+# define BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_EXPAND{0}_(x) \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_EXPAND_OO{0}_((x))
+# define BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_EXPAND_OO{0}_(par) \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_EXPAND_I{0}_ ## par
#endif
-#define CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_EXPAND_I{0}_(x) x
+#define BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_EXPAND_I{0}_(x) x
-#define CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_DFLT_OP_LASTDFLT{0}_( \\
+#define \\
+BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_DFLT_OP_LASTDFLT{0}_( \\
s, elem, list, last_default, elem_macro) \\
( \\
list /* unchanged list */ \\
, \\
/* set last-default */ \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_COMMA(BOOST_PP_TUPLE_REM(1), \\
- CONTRACT_DETAIL_PP_KEYWORD_DEFAULT_REMOVE_FRONT(elem)) \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_COMMA(BOOST_PP_TUPLE_REM(1), \\
+ BOOST_CONTRACT_DETAIL_PP_KEYWORD_DEFAULT_REMOVE_FRONT(elem)) \\
, \\
elem_macro /* unchanged op-macro */ \\
) \\
-#define CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_DFLT_OP_ELEM{0}_( \\
+#define BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_DFLT_OP_ELEM{0}_( \\
s, elem, list, last_default, elem_macro) \\
( \\
/* append elem_macro(elem) (in front because FOLD_RIGHT) */ \\
@@ -102,26 +114,36 @@
elem_macro /* unchanged op-macro */ \\
)
-#define CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_DFLT_OP{0}_( \\
+#define BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_DFLT_OP{0}_( \\
s, list_lastdefault_macro, elem) \\
- BOOST_PP_IIF(CONTRACT_DETAIL_PP_KEYWORD_IS_DEFAULT_FRONT(elem), \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_DFLT_OP_LASTDFLT{0}_ \\
+ BOOST_PP_IIF(BOOST_CONTRACT_DETAIL_PP_KEYWORD_IS_DEFAULT_FRONT(elem), \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_DFLT_OP_LASTDFLT{0}_\\
, \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_DFLT_OP_ELEM{0}_ \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_DFLT_OP_ELEM{0}_ \\
)(s, elem, \\
BOOST_PP_TUPLE_ELEM(3, 0, list_lastdefault_macro), \\
BOOST_PP_TUPLE_ELEM(3, 1, list_lastdefault_macro), \\
BOOST_PP_TUPLE_ELEM(3, 2, list_lastdefault_macro))
-#define CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_DFLT{0}_(seq, elem_macro) \\
- BOOST_PP_TUPLE_ELEM(3, 0, CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_EXPAND{0}_(\\
+#define BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_DFLT{0}_( \\
+ seq, elem_macro) \\
+ BOOST_PP_TUPLE_ELEM( \\
+ 3 \\
+ , 0 \\
+ , BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_EXPAND{0}_( \\
BOOST_PP_SEQ_FOLD_RIGHT( \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_DFLT_OP{0}_, \\
- ( BOOST_PP_NIL, \\
- (0, ()), /* no last-default to start */ \\
- elem_macro ), seq)))
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_DFLT_OP{0}_ \\
+ , ( \\
+ BOOST_PP_NIL
+ , (0, ()) /* no last-default to start */ \\
+ , elem_macro \\
+ ) \\
+ , seq \\
+ ) \\
+ ) \\
+ )
-#define CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_NODFLT_OP_ELEM{0}_( \\
+#define BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_NODFLT_OP_ELEM{0}_( \\
s, elem, list, elem_macro) \\
( \\
BOOST_PP_LIST_APPEND( \\
@@ -132,27 +154,28 @@
elem_macro /* unchanged op-macro */ \\
)
-#define CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_NODFLT_OP{0}_( \\
+#define BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_NODFLT_OP{0}_( \\
s, list_macro, elem) \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_NODFLT_OP_ELEM{0}_(s, elem, \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_NODFLT_OP_ELEM{0}_( \\
+ s, elem, \\
BOOST_PP_TUPLE_ELEM(2, 0, list_macro), \\
BOOST_PP_TUPLE_ELEM(2, 1, list_macro))
-#define CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_NODFLT{0}_( \\
+#define BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_NODFLT{0}_( \\
seq, elem_macro) \\
BOOST_PP_TUPLE_ELEM(2, 0, BOOST_PP_SEQ_FOLD_RIGHT( \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_NODFLT_OP{0}_,\\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_NODFLT_OP{0}_, \\
( BOOST_PP_NIL, elem_macro ), seq))
-#define CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_NOTEMPTY{0}_( \\
+#define BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_NOTEMPTY{0}_( \\
seq, allow_empty, with_defaults, elem_macro) \\
BOOST_PP_IIF(with_defaults, \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_DFLT{0}_ \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_DFLT{0}_ \\
, \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_NODFLT{0}_ \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_NODFLT{0}_ \\
)(seq, elem_macro)
-#define CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_EMPTY{0}_( \\
+#define BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_EMPTY{0}_( \\
seq, allow_empty, with_defaults, elem_macro) \\
BOOST_PP_IIF(allow_empty, \\
BOOST_PP_NIL /* nil list */ \\
@@ -161,107 +184,113 @@
BOOST_PP_ASSERT_MSG /* error */ \\
)(0, ERROR_unexpected_empty_token_list)
-#define CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_IS_EMPTY_CHECK_HEAD{0}_( \\
+#define \\
+BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_IS_EMPTY_CHECK_HEAD{0}_( \\
seq) \\
- CONTRACT_DETAIL_PP_KEYWORD_IS_VOID_FRONT(BOOST_PP_SEQ_HEAD(seq))
+ BOOST_CONTRACT_DETAIL_PP_KEYWORD_IS_VOID_FRONT(BOOST_PP_SEQ_HEAD(seq))
-#define CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_IS_EMPTY_CHECK{0}_(seq) \\
+#define BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_IS_EMPTY_CHECK{0}_( \\
+ seq) \\
BOOST_PP_IIF(BOOST_PP_EQUAL(BOOST_PP_SEQ_SIZE(seq), 1), \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_IS_EMPTY_CHECK_HEAD{0}_ \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_IS_EMPTY_CHECK_HEAD{0}_ \\
, \\
0 BOOST_PP_TUPLE_EAT(1) \\
)(seq)
-#define CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_IS_EMPTY{0}_(void_or_seq) \\
- BOOST_PP_IIF(CONTRACT_DETAIL_PP_KEYWORD_IS_VOID_FRONT(void_or_seq), \\
+#define BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_IS_EMPTY{0}_( \\
+ void_or_seq) \\
+ BOOST_PP_IIF(BOOST_CONTRACT_DETAIL_PP_KEYWORD_IS_VOID_FRONT(void_or_seq), \\
1 BOOST_PP_TUPLE_EAT(1) \\
, \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_IS_EMPTY_CHECK{0}_ \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_IS_EMPTY_CHECK{0}_ \\
)(void_or_seq)
-#define CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ{0}_( \\
+#define BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ{0}_( \\
void_or_seq, allow_empty, with_defaults, elem_macro) \\
BOOST_PP_IIF(BOOST_PP_EXPAND( /* expand for MSVC */ \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_IS_EMPTY{0}_( \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_IS_EMPTY{0}_( \\
void_or_seq)), \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_EMPTY{0}_ \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_EMPTY{0}_ \\
, \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_NOTEMPTY{0}_ \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ_NOTEMPTY{0}_ \\
)(void_or_seq, allow_empty, with_defaults, elem_macro)
#ifndef BOOST_NO_VARIADIC_MACROS
-# include <contract/detail/preprocessor/variadic/to_seq.hpp>
-# define CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_SPLIT_SEQ{0}_(...) \\
- CONTRACT_DETAIL_PP_VARIADIC_TO_SEQ(void, __VA_ARGS__) \\
+# include <boost/contract/detail/preprocessor/variadic/to_seq.hpp>
+# define BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_SPLIT_SEQ{0}_(...) \\
+ BOOST_CONTRACT_DETAIL_PP_VARIADIC_TO_SEQ(void, __VA_ARGS__) \\
, /* split into 2-tuple `(seq_from(__VA_ARGS__), following_tokens)` */
#else // variadics
-# define CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_SPLIT_SEQ{0}_(seq) \\
+# define BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_SPLIT_SEQ{0}_(seq) \\
seq \\
, /* split into 2-tuple `(seq_from(__VA_ARGS__), following_tokens)` */
#endif // variadics
// Expand from paren_tokens `(a, b, ...) tokens...` (variadics) or
// `( (a) (b) ... ) tokens...` to `(a) (b) ...`.
-#define CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_GET_SEQ{0}_(paren_tokens) \\
+#define BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_GET_SEQ{0}_(paren_tokens) \\
BOOST_PP_TUPLE_ELEM(2, 0, \\
( /* split expand to 2-tuple `(seq, ignore_tokens)` */ \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_SPLIT_SEQ{0}_ paren_tokens \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_SPLIT_SEQ{0}_ \\
+ paren_tokens \\
) \\
)
-#define CONTRACT_DETAIL_PP_TRAITS_AUX_TAGGED_LIST{0}_( \\
+#define BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_TAGGED_LIST{0}_( \\
tokens, allow_empty, with_defaults, remove_tag_macro, elem_macro) \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ{0}_( \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_GET_SEQ{0}_( \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ{0}_( \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_GET_SEQ{0}_( \\
remove_tag_macro(tokens)), \\
allow_empty, with_defaults, elem_macro)
// PROTECTED //
-#define CONTRACT_DETAIL_PP_TRAITS_AUX_TAGGED_LIST{0}(tokens, \\
+#define BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_TAGGED_LIST{0}(tokens, \\
allow_empty, with_defaults, \\
is_tagged_macro, remove_tag_macro, elem_macro) \\
BOOST_PP_IIF(is_tagged_macro(tokens), \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_TAGGED_LIST{0}_ \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_TAGGED_LIST{0}_ \\
, \\
BOOST_PP_NIL /* nil list */ \\
BOOST_PP_TUPLE_EAT(5) \\
)(tokens, allow_empty, with_defaults, remove_tag_macro, elem_macro)
#ifndef BOOST_NO_VARIADIC_MACROS
-# define CONTRACT_DETAIL_PP_TRAITS_AUX_TAGGED_LIST_REMOVE{0}(...) /*nothing*/
+# define BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_TAGGED_LIST_REMOVE{0}(...) \\
+ /* nothing */
#else // variadics
-# define CONTRACT_DETAIL_PP_TRAITS_AUX_TAGGED_LIST_REMOVE{0}(seq) /*nothing*/
+# define BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_TAGGED_LIST_REMOVE{0}(seq) \\
+ /* nothing */
#endif // variadics
-#define CONTRACT_DETAIL_PP_TRAITS_AUX_AFTER_TAGGED_LIST{0}( \\
+#define BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_AFTER_TAGGED_LIST{0}( \\
tokens, is_tagged_macro, removing_prefix) \\
- CONTRACT_DETAIL_PP_KEYWORD_FACILITY_REMOVE_FRONT(tokens, \\
+ BOOST_CONTRACT_DETAIL_PP_KEYWORD_FACILITY_REMOVE_FRONT(tokens, \\
is_tagged_macro, removing_prefix)
-#define CONTRACT_DETAIL_PP_TRAITS_AUX_LIST{0}(tokens, \\
+#define BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_LIST{0}(tokens, \\
allow_empty, with_defaults, elem_macro) \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ{0}_( \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_GET_SEQ{0}_(tokens), \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_FROM_SEQ{0}_( \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_GET_SEQ{0}_(tokens), \\
allow_empty, with_defaults, elem_macro)
-#define CONTRACT_DETAIL_PP_TRAITS_AUX_AFTER_LIST{0}(tokens) \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_TAGGED_LIST_REMOVE_ERASE{0}_( \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_EXPAND{0}_( \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_TAGGED_LIST_REMOVE{0} tokens \\
+#define BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_AFTER_LIST{0}(tokens) \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_TAGGED_LIST_REMOVE_ERASE{0}_( \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_LIST_EXPAND{0}_( \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_TAGGED_LIST_REMOVE{0} tokens \\
))
-#define CONTRACT_DETAIL_PP_TRAITS_AUX_OPTIONAL_LIST{0}( \\
+#define BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_OPTIONAL_LIST{0}( \\
tokens, allow_empty, with_defaults, elem_macro) \\
- BOOST_PP_IIF(CONTRACT_DETAIL_PP_HAS_PAREN(tokens), \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_LIST{0} /* list present */ \\
+ BOOST_PP_IIF(BOOST_CONTRACT_DETAIL_PP_HAS_PAREN(tokens), \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_LIST{0} /* list present */ \\
, \\
BOOST_PP_NIL BOOST_PP_TUPLE_EAT(4) /* expand to nil pp-list */ \\
)(tokens, allow_empty, with_defaults, elem_macro)
-#define CONTRACT_DETAIL_PP_TRAITS_AUX_AFTER_OPTIONAL_LIST{0}(tokens) \\
- BOOST_PP_IIF(CONTRACT_DETAIL_PP_HAS_PAREN(tokens), \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_AFTER_LIST{0} /* list present */ \\
+#define BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_AFTER_OPTIONAL_LIST{0}(tokens) \\
+ BOOST_PP_IIF(BOOST_CONTRACT_DETAIL_PP_HAS_PAREN(tokens), \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_AFTER_LIST{0} /* list present */ \\
, \\
tokens BOOST_PP_TUPLE_EAT(1) /* expand to tokens */ \\
)(tokens)
@@ -271,5 +300,5 @@
'''.format(p, iterations))
h.close()
- print "Written:", header
+ print "Generated:", header
Modified: sandbox/contract/libs/contract/generate/boost/contract/detail/preprocessor/traits/aux_/select_assertion_-generate.py
==============================================================================
--- sandbox/contract/libs/contract/generate/boost/contract/detail/preprocessor/traits/aux_/select_assertion_-generate.py (original)
+++ sandbox/contract/libs/contract/generate/boost/contract/detail/preprocessor/traits/aux_/select_assertion_-generate.py 2013-03-04 17:41:09 EST (Mon, 04 Mar 2013)
@@ -6,58 +6,65 @@
# Home at http://sourceforge.net/projects/contractpp
import sys
+import os
import shutil
-CONTRACT_LIMIT_NESTED_SELECT_ASSERTIONS = raw_input(
- "CONTRACT_LIMIT_NESTED_SELECT_ASSERTIONS form " +
- "<contract/limits.hpp> [5] = ")
-if CONTRACT_LIMIT_NESTED_SELECT_ASSERTIONS == "":
- CONTRACT_LIMIT_NESTED_SELECT_ASSERTIONS = 5
+BOOST_CONTRACT_LIMIT_NESTED_SELECT_ASSERTIONS = raw_input(
+ "BOOST_CONTRACT_LIMIT_NESTED_SELECT_ASSERTIONS (as in " +
+ "<boost/contract/limits.hpp>) [5] = ")
+if BOOST_CONTRACT_LIMIT_NESTED_SELECT_ASSERTIONS == "":
+ BOOST_CONTRACT_LIMIT_NESTED_SELECT_ASSERTIONS = 5
else:
- CONTRACT_LIMIT_NESTED_SELECT_ASSERTIONS = int(
- CONTRACT_LIMIT_NESTED_SELECT_ASSERTIONS)
+ BOOST_CONTRACT_LIMIT_NESTED_SELECT_ASSERTIONS = int(
+ BOOST_CONTRACT_LIMIT_NESTED_SELECT_ASSERTIONS)
-# 1 and CONTRACT_LIMIT_NESTED_SELECT_ASSERTIONS included in range.
-for i in range(1, CONTRACT_LIMIT_NESTED_SELECT_ASSERTIONS + 1):
+# 1 and BOOST_CONTRACT_LIMIT_NESTED_SELECT_ASSERTIONS included in range.
+for i in range(1, BOOST_CONTRACT_LIMIT_NESTED_SELECT_ASSERTIONS + 1):
+ # $ python <NAME>-generate.py [DIR]
header = sys.argv[0].replace("-generate.py", str(i) + ".hpp", 1)
- shutil.copyfile(header, header + ".bak")
+ if(len(sys.argv) > 1): header = os.path.join(sys.argv[1], header)
+
+ try: shutil.copyfile(header, header + ".bak")
+ except: pass
h = open(header, 'w')
h.write('''
-#ifndef CONTRACT_DETAIL_PP_TRAITS_AUX_SELECT_ASSERTION_{0}_HPP_
-#define CONTRACT_DETAIL_PP_TRAITS_AUX_SELECT_ASSERTION_{0}_HPP_
-
-// WARNING: FILE AUTOMATICALLY GENERATED, DO NOT MODIFY IT!
-// Instead modify the generation script "<FILE>-generate.py" and run
-// `$ python <FILE_NAME>-generate.py > FILE_NAME.hpp`.
-// Used CONTRACT_LIMIT_NESTED_SELECT_ASSERTIONS: {2}
-
-#include <contract/limits.hpp>
-#if CONTRACT_LIMIT_NESTED_SELECT_ASSERTIONS != {2}
-#error "Code generation used incorrect CONTRACT_LIMIT_NESTED_SELECT_ASSERTIONS"
+/*************************************************************/
+/* WARNING: FILE AUTOMATICALLY GENERATED, DO NOT MODIFY IT! */
+/* Instead modify the generation script "<FILE>-generate.py" */
+/*************************************************************/
+// Used BOOST_CONTRACT_LIMIT_NESTED_SELECT_ASSERTIONS: {2}
+
+#ifndef BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_SELECT_ASSERTION_{0}_HPP_
+#define BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_SELECT_ASSERTION_{0}_HPP_
+
+#include <boost/contract/limits.hpp>
+#if BOOST_CONTRACT_LIMIT_NESTED_SELECT_ASSERTIONS != {2}
+# error "Code generation used incorrect BOOST_CONTRACT_LIMIT_NESTED_SELECT_ASSERTIONS"
#endif
-#include <contract/detail/preprocessor/traits/aux_/assertion.hpp>
-#include <contract/detail/preprocessor/traits/aux_/select_assertion.hpp>
+#include <boost/contract/detail/preprocessor/traits/aux_/assertion.hpp>
+#include <boost/contract/detail/preprocessor/traits/aux_/select_assertion.hpp>
#if {1} <= {2}
-# include <contract/detail/preprocessor/traits/aux_/select_assertion_{1}.hpp>
+# include <boost/contract/detail/preprocessor/traits/aux_/select_assertion_{1}.hpp>
#endif
-#include <contract/detail/preprocessor/keyword/contract/requires.hpp>
-#include <contract/detail/preprocessor/keyword/if.hpp>
+#include <boost/contract/detail/preprocessor/keyword/boost/contract/requires.hpp>
+#include <boost/contract/detail/preprocessor/keyword/if.hpp>
// PRIVATE //
-#define CONTRACT_DETAIL_PP_TRAITS_AUX_SELECT_ASSERTION_ELEM_{0}_( \\
+#define BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_SELECT_ASSERTION_ELEM_{0}_( \\
d, number_instruction_requirements_traits, assertion) \\
- BOOST_PP_IIF(CONTRACT_DETAIL_PP_KEYWORD_IS_IF_FRONT(assertion), \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_SELECT_ASSERTION_{1} \\
- , BOOST_PP_IIF(CONTRACT_DETAIL_PP_TRAITS_AUX_ASSERTION_IS_STATEMENT( \\
+ BOOST_PP_IIF(BOOST_CONTRACT_DETAIL_PP_KEYWORD_IS_IF_FRONT(assertion), \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_SELECT_ASSERTION_{1} \\
+ , BOOST_PP_IIF(BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_ASSERTION_IS_STATEMENT(\\
assertion), \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_ASSERTION_STATEMENT \\
- , BOOST_PP_IIF(CONTRACT_DETAIL_PP_KEYWORD_IS_REQUIRES_FRONT(assertion), \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_ASSERTION_REQUIRES \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_ASSERTION_STATEMENT \\
+ , BOOST_PP_IIF( \\
+ BOOST_CONTRACT_DETAIL_PP_KEYWORD_IS_REQUIRES_FRONT(assertion), \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_ASSERTION_REQUIRES \\
, /* else: bool, const, or static assert */ \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_ASSERTION_CONDITION \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_ASSERTION_CONDITION \\
)))(d, assertion \\
, BOOST_PP_TUPLE_ELEM(4, 0, number_instruction_requirements_traits) \\
, BOOST_PP_TUPLE_ELEM(4, 1, number_instruction_requirements_traits) \\
@@ -65,54 +72,50 @@
, BOOST_PP_TUPLE_ELEM(4, 3, number_instruction_requirements_traits) \\
)
-#define CONTRACT_DETAIL_PP_TRAITS_AUX_SELECT_ASSERTION_LIST_{0}_( \\
+#define BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_SELECT_ASSERTION_LIST_{0}_( \\
d, select_assertions, number_instruction_requirements_traits) \\
BOOST_PP_LIST_FOLD_LEFT_ ## d( \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_SELECT_ASSERTION_ELEM_{0}_, \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_SELECT_ASSERTION_ELEM_{0}_, \\
number_instruction_requirements_traits, select_assertions)
-#define CONTRACT_DETAIL_PP_TRAITS_AUX_SELECT_ASSERTION_{0}_(d, select_traits, \\
- prev_number, prev_instruction, prev_requirements, traits) \\
+#define BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_SELECT_ASSERTION_{0}_( \\
+ d, select_traits, prev_number, prev_instruction, prev_requirements, \\
+ traits) \\
/* 6th, append right-curly to end else block */ \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_SELECT_ASSERTION_PREPEND_RCURLY(d \\
- /* 5th, append else-assertions */ \\
- , CONTRACT_DETAIL_PP_TRAITS_AUX_SELECT_ASSERTION_LIST_{0}_(d \\
- , CONTRACT_DETAIL_PP_TRAITS_AUX_SELECT_ASSERTION_ELSES( \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_SELECT_ASSERTION_PREPEND_RCURLY(d \\
+ /* 5th, append else-assertions */ \\
+ , BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_SELECT_ASSERTION_LIST_{0}_(d, \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_SELECT_ASSERTION_ELSES( \\
select_traits) \\
- /* 4th, append else-statement `else` */ \\
- , CONTRACT_DETAIL_PP_TRAITS_AUX_SELECT_ASSERTION_PREPEND_ELSE(d \\
- /* 3rd, append right-curly to end if block */ \\
- ,CONTRACT_DETAIL_PP_TRAITS_AUX_SELECT_ASSERTION_PREPEND_RCURLY(\\
- d \\
- /* 2nd, append then-assertions */ \\
- ,CONTRACT_DETAIL_PP_TRAITS_AUX_SELECT_ASSERTION_LIST_{0}_(\\
- d \\
- ,CONTRACT_DETAIL_PP_TRAITS_AUX_SELECT_ASSERTION_THENS(\\
- select_traits) \\
- /* 1st, append if-statement `if(...)` */ \\
- , CONTRACT_DETAIL_PP_TRAITS_AUX_SELECT_ASSERTION_PREPEND_IF(d \\
- , CONTRACT_DETAIL_PP_TRAITS_AUX_SELECT_ASSERTION_IF(select_traits) \\
- , (prev_number, prev_instruction, prev_requirements, traits) \\
- ) \\
- ) \\
- ) \\
- ) \\
- ) \\
- )
+ /* 4th, append else-statement `else` */ \\
+ , BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_SELECT_ASSERTION_PREPEND_ELSE(d \\
+ /* 3rd, append right-curly to end if block */ \\
+ , BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_SELECT_ASSERTION_PREPEND_RCURLY(d \\
+ /* 2nd, append then-assertions */ \\
+ , BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_SELECT_ASSERTION_LIST_{0}_(d \\
+ , BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_SELECT_ASSERTION_THENS(select_traits) \\
+ /* 1st, append if-statement `if(...)` */ \\
+ , BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_SELECT_ASSERTION_PREPEND_IF(d \\
+ , BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_SELECT_ASSERTION_IF(select_traits) \\
+ , (prev_number, prev_instruction, prev_requirements, traits) \\
+ ) ) ) ) ) )
// PROTECTED //
-#define CONTRACT_DETAIL_PP_TRAITS_AUX_SELECT_ASSERTION_{0}(d, assertion, \\
- prev_number, prev_instruction, prev_requirements, traits)\\
- CONTRACT_DETAIL_PP_TRAITS_AUX_ASSERTION_APPEND_TUPLE(d, \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_SELECT_ASSERTION_{0}_(d, \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_SELECT_ASSERTION(assertion),\\
+#define BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_SELECT_ASSERTION_{0}( \\
+ d, assertion, prev_number, prev_instruction, prev_requirements, \\
+ traits) \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_ASSERTION_APPEND_TUPLE(d, \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_SELECT_ASSERTION_{0}_(d, \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_SELECT_ASSERTION( \\
+ assertion),\\
prev_number, prev_instruction, prev_requirements, traits))
#endif // #include guard
-'''.format(str(i), str(i + 1), str(CONTRACT_LIMIT_NESTED_SELECT_ASSERTIONS)))
+'''.format(str(i), str(i + 1), str(
+ BOOST_CONTRACT_LIMIT_NESTED_SELECT_ASSERTIONS)))
h.close()
- print "Written:", header
+ print "Generated:", header
Modified: sandbox/contract/libs/contract/generate/boost/contract/detail/preprocessor/traits/func/catches-generate.py
==============================================================================
--- sandbox/contract/libs/contract/generate/boost/contract/detail/preprocessor/traits/func/catches-generate.py (original)
+++ sandbox/contract/libs/contract/generate/boost/contract/detail/preprocessor/traits/func/catches-generate.py 2013-03-04 17:41:09 EST (Mon, 04 Mar 2013)
@@ -6,8 +6,13 @@
# Home at http://sourceforge.net/projects/contractpp
import sys
+import os
import shutil
+# $ python <NAME>-generate.py [DIR]
+header = sys.argv[0].replace("-generate.py", ".hpp", 1)
+if(len(sys.argv) > 1): header = os.path.join(sys.argv[1], header)
+
def data(max):
s = ''
for i in range(0, max):
@@ -19,53 +24,57 @@
"_catch_statements"
else:
next_sign_macro = \
- "CONTRACT_DETAIL_PP_FUNC_TRAITS_CATCHES_TRAIT_SIGN_" + \
- str(i + 1) + "_"
+ "BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_CATCHES_TRAIT_SIGN_" \
+ + str(i + 1) + "_"
s = s + '''
-#define CONTRACT_DETAIL_PP_FUNC_TRAITS_CATCHES_TRAIT_SIGN_NEXT{0}_(seq_sign) \\
- BOOST_PP_IIF(CONTRACT_DETAIL_PP_KEYWORD_IS_CATCH_FRONT( \\
+#define BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_CATCHES_TRAIT_SIGN_NEXT{0}_( \\
+ seq_sign) \\
+ BOOST_PP_IIF(BOOST_CONTRACT_DETAIL_PP_KEYWORD_IS_CATCH_FRONT( \\
BOOST_PP_TUPLE_ELEM(2, 1, seq_sign)), \\
{1} \\
, \\
seq_sign BOOST_PP_TUPLE_EAT(2) \\
)(BOOST_PP_TUPLE_ELEM(2, 0, seq_sign), BOOST_PP_TUPLE_ELEM(2, 1, seq_sign))
-#define CONTRACT_DETAIL_PP_FUNC_TRAITS_CATCHES_TRAIT_SIGN{0}_(seq, sign) \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_CATCHES_TRAIT_SIGN_NEXT{0}_( ( \\
+#define BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_CATCHES_TRAIT_SIGN{0}_( \\
+ seq, sign) \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_CATCHES_TRAIT_SIGN_NEXT{0}_( ( \\
seq BOOST_PP_CAT( \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_CATCHES_EXCEPTION_DECL_, sign) \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_CATCHES_EXCEPTION_DECL_, \\
+ sign) \\
) ) \
'''.format(p, next_sign_macro)
return s
-CONTRACT_LIMIT_CONSTRUCTOR_TRY_BLOCK_CATCHES = raw_input(
- "CONTRACT_LIMIT_CONSTRUCTOR_TRY_BLOCK_CATCHES" +
- " from <contract/limits.hpp> [10] = ")
-if CONTRACT_LIMIT_CONSTRUCTOR_TRY_BLOCK_CATCHES == "":
- CONTRACT_LIMIT_CONSTRUCTOR_TRY_BLOCK_CATCHES = 10
+BOOST_CONTRACT_LIMIT_CONSTRUCTOR_TRY_BLOCK_CATCHES = raw_input(
+ "BOOST_CONTRACT_LIMIT_CONSTRUCTOR_TRY_BLOCK_CATCHES" +
+ " (as in <boost/contract/limits.hpp>) [10] = ")
+if BOOST_CONTRACT_LIMIT_CONSTRUCTOR_TRY_BLOCK_CATCHES == "":
+ BOOST_CONTRACT_LIMIT_CONSTRUCTOR_TRY_BLOCK_CATCHES = 10
else:
- CONTRACT_LIMIT_CONSTRUCTOR_TRY_BLOCK_CATCHES = int(
- CONTRACT_LIMIT_CONSTRUCTOR_TRY_BLOCK_CATCHES)
+ BOOST_CONTRACT_LIMIT_CONSTRUCTOR_TRY_BLOCK_CATCHES = int(
+ BOOST_CONTRACT_LIMIT_CONSTRUCTOR_TRY_BLOCK_CATCHES)
-header = sys.argv[0].replace("-generate.py", ".hpp", 1)
-shutil.copyfile(header, header + ".bak")
+try: shutil.copyfile(header, header + ".bak")
+except: pass
h = open(header, 'w')
h.write('''
-#ifndef CONTRACT_DETAIL_PP_FUNC_TRAITS_CATCHES_HPP_
-#define CONTRACT_DETAIL_PP_FUNC_TRAITS_CATCHES_HPP_
-
-// WARNING: FILE AUTOMATICALLY GENERATED, DO NOT MODIFY IT!
-// Instead modify the generation script "<FILE>-generate.py" and run
-// `$ python <FILE_NAME>-generate.py > FILE_NAME.hpp`.
-// Used: #define CONTRACT_LIMIT_CONSTRUCTOR_TRY_BLOCK_CATCHES {0}
-
-#include <contract/limits.hpp>
-#if CONTRACT_LIMIT_CONSTRUCTOR_TRY_BLOCK_CATCHES != {0}
-#error "Code generation used incorrect CONTRACT_LIMIT_CONSTRUCTOR_TRY_BLOCK_CATCHES"
+/*************************************************************/
+/* WARNING: FILE AUTOMATICALLY GENERATED, DO NOT MODIFY IT! */
+/* Instead modify the generation script "<FILE>-generate.py" */
+/*************************************************************/
+// Used: #define BOOST_CONTRACT_LIMIT_CONSTRUCTOR_TRY_BLOCK_CATCHES {0}
+
+#ifndef BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_CATCHES_HPP_
+#define BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_CATCHES_HPP_
+
+#include <boost/contract/limits.hpp>
+#if BOOST_CONTRACT_LIMIT_CONSTRUCTOR_TRY_BLOCK_CATCHES != {0}
+# error "Code generation used incorrect BOOST_CONTRACT_LIMIT_CONSTRUCTOR_TRY_BLOCK_CATCHES"
#endif
-#include <contract/detail/preprocessor/traits/aux_/apply.hpp>
-#include <contract/detail/preprocessor/keyword/catch.hpp>
+#include <boost/contract/detail/preprocessor/traits/aux_/apply.hpp>
+#include <boost/contract/detail/preprocessor/keyword/catch.hpp>
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/control/iif.hpp>
#include <boost/preprocessor/array/elem.hpp>
@@ -74,66 +83,70 @@
// PRIVATE //
-#define CONTRACT_DETAIL_PP_FUNC_TRAITS_CATCHES_STATEMENTS_(statements) \\
+#define BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_CATCHES_STATEMENTS_(statements) \\
/* beginning of seq elem of 3-tuple from DECL_catch here */ \\
statements)), /* this comma splits */
-#define CONTRACT_DETAIL_PP_FUNC_TRAITS_CATCHES_EXCEPTION_DECL_catch( \\
+#define BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_CATCHES_EXCEPTION_DECL_catch( \\
exception_decl) \\
- ((exception_decl, CONTRACT_DETAIL_PP_FUNC_TRAITS_CATCHES_STATEMENTS_ \\
+ ( ( \\
+ exception_decl \\
+ , \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_CATCHES_STATEMENTS_ \\
/* end of seq elem of 3-tuple from STATEMENTS_ here */
{1}
-#define CONTRACT_DETAIL_PP_FUNC_TRAITS_CATCHES_LIST_(sign) \\
- CONTRACT_DETAIL_PP_SEQ_TO_LIST_NEVER_EMPTY(BOOST_PP_TUPLE_ELEM(2, 0, \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_CATCHES_TRAIT_SIGN_( \\
- BOOST_PP_EMPTY(), sign)))
-
-#define CONTRACT_DETAIL_PP_FUNC_TRAITS_CATCHES_TRAIT_(sign) \\
- BOOST_PP_IIF(CONTRACT_DETAIL_PP_KEYWORD_IS_CATCH_FRONT(sign), \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_CATCHES_LIST_ \\
+#define BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_CATCHES_LIST_(sign) \\
+ BOOST_CONTRACT_DETAIL_PP_SEQ_TO_LIST_NEVER_EMPTY( \\
+ BOOST_PP_TUPLE_ELEM(2, 0, \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_CATCHES_TRAIT_SIGN_( \\
+ BOOST_PP_EMPTY(), sign)))
+
+#define BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_CATCHES_TRAIT_(sign) \\
+ BOOST_PP_IIF(BOOST_CONTRACT_DETAIL_PP_KEYWORD_IS_CATCH_FRONT(sign), \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_CATCHES_LIST_ \\
, \\
BOOST_PP_NIL BOOST_PP_TUPLE_EAT(1) /* empty catch list */ \\
)(sign)
-#define CONTRACT_DETAIL_PP_FUNC_TRAITS_CATCHES_REMOVE_(sign) \\
+#define BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_CATCHES_REMOVE_(sign) \\
BOOST_PP_TUPLE_ELEM(2, 1, \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_CATCHES_TRAIT_SIGN_( \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_CATCHES_TRAIT_SIGN_( \\
BOOST_PP_EMPTY(), sign))
-#define CONTRACT_DETAIL_PP_FUNC_TRAITS_CATCHES_SIGN_(sign) \\
- BOOST_PP_IIF(CONTRACT_DETAIL_PP_KEYWORD_IS_CATCH_FRONT(sign), \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_CATCHES_REMOVE_ \\
+#define BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_CATCHES_SIGN_(sign) \\
+ BOOST_PP_IIF(BOOST_CONTRACT_DETAIL_PP_KEYWORD_IS_CATCH_FRONT(sign), \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_CATCHES_REMOVE_ \\
, \\
sign BOOST_PP_TUPLE_EAT(1) \\
)(sign)
// PROTECTED //
-#define CONTRACT_DETAIL_PP_FUNC_TRAITS_AUX_CATCHES(traits_sign) \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_APPLY(traits_sign, \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_CATCHES_TRAIT_, \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_CATCHES_SIGN_)
+#define BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_AUX_CATCHES(traits_sign) \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_APPLY(traits_sign, \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_CATCHES_TRAIT_, \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_CATCHES_SIGN_)
// PUBLIC //
// Expand to pp-list of catch traits `(exception_decl, statements)`.
-#define CONTRACT_DETAIL_PP_FUNC_TRAITS_CATCHES(func_traits) \\
+#define BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_CATCHES(func_traits) \\
BOOST_PP_ARRAY_ELEM(23, func_traits)
// Expand to either `exception_type exception_var` or `...`.
-#define CONTRACT_DETAIL_PP_CATCH_TRAITS_EXCEPTION_DECL(catch_traits) \\
+#define BOOST_CONTRACT_DETAIL_PP_CATCH_TRAITS_EXCEPTION_DECL(catch_traits) \\
BOOST_PP_TUPLE_ELEM(2, 0, catch_traits)
// Expand to `instruction; instruction; ...` (all instructions optional).
-#define CONTRACT_DETAIL_PP_CATCH_TRAITS_STATEMENTS(catch_traits) \\
+#define BOOST_CONTRACT_DETAIL_PP_CATCH_TRAITS_STATEMENTS(catch_traits) \\
BOOST_PP_TUPLE_ELEM(2, 1, catch_traits)
#endif // #include guard
-'''.format(CONTRACT_LIMIT_CONSTRUCTOR_TRY_BLOCK_CATCHES,
- data(CONTRACT_LIMIT_CONSTRUCTOR_TRY_BLOCK_CATCHES)))
+'''.format(BOOST_CONTRACT_LIMIT_CONSTRUCTOR_TRY_BLOCK_CATCHES,
+ data(BOOST_CONTRACT_LIMIT_CONSTRUCTOR_TRY_BLOCK_CATCHES)))
h.close()
-print "Written:", header
+print "Generated:", header
Modified: sandbox/contract/libs/contract/generate/boost/contract/detail/preprocessor/traits/func/postconditions-generate.py
==============================================================================
--- sandbox/contract/libs/contract/generate/boost/contract/detail/preprocessor/traits/func/postconditions-generate.py (original)
+++ sandbox/contract/libs/contract/generate/boost/contract/detail/preprocessor/traits/func/postconditions-generate.py 2013-03-04 17:41:09 EST (Mon, 04 Mar 2013)
@@ -6,8 +6,13 @@
# Home at http://sourceforge.net/projects/contractpp
import sys
+import os
import shutil
+# $ python <NAME>-generate.py [DIR]
+header = sys.argv[0].replace("-generate.py", ".hpp", 1)
+if(len(sys.argv) > 1): header = os.path.join(sys.argv[1], header)
+
def data(max):
s = ''
for i in reversed(range(1, max)): # i == 0 handled separately (no `seq`).
@@ -17,66 +22,68 @@
"_old_value_declarations"
else:
next_sign_macro = \
- "CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_TRAIT_SIGN_" + \
- str(i + 1) + "_"
+ "BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_TRAIT_SIGN_" \
+ + str(i + 1) + "_"
s = s + '''
-#define CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_TRAIT_SIGN_NEXT{0}_( \\
+#define \\
+BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_TRAIT_SIGN_NEXT{0}_( \\
seq_sign) \\
- BOOST_PP_IIF(CONTRACT_DETAIL_PP_KEYWORD_IS_POSTCONDITION_FRONT( \\
+ BOOST_PP_IIF(BOOST_CONTRACT_DETAIL_PP_KEYWORD_IS_POSTCONDITION_FRONT( \\
BOOST_PP_TUPLE_ELEM(2, 1, seq_sign)), \\
{1} \\
- , BOOST_PP_IIF(CONTRACT_DETAIL_PP_HAS_PAREN( \\
+ , BOOST_PP_IIF(BOOST_CONTRACT_DETAIL_PP_HAS_PAREN( \\
BOOST_PP_TUPLE_ELEM(2, 1, seq_sign)), \\
{1} \\
, \\
seq_sign BOOST_PP_TUPLE_EAT(2) \\
))(BOOST_PP_TUPLE_ELEM(2, 0, seq_sign), BOOST_PP_TUPLE_ELEM(2, 1, seq_sign))
-#define CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_TRAIT_SIGN{0}_( \\
+#define BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_TRAIT_SIGN{0}_( \\
seq, sign) \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_TRAIT_SIGN_NEXT{0}_( ( \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_TRAIT_SIGN_NEXT{0}_((\\
seq \\
- BOOST_PP_IIF(CONTRACT_DETAIL_PP_HAS_PAREN(sign), \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_postcondition \\
+ BOOST_PP_IIF(BOOST_CONTRACT_DETAIL_PP_HAS_PAREN(sign), \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_postcondition \\
, \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_CAT_ \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_CAT_\\
)(sign) \\
- ) ) \
+ )) \
'''.format(p, next_sign_macro)
return s
-CONTRACT_LIMIT_OLDOFS = raw_input("CONTRACT_LIMIT_OLDOFS" +
- "from <contract/limits.hpp> [15] = ")
-if CONTRACT_LIMIT_OLDOFS == "": CONTRACT_LIMIT_OLDOFS = 15
-else: CONTRACT_LIMIT_OLDOFS = int(CONTRACT_LIMIT_OLDOFS)
+BOOST_CONTRACT_LIMIT_OLDOFS = raw_input("BOOST_CONTRACT_LIMIT_OLDOFS" +
+ " (as in <boost/contract/limits.hpp>) [15] = ")
+if BOOST_CONTRACT_LIMIT_OLDOFS == "": BOOST_CONTRACT_LIMIT_OLDOFS = 15
+else: BOOST_CONTRACT_LIMIT_OLDOFS = int(BOOST_CONTRACT_LIMIT_OLDOFS)
-header = sys.argv[0].replace("-generate.py", ".hpp", 1)
-shutil.copyfile(header, header + ".bak")
+try: shutil.copyfile(header, header + ".bak")
+except: pass
h = open(header, 'w')
h.write('''
-#ifndef CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_HPP_
-#define CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_HPP_
-
-// WARNING: FILE AUTOMATICALLY GENERATED, DO NOT MODIFY IT!
-// Instead modify the generation script "<FILE>-generate.py" and run
-// `$ python <FILE_NAME>-generate.py > FILE_NAME.hpp`.
-// Used: #define CONTRACT_LIMIT_OLDOFS {0}
-
-#include <contract/limits.hpp>
-#if CONTRACT_LIMIT_OLDOFS != {0}
-#error "Code generation used incorrect CONTRACT_LIMIT_OLDOFS"
+/*************************************************************/
+/* WARNING: FILE AUTOMATICALLY GENERATED, DO NOT MODIFY IT! */
+/* Instead modify the generation script "<FILE>-generate.py" */
+/*************************************************************/
+// Used: #define BOOST_CONTRACT_LIMIT_OLDOFS {0}
+
+#ifndef BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_HPP_
+#define BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_HPP_
+
+#include <boost/contract/limits.hpp>
+#if BOOST_CONTRACT_LIMIT_OLDOFS != {0}
+# error "Code generation used incorrect BOOST_CONTRACT_LIMIT_OLDOFS"
#endif
// Old-of already parsed but header included here for user to access this trait.
-#include <contract/detail/preprocessor/traits/oldof.hpp>
+#include <boost/contract/detail/preprocessor/traits/oldof.hpp>
-#include <contract/detail/preprocessor/traits/aux_/oldof.hpp>
-#include <contract/detail/preprocessor/traits/aux_/type.hpp>
-#include <contract/detail/preprocessor/traits/aux_/nil.hpp>
-#include <contract/detail/preprocessor/traits/assertion.hpp>
-#include <contract/detail/preprocessor/keyword/contract/postcondition.hpp>
-#include <contract/detail/preprocessor/keyword/auto.hpp>
-#include <contract/detail/preprocessor/variadic/to_seq.hpp>
+#include <boost/contract/detail/preprocessor/traits/aux_/oldof.hpp>
+#include <boost/contract/detail/preprocessor/traits/aux_/type.hpp>
+#include <boost/contract/detail/preprocessor/traits/aux_/nil.hpp>
+#include <boost/contract/detail/preprocessor/traits/assertion.hpp>
+#include <boost/contract/detail/preprocessor/keyword/boost/contract/postcondition.hpp>
+#include <boost/contract/detail/preprocessor/keyword/auto.hpp>
+#include <boost/contract/detail/preprocessor/variadic/to_seq.hpp>
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/config/config.hpp>
#include <boost/preprocessor/control/iif.hpp>
@@ -92,24 +99,25 @@
// PRIVATE //
-#define CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_OLDOF_TYPE_( \\
+#define BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_OLDOF_TYPE_( \\
oldof_typed_assignment) \\
- BOOST_PP_IIF(CONTRACT_DETAIL_PP_KEYWORD_IS_AUTO_FRONT( \\
+ BOOST_PP_IIF(BOOST_CONTRACT_DETAIL_PP_KEYWORD_IS_AUTO_FRONT( \\
oldof_typed_assignment), \\
/* 0-size array for no type (`auto` for typeof deduction) */ \\
(0, ()) BOOST_PP_TUPLE_EAT(1) \\
, \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_TYPE \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_TYPE \\
)(oldof_typed_assignment)
-#define CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_OLDOF_ASSIGNMENT_( \\
+#define BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_OLDOF_ASSIGNMENT_(\\
oldof_typed_assignment) \\
- CONTRACT_DETAIL_PP_KEYWORD_AUTO_REMOVE_FRONT( \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_AFTER_TYPE( \\
+ BOOST_CONTRACT_DETAIL_PP_KEYWORD_AUTO_REMOVE_FRONT( \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_AFTER_TYPE( \\
oldof_typed_assignment \\
))
-#define CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_OLDOF_TYPED_ASSIGNMENT_(\\
+#define \\
+BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_OLDOF_TYPED_ASSIGNMENT_(\\
s, result_oldofs_assertions_lastoldofexpr, oldof_typed_assignment) \\
( \\
BOOST_PP_TUPLE_ELEM(4, 0, result_oldofs_assertions_lastoldofexpr) \\
@@ -117,13 +125,13 @@
BOOST_PP_LIST_APPEND( \\
( /* pp-list */ \\
(3, ( /* oldof pp-array with `NIL type, var =, expr` */ \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_OLDOF_TYPE_(\\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_OLDOF_TYPE_(\\
oldof_typed_assignment) \\
, \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_OLDOF_ASSIGNMENT_( \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_OLDOF_ASSIGNMENT_( \\
oldof_typed_assignment) \\
, \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_OLDOF_REMOVE_FRONT( \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_OLDOF_REMOVE_FRONT( \\
BOOST_PP_TUPLE_ELEM(4, 3, \\
result_oldofs_assertions_lastoldofexpr)) \\
) ) \\
@@ -135,10 +143,10 @@
, \\
BOOST_PP_TUPLE_ELEM(4, 2, result_oldofs_assertions_lastoldofexpr) \\
, \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_NIL /* no open old-of expr */ \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_NIL /* no open old-of expr */ \\
)
-#define CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_OLDOF_EXPR_( \\
+#define BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_OLDOF_EXPR_( \\
s, result_oldofs_assertions_lastoldofexpr, oldof_expr) \\
( \\
BOOST_PP_TUPLE_ELEM(4, 0, result_oldofs_assertions_lastoldofexpr) \\
@@ -150,18 +158,20 @@
oldof_expr /* open an old-of expr (expect old-of assignment next) */ \\
)
-#define return_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_STRIP_RETURN \\
+#define \\
+return_BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_STRIP_RETURN \\
/* nothing */
-#define CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_RESULT_ASSIGNMENT_( \\
+#define \\
+BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_RESULT_ASSIGNMENT_( \\
s, result_oldofs_assertions_lastoldofexpr, result_assignment) \\
( \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_NIL /* optional trait */ \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_NIL /* optional trait */ \\
/* LIMITATION: With this implementation, multiple result */ \\
/* declarations override each other (instead of compiler error) */ \\
- CONTRACT_DETAIL_PP_KEYWORD_AUTO_REMOVE_FRONT(BOOST_PP_CAT( \\
+ BOOST_CONTRACT_DETAIL_PP_KEYWORD_AUTO_REMOVE_FRONT(BOOST_PP_CAT( \\
result_assignment, \\
- _CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_STRIP_RETURN)) \\
+ _BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_STRIP_RETURN)) \\
, \\
BOOST_PP_TUPLE_ELEM(4, 1, result_oldofs_assertions_lastoldofexpr) \\
, \\
@@ -170,7 +180,7 @@
BOOST_PP_TUPLE_ELEM(4, 3, result_oldofs_assertions_lastoldofexpr) \\
)
-#define CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_ASSERTION_( \\
+#define BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_ASSERTION_( \\
s, result_oldofs_assertions_lastoldofexpr, assertion) \\
( \\
BOOST_PP_TUPLE_ELEM(4, 0, result_oldofs_assertions_lastoldofexpr) \\
@@ -184,22 +194,22 @@
BOOST_PP_TUPLE_ELEM(4, 3, result_oldofs_assertions_lastoldofexpr) \\
)
-#define CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_FROM_SEQ_OP_( \\
+#define BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_FROM_SEQ_OP_( \\
s, result_oldofs_assertions_lastoldofexpr, elem) \\
- BOOST_PP_IIF(BOOST_PP_COMPL(CONTRACT_DETAIL_PP_TRAITS_AUX_IS_NIL( \\
+ BOOST_PP_IIF(BOOST_PP_COMPL(BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_IS_NIL( \\
BOOST_PP_TUPLE_ELEM(4, 3, \\
result_oldofs_assertions_lastoldofexpr))), \\
/* prev there was an old-of expr so elem must be old-of assignment */\\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_OLDOF_TYPED_ASSIGNMENT_ \\
- , BOOST_PP_IIF(CONTRACT_DETAIL_PP_TRAITS_AUX_IS_OLDOF_FRONT(elem), \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_OLDOF_EXPR_ \\
- , BOOST_PP_IIF(CONTRACT_DETAIL_PP_KEYWORD_IS_AUTO_FRONT(elem), \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_RESULT_ASSIGNMENT_ \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_OLDOF_TYPED_ASSIGNMENT_ \\
+ , BOOST_PP_IIF(BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_IS_OLDOF_FRONT(elem), \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_OLDOF_EXPR_ \\
+ , BOOST_PP_IIF(BOOST_CONTRACT_DETAIL_PP_KEYWORD_IS_AUTO_FRONT(elem), \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_RESULT_ASSIGNMENT_ \\
, /* else, it is an assertion */ \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_ASSERTION_ \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_ASSERTION_ \\
)))(s, result_oldofs_assertions_lastoldofexpr, elem)
-#define CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_FROM_SEQ_3TUPLE_( \\
+#define BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_FROM_SEQ_3TUPLE_( \\
result_oldofs_assertions_lastoldofexpr) \\
( /* after folding, ignore 4th elem `lastoldofexpr` */ \\
BOOST_PP_TUPLE_ELEM(4, 0, result_oldofs_assertions_lastoldofexpr) \\
@@ -209,18 +219,20 @@
BOOST_PP_TUPLE_ELEM(4, 2, result_oldofs_assertions_lastoldofexpr) \\
)
-#define CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_FROM_SEQ_(seq_sign) \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_FROM_SEQ_3TUPLE_( \\
+#define \\
+BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_FROM_SEQ_(seq_sign) \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_FROM_SEQ_3TUPLE_( \\
BOOST_PP_SEQ_FOLD_RIGHT( \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_FROM_SEQ_OP_, \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_FROM_SEQ_OP_, \\
( \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_NIL /* no result */ \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_NIL /* no result */ \\
, \\
BOOST_PP_NIL /* no oldofs */ \\
, \\
BOOST_PP_NIL /* no assertions */ \\
, \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_NIL /* no last oldof expr */ \\
+ /* no last oldof expr */ \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_NIL \\
), \\
BOOST_PP_TUPLE_ELEM(2, 0, seq_sign) \\
) \\
@@ -228,130 +240,138 @@
// Adapted from PP_CAT (needed for reentrancy as CAT already used by VARIADIC).
#if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()
-# define CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_CAT_(a, b) \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_CAT_I_(a, b)
+# define BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_CAT_(a, b) \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_CAT_I_(a, b)
#else
-# define CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_CAT_(a, b) \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_CAT_OO_((a, b))
-# define CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_CAT_OO_(par) \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_CAT_I_ ## par
+# define BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_CAT_(a, b) \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_CAT_OO_((a, b))
+# define BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_CAT_OO_(par) \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_CAT_I_ ## par
#endif
#if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()
-# define CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_CAT_I_(a, b) a ## b
+# define BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_CAT_I_(a, b) \\
+ a ## b
#else
-# define CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_CAT_I_(a, b) \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_CAT_II_(a ## b)
-# define CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_CAT_II_(res) res
+# define BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_CAT_I_(a, b) \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_CAT_II_(a ## b)
+# define BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_CAT_II_(res) res
#endif
-#define CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_PAREN_(paren) \\
- CONTRACT_DETAIL_PP_TUPLE_SPLIT(1) paren
+#define BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_PAREN_( \\
+ paren) \\
+ BOOST_CONTRACT_DETAIL_PP_TUPLE_SPLIT(1) paren
#ifndef BOOST_NO_VARIADIC_MACROS
-# include <contract/detail/preprocessor/variadic/to_seq.hpp>
-# define CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_VARIADIC_( \\
+# include <boost/contract/detail/preprocessor/variadic/to_seq.hpp>
+# define \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_VARIADIC_( \\
...) \\
- CONTRACT_DETAIL_PP_VARIADIC_TO_SEQ(void, __VA_ARGS__) , /*comma split*/
+ BOOST_CONTRACT_DETAIL_PP_VARIADIC_TO_SEQ(void, __VA_ARGS__) , /*comma split*/
# define \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_MAYBE_PAREN1_( \
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_MAYBE_PAREN1_( \
paren) \\
- BOOST_PP_IIF(CONTRACT_DETAIL_PP_KEYWORD_IS_POSTCONDITION_FRONT( \\
- CONTRACT_DETAIL_PP_VARIADIC_EAT paren), \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_PAREN_ \\
+ BOOST_PP_IIF(BOOST_CONTRACT_DETAIL_PP_KEYWORD_IS_POSTCONDITION_FRONT( \\
+ BOOST_CONTRACT_DETAIL_PP_VARIADIC_EAT paren), \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_PAREN_ \\
/* unfortunately this needs to know that initialize is next (needed */\\
/* to handle typed old-of when no variadic macros) */ \\
- , BOOST_PP_IIF(CONTRACT_DETAIL_PP_KEYWORD_IS_INITIALIZE_FRONT( \\
- CONTRACT_DETAIL_PP_VARIADIC_EAT paren), \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_PAREN_ \\
- , BOOST_PP_IIF(CONTRACT_DETAIL_PP_TRAITS_AUX_IS_NIL_FRONT( \\
- CONTRACT_DETAIL_PP_VARIADIC_EAT paren), \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_PAREN_ \\
- , BOOST_PP_IIF(CONTRACT_DETAIL_PP_HAS_PAREN( \\
- CONTRACT_DETAIL_PP_VARIADIC_EAT paren), \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_PAREN_ \\
+ , BOOST_PP_IIF(BOOST_CONTRACT_DETAIL_PP_KEYWORD_IS_INITIALIZE_FRONT( \\
+ BOOST_CONTRACT_DETAIL_PP_VARIADIC_EAT paren), \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_PAREN_ \\
+ , BOOST_PP_IIF(BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_IS_NIL_FRONT( \\
+ BOOST_CONTRACT_DETAIL_PP_VARIADIC_EAT paren), \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_PAREN_ \\
+ , BOOST_PP_IIF(BOOST_CONTRACT_DETAIL_PP_HAS_PAREN( \\
+ BOOST_CONTRACT_DETAIL_PP_VARIADIC_EAT paren), \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_PAREN_ \\
, \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_VARIADIC_ \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_VARIADIC_ \\
))))(paren)
# define \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_MAYBE_PAREN_( \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_MAYBE_PAREN_( \\
tokens) \\
- BOOST_PP_IIF(CONTRACT_DETAIL_PP_HAS_PAREN(tokens), \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_MAYBE_PAREN1_ \\
+ BOOST_PP_IIF(BOOST_CONTRACT_DETAIL_PP_HAS_PAREN(tokens), \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_MAYBE_PAREN1_ \\
, \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_VARIADIC_ \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_VARIADIC_ \\
)(tokens)
# define \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_postcondition(...)\\
- BOOST_PP_IIF(BOOST_PP_EQUAL(1, CONTRACT_DETAIL_PP_VARIADIC_SIZE( \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_postcondition(\\
+ ...) \\
+ BOOST_PP_IIF(BOOST_PP_EQUAL(1, BOOST_CONTRACT_DETAIL_PP_VARIADIC_SIZE(\\
__VA_ARGS__)), \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_MAYBE_PAREN_ \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_MAYBE_PAREN_ \\
, \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_VARIADIC_ \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_VARIADIC_ \\
)(__VA_ARGS__)
#else
-# define CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_TOKEN_( \\
+# define \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_TOKEN_( \\
token) \\
(token) , /* comma split */
# define \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_postcondition( \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_postcondition(\\
tokens) \\
- BOOST_PP_IIF(CONTRACT_DETAIL_PP_HAS_PAREN(tokens), \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_PAREN_ \\
+ BOOST_PP_IIF(BOOST_CONTRACT_DETAIL_PP_HAS_PAREN(tokens), \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_PAREN_ \\
, \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_TOKEN_ \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_TOKEN_ \\
)(tokens)
#endif
// Precondition: sign is `postcondition(...)`.
-#define CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_CAT_(sign) \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_CAT_( \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_, sign)
+#define BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_CAT_( \\
+ sign) \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_CAT_( \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_, \\
+ sign)
{1}
-#define CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_TRAIT_SIGN_NEXT_( \\
+#define BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_TRAIT_SIGN_NEXT_( \\
seq_sign) \\
- BOOST_PP_IIF(CONTRACT_DETAIL_PP_KEYWORD_IS_POSTCONDITION_FRONT( \\
+ BOOST_PP_IIF(BOOST_CONTRACT_DETAIL_PP_KEYWORD_IS_POSTCONDITION_FRONT( \\
BOOST_PP_TUPLE_ELEM(2, 1, seq_sign)), \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_TRAIT_SIGN_1_ \\
- , BOOST_PP_IIF(CONTRACT_DETAIL_PP_HAS_PAREN( \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_TRAIT_SIGN_1_ \\
+ , BOOST_PP_IIF(BOOST_CONTRACT_DETAIL_PP_HAS_PAREN( \\
BOOST_PP_TUPLE_ELEM(2, 1, seq_sign)), \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_TRAIT_SIGN_1_ \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_TRAIT_SIGN_1_ \\
, \\
seq_sign BOOST_PP_TUPLE_EAT(2) \\
))(BOOST_PP_TUPLE_ELEM(2, 0, seq_sign), BOOST_PP_TUPLE_ELEM(2, 1, seq_sign))
-#define CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_TRAIT_SIGN_(sign) \\
+#define BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_TRAIT_SIGN_(sign) \\
BOOST_PP_EXPAND( \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_TRAIT_SIGN_NEXT_( ( \\
- BOOST_PP_IIF(CONTRACT_DETAIL_PP_HAS_PAREN(sign), \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_postcondition \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_TRAIT_SIGN_NEXT_( ( \\
+ BOOST_PP_IIF(BOOST_CONTRACT_DETAIL_PP_HAS_PAREN(sign), \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_postcondition \\
, \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_CAT_ \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SPLIT_SEQ_CAT_\\
)(sign) \\
) ) )
-#define CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_ASSERTION_LIST_( \\
+#define BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_ASSERTION_LIST_( \\
result_oldofs_assertions) \\
( \\
BOOST_PP_TUPLE_ELEM(3, 0, result_oldofs_assertions) \\
, \\
BOOST_PP_TUPLE_ELEM(3, 1, result_oldofs_assertions) \\
, \\
- CONTRACT_DETAIL_PP_ASSERTION_TRAITS(BOOST_PP_TUPLE_ELEM(3, 2, \\
+ BOOST_CONTRACT_DETAIL_PP_ASSERTION_TRAITS(BOOST_PP_TUPLE_ELEM(3, 2, \\
result_oldofs_assertions)) /* process assertion traits */ \\
)
-#define CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_LIST_(sign) \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_ASSERTION_LIST_( \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_FROM_SEQ_( \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_TRAIT_SIGN_( \\
+#define BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_LIST_(sign) \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_ASSERTION_LIST_( \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_FROM_SEQ_( \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_TRAIT_SIGN_( \\
sign \\
)))
-#define CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_TRAIT_(sign) \\
- BOOST_PP_IIF(CONTRACT_DETAIL_PP_KEYWORD_IS_POSTCONDITION_FRONT(sign), \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_LIST_ \\
+#define BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_TRAIT_(sign) \\
+ BOOST_PP_IIF( \\
+ BOOST_CONTRACT_DETAIL_PP_KEYWORD_IS_POSTCONDITION_FRONT(sign), \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_LIST_ \\
, \\
( \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_NIL /* no result */ \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_NIL /* no result */ \\
, \\
BOOST_PP_NIL /* no oldofs */ \\
, \\
@@ -360,43 +380,46 @@
BOOST_PP_TUPLE_EAT(1) \\
)(sign)
-#define CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_REMOVE_(sign) \\
+#define BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_REMOVE_(sign) \\
BOOST_PP_TUPLE_ELEM(2, 1, BOOST_PP_EXPAND( \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_TRAIT_SIGN_(sign)))
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_TRAIT_SIGN_( \\
+ sign)))
-#define CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SIGN_(sign) \\
- BOOST_PP_IIF(CONTRACT_DETAIL_PP_KEYWORD_IS_POSTCONDITION_FRONT(sign), \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_REMOVE_ \\
+#define BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SIGN_(sign) \\
+ BOOST_PP_IIF( \
+ BOOST_CONTRACT_DETAIL_PP_KEYWORD_IS_POSTCONDITION_FRONT(sign), \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_REMOVE_ \\
, \\
sign BOOST_PP_TUPLE_EAT(1) \\
)(sign)
// PROTECTED //
-#define CONTRACT_DETAIL_PP_FUNC_TRAITS_AUX_POSTCONDITIONS(traits_sign) \\
- CONTRACT_DETAIL_PP_TRAITS_AUX_APPLY(traits_sign, \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_TRAIT_, \\
- CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SIGN_)
+#define BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_AUX_POSTCONDITIONS(traits_sign) \\
+ BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_APPLY(traits_sign, \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_TRAIT_, \\
+ BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS_SIGN_)
// PUBLIC //
-#define CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITION_RESULT_ASSIGNMENT( \\
+#define BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITION_RESULT_ASSIGNMENT( \\
func_traits) \\
- BOOST_PP_CAT(CONTRACT_DETAIL_PP_TRAITS_AUX_NIL_REMOVE_, \\
+ BOOST_PP_CAT(BOOST_CONTRACT_DETAIL_PP_TRAITS_AUX_NIL_REMOVE_, \\
BOOST_PP_TUPLE_ELEM(3, 0, BOOST_PP_ARRAY_ELEM(21, func_traits)))
// Expand to pp-list of oldofs (see `OLDOF_TRAITS`).
-#define CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITION_OLDOFS(func_traits) \\
+#define BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITION_OLDOFS( \\
+ func_traits) \\
BOOST_PP_TUPLE_ELEM(3, 1, BOOST_PP_ARRAY_ELEM(21, func_traits))
// Expand to pp-list of postcondition assertions.
-#define CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS(func_traits) \\
+#define BOOST_CONTRACT_DETAIL_PP_FUNC_TRAITS_POSTCONDITIONS(func_traits) \\
BOOST_PP_TUPLE_ELEM(3, 2, BOOST_PP_ARRAY_ELEM(21, func_traits))
#endif // #include guard
-'''.format(CONTRACT_LIMIT_OLDOFS, data(CONTRACT_LIMIT_OLDOFS)))
+'''.format(BOOST_CONTRACT_LIMIT_OLDOFS, data(BOOST_CONTRACT_LIMIT_OLDOFS)))
h.close()
-print "Written:", header
+print "Generated:", header
Modified: sandbox/contract/libs/contract/generate/boost/contract/detail/preprocessor/tuple/split-generate.py
==============================================================================
--- sandbox/contract/libs/contract/generate/boost/contract/detail/preprocessor/tuple/split-generate.py (original)
+++ sandbox/contract/libs/contract/generate/boost/contract/detail/preprocessor/tuple/split-generate.py 2013-03-04 17:41:09 EST (Mon, 04 Mar 2013)
@@ -6,8 +6,13 @@
# Home at http://sourceforge.net/projects/contractpp
import sys
+import os
import shutil
+# $ python <NAME>-generate.py [DIR]
+header = sys.argv[0].replace("-generate.py", ".hpp", 1)
+if(len(sys.argv) > 1): header = os.path.join(sys.argv[1], header)
+
def placeholders(start, stop):
(s, comma) = ('', '')
for i in range(start, stop):
@@ -24,26 +29,27 @@
return s
BOOST_PP_LIMIT_TUPLE = raw_input("BOOST_PP_LIMIT_TUPLE" +
- " from <boost/preprocessor/limit.hpp> [64] = ")
+ " (as in <boost/preprocessor/limit.hpp>) [64] = ")
if BOOST_PP_LIMIT_TUPLE == "": BOOST_PP_LIMIT_TUPLE = 64
else: BOOST_PP_LIMIT_TUPLE = int(BOOST_PP_LIMIT_TUPLE)
-header = sys.argv[0].replace("-generate.py", ".hpp", 1)
-shutil.copyfile(header, header + ".bak")
+try: shutil.copyfile(header, header + ".bak")
+except: pass
h = open(header, 'w')
h.write('''
+/*************************************************************/
+/* WARNING: FILE AUTOMATICALLY GENERATED, DO NOT MODIFY IT! */
+/* Instead modify the generation script "<FILE>-generate.py" */
+/*************************************************************/
+// Used: #define BOOST_PP_LIMIT_TUPLE {0}
+
#ifndef CONTRACT_DETAIL_PP_TUPLE_SPLIT_HPP_
#define CONTRACT_DETAIL_PP_TUPLE_SPLIT_HPP_
-// WARNING: FILE AUTOMATICALLY GENERATED, DO NOT MODIFY IT!
-// Instead modify the generation script "<FILE>-generate.py" and run
-// `$ python <FILE_NAME>-generate.py > FILE_NAME.hpp`.
-// Used: #define BOOST_PP_LIMIT_TUPLE {0}
-
#include <boost/preprocessor/limits.hpp>
#if BOOST_PP_LIMIT_TUPLE != {0}
-#error "Code generation used incorrect BOOST_PP_LIMIT_TUPLE"
+# error "Code generation used incorrect BOOST_PP_LIMIT_TUPLE"
#endif
// PRIVATE //
@@ -81,5 +87,5 @@
'''.format(BOOST_PP_LIMIT_TUPLE, data(BOOST_PP_LIMIT_TUPLE)))
h.close()
-print "Written", header
+print "Generated:", header
Deleted: sandbox/contract/libs/contract/generate/boost/generate.py
==============================================================================
--- sandbox/contract/libs/contract/generate/boost/generate.py 2013-03-04 17:41:09 EST (Mon, 04 Mar 2013)
+++ (empty file)
@@ -1,35 +0,0 @@
-
-# Copyright (C) 2008-2012 Lorenzo Caminiti
-# Distributed under the Boost Software License, Version 1.0
-# (see accompanying file LICENSE_1_0.txt or a copy at
-# http://www.boost.org/LICENSE_1_0.txt)
-# Home at http://sourceforge.net/projects/contractpp
-
-import os
-
-scripts = [
- ("contract/detail/preprocessor/array", "first_n-generate.py"),
- ("contract/detail/preprocessor/array", "rest_n-generate.py"),
- ("contract/detail/preprocessor/facilities", "is_digit-generate.py"),
- ("contract/detail/preprocessor/traits/aux_", "apply-generate.py"),
- ("contract/detail/preprocessor/traits/aux_", "list-generate.py"),
- ("contract/detail/preprocessor/traits/aux_",
- "select_assertion_-generate.py"),
- ("contract/detail/preprocessor/traits/func", "catches-generate.py"),
- ("contract/detail/preprocessor/traits/func", "postconditions-generate.py"),
- ("contract/detail/preprocessor/tuple", "split-generate.py"),
-]
-
-root = os.getcwd()
-for s in scripts:
- dir = s[0]
- cmd = "python " + s[1]
- print
- print dir + "$ " + cmd
- os.chdir(dir)
- os.system(cmd)
- os.chdir(root)
-
-print
-print "Done. (Add any missing generation Python script to this script.)",
-
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