Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

EXPERT MACRO PROGRAMMING

Name: Anonymous 2014-03-09 5:07

#define UP_DETAIL_PP_CAT_II(x, y) x##y
#define UP_DETAIL_PP_CAT_I(x, y) UP_DETAIL_PP_CAT_II(x, y)
#define UP_PP_CAT(x, y) UP_DETAIL_PP_CAT_I(x, y)

#define UP_PP_EMPTY()
#define UP_PP_COMMA() ,
#define UP_PP_FIRST(x, ...) x
#define UP_PP_REST(x, ...) __VA_ARGS__
#define UP_PP_EAT(...)
#define UP_PP_EXPAND(...) __VA_ARGS__
#define UP_PP_IDENTITY(...) __VA_ARGS__ UP_PP_EMPTY
#define UP_PP_DEFER(...) __VA_ARGS__ UP_PP_EMPTY()
#define UP_PP_OBSTRUCT(...) __VA_ARGS__ UP_PP_DEFER(UP_PP_EMPTY)()

#define UP_DETAIL_PP_EVALUATE_III(...) __VA_ARGS__
#define UP_DETAIL_PP_EVALUATE_II(...) UP_DETAIL_PP_EVALUATE_III(UP_DETAIL_PP_EVALUATE_III(UP_DETAIL_PP_EVALUATE_III(UP_DETAIL_PP_EVALUATE_III(__VA_ARGS__))))
#define UP_DETAIL_PP_EVALUATE_I(...) UP_DETAIL_PP_EVALUATE_II(UP_DETAIL_PP_EVALUATE_II(UP_DETAIL_PP_EVALUATE_II(UP_DETAIL_PP_EVALUATE_II(__VA_ARGS__))))
#define UP_PP_EVALUATE(...) UP_DETAIL_PP_EVALUATE_I(UP_DETAIL_PP_EVALUATE_I(UP_DETAIL_PP_EVALUATE_I(UP_DETAIL_PP_EVALUATE_I(__VA_ARGS__))))

#define UP_DETAIL_PP_CHECK(x, n, ...) n
#define UP_PP_CHECK(...) UP_DETAIL_PP_CHECK(__VA_ARGS__, 0,)
#define UP_PP_PROBE(x) x, 1,

#define UP_PP_BITNOT_0 1
#define UP_PP_BITNOT_1 0
#define UP_PP_BITNOT(x) UP_PP_CAT(UP_PP_BITNOT_, x)

#define UP_PP_BITAND_00 0
#define UP_PP_BITAND_01 0
#define UP_PP_BITAND_10 0
#define UP_PP_BITAND_11 1
#define UP_PP_BITAND(x, y) UP_PP_CAT(UP_PP_CAT(UP_PP_BITAND_, x), y)

#define UP_PP_BITOR_00 0
#define UP_PP_BITOR_01 1
#define UP_PP_BITOR_10 1
#define UP_PP_BITOR_11 1
#define UP_PP_BITOR(x, y) UP_PP_CAT(UP_PP_CAT(UP_PP_BITOR_, x), y)

#define UP_PP_BITXOR_00 0
#define UP_PP_BITXOR_01 1
#define UP_PP_BITXOR_10 1
#define UP_PP_BITXOR_11 0
#define UP_PP_BITXOR(x, y) UP_PP_CAT(UP_PP_CAT(UP_PP_BITXOR_, x), y)

#define UP_PP_IIF_0(x, y) y
#define UP_PP_IIF_1(x, y) x
#define UP_PP_IIF(c, x, y) UP_PP_CAT(UP_PP_IIF_, c)(x, y)

#define UP_PP_COMMA_IIF(c) UP_PP_IIF(c, UP_PP_COMMA, UP_PP_EMPTY)()
#define UP_PP_BITSELECT(c) UP_PP_IIF(c, UP_PP_FIRST, UP_PP_REST)
#define UP_PP_BITWHEN(c) UP_PP_IIF(c, UP_PP_EXPAND, UP_PP_EAT)

#define UP_PP_NOT_0 UP_PP_PROBE(~)
#define UP_PP_NOT(x) UP_PP_CHECK(UP_PP_CAT(UP_PP_NOT_, x))
#define UP_PP_BOOL(x) UP_PP_BITNOT(UP_PP_NOT(x))

#define UP_PP_AND(x, y) UP_PP_BITAND(UP_PP_BOOL(x), UP_PP_BOOL(y))
#define UP_PP_OR(x, y) UP_PP_BITOR(UP_PP_BOOL(x), UP_PP_BOOL(y))
#define UP_PP_XOR(x, y) UP_PP_BITXOR(UP_PP_BOOL(x), UP_PP_BOOL(y))
#define UP_PP_IF(c, x, y) UP_PP_IIF(UP_PP_BOOL(c), x, y)
#define UP_PP_COMMA_IF(c) UP_PP_COMMA_IIF(UP_PP_BOOL(c))
#define UP_PP_SELECT(c) UP_PP_BITSELECT(UP_PP_BOOL(c))
#define UP_PP_WHEN(c) UP_PP_BITWHEN(UP_PP_BOOL(c))

#define UP_PP_INC_0 1
#define UP_PP_INC_1 2
#define UP_PP_INC_2 3
#define UP_PP_INC_3 4
#define UP_PP_INC_4 5
#define UP_PP_INC_5 6
#define UP_PP_INC_6 7
#define UP_PP_INC_7 8
#define UP_PP_INC_8 9
#define UP_PP_INC_9 10
#define UP_PP_INC_10 11
#define UP_PP_INC_11 12
#define UP_PP_INC_12 13
#define UP_PP_INC_13 14
#define UP_PP_INC_14 15
#define UP_PP_INC_15 16
#define UP_PP_INC_16 17
#define UP_PP_INC_17 18
#define UP_PP_INC_18 19
#define UP_PP_INC_19 20
#define UP_PP_INC_20 21
#define UP_PP_INC_21 22
#define UP_PP_INC_22 23
#define UP_PP_INC_23 24
#define UP_PP_INC_24 25
#define UP_PP_INC_25 26
#define UP_PP_INC_26 27
#define UP_PP_INC_27 28
#define UP_PP_INC_28 29
#define UP_PP_INC_29 30
#define UP_PP_INC_30 31
#define UP_PP_INC_31 32
#define UP_PP_INC_32 33
#define UP_PP_INC(x) UP_PP_CAT(UP_PP_INC_, x)

#define UP_PP_DEC_0 0
#define UP_PP_DEC_1 0
#define UP_PP_DEC_2 1
#define UP_PP_DEC_3 2
#define UP_PP_DEC_4 3
#define UP_PP_DEC_5 4
#define UP_PP_DEC_6 5
#define UP_PP_DEC_7 6
#define UP_PP_DEC_8 7
#define UP_PP_DEC_9 8
#define UP_PP_DEC_10 9
#define UP_PP_DEC_11 10
#define UP_PP_DEC_12 11
#define UP_PP_DEC_13 12
#define UP_PP_DEC_14 13
#define UP_PP_DEC_15 14
#define UP_PP_DEC_16 15
#define UP_PP_DEC_17 16
#define UP_PP_DEC_18 17
#define UP_PP_DEC_19 18
#define UP_PP_DEC_20 19
#define UP_PP_DEC_21 20
#define UP_PP_DEC_22 21
#define UP_PP_DEC_23 22
#define UP_PP_DEC_24 23
#define UP_PP_DEC_25 24
#define UP_PP_DEC_26 25
#define UP_PP_DEC_27 26
#define UP_PP_DEC_28 27
#define UP_PP_DEC_29 28
#define UP_PP_DEC_30 29
#define UP_PP_DEC_31 30
#define UP_PP_DEC_32 31
#define UP_PP_DEC(x) UP_PP_CAT(UP_PP_DEC_, x)

#define UP_PP_COMPARE_0(x) x
#define UP_PP_COMPARE_1(x) x
#define UP_PP_COMPARE_2(x) x
#define UP_PP_COMPARE_2(x) x
#define UP_PP_COMPARE_3(x) x
#define UP_PP_COMPARE_4(x) x
#define UP_PP_COMPARE_5(x) x
#define UP_PP_COMPARE_6(x) x
#define UP_PP_COMPARE_7(x) x
#define UP_PP_COMPARE_8(x) x
#define UP_PP_COMPARE_9(x) x
#define UP_PP_COMPARE_10(x) x
#define UP_PP_COMPARE_11(x) x
#define UP_PP_COMPARE_12(x) x
#define UP_PP_COMPARE_12(x) x
#define UP_PP_COMPARE_13(x) x
#define UP_PP_COMPARE_14(x) x
#define UP_PP_COMPARE_15(x) x
#define UP_PP_COMPARE_16(x) x
#define UP_PP_COMPARE_17(x) x
#define UP_PP_COMPARE_18(x) x
#define UP_PP_COMPARE_19(x) x
#define UP_PP_COMPARE_20(x) x
#define UP_PP_COMPARE_21(x) x
#define UP_PP_COMPARE_22(x) x
#define UP_PP_COMPARE_22(x) x
#define UP_PP_COMPARE_23(x) x
#define UP_PP_COMPARE_24(x) x
#define UP_PP_COMPARE_25(x) x
#define UP_PP_COMPARE_26(x) x
#define UP_PP_COMPARE_27(x) x
#define UP_PP_COMPARE_28(x) x
#define UP_PP_COMPARE_29(x) x
#define UP_PP_COMPARE_30(x) x
#define UP_PP_COMPARE_31(x) x
#define UP_PP_COMPARE_32(x) x
#define UP_PP_IS_COMPARABLE(x) UP_PP_IS_TUPLE(UP_PP_CAT(UP_PP_COMPARE_, x)(()))

#define UP_DETAIL_PP_NOT_EQUAL(x, y) UP_PP_IS_TUPLE(UP_PP_COMPARE_ ## x( UP_PP_COMPARE_ ## y )(()))
#define UP_PP_NOT_EQUAL(x, y) UP_PP_IIF(UP_PP_BITAND(UP_PP_IS_COMPARABLE(x), UP_PP_IS_COMPARABLE(y)), UP_DETAIL_PP_NOT_EQUAL, 1 UP_PP_EAT)(x, y)
#define UP_PP_EQUAL(x, y) UP_PP_BITNOT(UP_PP_NOT_EQUAL(x, y))

#define UP_DETAIL_PP_EXPAND_R(...) __VA_ARGS__
#define UP_DETAIL_PP_EAT_R(...)
#define UP_DETAIL_PP_FIRST_R(x, ...) x
#define UP_DETAIL_PP_REST_R(x, ...) __VA_ARGS__

#define UP_PP_REPEAT_R(count, macro, ...) \
UP_PP_IIF(UP_PP_BOOL(count), UP_DETAIL_PP_EXPAND_R, UP_DETAIL_PP_EAT_R)( \
UP_PP_OBSTRUCT(UP_DETAIL_PP_REPEAT_INDIRECT)()(UP_PP_DEC(count), macro, __VA_ARGS__) \
UP_PP_OBSTRUCT(macro)(UP_PP_DEC(count), __VA_ARGS__) \
)

#define UP_DETAIL_PP_REPEAT_INDIRECT() UP_PP_REPEAT_R
#define UP_PP_REPEAT(count, macro, ...) UP_PP_EVALUATE(UP_PP_REPEAT_R(count, macro, __VA_ARGS__))

#define UP_PP_REPEAT_FROM_TO_R(first, last, macro, ...) \
UP_PP_IIF(UP_PP_NOT_EQUAL(first, last), UP_DETAIL_PP_EXPAND_R, UP_DETAIL_PP_EAT_R)( \
UP_PP_OBSTRUCT(UP_DETAIL_PP_REPEAT_FROM_TO_INDIRECT)()(first, UP_PP_DEC(last), macro, __VA_ARGS__) \
UP_PP_OBSTRUCT(macro)(UP_PP_DEC(last), __VA_ARGS__) \
)

#define UP_DETAIL_PP_REPEAT_FROM_TO_INDIRECT() UP_PP_REPEAT_FROM_TO_R
#define UP_PP_REPEAT_FROM_TO(first, last, macro, ...) UP_PP_EVALUATE(UP_PP_REPEAT_FROM_TO_R(first, last, macro, __VA_ARGS__))

#define UP_PP_WHILE_R(predicate, macro, ...) \
UP_PP_IIF(UP_PP_BOOL(predicate(__VA_ARGS__)), UP_DETAIL_PP_FIRST_R, UP_DETAIL_PP_REST_R)( \
UP_PP_DEFER(UP_DETAIL_PP_WHILE_INDIRECT)()(predicate, macro, macro(__VA_ARGS__)), \
__VA_ARGS__ \
)

#define UP_DETAIL_PP_WHILE_INDIRECT() UP_PP_WHILE_R
#define UP_PP_WHILE(predicate, macro, ...) UP_PP_EVALUATE(UP_PP_WHILE_R(predicate, macro, __VA_ARGS__))

#define UP_DETAIL_PP_SIZE(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17,e18,e19,e20,e21,e22,e23,e24,e25,e26,e27,e28,e29,e30,e31,n,...) n
#define UP_PP_SIZE(...) UP_DETAIL_PP_SIZE(__VA_ARGS__,32,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,)

#define UP_PP_ELEM_0(e0,...) e0
#define UP_PP_ELEM_1(e0,e1,...) e1
#define UP_PP_ELEM_2(e0,e1,e2,...) e2
#define UP_PP_ELEM_3(e0,e1,e2,e3,...) e3
#define UP_PP_ELEM_4(e0,e1,e2,e3,e4,...) e4
#define UP_PP_ELEM_5(e0,e1,e2,e3,e4,e5,...) e5
#define UP_PP_ELEM_6(e0,e1,e2,e3,e4,e5,e6,...) e6
#define UP_PP_ELEM_7(e0,e1,e2,e3,e4,e5,e6,e7,...) e7
#define UP_PP_ELEM_8(e0,e1,e2,e3,e4,e5,e6,e7,e8,...) e8
#define UP_PP_ELEM_9(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,...) e9
#define UP_PP_ELEM_10(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,...) e10
#define UP_PP_ELEM_11(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,...) e11
#define UP_PP_ELEM_12(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,...) e12
#define UP_PP_ELEM_13(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,...) e13
#define UP_PP_ELEM_14(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,...) e14
#define UP_PP_ELEM_15(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,...) e15
#define UP_PP_ELEM_16(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,...) e16
#define UP_PP_ELEM_17(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17,...) e17
#define UP_PP_ELEM_18(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17,e18,...) e18
#define UP_PP_ELEM_19(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17,e18,e19,...) e19
#define UP_PP_ELEM_20(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17,e18,e19,e20,...) e20
#define UP_PP_ELEM_21(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17,e18,e19,e20,e21,...) e21
#define UP_PP_ELEM_22(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17,e18,e19,e20,e21,e22,...) e22
#define UP_PP_ELEM_23(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17,e18,e19,e20,e21,e22,e23,...) e23
#define UP_PP_ELEM_24(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17,e18,e19,e20,e21,e22,e23,e24,...) e24
#define UP_PP_ELEM_25(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17,e18,e19,e20,e21,e22,e23,e24,e25,...) e25
#define UP_PP_ELEM_26(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17,e18,e19,e20,e21,e22,e23,e24,e25,e26,...) e26
#define UP_PP_ELEM_27(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17,e18,e19,e20,e21,e22,e23,e24,e25,e26,e27,...) e27
#define UP_PP_ELEM_28(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17,e18,e19,e20,e21,e22,e23,e24,e25,e26,e27,e28,...) e28
#define UP_PP_ELEM_29(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17,e18,e19,e20,e21,e22,e23,e24,e25,e26,e27,e28,e29,...) e29
#define UP_PP_ELEM_30(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17,e18,e19,e20,e21,e22,e23,e24,e25,e26,e27,e28,e29,e30,...) e30
#define UP_PP_ELEM_31(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17,e18,e19,e20,e21,e22,e23,e24,e25,e26,e27,e28,e29,e30,e31,...) e31
#define UP_PP_ELEM(i, ...) UP_PP_CAT(UP_PP_ELEM_, i)(__VA_ARGS__)
#define UP_PP_ELEM_N(n, i, ...) UP_PP_CAT(UP_PP_ELEM_, i)(__VA_ARGS__)

#define UP_PP_JOIN_1(e0) e0
#define UP_PP_JOIN_2(e0,e1) UP_PP_CAT(e0,e1)
#define UP_PP_JOIN_3(e0,e1,e2) UP_PP_CAT(UP_PP_CAT(e0,e1),e2)
#define UP_PP_JOIN_4(e0,e1,e2,e3) UP_PP_CAT(UP_PP_JOIN_3(e0,e1,e2),e3)
#define UP_PP_JOIN_5(e0,e1,e2,e3,e4) UP_PP_CAT(UP_PP_JOIN_4(e0,e1,e2,e3),e4)
#define UP_PP_JOIN_6(e0,e1,e2,e3,e4,e5) UP_PP_CAT(UP_PP_JOIN_5(e0,e1,e2,e3,e4),e5)
#define UP_PP_JOIN_7(e0,e1,e2,e3,e4,e5,e6) UP_PP_CAT(UP_PP_JOIN_6(e0,e1,e2,e3,e4,e5),e6)
#define UP_PP_JOIN_8(e0,e1,e2,e3,e4,e5,e6,e7) UP_PP_CAT(UP_PP_JOIN_7(e0,e1,e2,e3,e4,e5,e6),e7)
#define UP_PP_JOIN_9(e0,e1,e2,e3,e4,e5,e6,e7,e8) UP_PP_CAT(UP_PP_JOIN_8(e0,e1,e2,e3,e4,e5,e6,e7),e8)
#define UP_PP_JOIN_10(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9) UP_PP_CAT(UP_PP_JOIN_9(e0,e1,e2,e3,e4,e5,e6,e7,e8),e9)
#define UP_PP_JOIN_11(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10) UP_PP_CAT(UP_PP_JOIN_10(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9),e10)
#define UP_PP_JOIN_12(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11) UP_PP_CAT(UP_PP_JOIN_11(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10),e11)
#define UP_PP_JOIN_13(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12) UP_PP_CAT(UP_PP_JOIN_12(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11),e12)
#define UP_PP_JOIN_14(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13) UP_PP_CAT(UP_PP_JOIN_13(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12),e13)
#define UP_PP_JOIN_15(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14) UP_PP_CAT(UP_PP_JOIN_14(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13),e14)
#define UP_PP_JOIN_16(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15) UP_PP_CAT(UP_PP_JOIN_15(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14),e15)
#define UP_PP_JOIN_17(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16) UP_PP_CAT(UP_PP_JOIN_16(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15),e16)
#define UP_PP_JOIN_18(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17) UP_PP_CAT(UP_PP_JOIN_17(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16),e17)
#define UP_PP_JOIN_19(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17,e18) UP_PP_CAT(UP_PP_JOIN_18(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17),e18)
#define UP_PP_JOIN_20(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17,e18,e19) UP_PP_CAT(UP_PP_JOIN_19(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17,e18),e19)
#define UP_PP_JOIN_21(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17,e18,e19,e20) UP_PP_CAT(UP_PP_JOIN_20(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17,e18,e19),e20)
#define UP_PP_JOIN_22(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17,e18,e19,e20,e21) UP_PP_CAT(UP_PP_JOIN_21(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17,e18,e19,e20),e21)
#define UP_PP_JOIN_23(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17,e18,e19,e20,e21,e22) UP_PP_CAT(UP_PP_JOIN_22(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17,e18,e19,e20,e21),e22)
#define UP_PP_JOIN_24(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17,e18,e19,e20,e21,e22,e23) UP_PP_CAT(UP_PP_JOIN_23(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17,e18,e19,e20,e21,e22),e23)
#define UP_PP_JOIN_25(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17,e18,e19,e20,e21,e22,e23,e24) UP_PP_CAT(UP_PP_JOIN_24(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17,e18,e19,e20,e21,e22,e23),e24)
#define UP_PP_JOIN_26(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17,e18,e19,e20,e21,e22,e23,e24,e25) UP_PP_CAT(UP_PP_JOIN_25(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17,e18,e19,e20,e21,e22,e23,e24),e25)
#define UP_PP_JOIN_27(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17,e18,e19,e20,e21,e22,e23,e24,e25,e26) UP_PP_CAT(UP_PP_JOIN_26(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17,e18,e19,e20,e21,e22,e23,e24,e25),e26)
#define UP_PP_JOIN_28(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17,e18,e19,e20,e21,e22,e23,e24,e25,e26,e27) UP_PP_CAT(UP_PP_JOIN_27(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17,e18,e19,e20,e21,e22,e23,e24,e25,e26),e27)
#define UP_PP_JOIN_29(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17,e18,e19,e20,e21,e22,e23,e24,e25,e26,e27,e28) UP_PP_CAT(UP_PP_JOIN_28(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17,e18,e19,e20,e21,e22,e23,e24,e25,e26,e27),e28)
#define UP_PP_JOIN_30(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17,e18,e19,e20,e21,e22,e23,e24,e25,e26,e27,e28,e29) UP_PP_CAT(UP_PP_JOIN_29(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17,e18,e19,e20,e21,e22,e23,e24,e25,e26,e27,e28),e29)
#define UP_PP_JOIN_31(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17,e18,e19,e20,e21,e22,e23,e24,e25,e26,e27,e28,e29,e30) UP_PP_CAT(UP_PP_JOIN_30(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17,e18,e19,e20,e21,e22,e23,e24,e25,e26,e27,e28,e29),e30)
#define UP_PP_JOIN_32(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17,e18,e19,e20,e21,e22,e23,e24,e25,e26,e27,e28,e29,e30,e31) UP_PP_CAT(UP_PP_JOIN_31(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17,e18,e19,e20,e21,e22,e23,e24,e25,e26,e27,e28,e29,e30),e31)
#define UP_PP_JOIN(...) UP_PP_CAT(UP_PP_JOIN_, UP_PP_SIZE(__VA_ARGS__))(__VA_ARGS__)
#define UP_PP_JOIN_N(n, ...) UP_PP_CAT(UP_PP_JOIN_, n)(__VA_ARGS__)

#define UP_DETAIL_PP_IS_TUPLE(...) UP_PP_PROBE(~)
#define UP_PP_IS_TUPLE(t) UP_PP_CHECK(UP_DETAIL_PP_IS_TUPLE t)

#define UP_PP_TUPLE_ELEM(i, t) UP_PP_ELEM(i, UP_PP_TUPLE_ENUM(t))
#define UP_PP_TUPLE_ELEM_N(n, i, t) UP_PP_ELEM_N(n, i, UP_PP_TUPLE_ENUM(t))
#define UP_PP_TUPLE_ENUM(t) UP_PP_EXPAND(UP_PP_EXPAND t)
#define UP_PP_TUPLE_JOIN(t) UP_PP_EXPAND(UP_PP_JOIN t)
#define UP_PP_TUPLE_JOIN_N(n, t) UP_PP_JOIN_N(n, UP_PP_TUPLE_ENUM(t))
#define UP_PP_TUPLE_SIZE(t) UP_PP_EXPAND(UP_PP_SIZE t)
#define UP_PP_TO_TUPLE(...) (__VA_ARGS__)

#define UP_PP_TUPLE_FOREACH_R_N_7_c(i2, i1, i0, t0, s0, t1, s1, t2, s2, macro) macro(UP_PP_TUPLE_ELEM_N(s0, i0, t0), UP_PP_TUPLE_ELEM_N(s1, i1, t1), UP_PP_TUPLE_ELEM_N(s2, i2, t2))
#define UP_PP_TUPLE_FOREACH_R_N_7_b(i1, i0, t0, s0, t1, s1, t2, s2, macro) UP_PP_REPEAT_R(s2, UP_PP_TUPLE_FOREACH_R_N_7_c, i1, i0, t0, s0, t1, s1, t2, s2, macro)
#define UP_PP_TUPLE_FOREACH_R_N_7_a(i0, t0, s0, t1, s1, t2, s2, macro) UP_PP_REPEAT_R(s1, UP_PP_TUPLE_FOREACH_R_N_7_b, i0, t0, s0, t1, s1, t2, s2, macro)
#define UP_PP_TUPLE_FOREACH_R_N_7(t0, s0, t1, s1, t2, s2, macro) UP_PP_REPEAT_R(s0, UP_PP_TUPLE_FOREACH_R_N_7_a, t0, s0, t1, s1, t2, s2, macro)
#define UP_PP_TUPLE_FOREACH_R_N_5_b(i1, i0, t0, s0, t1, s1, macro) macro(UP_PP_TUPLE_ELEM_N(s0, i0, t0), UP_PP_TUPLE_ELEM_N(s1, i1, t1))
#define UP_PP_TUPLE_FOREACH_R_N_5_a(i0, t0, s0, t1, s1, macro) UP_PP_REPEAT_R(s1, UP_PP_TUPLE_FOREACH_R_N_5_b, i0, t0, s0, t1, s1, macro)
#define UP_PP_TUPLE_FOREACH_R_N_5(t0, s0, t1, s1, macro) UP_PP_REPEAT_R(s0, UP_PP_TUPLE_FOREACH_R_N_5_a, t0, s0, t1, s1, macro)
#define UP_PP_TUPLE_FOREACH_R_N_3_a(i0, t0, s0, macro) macro(UP_PP_TUPLE_ELEM_N(s0, i0, t0))
#define UP_PP_TUPLE_FOREACH_R_N_3(t0, s0, macro) UP_PP_REPEAT_R(s0, UP_PP_TUPLE_FOREACH_R_N_3_a, t0, s0, macro)
#define UP_PP_TUPLE_FOREACH_R_N(...) UP_PP_CAT(UP_PP_TUPLE_FOREACH_R_N_, UP_PP_SIZE(__VA_ARGS__))(__VA_ARGS__)
#define UP_PP_TUPLE_FOREACH_N(...) UP_PP_EVALUATE(UP_PP_TUPLE_FOREACH_R_N(__VA_ARGS__))

#define UP_PP_TUPLE_FOREACH_R_4(t0, t1, t2, macro) UP_PP_TUPLE_FOREACH_R_N_7(t0, UP_PP_TUPLE_SIZE(t0), t1, UP_PP_TUPLE_SIZE(t1), t2, UP_PP_TUPLE_SIZE(t2), macro)
#define UP_PP_TUPLE_FOREACH_R_3(t0, t1, macro) UP_PP_TUPLE_FOREACH_R_N_5(t0, UP_PP_TUPLE_SIZE(t0), t1, UP_PP_TUPLE_SIZE(t1), macro)
#define UP_PP_TUPLE_FOREACH_R_2(t0, macro) UP_PP_TUPLE_FOREACH_R_N_3(t0, UP_PP_TUPLE_SIZE(t0), macro)
#define UP_PP_TUPLE_FOREACH_R(...) UP_PP_CAT(UP_PP_TUPLE_FOREACH_R_, UP_PP_SIZE(__VA_ARGS__))(__VA_ARGS__)
#define UP_PP_TUPLE_FOREACH(...) UP_PP_EVALUATE(UP_PP_TUPLE_FOREACH_R(__VA_ARGS__))

Name: sage 2014-03-29 22:53

>>13
I think that was Microsoft's way of making C look more like the macro assembler all its programmers were accustomed to at the time.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List