libqi-api
2.0.6.8
|
00001 #pragma once 00002 /* 00003 * Copyright (C) 2009-2012, Aldebaran Robotics. 00004 * Imported from urbi-sdk's libport. 00005 * 00006 */ 00007 00008 #ifndef _QI_PREPROC_HPP_ 00009 #define _QI_PREPROC_HPP_ 00010 00011 # include <boost/preprocessor/seq/for_each.hpp> 00012 # include <boost/preprocessor/seq/remove.hpp> 00013 # include <boost/preprocessor/seq/transform.hpp> 00014 00015 # define QI_MAP_HELPER(R, Macro, Elt) (Macro(Elt)) 00016 00017 # define QI_MAP(Macro, Seq) \ 00018 BOOST_PP_SEQ_FOR_EACH(QI_MAP_HELPER, Macro, Seq) 00019 00020 # define QI_APPLY_HELPER(R, Macro, Elt) Macro(Elt) 00021 00022 # define QI_APPLY(Macro, Seq) \ 00023 BOOST_PP_SEQ_FOR_EACH(QI_APPLY_HELPER, Macro, Seq) 00024 00025 00026 # define QI_SEPARATE_HELPER(Elt) , Elt 00027 00028 # define QI_SEPARATE(Seq) \ 00029 BOOST_PP_SEQ_HEAD(Seq) \ 00030 QI_APPLY(QI_SEPARATE_HELPER, BOOST_PP_SEQ_TAIL(Seq)) 00031 00033 # define QI_ENUM(Seq, Sep) \ 00034 BOOST_PP_SEQ_HEAD(Seq) \ 00035 BOOST_PP_SEQ_FOR_EACH(QI_ENUM_HELPER, Sep, BOOST_PP_SEQ_TAIL(Seq)) 00036 # define QI_ENUM_HELPER(Data, Sep, Elt) Sep Elt 00037 00040 # define QI_ENUM_PRETTY(Seq, Sep, LSep) \ 00041 BOOST_PP_CAT( \ 00042 QI_ENUM_PRETTY_, \ 00043 BOOST_PP_IF(BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(Seq)), SEVERAL, ONE)) \ 00044 (Seq, Sep, LSep) 00045 # define QI_ENUM_PRETTY_ONE(Seq, Sep, LSep) \ 00046 BOOST_PP_SEQ_HEAD(Seq) 00047 # define QI_ENUM_PRETTY_SEVERAL(Seq, Sep, LSep) \ 00048 QI_ENUM(QI_RTAIL(Seq), Sep) LSep QI_RHEAD(Seq) 00049 00051 # define QI_RHEAD(Seq) BOOST_PP_SEQ_ELEM(BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(Seq)), Seq) 00052 00053 # define QI_RTAIL(Seq) BOOST_PP_SEQ_REMOVE(Seq, BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(Seq))) 00054 00056 # ifdef _MSC_VER 00057 00058 # define QI_CAT(A, B) QI_CAT_0(A, B) 00059 /* 00060 #!/usr/bin/python 00061 00062 for i in range(0, 32): 00063 print '# define QI_CAT_%s(A, B) QI_CAT_%s(A, B)' % (i, i + 1) 00064 */ 00065 # define QI_CAT_0(A, B) QI_CAT_1(A, B) 00066 # define QI_CAT_1(A, B) QI_CAT_2(A, B) 00067 # define QI_CAT_2(A, B) QI_CAT_3(A, B) 00068 # define QI_CAT_3(A, B) QI_CAT_4(A, B) 00069 # define QI_CAT_4(A, B) QI_CAT_5(A, B) 00070 # define QI_CAT_5(A, B) QI_CAT_6(A, B) 00071 # define QI_CAT_6(A, B) QI_CAT_7(A, B) 00072 # define QI_CAT_7(A, B) QI_CAT_8(A, B) 00073 # define QI_CAT_8(A, B) QI_CAT_9(A, B) 00074 # define QI_CAT_9(A, B) QI_CAT_10(A, B) 00075 # define QI_CAT_10(A, B) QI_CAT_11(A, B) 00076 # define QI_CAT_11(A, B) QI_CAT_12(A, B) 00077 # define QI_CAT_12(A, B) QI_CAT_13(A, B) 00078 # define QI_CAT_13(A, B) QI_CAT_14(A, B) 00079 # define QI_CAT_14(A, B) QI_CAT_15(A, B) 00080 # define QI_CAT_15(A, B) QI_CAT_16(A, B) 00081 # define QI_CAT_16(A, B) QI_CAT_17(A, B) 00082 # define QI_CAT_17(A, B) QI_CAT_18(A, B) 00083 # define QI_CAT_18(A, B) QI_CAT_19(A, B) 00084 # define QI_CAT_19(A, B) QI_CAT_20(A, B) 00085 # define QI_CAT_20(A, B) QI_CAT_21(A, B) 00086 # define QI_CAT_21(A, B) QI_CAT_22(A, B) 00087 # define QI_CAT_22(A, B) QI_CAT_23(A, B) 00088 # define QI_CAT_23(A, B) QI_CAT_24(A, B) 00089 # define QI_CAT_24(A, B) QI_CAT_25(A, B) 00090 # define QI_CAT_25(A, B) QI_CAT_26(A, B) 00091 # define QI_CAT_26(A, B) QI_CAT_27(A, B) 00092 # define QI_CAT_27(A, B) QI_CAT_28(A, B) 00093 # define QI_CAT_28(A, B) QI_CAT_29(A, B) 00094 # define QI_CAT_29(A, B) QI_CAT_30(A, B) 00095 # define QI_CAT_30(A, B) QI_CAT_31(A, B) 00096 # define QI_CAT_31(A, B) A ## B 00097 # else 00098 # define QI_CAT(A, B) QI_CAT_(A, B) 00099 # define QI_CAT_(A, B) A ## B 00100 # endif 00101 00103 # define __HERE \ 00104 __FILE__ ":" BOOST_PP_STRINGIZE(__LINE__) 00105 00106 # define QI_ID(...) __VA_ARGS__ 00107 00108 # define QI_DELAY(X) X 00109 00110 # define QI_COMMA , 00111 00112 # define QI_WRAP(...) (__VA_ARGS__) 00113 00114 # define QI_UNWRAP(...) QI_ID __VA_ARGS__ 00115 00116 00117 /* 00118 #!/usr/bin/python 00119 00120 def gen(n): 00121 print '#define QI_LIST_BUILD_%(max)s(%(formals)s IGNORED) %(list)s' % { 00122 'formals' : ''.join(map(lambda i: 'A%s,' % i, range(n))), 00123 'list' : ''.join(map(lambda i: '(A%s)' % i, range(n))), 00124 'max' : n, 00125 } 00126 00127 for i in range(10): 00128 gen(i) 00129 */ 00130 00131 #define QI_LIST_BUILD_0( IGNORED) 00132 #define QI_LIST_BUILD_1(A0, IGNORED) \ 00133 (A0) 00134 #define QI_LIST_BUILD_2(A0,A1, IGNORED) \ 00135 (A0)(A1) 00136 #define QI_LIST_BUILD_3(A0,A1,A2, IGNORED) \ 00137 (A0)(A1)(A2) 00138 #define QI_LIST_BUILD_4(A0,A1,A2,A3, IGNORED) \ 00139 (A0)(A1)(A2)(A3) 00140 #define QI_LIST_BUILD_5(A0,A1,A2,A3,A4, IGNORED) \ 00141 (A0)(A1)(A2)(A3)(A4) 00142 #define QI_LIST_BUILD_6(A0,A1,A2,A3,A4,A5, IGNORED) \ 00143 (A0)(A1)(A2)(A3)(A4)(A5) 00144 #define QI_LIST_BUILD_7(A0,A1,A2,A3,A4,A5,A6, IGNORED) \ 00145 (A0)(A1)(A2)(A3)(A4)(A5)(A6) 00146 #define QI_LIST_BUILD_8(A0,A1,A2,A3,A4,A5,A6,A7, IGNORED) \ 00147 (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7) 00148 #define QI_LIST_BUILD_9(A0,A1,A2,A3,A4,A5,A6,A7,A8, IGNORED) \ 00149 (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)(A8) 00150 #define QI_LIST_BUILD_10(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9, IGNORED) \ 00151 (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)(A8)(A9) 00152 #define QI_LIST_BUILD_11(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10, IGNORED) \ 00153 (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)(A8)(A9)(A10) 00154 #define QI_LIST_BUILD_12(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11, IGNORED) \ 00155 (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)(A8)(A9)(A10)(A11) 00156 #define QI_LIST_BUILD_13(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12, IGNORED) \ 00157 (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)(A8)(A9)(A10)(A11)(A12) 00158 #define QI_LIST_BUILD_14(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13, IGNORED) \ 00159 (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)(A8)(A9)(A10)(A11)(A12)(A13) 00160 #define QI_LIST_BUILD_15(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14, IGNORED) \ 00161 (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)(A8)(A9)(A10)(A11)(A12)(A13)(A14) 00162 #define QI_LIST_BUILD_16(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15, IGNORED) \ 00163 (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)(A8)(A9)(A10)(A11)(A12)(A13)(A14)(A15) 00164 #define QI_LIST_BUILD_17(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16, IGNORED) \ 00165 (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)(A8)(A9)(A10)(A11)(A12)(A13)(A14)(A15)(A16) 00166 #define QI_LIST_BUILD_18(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17, IGNORED) \ 00167 (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)(A8)(A9)(A10)(A11)(A12)(A13)(A14)(A15)(A16)(A17) 00168 #define QI_LIST_BUILD_19(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17,A18, IGNORED) \ 00169 (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)(A8)(A9)(A10)(A11)(A12)(A13)(A14)(A15)(A16)(A17)(A18) 00170 #define QI_LIST_BUILD_20(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17,A18,A19, IGNORED) \ 00171 (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)(A8)(A9)(A10)(A11)(A12)(A13)(A14)(A15)(A16)(A17)(A18)(A19) 00172 #define QI_LIST_BUILD_21(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17,A18,A19,A20, IGNORED) \ 00173 (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)(A8)(A9)(A10)(A11)(A12)(A13)(A14)(A15)(A16)(A17)(A18)(A19)(A20) 00174 #define QI_LIST_BUILD_22(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17,A18,A19,A20,A21, IGNORED) \ 00175 (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)(A8)(A9)(A10)(A11)(A12)(A13)(A14)(A15)(A16)(A17)(A18)(A19)(A20)(A21) 00176 #define QI_LIST_BUILD_23(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17,A18,A19,A20,A21,A22, IGNORED) \ 00177 (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)(A8)(A9)(A10)(A11)(A12)(A13)(A14)(A15)(A16)(A17)(A18)(A19)(A20)(A21)(A22) 00178 #define QI_LIST_BUILD_24(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17,A18,A19,A20,A21,A22,A23, IGNORED) \ 00179 (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)(A8)(A9)(A10)(A11)(A12)(A13)(A14)(A15)(A16)(A17)(A18)(A19)(A20)(A21)(A22)(A23) 00180 #define QI_LIST_BUILD_25(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17,A18,A19,A20,A21,A22,A23,A24, IGNORED) \ 00181 (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)(A8)(A9)(A10)(A11)(A12)(A13)(A14)(A15)(A16)(A17)(A18)(A19)(A20)(A21)(A22)(A23)(A24) 00182 #define QI_LIST_BUILD_26(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17,A18,A19,A20,A21,A22,A23,A24,A25, IGNORED) \ 00183 (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)(A8)(A9)(A10)(A11)(A12)(A13)(A14)(A15)(A16)(A17)(A18)(A19)(A20)(A21)(A22)(A23)(A24)(A25) 00184 #define QI_LIST_BUILD_27(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17,A18,A19,A20,A21,A22,A23,A24,A25,A26, IGNORED) \ 00185 (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)(A8)(A9)(A10)(A11)(A12)(A13)(A14)(A15)(A16)(A17)(A18)(A19)(A20)(A21)(A22)(A23)(A24)(A25)(A26) 00186 #define QI_LIST_BUILD_28(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17,A18,A19,A20,A21,A22,A23,A24,A25,A26,A27, IGNORED) \ 00187 (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)(A8)(A9)(A10)(A11)(A12)(A13)(A14)(A15)(A16)(A17)(A18)(A19)(A20)(A21)(A22)(A23)(A24)(A25)(A26)(A27) 00188 #define QI_LIST_BUILD_29(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17,A18,A19,A20,A21,A22,A23,A24,A25,A26,A27,A28, IGNORED) \ 00189 (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)(A8)(A9)(A10)(A11)(A12)(A13)(A14)(A15)(A16)(A17)(A18)(A19)(A20)(A21)(A22)(A23)(A24)(A25)(A26)(A27)(A28) 00190 #define QI_LIST_BUILD_30(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17,A18,A19,A20,A21,A22,A23,A24,A25,A26,A27,A28,A29, IGNORED) \ 00191 (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)(A8)(A9)(A10)(A11)(A12)(A13)(A14)(A15)(A16)(A17)(A18)(A19)(A20)(A21)(A22)(A23)(A24)(A25)(A26)(A27)(A28)(A29) 00192 #define QI_LIST_BUILD_31(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17,A18,A19,A20,A21,A22,A23,A24,A25,A26,A27,A28,A29,A30, IGNORED) \ 00193 (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)(A8)(A9)(A10)(A11)(A12)(A13)(A14)(A15)(A16)(A17)(A18)(A19)(A20)(A21)(A22)(A23)(A24)(A25)(A26)(A27)(A28)(A29)(A30) 00194 00195 # ifdef _MSC_VER 00196 # define QI_LIST_VASIZE_HELPER1(...) \ 00197 QI_DELAY(QI_LIST_VASIZE_HELPER)##2(__VA_ARGS__, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) 00198 # else 00199 # define QI_LIST_VASIZE_HELPER1(...) \ 00200 QI_LIST_VASIZE_HELPER2(__VA_ARGS__, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) 00201 # endif 00202 # define QI_LIST_VASIZE_HELPER2(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24, A25, A26, A27, A28, A29, A30, A31, A32, ...) \ 00203 A32 00204 00205 # define QI_LIST_VASIZE(List) \ 00206 QI_LIST_VASIZE_HELPER1 List 00207 00208 #define QI_LIST_HELPER(M, A) M A 00209 00210 #define QI_LIST(...) \ 00211 QI_LIST_HELPER( \ 00212 QI_CAT(QI_LIST_BUILD_, QI_LIST_VASIZE((__VA_ARGS__))), \ 00213 (__VA_ARGS__)) 00214 00215 # define QI_LIST_SIZE(List) BOOST_PP_SEQ_SIZE(List) 00216 00217 # define QI_LIST_EMPTY_0 QI_TRUE 00218 # define QI_LIST_EMPTY_1 QI_FALSE 00219 # define QI_LIST_EMPTY_2 QI_FALSE 00220 # define QI_LIST_EMPTY_3 QI_FALSE 00221 # define QI_LIST_EMPTY_4 QI_FALSE 00222 # define QI_LIST_EMPTY_5 QI_FALSE 00223 # define QI_LIST_EMPTY_6 QI_FALSE 00224 # define QI_LIST_EMPTY_7 QI_FALSE 00225 # define QI_LIST_EMPTY_8 QI_FALSE 00226 # define QI_LIST_EMPTY_9 QI_FALSE 00227 # define QI_LIST_EMPTY_10 QI_FALSE 00228 # define QI_LIST_EMPTY_11 QI_FALSE 00229 # define QI_LIST_EMPTY_12 QI_FALSE 00230 # define QI_LIST_EMPTY_13 QI_FALSE 00231 # define QI_LIST_EMPTY_14 QI_FALSE 00232 # define QI_LIST_EMPTY_15 QI_FALSE 00233 # define QI_LIST_EMPTY_16 QI_FALSE 00234 # define QI_LIST_EMPTY_17 QI_FALSE 00235 # define QI_LIST_EMPTY_18 QI_FALSE 00236 # define QI_LIST_EMPTY_19 QI_FALSE 00237 # define QI_LIST_EMPTY_20 QI_FALSE 00238 # define QI_LIST_EMPTY_21 QI_FALSE 00239 # define QI_LIST_EMPTY_22 QI_FALSE 00240 # define QI_LIST_EMPTY_23 QI_FALSE 00241 # define QI_LIST_EMPTY_24 QI_FALSE 00242 # define QI_LIST_EMPTY_25 QI_FALSE 00243 # define QI_LIST_EMPTY_26 QI_FALSE 00244 # define QI_LIST_EMPTY_27 QI_FALSE 00245 # define QI_LIST_EMPTY_28 QI_FALSE 00246 # define QI_LIST_EMPTY_29 QI_FALSE 00247 # define QI_LIST_EMPTY_30 QI_FALSE 00248 # define QI_LIST_EMPTY_31 QI_FALSE 00249 # define QI_LIST_EMPTY(List) QI_CAT(QI_LIST_EMPTY_, QI_LIST_SIZE(List)) 00250 00251 # define QI_LIST_HEAD(List) BOOST_PP_SEQ_HEAD(List) 00252 00253 # define QI_LIST_TAIL(List) BOOST_PP_SEQ_TAIL(List) 00254 00255 # define QI_LIST_MAP_HELPER(Unused, Macro, Elt) \ 00256 Macro(Elt) 00257 # define QI_LIST_MAP(Macro, List) \ 00258 BOOST_PP_SEQ_TRANSFORM(QI_LIST_MAP_HELPER, Macro, List) 00259 00260 # define QI_LIST_MAP_AUX_HELPER(Unused, Aux, Elt) \ 00261 BOOST_PP_TUPLE_ELEM(2, 0, Aux)(Elt, BOOST_PP_TUPLE_ELEM(2, 1, Aux)) 00262 # define QI_LIST_MAP_AUX(Macro, List, Aux) \ 00263 BOOST_PP_SEQ_TRANSFORM(QI_LIST_MAP_AUX_HELPER, (Macro, Aux), List) 00264 00265 # define QI_LIST_APPLY_HELPER(Unused, Macro, Elt) \ 00266 Macro(Elt) 00267 # define QI_LIST_APPLY(Macro, List) \ 00268 BOOST_PP_SEQ_FOR_EACH(QI_LIST_APPLY_HELPER, Macro, List) 00269 00270 # define QI_LIST_APPLY_ARGS_HELPER(Unused, Macro, Elt) \ 00271 Macro Elt 00272 # define QI_LIST_APPLY_ARGS(Macro, List) \ 00273 BOOST_PP_SEQ_FOR_EACH(QI_LIST_APPLY_ARGS_HELPER, Macro, List) 00274 00275 # define QI_LIST_APPLY_AUX_HELPER(Unused, Aux, Elt) \ 00276 BOOST_PP_TUPLE_ELEM(2, 0, Aux)(Elt, BOOST_PP_TUPLE_ELEM(2, 1, Aux)) 00277 # define QI_LIST_APPLY_AUX(Macro, List, Aux) \ 00278 BOOST_PP_SEQ_FOR_EACH(QI_LIST_APPLY_AUX_HELPER, (Macro, Aux), List) 00279 00280 /* 00281 #!/usr/bin/python 00282 00283 def gen(n): 00284 args = {'n': n, 'n_1': n - 1,} 00285 print '# define QI_LIST_NTH_%(n)s(List) BOOST_PP_CAT(QI_LIST_NTH_%(n)s_, QI_LIST_EMPTY(List))(List)' % args 00286 print '# define QI_LIST_NTH_%(n)s_QI_TRUE(List)' % args 00287 if n != 0: 00288 print '# define QI_LIST_NTH_%(n)s_QI_FALSE(List) QI_LIST_NTH_%(n_1)s(QI_LIST_TAIL(List))' %args 00289 00290 for i in range(0, 10): 00291 gen(i) 00292 */ 00293 00294 # define QI_LIST_NTH_0(List) BOOST_PP_CAT(QI_LIST_NTH_0_, QI_LIST_EMPTY(List))(List) 00295 # define QI_LIST_NTH_0_QI_TRUE(List) 00296 # define QI_LIST_NTH_1(List) BOOST_PP_CAT(QI_LIST_NTH_1_, QI_LIST_EMPTY(List))(List) 00297 # define QI_LIST_NTH_1_QI_TRUE(List) 00298 # define QI_LIST_NTH_1_QI_FALSE(List) QI_LIST_NTH_0(QI_LIST_TAIL(List)) 00299 # define QI_LIST_NTH_2(List) BOOST_PP_CAT(QI_LIST_NTH_2_, QI_LIST_EMPTY(List))(List) 00300 # define QI_LIST_NTH_2_QI_TRUE(List) 00301 # define QI_LIST_NTH_2_QI_FALSE(List) QI_LIST_NTH_1(QI_LIST_TAIL(List)) 00302 # define QI_LIST_NTH_3(List) BOOST_PP_CAT(QI_LIST_NTH_3_, QI_LIST_EMPTY(List))(List) 00303 # define QI_LIST_NTH_3_QI_TRUE(List) 00304 # define QI_LIST_NTH_3_QI_FALSE(List) QI_LIST_NTH_2(QI_LIST_TAIL(List)) 00305 # define QI_LIST_NTH_4(List) BOOST_PP_CAT(QI_LIST_NTH_4_, QI_LIST_EMPTY(List))(List) 00306 # define QI_LIST_NTH_4_QI_TRUE(List) 00307 # define QI_LIST_NTH_4_QI_FALSE(List) QI_LIST_NTH_3(QI_LIST_TAIL(List)) 00308 # define QI_LIST_NTH_5(List) BOOST_PP_CAT(QI_LIST_NTH_5_, QI_LIST_EMPTY(List))(List) 00309 # define QI_LIST_NTH_5_QI_TRUE(List) 00310 # define QI_LIST_NTH_5_QI_FALSE(List) QI_LIST_NTH_4(QI_LIST_TAIL(List)) 00311 # define QI_LIST_NTH_6(List) BOOST_PP_CAT(QI_LIST_NTH_6_, QI_LIST_EMPTY(List))(List) 00312 # define QI_LIST_NTH_6_QI_TRUE(List) 00313 # define QI_LIST_NTH_6_QI_FALSE(List) QI_LIST_NTH_5(QI_LIST_TAIL(List)) 00314 # define QI_LIST_NTH_7(List) BOOST_PP_CAT(QI_LIST_NTH_7_, QI_LIST_EMPTY(List))(List) 00315 # define QI_LIST_NTH_7_QI_TRUE(List) 00316 # define QI_LIST_NTH_7_QI_FALSE(List) QI_LIST_NTH_6(QI_LIST_TAIL(List)) 00317 # define QI_LIST_NTH_8(List) BOOST_PP_CAT(QI_LIST_NTH_8_, QI_LIST_EMPTY(List))(List) 00318 # define QI_LIST_NTH_8_QI_TRUE(List) 00319 # define QI_LIST_NTH_8_QI_FALSE(List) QI_LIST_NTH_7(QI_LIST_TAIL(List)) 00320 # define QI_LIST_NTH_9(List) BOOST_PP_CAT(QI_LIST_NTH_9_, QI_LIST_EMPTY(List))(List) 00321 # define QI_LIST_NTH_9_QI_TRUE(List) 00322 # define QI_LIST_NTH_9_QI_FALSE(List) QI_LIST_NTH_8(QI_LIST_TAIL(List)) 00323 # define QI_LIST_NTH_10(List) BOOST_PP_CAT(QI_LIST_NTH_10_, QI_LIST_EMPTY(List))(List) 00324 # define QI_LIST_NTH_10_QI_TRUE(List) 00325 # define QI_LIST_NTH_10_QI_FALSE(List) QI_LIST_NTH_9(QI_LIST_TAIL(List)) 00326 # define QI_LIST_NTH_11(List) BOOST_PP_CAT(QI_LIST_NTH_11_, QI_LIST_EMPTY(List))(List) 00327 # define QI_LIST_NTH_11_QI_TRUE(List) 00328 # define QI_LIST_NTH_11_QI_FALSE(List) QI_LIST_NTH_10(QI_LIST_TAIL(List)) 00329 # define QI_LIST_NTH_12(List) BOOST_PP_CAT(QI_LIST_NTH_12_, QI_LIST_EMPTY(List))(List) 00330 # define QI_LIST_NTH_12_QI_TRUE(List) 00331 # define QI_LIST_NTH_12_QI_FALSE(List) QI_LIST_NTH_11(QI_LIST_TAIL(List)) 00332 # define QI_LIST_NTH_13(List) BOOST_PP_CAT(QI_LIST_NTH_13_, QI_LIST_EMPTY(List))(List) 00333 # define QI_LIST_NTH_13_QI_TRUE(List) 00334 # define QI_LIST_NTH_13_QI_FALSE(List) QI_LIST_NTH_12(QI_LIST_TAIL(List)) 00335 # define QI_LIST_NTH_14(List) BOOST_PP_CAT(QI_LIST_NTH_14_, QI_LIST_EMPTY(List))(List) 00336 # define QI_LIST_NTH_14_QI_TRUE(List) 00337 # define QI_LIST_NTH_14_QI_FALSE(List) QI_LIST_NTH_13(QI_LIST_TAIL(List)) 00338 # define QI_LIST_NTH_15(List) BOOST_PP_CAT(QI_LIST_NTH_15_, QI_LIST_EMPTY(List))(List) 00339 # define QI_LIST_NTH_15_QI_TRUE(List) 00340 # define QI_LIST_NTH_15_QI_FALSE(List) QI_LIST_NTH_14(QI_LIST_TAIL(List)) 00341 # define QI_LIST_NTH_16(List) BOOST_PP_CAT(QI_LIST_NTH_16_, QI_LIST_EMPTY(List))(List) 00342 # define QI_LIST_NTH_16_QI_TRUE(List) 00343 # define QI_LIST_NTH_16_QI_FALSE(List) QI_LIST_NTH_15(QI_LIST_TAIL(List)) 00344 # define QI_LIST_NTH_17(List) BOOST_PP_CAT(QI_LIST_NTH_17_, QI_LIST_EMPTY(List))(List) 00345 # define QI_LIST_NTH_17_QI_TRUE(List) 00346 # define QI_LIST_NTH_17_QI_FALSE(List) QI_LIST_NTH_16(QI_LIST_TAIL(List)) 00347 # define QI_LIST_NTH_18(List) BOOST_PP_CAT(QI_LIST_NTH_18_, QI_LIST_EMPTY(List))(List) 00348 # define QI_LIST_NTH_18_QI_TRUE(List) 00349 # define QI_LIST_NTH_18_QI_FALSE(List) QI_LIST_NTH_17(QI_LIST_TAIL(List)) 00350 # define QI_LIST_NTH_19(List) BOOST_PP_CAT(QI_LIST_NTH_19_, QI_LIST_EMPTY(List))(List) 00351 # define QI_LIST_NTH_19_QI_TRUE(List) 00352 # define QI_LIST_NTH_19_QI_FALSE(List) QI_LIST_NTH_18(QI_LIST_TAIL(List)) 00353 # define QI_LIST_NTH_20(List) BOOST_PP_CAT(QI_LIST_NTH_20_, QI_LIST_EMPTY(List))(List) 00354 # define QI_LIST_NTH_20_QI_TRUE(List) 00355 # define QI_LIST_NTH_20_QI_FALSE(List) QI_LIST_NTH_19(QI_LIST_TAIL(List)) 00356 # define QI_LIST_NTH_21(List) BOOST_PP_CAT(QI_LIST_NTH_21_, QI_LIST_EMPTY(List))(List) 00357 # define QI_LIST_NTH_21_QI_TRUE(List) 00358 # define QI_LIST_NTH_21_QI_FALSE(List) QI_LIST_NTH_20(QI_LIST_TAIL(List)) 00359 # define QI_LIST_NTH_22(List) BOOST_PP_CAT(QI_LIST_NTH_22_, QI_LIST_EMPTY(List))(List) 00360 # define QI_LIST_NTH_22_QI_TRUE(List) 00361 # define QI_LIST_NTH_22_QI_FALSE(List) QI_LIST_NTH_21(QI_LIST_TAIL(List)) 00362 # define QI_LIST_NTH_23(List) BOOST_PP_CAT(QI_LIST_NTH_23_, QI_LIST_EMPTY(List))(List) 00363 # define QI_LIST_NTH_23_QI_TRUE(List) 00364 # define QI_LIST_NTH_23_QI_FALSE(List) QI_LIST_NTH_22(QI_LIST_TAIL(List)) 00365 # define QI_LIST_NTH_24(List) BOOST_PP_CAT(QI_LIST_NTH_24_, QI_LIST_EMPTY(List))(List) 00366 # define QI_LIST_NTH_24_QI_TRUE(List) 00367 # define QI_LIST_NTH_24_QI_FALSE(List) QI_LIST_NTH_23(QI_LIST_TAIL(List)) 00368 # define QI_LIST_NTH_25(List) BOOST_PP_CAT(QI_LIST_NTH_25_, QI_LIST_EMPTY(List))(List) 00369 # define QI_LIST_NTH_25_QI_TRUE(List) 00370 # define QI_LIST_NTH_25_QI_FALSE(List) QI_LIST_NTH_24(QI_LIST_TAIL(List)) 00371 # define QI_LIST_NTH_26(List) BOOST_PP_CAT(QI_LIST_NTH_26_, QI_LIST_EMPTY(List))(List) 00372 # define QI_LIST_NTH_26_QI_TRUE(List) 00373 # define QI_LIST_NTH_26_QI_FALSE(List) QI_LIST_NTH_25(QI_LIST_TAIL(List)) 00374 # define QI_LIST_NTH_27(List) BOOST_PP_CAT(QI_LIST_NTH_27_, QI_LIST_EMPTY(List))(List) 00375 # define QI_LIST_NTH_27_QI_TRUE(List) 00376 # define QI_LIST_NTH_27_QI_FALSE(List) QI_LIST_NTH_26(QI_LIST_TAIL(List)) 00377 # define QI_LIST_NTH_28(List) BOOST_PP_CAT(QI_LIST_NTH_28_, QI_LIST_EMPTY(List))(List) 00378 # define QI_LIST_NTH_28_QI_TRUE(List) 00379 # define QI_LIST_NTH_28_QI_FALSE(List) QI_LIST_NTH_27(QI_LIST_TAIL(List)) 00380 # define QI_LIST_NTH_29(List) BOOST_PP_CAT(QI_LIST_NTH_29_, QI_LIST_EMPTY(List))(List) 00381 # define QI_LIST_NTH_29_QI_TRUE(List) 00382 # define QI_LIST_NTH_29_QI_FALSE(List) QI_LIST_NTH_28(QI_LIST_TAIL(List)) 00383 # define QI_LIST_NTH_30(List) BOOST_PP_CAT(QI_LIST_NTH_30_, QI_LIST_EMPTY(List))(List) 00384 # define QI_LIST_NTH_30_QI_TRUE(List) 00385 # define QI_LIST_NTH_30_QI_FALSE(List) QI_LIST_NTH_29(QI_LIST_TAIL(List)) 00386 # define QI_LIST_NTH_31(List) BOOST_PP_CAT(QI_LIST_NTH_31_, QI_LIST_EMPTY(List))(List) 00387 # define QI_LIST_NTH_31_QI_TRUE(List) 00388 # define QI_LIST_NTH_31_QI_FALSE(List) QI_LIST_NTH_30(QI_LIST_TAIL(List)) 00389 00390 # define QI_LIST_NTH_0_QI_FALSE(List) QI_LIST_HEAD(List) 00391 # define QI_LIST_NTH(Nth, List) BOOST_PP_CAT(QI_LIST_NTH_, Nth)(List) 00392 00393 # define QI_LIST_FLATTEN(List) QI_LIST_SEP(List, ) 00394 00395 # define QI_LIST_SEP_HELPER(Elt, Sep) \ 00396 QI_UNWRAP(Sep) Elt 00397 # define QI_LIST_SEP_QI_FALSE(List, Sep) \ 00398 QI_LIST_HEAD(List) \ 00399 QI_LIST_APPLY_AUX(QI_LIST_SEP_HELPER, QI_LIST_TAIL(List), Sep) 00400 # define QI_LIST_SEP_QI_TRUE(List, Sep) 00401 # define QI_LIST_SEP(List, Sep) \ 00402 QI_CAT(QI_LIST_SEP_, \ 00403 QI_LIST_EMPTY(List))(List, QI_WRAP(Sep)) 00404 00405 # define QI_LIST_ARG_HELPER(Macro, Args) \ 00406 Macro Args 00407 # define QI_LIST_ARG(Macro, List) \ 00408 QI_LIST_ARG_HELPER(Macro, (QI_LIST_SEP(List, QI_COMMA))) 00409 00411 #define QI_VAARGS_APPLY(Macro, Arg, ...) \ 00412 BOOST_PP_SEQ_FOR_EACH(Macro, Arg, \ 00413 QI_LIST(__VA_ARGS__,)) 00414 00415 #define _QI_OR_00 0 00416 #define _QI_OR_01 1 00417 #define _QI_OR_10 1 00418 #define _QI_OR_11 1 00419 #define _QI_OR_I1(a, b) BOOST_PP_CAT(BOOST_PP_CAT(_QI_OR_, a), b) 00420 #define _QI_OR_I2(a, b) _QI_OR_I1(a, b) 00421 #define _QI_OR_I3(a, b) _QI_OR_I2(a, b) 00422 #define _QI_OR_I4(a, b) _QI_OR_I3(a, b) 00423 #define QI_OR(a, b) _QI_OR_I4(a, b) 00424 00425 #define _QI_IS_EMPTY_HELPER__ a,b 00426 #define _QI_IS_ONE_HELPER__1 a,b 00427 00428 // To suppress a VCXX warning, the two macro below must be called with CAT(_, arg) 00429 // otherwise due to evaluation ordering, code ends up calling QI_IS_ONE() which 00430 // triggers a warning 00431 00432 //@return 1 if a is defined to 1, 0 otherwise. Must be called with CAT(_, a) 00433 #define _QI_IS_ONE(a) QI_LIST_VASIZE((BOOST_PP_CAT(_QI_IS_ONE_HELPER_, a))) 00434 //@return 1 if a is defined to empty, 0 otherwise. Must be called with CAT(_, a) 00435 #define _QI_IS_EMPTY(a) QI_LIST_VASIZE((BOOST_PP_CAT(_QI_IS_EMPTY_HELPER, BOOST_PP_CAT(_, a)))) 00436 00437 00438 //@return 1 if a is defined to empty or 1. Return 0 otherwise. Must be called with CAT(_, a) 00439 #define _QI_IS_ONE_OR_EMPTY(a) \ 00440 QI_OR(_QI_IS_EMPTY(a), _QI_IS_ONE(a)) 00441 00442 00443 #define _QI_GEN_ARGTYPE(z,n,_) BOOST_PP_COMMA_IF(n) P ## n 00444 #define _QI_GEN_ARGDECL(z,n,_) BOOST_PP_COMMA_IF(n) P ## n p##n 00445 #define _QI_GEN_ARGDECLSAMETYPE(z,n,t) BOOST_PP_COMMA_IF(n) t p##n 00446 #define _QI_GEN_ARGUSE(z,n,_) BOOST_PP_COMMA_IF(n) p##n 00447 #define _QI_GEN_ARGTYPEDECL(z, n, _) BOOST_PP_COMMA_IF(n) typename P##n 00448 00449 #define _QI_GEN_PREPOST(z, n, prepost) BOOST_PP_CAT(BOOST_PP_SEQ_ELEM(0, prepost), n) BOOST_PP_SEQ_ELEM(1, prepost) 00450 #define _QI_GEN_PREPOST2(z, n, prepost) BOOST_PP_CAT(BOOST_PP_SEQ_ELEM(0, prepost), n) BOOST_PP_CAT(BOOST_PP_SEQ_ELEM(1, prepost), n) BOOST_PP_SEQ_ELEM(2, prepost) 00451 00452 // pre 0 post pre 1 post pre 2 post... 00453 #define QI_GEN_PREPOST(n, pre, post) BOOST_PP_REPEAT(n, _QI_GEN_PREPOST, (pre)(post)) 00454 // pre 0 mid 0 post pre 1 mid 1 post ... 00455 #define QI_GEN_PREPOST2(n, pre, mid, post) BOOST_PP_REPEAT(n, _QI_GEN_PREPOST2, (pre)(mid)(post)) 00456 // P0, P1, ... 00457 #define QI_GEN_ARGSTYPE(n) BOOST_PP_REPEAT(n, _QI_GEN_ARGTYPE, _) 00458 // P0 p0, P1 p1, ... 00459 #define QI_GEN_ARGSDECL(n) BOOST_PP_REPEAT(n, _QI_GEN_ARGDECL, _) 00460 // p0, p1, p2 ... 00461 #define QI_GEN_ARGSUSE(n) BOOST_PP_REPEAT(n, _QI_GEN_ARGUSE, _) 00462 // typename P0, typename P1... 00463 #define QI_GEN_ARGSTYPEDECL(n) BOOST_PP_REPEAT(n, _QI_GEN_ARGTYPEDECL, _) 00464 // t p0, t p1... 00465 #define QI_GEN_ARGSDECLSAMETYPE(n, t) BOOST_PP_REPEAT(n, _QI_GEN_ARGDECLSAMETYPE, t) 00466 00467 00468 #define _QI_GEN(z, n, f) f(n, QI_GEN_ARGSTYPEDECL(n), QI_GEN_ARGSTYPE(n), QI_GEN_ARGSDECL(n), QI_GEN_ARGSUSE(n), BOOST_PP_COMMA_IF(n)) 00469 00470 // invoke f(n, argtypedecl, argstype, argsdecl, argsuses, comma_or_empty) for n in [0, 10] 00471 #define QI_GEN(f) BOOST_PP_REPEAT(10, _QI_GEN, f) 00472 #define QI_GEN_RANGE(f, max) BOOST_PP_REPEAT(max, _QI_GEN, f) 00473 00474 // Evaluate to empty or 'template<' depending on wheter args is empty or a comma. 00475 #define QI_GEN_MAYBE_TEMPLATE_OPEN(...) \ 00476 QI_CAT(_QI_GEN_MAYBE_TEMPLATE_OPEN_, QI_LIST_VASIZE((__VA_ARGS__))) 00477 #define QI_GEN_MAYBE_TEMPLATE_CLOSE(...) \ 00478 QI_CAT(_QI_GEN_MAYBE_TEMPLATE_CLOSE_, QI_LIST_VASIZE((__VA_ARGS__))) 00479 00480 #define QI_PAIR_FIRST(x) QI_DELAY(_QI_PAIR_FIRST)x 00481 #define QI_PAIR_SECOND(x) QI_DELAY(_QI_PAIR_SECOND)x 00482 #define _QI_PAIR_FIRST(x, ...) x 00483 #define _QI_PAIR_SECOND(x, y) y 00484 #define _QI_GEN_MAYBE_TEMPLATE_OPEN_1 template< 00485 #define _QI_GEN_MAYBE_TEMPLATE_OPEN_0 00486 #define _QI_GEN_MAYBE_TEMPLATE_CLOSE_1 > 00487 #define _QI_GEN_MAYBE_TEMPLATE_CLOSE_0 00488 // Return i+1 as a symbol 00489 #define QI_GEN_SYMINC(i) BOOST_PP_CAT(_QI_GEN_SYMINC_, i) 00490 #define _QI_GEN_SYMINC_9 10 00491 #define _QI_GEN_SYMINC_8 9 00492 #define _QI_GEN_SYMINC_7 8 00493 #define _QI_GEN_SYMINC_6 7 00494 #define _QI_GEN_SYMINC_5 6 00495 #define _QI_GEN_SYMINC_4 5 00496 #define _QI_GEN_SYMINC_3 4 00497 #define _QI_GEN_SYMINC_2 3 00498 #define _QI_GEN_SYMINC_1 2 00499 #define _QI_GEN_SYMINC_0 1 00500 00501 #define _QI_IF_QI_TRUE(a) a 00502 #define _QI_IF_QI_FALSE(a) 00503 #define _QI_NIF_QI_TRUE(a) 00504 #define _QI_NIF_QI_FALSE(a) a 00505 00506 00507 00508 #define QI_01_TO_TRUEFALSE(v) BOOST_PP_CAT(_QI_01_TO_TRUEFALSE_,v) 00509 #define _QI_01_TO_TRUEFALSE_0 QI_FALSE 00510 #define _QI_01_TO_TRUEFALSE_1 QI_TRUE 00511 00512 # ifdef _MSC_VER 00513 /* Sometimes when bouncing __VA_ARGS__ around you end up with all args in the same, so use a delay-trick 00514 */ 00515 #define __QI_VAARGS_MAP_0(Macro, Arg, elem, ...) Macro(0, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##1(Macro, Arg, __VA_ARGS__)) 00516 #define __QI_VAARGS_MAP_1(Macro, Arg, elem, ...) , Macro(1, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##2(Macro, Arg, __VA_ARGS__)) 00517 #define __QI_VAARGS_MAP_2(Macro, Arg, elem, ...) , Macro(2, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##3(Macro, Arg, __VA_ARGS__)) 00518 #define __QI_VAARGS_MAP_3(Macro, Arg, elem, ...) , Macro(3, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##4(Macro, Arg, __VA_ARGS__)) 00519 #define __QI_VAARGS_MAP_4(Macro, Arg, elem, ...) , Macro(4, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##5(Macro, Arg, __VA_ARGS__)) 00520 #define __QI_VAARGS_MAP_5(Macro, Arg, elem, ...) , Macro(5, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##6(Macro, Arg, __VA_ARGS__)) 00521 #define __QI_VAARGS_MAP_6(Macro, Arg, elem, ...) , Macro(6, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##7(Macro, Arg, __VA_ARGS__)) 00522 #define __QI_VAARGS_MAP_7(Macro, Arg, elem, ...) , Macro(7, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##8(Macro, Arg, __VA_ARGS__)) 00523 #define __QI_VAARGS_MAP_8(Macro, Arg, elem, ...) , Macro(8, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##9(Macro, Arg, __VA_ARGS__)) 00524 #define __QI_VAARGS_MAP_9(Macro, Arg, elem, ...) , Macro(9, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##10(Macro, Arg, __VA_ARGS__)) 00525 #define __QI_VAARGS_MAP_10(Macro, Arg, elem, ...) , Macro(10, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##11(Macro, Arg, __VA_ARGS__)) 00526 #define __QI_VAARGS_MAP_11(Macro, Arg, elem, ...) , Macro(11, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##12(Macro, Arg, __VA_ARGS__)) 00527 #define __QI_VAARGS_MAP_12(Macro, Arg, elem, ...) , Macro(12, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##13(Macro, Arg, __VA_ARGS__)) 00528 #define __QI_VAARGS_MAP_13(Macro, Arg, elem, ...) , Macro(13, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##14(Macro, Arg, __VA_ARGS__)) 00529 #define __QI_VAARGS_MAP_14(Macro, Arg, elem, ...) , Macro(14, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##15(Macro, Arg, __VA_ARGS__)) 00530 #define __QI_VAARGS_MAP_15(Macro, Arg, elem, ...) , Macro(15, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##16(Macro, Arg, __VA_ARGS__)) 00531 #define __QI_VAARGS_MAP_16(Macro, Arg, elem, ...) , Macro(16, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##17(Macro, Arg, __VA_ARGS__)) 00532 #define __QI_VAARGS_MAP_17(Macro, Arg, elem, ...) , Macro(17, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##18(Macro, Arg, __VA_ARGS__)) 00533 #define __QI_VAARGS_MAP_18(Macro, Arg, elem, ...) , Macro(18, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##19(Macro, Arg, __VA_ARGS__)) 00534 #define __QI_VAARGS_MAP_19(Macro, Arg, elem, ...) , Macro(19, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##20(Macro, Arg, __VA_ARGS__)) 00535 #define __QI_VAARGS_MAP_20(Macro, Arg, elem, ...) , Macro(20, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##21(Macro, Arg, __VA_ARGS__)) 00536 #define __QI_VAARGS_MAP_21(Macro, Arg, elem, ...) , Macro(21, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##22(Macro, Arg, __VA_ARGS__)) 00537 #define __QI_VAARGS_MAP_22(Macro, Arg, elem, ...) , Macro(22, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##23(Macro, Arg, __VA_ARGS__)) 00538 #define __QI_VAARGS_MAP_23(Macro, Arg, elem, ...) , Macro(23, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##24(Macro, Arg, __VA_ARGS__)) 00539 #define __QI_VAARGS_MAP_24(Macro, Arg, elem, ...) , Macro(24, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##25(Macro, Arg, __VA_ARGS__)) 00540 #define __QI_VAARGS_MAP_25(Macro, Arg, elem, ...) , Macro(25, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##26(Macro, Arg, __VA_ARGS__)) 00541 #define __QI_VAARGS_MAP_26(Macro, Arg, elem, ...) , Macro(26, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##27(Macro, Arg, __VA_ARGS__)) 00542 #define __QI_VAARGS_MAP_27(Macro, Arg, elem, ...) , Macro(27, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##28(Macro, Arg, __VA_ARGS__)) 00543 #define __QI_VAARGS_MAP_28(Macro, Arg, elem, ...) , Macro(28, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##29(Macro, Arg, __VA_ARGS__)) 00544 #define __QI_VAARGS_MAP_29(Macro, Arg, elem, ...) , Macro(29, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##30(Macro, Arg, __VA_ARGS__)) 00545 #define __QI_VAARGS_MAP_30(Macro, Arg, elem, ...) , Macro(30, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##31(Macro, Arg, __VA_ARGS__)) 00546 #define __QI_VAARGS_MAP_31(Macro, Arg, elem, ...) , Macro(31, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##32(Macro, Arg, __VA_ARGS__)) 00547 #define __QI_VAARGS_MAP_32(Macro, Arg, elem, ...) , Macro(32, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##33(Macro, Arg, __VA_ARGS__)) 00548 #define __QI_VAARGS_MAP_33(Macro, Arg, elem, ...) , Macro(33, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(TOO_MANY_ARGUMENTS) 00549 00550 #define __QI_VAARGS_EMPTY(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, ...) QI_01_TO_TRUEFALSE(p20) 00551 00552 // QI_TRUE if __VA_ARGS__ has *no comma*, QI_FALSE else 00553 #define QI_VAARGS_EMPTY(...) QI_DELAY(__QI_VAARGS_)##EMPTY(__VA_ARGS__, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0, 0,1,1) 00554 // expand to Macro(0, Arg, p0), Macro(1, Arg, p1), ... , Macro(N, Arg, pN) 00555 #define QI_VAARGS_MAP(Macro, Arg, ...) \ 00556 QI_DELAY(__QI_VAARGS_MAP_)##0(Macro, Arg, __VA_ARGS__,) 00557 00558 #else 00559 00560 #define __QI_VAARGS_MAP_0(Macro, Arg, elem, ...) Macro(0, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_1(Macro, Arg, __VA_ARGS__)) 00561 #define __QI_VAARGS_MAP_1(Macro, Arg, elem, ...) , Macro(1, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_2(Macro, Arg, __VA_ARGS__)) 00562 #define __QI_VAARGS_MAP_2(Macro, Arg, elem, ...) , Macro(2, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_3(Macro, Arg, __VA_ARGS__)) 00563 #define __QI_VAARGS_MAP_3(Macro, Arg, elem, ...) , Macro(3, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_4(Macro, Arg, __VA_ARGS__)) 00564 #define __QI_VAARGS_MAP_4(Macro, Arg, elem, ...) , Macro(4, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_5(Macro, Arg, __VA_ARGS__)) 00565 #define __QI_VAARGS_MAP_5(Macro, Arg, elem, ...) , Macro(5, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_6(Macro, Arg, __VA_ARGS__)) 00566 #define __QI_VAARGS_MAP_6(Macro, Arg, elem, ...) , Macro(6, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_7(Macro, Arg, __VA_ARGS__)) 00567 #define __QI_VAARGS_MAP_7(Macro, Arg, elem, ...) , Macro(7, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_8(Macro, Arg, __VA_ARGS__)) 00568 #define __QI_VAARGS_MAP_8(Macro, Arg, elem, ...) , Macro(8, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_9(Macro, Arg, __VA_ARGS__)) 00569 #define __QI_VAARGS_MAP_9(Macro, Arg, elem, ...) , Macro(9, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_10(Macro, Arg, __VA_ARGS__)) 00570 #define __QI_VAARGS_MAP_10(Macro, Arg, elem, ...) , Macro(10, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_11(Macro, Arg, __VA_ARGS__)) 00571 #define __QI_VAARGS_MAP_11(Macro, Arg, elem, ...) , Macro(11, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_12(Macro, Arg, __VA_ARGS__)) 00572 #define __QI_VAARGS_MAP_12(Macro, Arg, elem, ...) , Macro(12, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_13(Macro, Arg, __VA_ARGS__)) 00573 #define __QI_VAARGS_MAP_13(Macro, Arg, elem, ...) , Macro(13, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_14(Macro, Arg, __VA_ARGS__)) 00574 #define __QI_VAARGS_MAP_14(Macro, Arg, elem, ...) , Macro(14, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_15(Macro, Arg, __VA_ARGS__)) 00575 #define __QI_VAARGS_MAP_15(Macro, Arg, elem, ...) , Macro(15, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_16(Macro, Arg, __VA_ARGS__)) 00576 #define __QI_VAARGS_MAP_16(Macro, Arg, elem, ...) , Macro(16, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_17(Macro, Arg, __VA_ARGS__)) 00577 #define __QI_VAARGS_MAP_17(Macro, Arg, elem, ...) , Macro(17, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_18(Macro, Arg, __VA_ARGS__)) 00578 #define __QI_VAARGS_MAP_18(Macro, Arg, elem, ...) , Macro(18, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_19(Macro, Arg, __VA_ARGS__)) 00579 #define __QI_VAARGS_MAP_19(Macro, Arg, elem, ...) , Macro(19, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_20(Macro, Arg, __VA_ARGS__)) 00580 #define __QI_VAARGS_MAP_20(Macro, Arg, elem, ...) , Macro(20, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_21(Macro, Arg, __VA_ARGS__)) 00581 #define __QI_VAARGS_MAP_21(Macro, Arg, elem, ...) , Macro(21, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_22(Macro, Arg, __VA_ARGS__)) 00582 #define __QI_VAARGS_MAP_22(Macro, Arg, elem, ...) , Macro(22, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_23(Macro, Arg, __VA_ARGS__)) 00583 #define __QI_VAARGS_MAP_23(Macro, Arg, elem, ...) , Macro(23, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_24(Macro, Arg, __VA_ARGS__)) 00584 #define __QI_VAARGS_MAP_24(Macro, Arg, elem, ...) , Macro(24, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_25(Macro, Arg, __VA_ARGS__)) 00585 #define __QI_VAARGS_MAP_25(Macro, Arg, elem, ...) , Macro(25, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_26(Macro, Arg, __VA_ARGS__)) 00586 #define __QI_VAARGS_MAP_26(Macro, Arg, elem, ...) , Macro(26, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_27(Macro, Arg, __VA_ARGS__)) 00587 #define __QI_VAARGS_MAP_27(Macro, Arg, elem, ...) , Macro(27, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_28(Macro, Arg, __VA_ARGS__)) 00588 #define __QI_VAARGS_MAP_28(Macro, Arg, elem, ...) , Macro(28, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_29(Macro, Arg, __VA_ARGS__)) 00589 #define __QI_VAARGS_MAP_29(Macro, Arg, elem, ...) , Macro(29, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_30(Macro, Arg, __VA_ARGS__)) 00590 #define __QI_VAARGS_MAP_30(Macro, Arg, elem, ...) , Macro(30, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_31(Macro, Arg, __VA_ARGS__)) 00591 #define __QI_VAARGS_MAP_31(Macro, Arg, elem, ...) , Macro(31, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_32(Macro, Arg, __VA_ARGS__)) 00592 #define __QI_VAARGS_MAP_32(Macro, Arg, elem, ...) , Macro(32, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_33(Macro, Arg, __VA_ARGS__)) 00593 #define __QI_VAARGS_MAP_33(Macro, Arg, elem, ...) , Macro(33, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(TOO_MANY_ARGUMENTS) 00594 00595 #define __QI_VAARGS_EMPTY(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, ...) QI_01_TO_TRUEFALSE(p20) 00596 00598 #define QI_VAARGS_EMPTY(...) __QI_VAARGS_EMPTY(__VA_ARGS__, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0, 0,1,1) 00599 00600 #define QI_VAARGS_MAP(Macro, Arg, ...) \ 00601 __QI_VAARGS_MAP_0(Macro, Arg, __VA_ARGS__,) 00602 00603 #endif 00604 00605 00606 00607 #endif // _QI_PREPROC_HPP_