diff options
Diffstat (limited to 'boost/local_function/aux_/preprocessor/traits')
20 files changed, 1147 insertions, 0 deletions
diff --git a/boost/local_function/aux_/preprocessor/traits/bind.hpp b/boost/local_function/aux_/preprocessor/traits/bind.hpp new file mode 100644 index 0000000000..601f36f8a1 --- /dev/null +++ b/boost/local_function/aux_/preprocessor/traits/bind.hpp @@ -0,0 +1,46 @@ + +// Copyright (C) 2009-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://www.boost.org/libs/local_function + +#ifndef BOOST_LOCAL_FUNCTION_AUX_PP_BIND_TRAITS_HPP_ +#define BOOST_LOCAL_FUNCTION_AUX_PP_BIND_TRAITS_HPP_ + +#include <boost/preprocessor/tuple/elem.hpp> + +// PRIVATE // + +// Non-this bind is 2-tuple `(name_without_type, name_with_type)`. +#define BOOST_LOCAL_FUNCTION_AUX_PP_BIND_TRAITS_INDEX_WITHOUT_TYPE_ 0 +#define BOOST_LOCAL_FUNCTION_AUX_PP_BIND_TRAITS_INDEX_WITH_TYPE_ 1 +#define BOOST_LOCAL_FUNCTION_AUX_PP_BIND_TRAITS_INDEX_MAX_ 2 + +// This bind is 1-typle `([type_] EMPTY)`. +#define BOOST_LOCAL_FUNCTION_AUX_PP_BIND_THIS_TRAITS_INDEX_TYPE_ 0 +#define BOOST_LOCAL_FUNCTION_AUX_PP_BIND_THIS_TRAITS_INDEX_MAX_ 1 + +// PUBLIC // + +// Expand: `[&] var_`. +#define BOOST_LOCAL_FUNCTION_AUX_PP_BIND_TRAITS_VAR_WITHOUT_TYPE(bind_traits) \ + BOOST_PP_TUPLE_ELEM(BOOST_LOCAL_FUNCTION_AUX_PP_BIND_TRAITS_INDEX_MAX_, \ + BOOST_LOCAL_FUNCTION_AUX_PP_BIND_TRAITS_INDEX_WITHOUT_TYPE_, \ + bind_traits) + +// Expand: `[type_ [&] var_]` (EMPTY if no type_ specified). +#define BOOST_LOCAL_FUNCTION_AUX_PP_BIND_TRAITS_VAR_WITH_TYPE(bind_traits) \ + BOOST_PP_TUPLE_ELEM(BOOST_LOCAL_FUNCTION_AUX_PP_BIND_TRAITS_INDEX_MAX_, \ + BOOST_LOCAL_FUNCTION_AUX_PP_BIND_TRAITS_INDEX_WITH_TYPE_, \ + bind_traits)(/* expand EMPTY */) + +// Expand: `[type_]` (EMPTY if no type_ specified). +#define BOOST_LOCAL_FUNCTION_AUX_PP_BIND_TRAITS_THIS_TYPE(bind_this_traits) \ + BOOST_PP_TUPLE_ELEM( \ + BOOST_LOCAL_FUNCTION_AUX_PP_BIND_THIS_TRAITS_INDEX_MAX_, \ + BOOST_LOCAL_FUNCTION_AUX_PP_BIND_THIS_TRAITS_INDEX_TYPE_, \ + bind_this_traits)(/* expand EMPTY */) + +#endif // #include guard + diff --git a/boost/local_function/aux_/preprocessor/traits/decl.hpp b/boost/local_function/aux_/preprocessor/traits/decl.hpp new file mode 100644 index 0000000000..8f6a6f78fd --- /dev/null +++ b/boost/local_function/aux_/preprocessor/traits/decl.hpp @@ -0,0 +1,29 @@ + +// Copyright (C) 2009-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://www.boost.org/libs/local_function + +#ifndef BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_HPP_ +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_HPP_ + +#include <boost/local_function/aux_/preprocessor/traits/decl_sign_/sign.hpp> +#include <boost/local_function/aux_/preprocessor/traits/decl_/nil.hpp> +#include <boost/preprocessor/control/iif.hpp> +#include <boost/preprocessor/tuple/eat.hpp> +#include <boost/preprocessor/list/adt.hpp> + +// PUBLIC // + +// Expand: decl_traits (see DECL_TRAITS macros to inspect these traits). +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS(declarations) \ + BOOST_PP_IIF(BOOST_PP_LIST_IS_NIL(declarations), \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_NIL \ + BOOST_PP_TUPLE_EAT(1) \ + , \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN \ + )(declarations) + +#endif // #include guard + diff --git a/boost/local_function/aux_/preprocessor/traits/decl_/append.hpp b/boost/local_function/aux_/preprocessor/traits/decl_/append.hpp new file mode 100644 index 0000000000..b810c66aac --- /dev/null +++ b/boost/local_function/aux_/preprocessor/traits/decl_/append.hpp @@ -0,0 +1,212 @@ + +// Copyright (C) 2009-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://www.boost.org/libs/local_function + +#ifndef BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_APPEND_HPP_ +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_APPEND_HPP_ + +#include <boost/local_function/aux_/preprocessor/traits/decl_returns.hpp> +#include <boost/local_function/aux_/preprocessor/traits/decl_params.hpp> +#include <boost/local_function/aux_/preprocessor/traits/decl_const_binds.hpp> +#include <boost/local_function/aux_/preprocessor/traits/decl_binds.hpp> +#include <boost/local_function/aux_/preprocessor/traits/decl_error.hpp> +#include <boost/local_function/aux_/preprocessor/traits/param.hpp> +#include <boost/local_function/detail/preprocessor/keyword/return.hpp> +#include <boost/preprocessor/facilities/empty.hpp> +#include <boost/preprocessor/arithmetic/dec.hpp> +#include <boost/preprocessor/list/append.hpp> +#include <boost/preprocessor/list/size.hpp> +#include <boost/preprocessor/list/at.hpp> +#include <boost/preprocessor/list/first_n.hpp> + +// PRIVATE // + +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_APPEND_PARAM_DEFAULT_( \ + params, default_value) \ + /* `DEC` ok because precondition that unbinds are not nil-list */ \ + BOOST_PP_LIST_APPEND( \ + BOOST_PP_LIST_FIRST_N(BOOST_PP_DEC(BOOST_PP_LIST_SIZE(params)), \ + params) \ + , \ + ( /* list 2-tuple */ \ + ( /* (param_decl, default) 2-tuple */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_PARAM_TRAITS_DECL( \ + BOOST_PP_LIST_AT(params, BOOST_PP_DEC( \ + BOOST_PP_LIST_SIZE(params)))) \ + , \ + default_value BOOST_PP_EMPTY \ + ) \ + , \ + BOOST_PP_NIL \ + ) \ + ) + +// PUBLIC // + +// return_type: `return result_type`. +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_APPEND_RETURN( \ + decl_traits, return_type) \ + ( /* returns */ \ + BOOST_PP_LIST_APPEND( \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_RETURNS(decl_traits), \ + ( BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_RETURN_REMOVE_FRONT( \ + return_type), BOOST_PP_NIL ) ) \ + , /* params and defaults */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_PARAMS(decl_traits) \ + , /* const-bind vars */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_CONST_BINDS(decl_traits) \ + , /* const-bind `this` types */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_CONST_BIND_THIS_TYPES( \ + decl_traits) \ + , /* bind vars */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_BINDS(decl_traits) \ + , /* bind `this` types */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_BIND_THIS_TYPES(decl_traits) \ + , /* error message (if any) */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_ERROR(decl_traits) \ + ) + + +// param_decl: `[auto | register] type_ name_`. +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_APPEND_PARAM( \ + decl_traits, param_decl) \ + ( /* returns */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_RETURNS(decl_traits) \ + , /* params and defaults */ \ + BOOST_PP_LIST_APPEND( \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_PARAMS(decl_traits), \ + /* append param (with no default -- EMPTY) */ \ + ( (param_decl, BOOST_PP_EMPTY), BOOST_PP_NIL ) ) \ + , /* const-bind vars */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_CONST_BINDS(decl_traits) \ + , /* const-bind `this` types */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_CONST_BIND_THIS_TYPES( \ + decl_traits) \ + , /* bind vars */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_BINDS(decl_traits) \ + , /* bind `this` types */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_BIND_THIS_TYPES(decl_traits) \ + , /* error message (if any) */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_ERROR(decl_traits) \ + ) + +// default_value: a valid parameter default value (`-1`, etc). +// Precondition: already added unbinds are not nil-list. +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_APPEND_PARAM_DEFAULT( \ + decl_traits, default_value) \ + ( /* returns */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_RETURNS(decl_traits) \ + , /* unbind params and defaults */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_APPEND_PARAM_DEFAULT_( \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_PARAMS(decl_traits), \ + default_value) /* append default to last added param */ \ + , /* const-bind vars */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_CONST_BINDS(decl_traits) \ + , /* const-bind `this` types */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_CONST_BIND_THIS_TYPES( \ + decl_traits) \ + , /* bind vars */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_BINDS(decl_traits) \ + , /* bind `this` types */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_BIND_THIS_TYPES(decl_traits) \ + , /* error message (if any) */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_ERROR(decl_traits) \ + ) + +// var_without_type: `[&] var_` (var_ != this). +// var_with_type: `PP_EMPTY | type [&] var_` (var_ != this). +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_APPEND_BIND( \ + decl_traits, var_without_type, var_with_type) \ + ( /* returns */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_RETURNS(decl_traits) \ + , /* params and defaults */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_PARAMS(decl_traits) \ + , /* const-bind vars */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_CONST_BINDS(decl_traits) \ + , /* const-bind `this` types */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_CONST_BIND_THIS_TYPES( \ + decl_traits) \ + , /* bind vars */ \ + BOOST_PP_LIST_APPEND( \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_BINDS(decl_traits), \ + ( (var_without_type, var_with_type), BOOST_PP_NIL ) ) \ + , /* bind `this` types */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_BIND_THIS_TYPES(decl_traits) \ + , /* error message (if any) */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_ERROR(decl_traits) \ + ) + +// this_type: `PP_EMPTY | type`. +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_APPEND_BIND_THIS_TYPE( \ + decl_traits, this_type) \ + ( /* returns */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_RETURNS(decl_traits) \ + , /* params and defaults */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_PARAMS(decl_traits) \ + , /* const-bind vars */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_CONST_BINDS(decl_traits) \ + , /* const-bind `this` types */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_CONST_BIND_THIS_TYPES( \ + decl_traits) \ + , /* bind vars */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_BINDS(decl_traits) \ + , /* bind `this` types */ \ + BOOST_PP_LIST_APPEND( \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_BIND_THIS_TYPES( \ + decl_traits), \ + ( (this_type), BOOST_PP_NIL ) ) \ + , /* error message (if any) */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_ERROR(decl_traits) \ + ) + +// var_without_type: `[&] var_` (var_ != this). +// var_with_type: `BOOST_PP_EMPTY | type_ [&] name_` (var_ != this). +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_APPEND_CONST_BIND( \ + decl_traits, var_without_type, var_with_type) \ + ( /* returns */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_RETURNS(decl_traits) \ + , /* params and defaults */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_PARAMS(decl_traits) \ + , /* const-bind vars */ \ + BOOST_PP_LIST_APPEND( \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_CONST_BINDS( \ + decl_traits), \ + ( (var_without_type, var_with_type), BOOST_PP_NIL ) ) \ + , /* const-bind `this` types */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_CONST_BIND_THIS_TYPES( \ + decl_traits) \ + , /* bind vars */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_BINDS(decl_traits) \ + , /* bind `this` types */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_BIND_THIS_TYPES(decl_traits) \ + , /* error message (if any) */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_ERROR(decl_traits) \ + ) + +// this_type: `PP_EMPTY | type`. +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_APPEND_CONST_BIND_THIS_TYPE( \ + decl_traits, this_type) \ + ( /* returns */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_RETURNS(decl_traits) \ + , /* params and defaults */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_PARAMS(decl_traits) \ + , /* const-bind vars */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_CONST_BINDS(decl_traits) \ + , /* const-bind `this` types */ \ + BOOST_PP_LIST_APPEND( \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_CONST_BIND_THIS_TYPES( \ + decl_traits), \ + ( (this_type), BOOST_PP_NIL ) ) \ + , /* bind vars */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_BINDS(decl_traits) \ + , /* bind `this` types */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_BIND_THIS_TYPES(decl_traits) \ + , /* error message (if any) */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_ERROR(decl_traits) \ + ) + +#endif // #include guard + diff --git a/boost/local_function/aux_/preprocessor/traits/decl_/index.hpp b/boost/local_function/aux_/preprocessor/traits/decl_/index.hpp new file mode 100644 index 0000000000..1d62693825 --- /dev/null +++ b/boost/local_function/aux_/preprocessor/traits/decl_/index.hpp @@ -0,0 +1,21 @@ + +// Copyright (C) 2009-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://www.boost.org/libs/local_function + +#ifndef BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_INDEX_HPP_ +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_INDEX_HPP_ + +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_INDEX_RETURNS 0 +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_INDEX_PARAMS 1 +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_INDEX_CONST_BINDS 2 +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_INDEX_CONST_BIND_THIS_TYPES 3 +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_INDEX_BINDS 4 +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_INDEX_BIND_THIS_TYPES 5 +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_INDEX_ERROR 6 +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_INDEX_MAX 7 + +#endif // #include guard + diff --git a/boost/local_function/aux_/preprocessor/traits/decl_/nil.hpp b/boost/local_function/aux_/preprocessor/traits/decl_/nil.hpp new file mode 100644 index 0000000000..0684dc518f --- /dev/null +++ b/boost/local_function/aux_/preprocessor/traits/decl_/nil.hpp @@ -0,0 +1,39 @@ + +// Copyright (C) 2009-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://www.boost.org/libs/local_function + +#ifndef BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_NIL_HPP_ +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_NIL_HPP_ + +#include <boost/preprocessor/facilities/empty.hpp> + +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_NIL \ + ( \ + /* returns: list of `return result_type` */ \ + BOOST_PP_NIL /* nil list */ \ + , \ + /* params: list of 2-tuples (param_decl, param_default) */ \ + BOOST_PP_NIL /* nil list */ \ + , \ + /* const-binds: list of 2-tuple `(var_untyped, var_typed)` */ \ + BOOST_PP_NIL /* nil list */ \ + , \ + /* const-bind this: list of 1-tuple `(type)` */ \ + BOOST_PP_NIL \ + /* number of const-bind `this` */ \ + , \ + /* binds: list of 2-tuple `(var_untyped, var_typed)` */ \ + BOOST_PP_NIL /* nil list */ \ + , \ + /* bind this: list of 1-type `(type)` */ \ + BOOST_PP_NIL \ + , \ + /* error: `[ERROR_message_text] EMPTY` */ \ + BOOST_PP_EMPTY /* no error */ \ + ) + +#endif // #include guard + diff --git a/boost/local_function/aux_/preprocessor/traits/decl_/set_error.hpp b/boost/local_function/aux_/preprocessor/traits/decl_/set_error.hpp new file mode 100644 index 0000000000..b3ec1b3fa7 --- /dev/null +++ b/boost/local_function/aux_/preprocessor/traits/decl_/set_error.hpp @@ -0,0 +1,38 @@ + +// Copyright (C) 2009-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://www.boost.org/libs/local_function + +#ifndef BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SET_ERROR_HPP_ +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SET_ERROR_HPP_ + +#include <boost/local_function/aux_/preprocessor/traits/decl_returns.hpp> +#include <boost/local_function/aux_/preprocessor/traits/decl_params.hpp> +#include <boost/local_function/aux_/preprocessor/traits/decl_const_binds.hpp> +#include <boost/local_function/aux_/preprocessor/traits/decl_binds.hpp> + +// PUBLIC // + +// error: `[ERROR_message_text] EMPTY`, no ERROR_message_text if no error. +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SET_ERROR(decl_traits, error) \ + ( /* return types */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_RETURNS(decl_traits) \ + , /* params and defaults */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_PARAMS(decl_traits) \ + , /* const-bind names */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_CONST_BINDS(decl_traits) \ + , /* const-bind `this` types */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_CONST_BIND_THIS_TYPES( \ + decl_traits) \ + , /* bind names */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_BINDS(decl_traits) \ + , /* bind `this` types */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_BIND_THIS_TYPES(decl_traits) \ + , /* error message (if any) */ \ + error \ + ) + +#endif // #include guard + diff --git a/boost/local_function/aux_/preprocessor/traits/decl_/validate.hpp b/boost/local_function/aux_/preprocessor/traits/decl_/validate.hpp new file mode 100644 index 0000000000..aab7f8866c --- /dev/null +++ b/boost/local_function/aux_/preprocessor/traits/decl_/validate.hpp @@ -0,0 +1,24 @@ + +// Copyright (C) 2009-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://www.boost.org/libs/local_function + +#ifndef BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_VALIDATE_HPP_ +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_VALIDATE_HPP_ + +#include <boost/local_function/aux_/preprocessor/traits/decl_/validate_/this_count.hpp> +#include <boost/local_function/aux_/preprocessor/traits/decl_/validate_/return_count.hpp> + +// PUBLIC // + +// Validate params after they have been parsed. +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_VALIDATE(decl_traits) \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_VALIDATE_THIS_COUNT( \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_VALIDATE_RETURN_COUNT( \ + decl_traits \ + )) + +#endif // #include guard + diff --git a/boost/local_function/aux_/preprocessor/traits/decl_/validate_/return_count.hpp b/boost/local_function/aux_/preprocessor/traits/decl_/validate_/return_count.hpp new file mode 100644 index 0000000000..4d337d900b --- /dev/null +++ b/boost/local_function/aux_/preprocessor/traits/decl_/validate_/return_count.hpp @@ -0,0 +1,32 @@ + +// Copyright (C) 2009-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://www.boost.org/libs/local_function + +#ifndef BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_VALIDATE_RETURN_COUNT_HPP_ +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_VALIDATE_RETURN_COUNT_HPP_ + +#include <boost/local_function/aux_/preprocessor/traits/decl_/set_error.hpp> +#include <boost/local_function/aux_/preprocessor/traits/decl_returns.hpp> +#include <boost/preprocessor/control/iif.hpp> +#include <boost/preprocessor/facilities/empty.hpp> +#include <boost/preprocessor/tuple/eat.hpp> +#include <boost/preprocessor/comparison/greater.hpp> +#include <boost/preprocessor/list/size.hpp> + +// PRIVATE // + +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_VALIDATE_RETURN_COUNT( \ + decl_traits) \ + BOOST_PP_IIF(BOOST_PP_GREATER(BOOST_PP_LIST_SIZE( \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_RETURNS(decl_traits)), 1), \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SET_ERROR \ + , /* else do nothing (keeping previous error, if any) */ \ + decl_traits BOOST_PP_TUPLE_EAT(2) \ + )(decl_traits, /* trailing `EMPTY` because error might not be present */ \ + ERROR_cannot_specify_more_than_one_return_type BOOST_PP_EMPTY) + +#endif // #include guard + diff --git a/boost/local_function/aux_/preprocessor/traits/decl_/validate_/this_count.hpp b/boost/local_function/aux_/preprocessor/traits/decl_/validate_/this_count.hpp new file mode 100644 index 0000000000..034e8e69b4 --- /dev/null +++ b/boost/local_function/aux_/preprocessor/traits/decl_/validate_/this_count.hpp @@ -0,0 +1,38 @@ + +// Copyright (C) 2009-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://www.boost.org/libs/local_function + +#ifndef BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_VALIDATE_THIS_COUNT_HPP_ +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_VALIDATE_THIS_COUNT_HPP_ + +#include <boost/local_function/aux_/preprocessor/traits/decl_/set_error.hpp> +#include <boost/local_function/aux_/preprocessor/traits/decl_const_binds.hpp> +#include <boost/local_function/aux_/preprocessor/traits/decl_binds.hpp> +#include <boost/preprocessor/control/iif.hpp> +#include <boost/preprocessor/facilities/empty.hpp> +#include <boost/preprocessor/tuple/eat.hpp> +#include <boost/preprocessor/comparison/greater.hpp> +#include <boost/preprocessor/list/append.hpp> +#include <boost/preprocessor/list/size.hpp> + +// PUBLIC // + +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_VALIDATE_THIS_COUNT( \ + decl_traits) \ + BOOST_PP_IIF(BOOST_PP_GREATER(BOOST_PP_LIST_SIZE(BOOST_PP_LIST_APPEND( \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_CONST_BIND_THIS_TYPES( \ + decl_traits), \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_BIND_THIS_TYPES( \ + decl_traits))), \ + 1), \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SET_ERROR \ + , /* do nothing (keeping previous error, if any) */ \ + decl_traits BOOST_PP_TUPLE_EAT(2) \ + )(decl_traits, /* trailing `EMPTY` because error might not be present */ \ + ERROR_cannot_bind_object_this_multiple_times BOOST_PP_EMPTY) + +#endif // #include guard + diff --git a/boost/local_function/aux_/preprocessor/traits/decl_binds.hpp b/boost/local_function/aux_/preprocessor/traits/decl_binds.hpp new file mode 100644 index 0000000000..0d4f18276c --- /dev/null +++ b/boost/local_function/aux_/preprocessor/traits/decl_binds.hpp @@ -0,0 +1,35 @@ + +// Copyright (C) 2009-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://www.boost.org/libs/local_function + +#ifndef BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_BINDS_HPP_ +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_BINDS_HPP_ + +#include <boost/local_function/aux_/preprocessor/traits/decl_/index.hpp> +#include <boost/preprocessor/tuple/elem.hpp> +#include <boost/preprocessor/list/transform.hpp> + +// PRIVATE // + +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_BIND_APPLY_( \ + d, bind_macro, bind_traits) \ + bind_macro(bind_traits) + +// PUBLIC // + +// Expand: pp-list of non-const bind-traits. +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_BINDS(decl_traits) \ + BOOST_PP_TUPLE_ELEM(BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_INDEX_MAX, \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_INDEX_BINDS, decl_traits) + +// Expand: pp-list non-const bind-this-traits (size <= 1 after validation). +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_BIND_THIS_TYPES(decl_traits) \ + BOOST_PP_TUPLE_ELEM(BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_INDEX_MAX, \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_INDEX_BIND_THIS_TYPES, \ + decl_traits) + +#endif // #include guard + diff --git a/boost/local_function/aux_/preprocessor/traits/decl_const_binds.hpp b/boost/local_function/aux_/preprocessor/traits/decl_const_binds.hpp new file mode 100644 index 0000000000..0ea40cf6df --- /dev/null +++ b/boost/local_function/aux_/preprocessor/traits/decl_const_binds.hpp @@ -0,0 +1,40 @@ + +// Copyright (C) 2009-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://www.boost.org/libs/local_function + +#ifndef BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_CONST_BINDS_HPP_ +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_CONST_BINDS_HPP_ + +#include <boost/local_function/aux_/preprocessor/traits/bind.hpp> +#include <boost/local_function/aux_/preprocessor/traits/decl_/index.hpp> +#include <boost/preprocessor/tuple/elem.hpp> +#include <boost/preprocessor/list/transform.hpp> + +// PRIVATE // + +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_CONST_BIND_APPLY_( \ + d, bind_macro, bind_traits) \ + bind_macro(bind_traits) + +// PUBLIC // + +// Expand: pp-list of const bind-traits. +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_CONST_BINDS(decl_traits) \ + BOOST_PP_TUPLE_ELEM(BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_INDEX_MAX, \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_INDEX_CONST_BINDS, \ + decl_traits) + +// Expand: pp-list of const bind-this-traits (size <= 1 after validation). +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_CONST_BIND_THIS_TYPES( \ + decl_traits) \ + BOOST_PP_TUPLE_ELEM( \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_INDEX_MAX \ + , BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_INDEX_CONST_BIND_THIS_TYPES \ + , decl_traits \ + ) + +#endif // #include guard + diff --git a/boost/local_function/aux_/preprocessor/traits/decl_error.hpp b/boost/local_function/aux_/preprocessor/traits/decl_error.hpp new file mode 100644 index 0000000000..a95fc7b760 --- /dev/null +++ b/boost/local_function/aux_/preprocessor/traits/decl_error.hpp @@ -0,0 +1,27 @@ + +// Copyright (C) 2009-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://www.boost.org/libs/local_function + +#ifndef BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_ERROR_HPP_ +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_ERROR_HPP_ + +#include <boost/local_function/aux_/preprocessor/traits/decl_/index.hpp> +#include <boost/preprocessor/tuple/elem.hpp> + +// PUBLIC // + +// Expand: `[ERROR_message_text] EMPTY`, EMPTY iff no pp-parsing error. +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_ERROR(decl_traits) \ + BOOST_PP_TUPLE_ELEM(BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_INDEX_MAX, \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_INDEX_ERROR, decl_traits) + +// Expand: `[ERROR_message_text]`, EMPTY iff no pp-parsing error. +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_ERROR_MSG(decl_traits) \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_ERROR(decl_traits) \ + (/* expand EMPTY */) + +#endif // #include guard + diff --git a/boost/local_function/aux_/preprocessor/traits/decl_params.hpp b/boost/local_function/aux_/preprocessor/traits/decl_params.hpp new file mode 100644 index 0000000000..ae5a34f776 --- /dev/null +++ b/boost/local_function/aux_/preprocessor/traits/decl_params.hpp @@ -0,0 +1,59 @@ + +// Copyright (C) 2009-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://www.boost.org/libs/local_function + +#ifndef BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_PARAMS_HPP_ +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_PARAMS_HPP_ + +#include <boost/local_function/aux_/preprocessor/traits/decl_/index.hpp> +#include <boost/local_function/aux_/preprocessor/traits/param.hpp> +#include <boost/local_function/detail/preprocessor/keyword/default.hpp> +#include <boost/preprocessor/tuple/elem.hpp> +#include <boost/preprocessor/tuple/eat.hpp> +#include <boost/preprocessor/tuple/rem.hpp> +#include <boost/preprocessor/arithmetic/inc.hpp> +#include <boost/preprocessor/control/iif.hpp> +#include <boost/preprocessor/logical/compl.hpp> +#include <boost/preprocessor/facilities/is_empty.hpp> +#include <boost/preprocessor/list/adt.hpp> +#include <boost/preprocessor/list/fold_left.hpp> + +// PRIVATE // + +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_PARAMS_DEFAULT_OP_(s, \ + default_count, param_traits) \ + BOOST_PP_IIF(BOOST_PP_IS_EMPTY( \ + BOOST_LOCAL_FUNCTION_AUX_PP_PARAM_TRAITS_DEFAULT(param_traits)), \ + BOOST_PP_TUPLE_REM(1) \ + , \ + BOOST_PP_INC \ + )(default_count) + +// Precondition: params is a pp-list which is not nil. +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_PARAMS_DEFAULT_COUNT_(params) \ + BOOST_PP_LIST_FOLD_LEFT( \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_PARAMS_DEFAULT_OP_, \ + 0 /* start with defaults_count to 0 */, params) + +// PUBLIC // + +// Expand: pp-list of param-traits (no bound variables). +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_PARAMS(decl_traits) \ + BOOST_PP_TUPLE_ELEM(BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_INDEX_MAX, \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_INDEX_PARAMS, decl_traits) + +// Expand: number of parameters with default values (0 if no default). +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_PARAMS_DEFAULT_COUNT( \ + decl_traits) \ + BOOST_PP_IIF(BOOST_PP_LIST_IS_CONS( \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_PARAMS(decl_traits)), \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_PARAMS_DEFAULT_COUNT_ \ + , \ + 0 BOOST_PP_TUPLE_EAT(1) \ + )(BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_PARAMS(decl_traits)) + +#endif // #include guard + diff --git a/boost/local_function/aux_/preprocessor/traits/decl_returns.hpp b/boost/local_function/aux_/preprocessor/traits/decl_returns.hpp new file mode 100644 index 0000000000..941358a6d5 --- /dev/null +++ b/boost/local_function/aux_/preprocessor/traits/decl_returns.hpp @@ -0,0 +1,22 @@ + +// Copyright (C) 2009-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://www.boost.org/libs/local_function + +#ifndef BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_RETURNS_HPP_ +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_RETURNS_HPP_ + +#include <boost/local_function/aux_/preprocessor/traits/decl_/index.hpp> +#include <boost/preprocessor/tuple/elem.hpp> + +// PUBLIC // + +// Expand: pp-list of result types (size <= 1 after validation). +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_RETURNS(decl_traits) \ + BOOST_PP_TUPLE_ELEM(BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_INDEX_MAX, \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_INDEX_RETURNS, decl_traits) + +#endif // #include guard + diff --git a/boost/local_function/aux_/preprocessor/traits/decl_sign_/any_bind_type.hpp b/boost/local_function/aux_/preprocessor/traits/decl_sign_/any_bind_type.hpp new file mode 100644 index 0000000000..a39964228a --- /dev/null +++ b/boost/local_function/aux_/preprocessor/traits/decl_sign_/any_bind_type.hpp @@ -0,0 +1,88 @@ + +// Copyright (C) 2009-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://www.boost.org/libs/local_function + +#ifndef BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_ANY_BIND_TYPE_HPP_ +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_ANY_BIND_TYPE_HPP_ + +#include <boost/local_function/detail/preprocessor/keyword/const_bind.hpp> +#include <boost/local_function/detail/preprocessor/keyword/this.hpp> +#include <boost/preprocessor/cat.hpp> +#include <boost/preprocessor/control/iif.hpp> +#include <boost/preprocessor/facilities/empty.hpp> +#include <boost/preprocessor/facilities/expand.hpp> +#include <boost/preprocessor/tuple/eat.hpp> +#include <boost/preprocessor/tuple/rem.hpp> +#include <boost/preprocessor/detail/is_unary.hpp> + +// PRIVATE // + +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_ANY_BIND_WITH_TYPE_(sign) \ + /* using PP_EXPAND here does not work on MSVC */ \ + BOOST_PP_TUPLE_REM(1) \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_CONST_BIND_REMOVE_FRONT(sign) \ + BOOST_PP_EMPTY /* always trail EMPTY because bind type is optional */ + +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_ANY_BIND_WITHOUT_TYPE_( \ + sign) \ + /* using PP_EXPAND here does not work on MSVC */ \ + BOOST_PP_TUPLE_EAT(1) \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_CONST_BIND_REMOVE_FRONT(sign) + +#define this_BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_REMOVE_THIS_ \ + /* must expand to nothing */ + +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_ANY_BIND_THIS_TYPE_(sign) \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_ANY_BIND_WITH_TYPE( \ + /* can't use `THISUNDERSCIRE_REMOVE_BACK` because `sign` contains */ \ + /* multiple tokens (and not just one token) so */ \ + /* `IS_THISUNDERSCORE_BACK` does not work (but we know `sign` ends */ \ + /* with this_ if we here so we can manually force the removal using */ \ + BOOST_PP_CAT(sign, \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_REMOVE_THIS_) \ + ) \ + /* do not append PP_EMPTY because ANY_BIND_WITH_TYPE macro above */ \ + /* already appends it */ + +// PUBLIC // + +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_ANY_BIND_HAS_TYPE(sign) \ + BOOST_PP_IS_UNARY( \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_CONST_BIND_REMOVE_FRONT( \ + sign)) + +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_ANY_BIND_WITH_TYPE(sign) \ + BOOST_PP_IIF( \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_ANY_BIND_HAS_TYPE( \ + sign),\ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_ANY_BIND_WITH_TYPE_ \ + , \ + BOOST_PP_EMPTY \ + BOOST_PP_TUPLE_EAT(1) \ + )(sign) + +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_ANY_BIND_WITHOUT_TYPE( \ + sign) \ + BOOST_PP_IIF( \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_ANY_BIND_HAS_TYPE( \ + sign),\ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_ANY_BIND_WITHOUT_TYPE_ \ + , \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_CONST_BIND_REMOVE_FRONT \ + )(sign) + +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_ANY_BIND_THIS_TYPE(sign) \ + BOOST_PP_IIF( \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_ANY_BIND_HAS_TYPE( \ + sign),\ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_ANY_BIND_THIS_TYPE_ \ + , \ + BOOST_PP_EMPTY \ + BOOST_PP_TUPLE_EAT(1) \ + )(sign) + +#endif // #include guard + diff --git a/boost/local_function/aux_/preprocessor/traits/decl_sign_/sign.hpp b/boost/local_function/aux_/preprocessor/traits/decl_sign_/sign.hpp new file mode 100644 index 0000000000..7dc4db1238 --- /dev/null +++ b/boost/local_function/aux_/preprocessor/traits/decl_sign_/sign.hpp @@ -0,0 +1,138 @@ + +// Copyright (C) 2009-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://www.boost.org/libs/local_function + +#ifndef BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_HPP_ +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_HPP_ + +#include <boost/local_function/aux_/preprocessor/traits/decl_sign_/validate.hpp> +#include <boost/local_function/aux_/preprocessor/traits/decl_sign_/any_bind_type.hpp> +#include <boost/local_function/aux_/preprocessor/traits/decl_/nil.hpp> +#include <boost/local_function/aux_/preprocessor/traits/decl_/set_error.hpp> +#include <boost/local_function/aux_/preprocessor/traits/decl_/validate.hpp> +#include <boost/local_function/aux_/preprocessor/traits/decl_/append.hpp> +#include <boost/local_function/detail/preprocessor/keyword/const_bind.hpp> +#include <boost/local_function/detail/preprocessor/keyword/bind.hpp> +#include <boost/local_function/detail/preprocessor/keyword/return.hpp> +#include <boost/local_function/detail/preprocessor/keyword/default.hpp> +#include <boost/local_function/detail/preprocessor/keyword/thisunderscore.hpp> +#include <boost/preprocessor/control/iif.hpp> +#include <boost/preprocessor/facilities/is_empty.hpp> +#include <boost/preprocessor/list/fold_left.hpp> + +// PRIVATE // + +// Parse const binds. + +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALID_CONST_BIND_THIS_( \ + decl_traits, sign) \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_APPEND_CONST_BIND_THIS_TYPE( \ + decl_traits, \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_ANY_BIND_THIS_TYPE( \ + sign)) + +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALID_CONST_BIND_VAR_( \ + decl_traits, sign) \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_APPEND_CONST_BIND(decl_traits, \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_ANY_BIND_WITHOUT_TYPE(\ + sign), \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_ANY_BIND_WITH_TYPE( \ + sign)) + +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALID_CONST_BIND_( \ + decl_traits, sign) \ + /* check from back because non `this` bounds might have `&` in front */ \ + BOOST_PP_IIF(BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_IS_THISUNDERSCORE_BACK(\ + /* remove all leading symbols `[const] bind [(type)] ...` */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_ANY_BIND_WITHOUT_TYPE(\ + sign)),\ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALID_CONST_BIND_THIS_ \ + , \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALID_CONST_BIND_VAR_ \ + )(decl_traits, sign) + +// Parse binds. + +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALID_BIND_THIS_( \ + decl_traits, sign) \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_APPEND_BIND_THIS_TYPE(decl_traits, \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_ANY_BIND_THIS_TYPE( \ + sign)) + +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALID_BIND_VAR_( \ + decl_traits, sign) \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_APPEND_BIND(decl_traits, \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_ANY_BIND_WITHOUT_TYPE(\ + sign), \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_ANY_BIND_WITH_TYPE( \ + sign)) + +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALID_BIND_( \ + decl_traits, sign) \ + /* check from back because non `this` bounds might have `&` in front */ \ + BOOST_PP_IIF(BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_IS_THISUNDERSCORE_BACK(\ + /* remove all leading symbols `[const] bind [(type)] ...` */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_ANY_BIND_WITHOUT_TYPE(\ + sign)), \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALID_BIND_THIS_ \ + , \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALID_BIND_VAR_ \ + )(decl_traits, sign) + +// Parse all elements. + +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALID_( \ + s, decl_traits, sign) \ + BOOST_PP_IIF(BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_IS_RETURN_FRONT(sign), \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_APPEND_RETURN \ + , BOOST_PP_IIF(BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_IS_BIND_FRONT(sign), \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALID_BIND_ \ + , BOOST_PP_IIF(BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_IS_CONST_BIND_FRONT( \ + sign), \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALID_CONST_BIND_ \ + , BOOST_PP_IIF(BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_IS_DEFAULT_FRONT( \ + sign), \ + /* elem is `default ...` where leading default is kept because */ \ + /* default value might not be alphanumeric (so it fails later CAT */ \ + /* for checks), leading default will be removed later when getting */ \ + /* the default value */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_APPEND_PARAM_DEFAULT \ + , /* else, it is a function parameter */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_APPEND_PARAM \ + ))))(decl_traits, sign) + +// Parse params after following precondition has been validated by caller. +// Precondition: If list contains a default param value `..., default, ...`, +// the default value element is never 1st (it always has a previous elem) and +// its previous element is a unbind param (no const-bind and no bind). +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALID(sign) \ + BOOST_PP_LIST_FOLD_LEFT( \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALID_, \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_NIL, sign) + +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_OK_(sign, unused) \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_VALIDATE( \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALID(sign)) + +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_ERR_(unused, error) \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SET_ERROR( \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_NIL, error) + +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_(sign, defaults_error) \ + BOOST_PP_IIF(BOOST_PP_IS_EMPTY(defaults_error (/* expand EMPTY */)), \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_OK_ \ + , \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_ERR_ \ + )(sign, defaults_error) + +// PUBLIC // + +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN(sign) \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_(sign, \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE(sign)) + +#endif // #include guard + diff --git a/boost/local_function/aux_/preprocessor/traits/decl_sign_/validate.hpp b/boost/local_function/aux_/preprocessor/traits/decl_sign_/validate.hpp new file mode 100644 index 0000000000..ef49610004 --- /dev/null +++ b/boost/local_function/aux_/preprocessor/traits/decl_sign_/validate.hpp @@ -0,0 +1,32 @@ + +// Copyright (C) 2009-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://www.boost.org/libs/local_function + +#ifndef BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_HPP_ +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_HPP_ + +#include <boost/local_function/aux_/preprocessor/traits/decl_sign_/validate_/defaults.hpp> +#include <boost/local_function/aux_/preprocessor/traits/decl_sign_/validate_/this.hpp> +#include <boost/preprocessor/tuple/eat.hpp> + +// PRIVATE // + +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_1_(sign, error) \ + BOOST_PP_IIF(BOOST_PP_IS_EMPTY(error(/* expand empty */)), \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_THIS \ + , \ + error BOOST_PP_TUPLE_EAT(1) \ + )(sign) + +// PUBLIC // + +// Validate params before starting to parse it. +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE(sign) \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_1_(sign, \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_DEFAULTS(sign)) + +#endif // #include guard + diff --git a/boost/local_function/aux_/preprocessor/traits/decl_sign_/validate_/defaults.hpp b/boost/local_function/aux_/preprocessor/traits/decl_sign_/validate_/defaults.hpp new file mode 100644 index 0000000000..28f1efa392 --- /dev/null +++ b/boost/local_function/aux_/preprocessor/traits/decl_sign_/validate_/defaults.hpp @@ -0,0 +1,125 @@ + +// Copyright (C) 2009-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://www.boost.org/libs/local_function + +#ifndef BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_DEFAULTS_HPP_ +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_DEFAULTS_HPP_ + +#include <boost/local_function/detail/preprocessor/keyword/const_bind.hpp> +#include <boost/local_function/detail/preprocessor/keyword/bind.hpp> +#include <boost/local_function/detail/preprocessor/keyword/default.hpp> +#include <boost/preprocessor/cat.hpp> +#include <boost/preprocessor/control/while.hpp> +#include <boost/preprocessor/control/iif.hpp> +#include <boost/preprocessor/control/if.hpp> +#include <boost/preprocessor/facilities/expand.hpp> +#include <boost/preprocessor/facilities/empty.hpp> +#include <boost/preprocessor/facilities/is_empty.hpp> +#include <boost/preprocessor/logical/bitand.hpp> +#include <boost/preprocessor/logical/bitor.hpp> +#include <boost/preprocessor/logical/not.hpp> +#include <boost/preprocessor/comparison/less.hpp> +#include <boost/preprocessor/arithmetic/inc.hpp> +#include <boost/preprocessor/arithmetic/dec.hpp> +#include <boost/preprocessor/tuple/eat.hpp> +#include <boost/preprocessor/tuple/elem.hpp> +#include <boost/preprocessor/list/size.hpp> +#include <boost/preprocessor/list/at.hpp> + +// PRIVATE // + +#define \ +BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_DEFAULTS_IS_UNBIND_( \ + sign) \ + /* PP_OR/PP_BITOR (instead of IIF) don't expand on MSVC */ \ + BOOST_PP_IIF(BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_IS_DEFAULT_FRONT(sign),\ + 0 \ + , BOOST_PP_IIF(BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_IS_CONST_BIND_FRONT( \ + sign), \ + 0 \ + , BOOST_PP_IIF(BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_IS_BIND_FRONT(sign), \ + 0 \ + , \ + 1 \ + ))) + +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_DEFAULTS_PREV_( \ + sign, index, error) \ + BOOST_PP_IIF( \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_DEFAULTS_IS_UNBIND_( \ + BOOST_PP_LIST_AT(sign, BOOST_PP_DEC(index))), \ + error /* no err, fwd existing one if any */ \ + , \ + BOOST_PP_CAT(BOOST_PP_CAT(ERROR_default_value_at_element_, \ + BOOST_PP_INC(index)), _must_follow_an_unbound_parameter) \ + BOOST_PP_EMPTY /* because error might not be present */ \ + ) + +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_DEFAULTS_INDEX_( \ + sign, index, error) \ + BOOST_PP_IF(index, /* can't use IIF because index can be any number */ \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_DEFAULTS_PREV_ \ + , \ + ERROR_default_value_cannot_be_specified_as_the_first_element \ + BOOST_PP_EMPTY /* because error might not be present */ \ + BOOST_PP_TUPLE_EAT(3) \ + )(sign, index, error) + +// While's operation. + +#define \ +BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_DEFAULTS_OP_DATA_( \ + sign, index, error) \ + ( \ + sign \ + , \ + BOOST_PP_INC(index) \ + , \ + BOOST_PP_IIF(BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_IS_DEFAULT_FRONT( \ + BOOST_PP_LIST_AT(sign, index)), \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_DEFAULTS_INDEX_ \ + , \ + error BOOST_PP_TUPLE_EAT(3) /* no err, fwd existing one if any */\ + )(sign, index, error) \ + ) + +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_DEFAULTS_OP_(d, \ + sign_index_error) \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_DEFAULTS_OP_DATA_( \ + BOOST_PP_TUPLE_ELEM(3, 0, sign_index_error), \ + BOOST_PP_TUPLE_ELEM(3, 1, sign_index_error), \ + BOOST_PP_TUPLE_ELEM(3, 2, sign_index_error)) + +// While predicate. + +#define \ +BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_DEFAULTS_PRED_DATA_( \ + sign, index, error) \ + BOOST_PP_BITAND( \ + BOOST_PP_IS_EMPTY(error (/* expand empty */) ) \ + , BOOST_PP_LESS(index, BOOST_PP_LIST_SIZE(sign)) \ + ) + +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_DEFAULTS_PRED_( \ + d, sign_index_error) \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_DEFAULTS_PRED_DATA_( \ + BOOST_PP_TUPLE_ELEM(3, 0, sign_index_error), \ + BOOST_PP_TUPLE_ELEM(3, 1, sign_index_error), \ + BOOST_PP_TUPLE_ELEM(3, 2, sign_index_error)) + +// PUBLIC // + +// Validate parameters default values: `default ...` cannot be 1st element and +// it must follow an unbind param. Expand to `EMPTY` if no error, or +// `ERROR_message EMPTY` if error. +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_DEFAULTS(sign) \ + BOOST_PP_TUPLE_ELEM(3, 2, BOOST_PP_WHILE( \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_DEFAULTS_PRED_, \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_DEFAULTS_OP_,\ + (sign, 0, BOOST_PP_EMPTY))) + +#endif // #include guard + diff --git a/boost/local_function/aux_/preprocessor/traits/decl_sign_/validate_/this.hpp b/boost/local_function/aux_/preprocessor/traits/decl_sign_/validate_/this.hpp new file mode 100644 index 0000000000..8a924bdab3 --- /dev/null +++ b/boost/local_function/aux_/preprocessor/traits/decl_sign_/validate_/this.hpp @@ -0,0 +1,66 @@ + +// Copyright (C) 2009-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://www.boost.org/libs/local_function + +#ifndef BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_THIS_HPP_ +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_THIS_HPP_ + +#include <boost/local_function/detail/preprocessor/keyword/this.hpp> +#include <boost/local_function/detail/preprocessor/keyword/const.hpp> +#include <boost/local_function/detail/preprocessor/keyword/bind.hpp> +#include <boost/local_function/detail/preprocessor/keyword/const_bind.hpp> +#include <boost/preprocessor/control/iif.hpp> +#include <boost/preprocessor/tuple/eat.hpp> +#include <boost/preprocessor/facilities/empty.hpp> +#include <boost/preprocessor/list/fold_left.hpp> + +// PRIVATE // + +#define \ +BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_THIS_TYPED_EAT_(elem) \ + /* must be in separate macro to delay expansion */ \ + BOOST_PP_TUPLE_EAT(1) elem + +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_THIS_TYPED_( \ + elem) \ + BOOST_PP_IIF(BOOST_PP_IS_UNARY(elem), \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_THIS_TYPED_EAT_ \ + , \ + BOOST_PP_TUPLE_REM(1) \ + )(elem) + +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_THIS_VAR_( \ + s, error, elem) \ + BOOST_PP_IIF(BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_IS_THIS_BACK( \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_THIS_TYPED_( \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_BIND_REMOVE_FRONT( \ + BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_CONST_REMOVE_FRONT( \ + elem)))), \ + ERROR_use_this_underscore_instead_of_this BOOST_PP_EMPTY \ + , \ + error \ + ) + +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_THIS_( \ + s, error, elem) \ + BOOST_PP_IIF(BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_IS_BIND_FRONT(elem), \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_THIS_VAR_ \ + , BOOST_PP_IIF(BOOST_LOCAL_FUNCTION_DETAIL_PP_KEYWORD_IS_CONST_BIND_FRONT( \ + elem), \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_THIS_VAR_ \ + , \ + error BOOST_PP_TUPLE_EAT(3) \ + ))(s, error, elem) + +// PUBLIC // + +#define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_THIS(sign) \ + BOOST_PP_LIST_FOLD_LEFT( \ + BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SIGN_VALIDATE_THIS_, \ + BOOST_PP_EMPTY, sign) + +#endif // #include guard + diff --git a/boost/local_function/aux_/preprocessor/traits/param.hpp b/boost/local_function/aux_/preprocessor/traits/param.hpp new file mode 100644 index 0000000000..641cd81766 --- /dev/null +++ b/boost/local_function/aux_/preprocessor/traits/param.hpp @@ -0,0 +1,36 @@ + +// Copyright (C) 2009-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://www.boost.org/libs/local_function + +#ifndef BOOST_LOCAL_FUNCTION_AUX_PP_PARAM_TRAITS_HPP_ +#define BOOST_LOCAL_FUNCTION_AUX_PP_PARAM_TRAITS_HPP_ + +#include <boost/preprocessor/tuple/elem.hpp> + +// PRIVATE // + +// Param 2-tuple `([auto | register] type name, default_value)`. +#define BOOST_LOCAL_FUNCTION_AUX_PP_PARAM_TRAITS_INDEX_DECL_ 0 +#define BOOST_LOCAL_FUNCTION_AUX_PP_PARAM_TRAITS_INDEX_DEFAULT_ 1 +#define BOOST_LOCAL_FUNCTION_AUX_PP_PARAM_TRAITS_INDEX_MAX_ 2 + +// PUBLIC // + +// Expand: `[auto | register] type_ name_` (parameter declaration). +#define BOOST_LOCAL_FUNCTION_AUX_PP_PARAM_TRAITS_DECL(param_traits) \ + BOOST_PP_TUPLE_ELEM(BOOST_LOCAL_FUNCTION_AUX_PP_PARAM_TRAITS_INDEX_MAX_, \ + BOOST_LOCAL_FUNCTION_AUX_PP_PARAM_TRAITS_INDEX_DECL_, param_traits) + +// Expand: `default ... EMPTY()` if default value, `EMPTY()` otherwise. +// Leading default is kept because default value might not be alphanumeric +// (e.g., -123) so failing `CAT` for `IS_EMPTY` check. +#define BOOST_LOCAL_FUNCTION_AUX_PP_PARAM_TRAITS_DEFAULT(param_traits) \ + BOOST_PP_TUPLE_ELEM(BOOST_LOCAL_FUNCTION_AUX_PP_PARAM_TRAITS_INDEX_MAX_, \ + BOOST_LOCAL_FUNCTION_AUX_PP_PARAM_TRAITS_INDEX_DEFAULT_, \ + param_traits)(/* expand EMPTY */) + +#endif // #include guard + |