mirror of
https://github.com/boostorg/preprocessor.git
synced 2025-07-13 12:36:45 +02:00
Ported to MSVC++ and MWCW.
[SVN r12577]
This commit is contained in:
@ -26,16 +26,15 @@
|
|||||||
#include <boost/preprocessor/tuple/eat.hpp>
|
#include <boost/preprocessor/tuple/eat.hpp>
|
||||||
#include <boost/preprocessor/comparison/less.hpp>
|
#include <boost/preprocessor/comparison/less.hpp>
|
||||||
#include <boost/preprocessor/logical/or.hpp>
|
#include <boost/preprocessor/logical/or.hpp>
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
/* Information about C operators. */
|
/* Information about C operators. */
|
||||||
|
|
||||||
/* Accessors for the operator datatype. */
|
/* Accessors for the operator datatype. */
|
||||||
#define OP_SYMBOL(O) BOOST_PP_TUPLE5_ELEM0 O
|
#define OP_SYMBOL(O) BOOST_PP_TUPLE_ELEM(5,0,O)
|
||||||
#define OP_NAME(O) BOOST_PP_TUPLE5_ELEM1 O
|
#define OP_NAME(O) BOOST_PP_TUPLE_ELEM(5,1,O)
|
||||||
#define OP_IS_FLOATING(O) BOOST_PP_TUPLE5_ELEM2 O
|
#define OP_IS_FLOATING(O) BOOST_PP_TUPLE_ELEM(5,2,O)
|
||||||
#define OP_IS_LOGICAL(O) BOOST_PP_TUPLE5_ELEM3 O
|
#define OP_IS_LOGICAL(O) BOOST_PP_TUPLE_ELEM(5,3,O)
|
||||||
#define OP_IS_SHIFT(O) BOOST_PP_TUPLE5_ELEM4 O
|
#define OP_IS_SHIFT(O) BOOST_PP_TUPLE_ELEM(5,4,O)
|
||||||
|
|
||||||
/* List of applicative unary operators. */
|
/* List of applicative unary operators. */
|
||||||
#define APPLICATIVE_UNARY_OPS\
|
#define APPLICATIVE_UNARY_OPS\
|
||||||
@ -81,10 +80,10 @@
|
|||||||
/* Information about C built-in types. */
|
/* Information about C built-in types. */
|
||||||
|
|
||||||
/* Accessors for the type datatype. */
|
/* Accessors for the type datatype. */
|
||||||
#define TYPE_NAME(T) BOOST_PP_TUPLE4_ELEM0 T
|
#define TYPE_NAME(T) BOOST_PP_TUPLE_ELEM(4,0,T)
|
||||||
#define TYPE_ABBREVIATION(T) BOOST_PP_TUPLE4_ELEM1 T
|
#define TYPE_ABBREVIATION(T) BOOST_PP_TUPLE_ELEM(4,1,T)
|
||||||
#define TYPE_IS_FLOATING(T) BOOST_PP_TUPLE4_ELEM2 T
|
#define TYPE_IS_FLOATING(T) BOOST_PP_TUPLE_ELEM(4,2,T)
|
||||||
#define TYPE_RANK(T) BOOST_PP_TUPLE4_ELEM3 T
|
#define TYPE_RANK(T) BOOST_PP_TUPLE_ELEM(4,3,T)
|
||||||
|
|
||||||
/* List of C built-in types. */
|
/* List of C built-in types. */
|
||||||
#define BUILTIN_TYPES\
|
#define BUILTIN_TYPES\
|
||||||
@ -121,8 +120,14 @@
|
|||||||
#define UNARY_ARRAY_OP2(O,T) BOOST_PP_IF(IS_VALID_UNARY_OP_AND_TYPE_COMBINATION(O,T),UNARY_ARRAY_OP3,BOOST_PP_TUPLE2_EAT)(O,T)
|
#define UNARY_ARRAY_OP2(O,T) BOOST_PP_IF(IS_VALID_UNARY_OP_AND_TYPE_COMBINATION(O,T),UNARY_ARRAY_OP3,BOOST_PP_TUPLE2_EAT)(O,T)
|
||||||
#define UNARY_ARRAY_OP3(O,T)\
|
#define UNARY_ARRAY_OP3(O,T)\
|
||||||
void BOOST_PP_CAT4(array_,OP_NAME(O),_,TYPE_ABBREVIATION(T))\
|
void BOOST_PP_CAT4(array_,OP_NAME(O),_,TYPE_ABBREVIATION(T))\
|
||||||
(const TYPE_NAME(T)* in, TYPE_NAME(TYPE_OF_UNARY_OP(O,T))* out, size_t n)\
|
( const TYPE_NAME(T)* in\
|
||||||
{ do { *out++ = OP_SYMBOL(O) *in++; } while (--n); }
|
, TYPE_NAME(TYPE_OF_UNARY_OP(O,T))* out\
|
||||||
|
, unsigned n\
|
||||||
|
)\
|
||||||
|
{ do\
|
||||||
|
{ *out++ = OP_SYMBOL(O) *in++;\
|
||||||
|
} while (--n);\
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_PP_LIST_FOR_EACH_PRODUCT(UNARY_ARRAY_OP,_,BOOST_PP_TUPLE_TO_LIST(2,(APPLICATIVE_UNARY_OPS,BUILTIN_TYPES)))
|
BOOST_PP_LIST_FOR_EACH_PRODUCT(UNARY_ARRAY_OP,_,BOOST_PP_TUPLE_TO_LIST(2,(APPLICATIVE_UNARY_OPS,BUILTIN_TYPES)))
|
||||||
|
|
||||||
@ -131,7 +136,16 @@ BOOST_PP_LIST_FOR_EACH_PRODUCT(UNARY_ARRAY_OP,_,BOOST_PP_TUPLE_TO_LIST(2,(APPLIC
|
|||||||
#define BINARY_ARRAY_OP2(O,L,R) BOOST_PP_IF(IS_VALID_BINARY_OP_AND_TYPE_COMBINATION(O,L,R),BINARY_ARRAY_OP3,BOOST_PP_TUPLE3_EAT)(O,L,R)
|
#define BINARY_ARRAY_OP2(O,L,R) BOOST_PP_IF(IS_VALID_BINARY_OP_AND_TYPE_COMBINATION(O,L,R),BINARY_ARRAY_OP3,BOOST_PP_TUPLE3_EAT)(O,L,R)
|
||||||
#define BINARY_ARRAY_OP3(O,L,R)\
|
#define BINARY_ARRAY_OP3(O,L,R)\
|
||||||
void BOOST_PP_CAT6(array_,OP_NAME(O),_,TYPE_ABBREVIATION(L),_,TYPE_ABBREVIATION(R))\
|
void BOOST_PP_CAT6(array_,OP_NAME(O),_,TYPE_ABBREVIATION(L),_,TYPE_ABBREVIATION(R))\
|
||||||
(const TYPE_NAME(L)* lhs_in, const TYPE_NAME(R)* rhs_in, TYPE_NAME(TYPE_OF_BINARY_OP(O,L,R))* out, size_t n)\
|
( const TYPE_NAME(L)* lhs_in\
|
||||||
{ do { *out++ = *lhs_in++ OP_SYMBOL(O) *rhs_in++; } while (--n); }
|
, const TYPE_NAME(R)* rhs_in\
|
||||||
|
, TYPE_NAME(TYPE_OF_BINARY_OP(O,L,R))* out\
|
||||||
|
, unsigned n\
|
||||||
|
)\
|
||||||
|
{ do\
|
||||||
|
{ *out++ = *lhs_in OP_SYMBOL(O) *rhs_in;\
|
||||||
|
++lhs_in;\
|
||||||
|
++rhs_in;\
|
||||||
|
} while (--n);\
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_PP_LIST_FOR_EACH_PRODUCT(BINARY_ARRAY_OP,_,BOOST_PP_TUPLE_TO_LIST(3,(APPLICATIVE_BINARY_OPS,BUILTIN_TYPES,BUILTIN_TYPES)))
|
BOOST_PP_LIST_FOR_EACH_PRODUCT(BINARY_ARRAY_OP,_,BOOST_PP_TUPLE_TO_LIST(3,(APPLICATIVE_BINARY_OPS,BUILTIN_TYPES,BUILTIN_TYPES)))
|
||||||
|
@ -25,6 +25,16 @@
|
|||||||
#define BOOST_PP_LIST_FOR_EACH_PRODUCT(F,P,LL) BOOST_PP_LIST_FOR_EACH_PRODUCT_R(0,F,P,LL)
|
#define BOOST_PP_LIST_FOR_EACH_PRODUCT(F,P,LL) BOOST_PP_LIST_FOR_EACH_PRODUCT_R(0,F,P,LL)
|
||||||
|
|
||||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||||
|
#if !defined(BOOST_NO_COMPILER_CONFIG) && defined(__MWERKS__) && __MWERKS__ <= 0x2406 ||\
|
||||||
|
!defined(BOOST_NO_COMPILER_CONFIG) && defined(_MSC_VER)
|
||||||
|
# define BOOST_PP_LIST_FOR_EACH_PRODUCT_R(R,F,P,LL) BOOST_PP_FOR##R((BOOST_PP_TUPLE_ELEM(3,0,LL),BOOST_PP_TUPLE_ELEM(3,1,LL),(_,_,0),F,P),BOOST_PP_LIST_FOR_EACH_PRODUCT_C,BOOST_PP_LIST_FOR_EACH_PRODUCT_F,BOOST_PP_LIST_FOR_EACH_PRODUCT_I0)
|
||||||
|
# define BOOST_PP_LIST_FOR_EACH_PRODUCT_C(R,P) BOOST_PP_TUPLE_ELEM(3,2,BOOST_PP_TUPLE_ELEM(5,0,P))
|
||||||
|
# define BOOST_PP_LIST_FOR_EACH_PRODUCT_F(R,P) (BOOST_PP_LIST_REST(BOOST_PP_TUPLE_ELEM(5,0,P)),BOOST_PP_TUPLE_ELEM(5,1,P),BOOST_PP_TUPLE_ELEM(5,2,P),BOOST_PP_TUPLE_ELEM(5,3,P),BOOST_PP_TUPLE_ELEM(5,4,P))
|
||||||
|
|
||||||
|
# define BOOST_PP_LIST_FOR_EACH_PRODUCT_I(R,P) BOOST_PP_TUPLE_ELEM(5,3,P)(R,BOOST_PP_TUPLE_ELEM(5,4,P),(BOOST_PP_TUPLE_ELEM(3,0,BOOST_PP_TUPLE_ELEM(5,0,P)),BOOST_PP_TUPLE_ELEM(5,2,P),1))
|
||||||
|
# define BOOST_PP_LIST_FOR_EACH_PRODUCT_I_C(P,I) BOOST_PP_IF(BOOST_PP_TUPLE_ELEM(3,2,BOOST_PP_TUPLE_ELEM(5,1,P)),BOOST_PP_LIST_FOR_EACH_PRODUCT_I##I##_C,BOOST_PP_LIST_FOR_EACH_PRODUCT_I)
|
||||||
|
# define BOOST_PP_LIST_FOR_EACH_PRODUCT_I_H(P) (BOOST_PP_TUPLE_ELEM(3,0,BOOST_PP_TUPLE_ELEM(5,1,P)),BOOST_PP_TUPLE_ELEM(3,1,BOOST_PP_TUPLE_ELEM(5,1,P)),(BOOST_PP_TUPLE_ELEM(3,0,BOOST_PP_TUPLE_ELEM(5,0,P)),BOOST_PP_TUPLE_ELEM(5,2,P),1),BOOST_PP_TUPLE_ELEM(5,3,P),BOOST_PP_TUPLE_ELEM(5,4,P))
|
||||||
|
#else
|
||||||
# define BOOST_PP_LIST_FOR_EACH_PRODUCT_R(R,F,P,LL) BOOST_PP_FOR##R((BOOST_PP_TUPLE3_ELEM0 LL,BOOST_PP_TUPLE3_ELEM1 LL,(_,_,0),F,P),BOOST_PP_LIST_FOR_EACH_PRODUCT_C,BOOST_PP_LIST_FOR_EACH_PRODUCT_F,BOOST_PP_LIST_FOR_EACH_PRODUCT_I0)
|
# define BOOST_PP_LIST_FOR_EACH_PRODUCT_R(R,F,P,LL) BOOST_PP_FOR##R((BOOST_PP_TUPLE3_ELEM0 LL,BOOST_PP_TUPLE3_ELEM1 LL,(_,_,0),F,P),BOOST_PP_LIST_FOR_EACH_PRODUCT_C,BOOST_PP_LIST_FOR_EACH_PRODUCT_F,BOOST_PP_LIST_FOR_EACH_PRODUCT_I0)
|
||||||
# define BOOST_PP_LIST_FOR_EACH_PRODUCT_C(R,P) BOOST_PP_TUPLE3_ELEM2 BOOST_PP_TUPLE5_ELEM0 P
|
# define BOOST_PP_LIST_FOR_EACH_PRODUCT_C(R,P) BOOST_PP_TUPLE3_ELEM2 BOOST_PP_TUPLE5_ELEM0 P
|
||||||
# define BOOST_PP_LIST_FOR_EACH_PRODUCT_F(R,P) (BOOST_PP_LIST_REST(BOOST_PP_TUPLE5_ELEM0 P),BOOST_PP_TUPLE5_ELEM1 P,BOOST_PP_TUPLE5_ELEM2 P,BOOST_PP_TUPLE5_ELEM3 P,BOOST_PP_TUPLE5_ELEM4 P)
|
# define BOOST_PP_LIST_FOR_EACH_PRODUCT_F(R,P) (BOOST_PP_LIST_REST(BOOST_PP_TUPLE5_ELEM0 P),BOOST_PP_TUPLE5_ELEM1 P,BOOST_PP_TUPLE5_ELEM2 P,BOOST_PP_TUPLE5_ELEM3 P,BOOST_PP_TUPLE5_ELEM4 P)
|
||||||
@ -32,7 +42,7 @@
|
|||||||
# define BOOST_PP_LIST_FOR_EACH_PRODUCT_I(R,P) BOOST_PP_TUPLE5_ELEM3 P(R,BOOST_PP_TUPLE5_ELEM4 P,(BOOST_PP_TUPLE3_ELEM0 BOOST_PP_TUPLE5_ELEM0 P,BOOST_PP_TUPLE5_ELEM2 P,1))
|
# define BOOST_PP_LIST_FOR_EACH_PRODUCT_I(R,P) BOOST_PP_TUPLE5_ELEM3 P(R,BOOST_PP_TUPLE5_ELEM4 P,(BOOST_PP_TUPLE3_ELEM0 BOOST_PP_TUPLE5_ELEM0 P,BOOST_PP_TUPLE5_ELEM2 P,1))
|
||||||
# define BOOST_PP_LIST_FOR_EACH_PRODUCT_I_C(P,I) BOOST_PP_IF(BOOST_PP_TUPLE3_ELEM2 BOOST_PP_TUPLE5_ELEM1 P,BOOST_PP_LIST_FOR_EACH_PRODUCT_I##I##_C,BOOST_PP_LIST_FOR_EACH_PRODUCT_I)
|
# define BOOST_PP_LIST_FOR_EACH_PRODUCT_I_C(P,I) BOOST_PP_IF(BOOST_PP_TUPLE3_ELEM2 BOOST_PP_TUPLE5_ELEM1 P,BOOST_PP_LIST_FOR_EACH_PRODUCT_I##I##_C,BOOST_PP_LIST_FOR_EACH_PRODUCT_I)
|
||||||
# define BOOST_PP_LIST_FOR_EACH_PRODUCT_I_H(P) (BOOST_PP_TUPLE3_ELEM0 BOOST_PP_TUPLE5_ELEM1 P,BOOST_PP_TUPLE3_ELEM1 BOOST_PP_TUPLE5_ELEM1 P,(BOOST_PP_TUPLE3_ELEM0 BOOST_PP_TUPLE5_ELEM0 P,BOOST_PP_TUPLE5_ELEM2 P,1),BOOST_PP_TUPLE5_ELEM3 P,BOOST_PP_TUPLE5_ELEM4 P)
|
# define BOOST_PP_LIST_FOR_EACH_PRODUCT_I_H(P) (BOOST_PP_TUPLE3_ELEM0 BOOST_PP_TUPLE5_ELEM1 P,BOOST_PP_TUPLE3_ELEM1 BOOST_PP_TUPLE5_ELEM1 P,(BOOST_PP_TUPLE3_ELEM0 BOOST_PP_TUPLE5_ELEM0 P,BOOST_PP_TUPLE5_ELEM2 P,1),BOOST_PP_TUPLE5_ELEM3 P,BOOST_PP_TUPLE5_ELEM4 P)
|
||||||
|
#endif
|
||||||
# define BOOST_PP_LIST_FOR_EACH_PRODUCT_I0_C(R,P) BOOST_PP_FOR##R(BOOST_PP_LIST_FOR_EACH_PRODUCT_I_H(P),BOOST_PP_LIST_FOR_EACH_PRODUCT_C,BOOST_PP_LIST_FOR_EACH_PRODUCT_F,BOOST_PP_LIST_FOR_EACH_PRODUCT_I1)
|
# define BOOST_PP_LIST_FOR_EACH_PRODUCT_I0_C(R,P) BOOST_PP_FOR##R(BOOST_PP_LIST_FOR_EACH_PRODUCT_I_H(P),BOOST_PP_LIST_FOR_EACH_PRODUCT_C,BOOST_PP_LIST_FOR_EACH_PRODUCT_F,BOOST_PP_LIST_FOR_EACH_PRODUCT_I1)
|
||||||
# define BOOST_PP_LIST_FOR_EACH_PRODUCT_I0(R,P) BOOST_PP_LIST_FOR_EACH_PRODUCT_I_C(P,0)(R,P)
|
# define BOOST_PP_LIST_FOR_EACH_PRODUCT_I0(R,P) BOOST_PP_LIST_FOR_EACH_PRODUCT_I_C(P,0)(R,P)
|
||||||
# define BOOST_PP_LIST_FOR_EACH_PRODUCT_I1_C(R,P) BOOST_PP_FOR##R(BOOST_PP_LIST_FOR_EACH_PRODUCT_I_H(P),BOOST_PP_LIST_FOR_EACH_PRODUCT_C,BOOST_PP_LIST_FOR_EACH_PRODUCT_F,BOOST_PP_LIST_FOR_EACH_PRODUCT_I2)
|
# define BOOST_PP_LIST_FOR_EACH_PRODUCT_I1_C(R,P) BOOST_PP_FOR##R(BOOST_PP_LIST_FOR_EACH_PRODUCT_I_H(P),BOOST_PP_LIST_FOR_EACH_PRODUCT_C,BOOST_PP_LIST_FOR_EACH_PRODUCT_F,BOOST_PP_LIST_FOR_EACH_PRODUCT_I2)
|
||||||
|
Reference in New Issue
Block a user