1 2 // (C) Copyright Tobias Schwinger 3 // 4 // Use modification and distribution are subject to the boost Software License, 5 // Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). 6 7 //------------------------------------------------------------------------------ 8 9 // no include guards, this file is intended for multiple inclusion 10 11 #ifndef BOOST_FT_PREPROCESSING_MODE 12 // input: BOOST_FT_mfp 0 or 1 <=> member function pointer? 13 // input: BOOST_FT_type_name BOOST_FT_type --> "R (* ..._type_name)()" (pass2) 14 #endif 15 // input: BOOST_FT_syntax type macro to use 16 // input: BOOST_FT_cc empty or cc specifier 17 // input: BOOST_FT_ell empty or "..." 18 // input: BOOST_FT_cv empty or cv qualifiers 19 // input: BOOST_FT_flags single decimal integer encoding the flags 20 // output: BOOST_FT_n number of component types (arity+1) 21 // output: BOOST_FT_arity current arity 22 // output: BOOST_FT_type macro that expands to the type 23 // output: BOOST_FT_tplargs(p) template arguments with given prefix 24 // output: BOOST_FT_params(p) parameters with given prefix 25 26 #ifdef __WAVE__ 27 # pragma wave option(preserve: 0) 28 #endif 29 30 #ifndef BOOST_FT_ARITY_LOOP_IS_ITERATING 31 32 # define BOOST_FT_AL_PREPROCESSED \ 33 BOOST_FT_AL_FILE(BOOST_FT_al_path,BOOST_FT_FROM_ARITY,BOOST_FT_mfp) 34 35 # define BOOST_FT_AL_FILE(base_path,max_arity,mfp) \ 36 BOOST_FT_AL_FILE_I(base_path,max_arity,mfp) 37 # define BOOST_FT_AL_FILE_I(base_path,max_arity,mfp) \ 38 <base_path/arity ## max_arity ## _ ## mfp.hpp> 39 40 # if !defined(BOOST_FT_PREPROCESSING_MODE) 41 42 # if BOOST_FT_MAX_ARITY < 10 43 # define BOOST_FT_FROM_ARITY 0 44 # elif BOOST_FT_MAX_ARITY < 20 45 # define BOOST_FT_FROM_ARITY 10 46 # elif BOOST_FT_MAX_ARITY < 30 47 # define BOOST_FT_FROM_ARITY 20 48 # elif BOOST_FT_MAX_ARITY < 40 49 # define BOOST_FT_FROM_ARITY 30 50 # endif 51 52 # if BOOST_FT_FROM_ARITY 53 # include BOOST_FT_AL_PREPROCESSED 54 # endif 55 56 # elif !defined(BOOST_FT_FROM_ARITY) // single pass preprocessing 57 # define BOOST_FT_FROM_ARITY 0 58 59 # elif BOOST_FT_FROM_ARITY > 0 // arity20 includes arity10 60 BOOST_PP_EXPAND(#) include BOOST_FT_AL_PREPROCESSED 61 # endif 62 63 # undef BOOST_FT_AL_PREPROCESSED 64 65 # undef BOOST_FT_AL_FILE 66 # undef BOOST_FT_AL_FILE_I 67 68 # if BOOST_FT_MAX_ARITY > BOOST_FT_FROM_ARITY 69 70 # ifndef BOOST_FT_DETAIL_ARITY_LOOP_HPP_INCLUDED 71 # define BOOST_FT_DETAIL_ARITY_LOOP_HPP_INCLUDED 72 # include <boost/preprocessor/cat.hpp> 73 # include <boost/preprocessor/tuple/eat.hpp> 74 # include <boost/preprocessor/control/if.hpp> 75 # include <boost/preprocessor/arithmetic/inc.hpp> 76 # include <boost/preprocessor/facilities/empty.hpp> 77 # include <boost/preprocessor/facilities/expand.hpp> 78 # include <boost/preprocessor/iteration/iterate.hpp> 79 # include <boost/preprocessor/repetition/enum_params.hpp> 80 # include <boost/preprocessor/repetition/enum_shifted_params.hpp> 81 # include <boost/preprocessor/repetition/enum_trailing_params.hpp> 82 # endif 83 84 # define BOOST_FT_AL_INCLUDE_FILE <BOOST_FT_al_path/master.hpp> 85 86 # define BOOST_FT_ARITY_LOOP_PREFIX 1 87 # include BOOST_FT_AL_INCLUDE_FILE 88 # undef BOOST_FT_ARITY_LOOP_PREFIX 89 90 # if !BOOST_PP_IS_ITERATING 91 # define BOOST_PP_FILENAME_1 BOOST_FT_AL_INCLUDE_FILE 92 # elif BOOST_PP_ITERATION_DEPTH() == 1 93 # define BOOST_PP_FILENAME_2 BOOST_FT_AL_INCLUDE_FILE 94 # else 95 # error "loops nested too deeply" 96 # endif 97 98 # define BOOST_FT_arity BOOST_PP_ITERATION() 99 # define BOOST_FT_n BOOST_PP_INC(BOOST_FT_arity) 100 101 # define BOOST_FT_type \ 102 BOOST_FT_syntax(BOOST_FT_cc,BOOST_FT_type_name BOOST_PP_EMPTY)\ 103 (BOOST_FT_params(BOOST_PP_EMPTY) BOOST_FT_ell) BOOST_FT_cv 104 105 # define BOOST_FT_tplargs(prefx) \ 106 prefx() R BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_FT_arity,prefx() T) 107 108 # if !BOOST_FT_mfp 109 110 # define BOOST_FT_params(prefx) \ 111 BOOST_PP_IF(BOOST_FT_arity,BOOST_PP_ENUM_PARAMS, \ 112 BOOST_FT_nullary_param BOOST_PP_TUPLE_EAT(2))( \ 113 BOOST_FT_arity,prefx() T) 114 # else 115 116 # define BOOST_FT_params(prefx) \ 117 BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_FT_arity,prefx() T) 118 119 # endif 120 121 # if !BOOST_FT_FROM_ARITY 122 # define BOOST_PP_ITERATION_LIMITS (BOOST_FT_mfp, BOOST_FT_MAX_ARITY) 123 # else 124 # define BOOST_PP_ITERATION_LIMITS \ 125 (BOOST_FT_FROM_ARITY+1, BOOST_FT_MAX_ARITY) 126 # endif 127 128 # define BOOST_FT_ARITY_LOOP_IS_ITERATING 1 129 # include BOOST_PP_ITERATE() 130 # undef BOOST_FT_ARITY_LOOP_IS_ITERATING 131 132 # undef BOOST_FT_arity 133 # undef BOOST_FT_params 134 # undef BOOST_FT_tplargs 135 # undef BOOST_FT_type 136 137 # define BOOST_FT_ARITY_LOOP_SUFFIX 1 138 # include BOOST_FT_AL_INCLUDE_FILE 139 # undef BOOST_FT_ARITY_LOOP_SUFFIX 140 141 # undef BOOST_FT_AL_INCLUDE_FILE 142 # endif 143 144 # undef BOOST_FT_FROM_ARITY 145 146 #else 147 # error "attempt to nest arity loops" 148 #endif 149 150