Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:53:36

0001 
0002 //  (C) Copyright Edward Diener 2011-2015
0003 //  Use, modification and distribution are subject to the Boost Software License,
0004 //  Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0005 //  http://www.boost.org/LICENSE_1_0.txt).
0006 
0007 #if !defined(BOOST_VMD_DETAIL_DATA_EQUAL_COMMON_HPP)
0008 #define BOOST_VMD_DETAIL_DATA_EQUAL_COMMON_HPP
0009 
0010 #include <boost/preprocessor/arithmetic/inc.hpp>
0011 #include <boost/preprocessor/array/elem.hpp>
0012 #include <boost/preprocessor/array/size.hpp>
0013 #include <boost/preprocessor/comparison/equal.hpp>
0014 #include <boost/preprocessor/control/iif.hpp>
0015 #include <boost/preprocessor/list/at.hpp>
0016 #include <boost/preprocessor/list/size.hpp>
0017 #include <boost/preprocessor/logical/bitand.hpp>
0018 #include <boost/preprocessor/logical/bitor.hpp>
0019 #include <boost/preprocessor/logical/compl.hpp>
0020 #include <boost/preprocessor/punctuation/is_begin_parens.hpp>
0021 #include <boost/preprocessor/seq/elem.hpp>
0022 #include <boost/preprocessor/seq/size.hpp>
0023 #include <boost/preprocessor/tuple/elem.hpp>
0024 #include <boost/preprocessor/tuple/pop_front.hpp>
0025 #include <boost/preprocessor/tuple/push_back.hpp>
0026 #include <boost/preprocessor/tuple/replace.hpp>
0027 #include <boost/preprocessor/tuple/size.hpp>
0028 #include <boost/vmd/empty.hpp>
0029 #include <boost/vmd/is_empty.hpp>
0030 #include <boost/vmd/get_type.hpp>
0031 #include <boost/vmd/detail/equal_type.hpp>
0032 
0033 #define BOOST_VMD_DETAIL_DATA_EQUAL_IS_BOTH_COMPOSITE(vseq1,vseq2) \
0034     BOOST_PP_BITAND \
0035         ( \
0036         BOOST_PP_IS_BEGIN_PARENS(vseq1), \
0037         BOOST_PP_IS_BEGIN_PARENS(vseq2) \
0038         ) \
0039 /**/
0040 
0041 #define BOOST_VMD_DETAIL_DATA_EQUAL_GET_ELEM_ARRAY(d,index,data) \
0042     BOOST_PP_ARRAY_ELEM(index,data) \
0043 /**/
0044 
0045 #define BOOST_VMD_DETAIL_DATA_EQUAL_GET_ELEM_LIST(d,index,data) \
0046     BOOST_PP_LIST_AT_D(d,data,index) \
0047 /**/
0048 
0049 #define BOOST_VMD_DETAIL_DATA_EQUAL_GET_ELEM_SEQ(d,index,data) \
0050     BOOST_PP_SEQ_ELEM(index,data) \
0051 /**/
0052 
0053 #define BOOST_VMD_DETAIL_DATA_EQUAL_GET_ELEM_TUPLE(d,index,data) \
0054     BOOST_PP_TUPLE_ELEM(index,data) \
0055 /**/
0056 
0057 #define BOOST_VMD_DETAIL_DATA_EQUAL_GET_SIZE_ARRAY(data) \
0058     BOOST_PP_ARRAY_SIZE(data) \
0059 /**/
0060 
0061 #define BOOST_VMD_DETAIL_DATA_EQUAL_GET_SIZE_LIST(data) \
0062     BOOST_PP_LIST_SIZE(data) \
0063 /**/
0064 
0065 #define BOOST_VMD_DETAIL_DATA_EQUAL_GET_SIZE_SEQ(data) \
0066     BOOST_PP_SEQ_SIZE(data) \
0067 /**/
0068 
0069 #define BOOST_VMD_DETAIL_DATA_EQUAL_GET_SIZE_TUPLE(data) \
0070     BOOST_PP_TUPLE_SIZE(data) \
0071 /**/
0072 
0073 #define BOOST_VMD_DETAIL_DATA_EQUAL_GET_SIZE_ARRAY_D(d,data) \
0074     BOOST_PP_ARRAY_SIZE(data) \
0075 /**/
0076 
0077 #define BOOST_VMD_DETAIL_DATA_EQUAL_GET_SIZE_LIST_D(d,data) \
0078     BOOST_PP_LIST_SIZE_D(d,data) \
0079 /**/
0080 
0081 #define BOOST_VMD_DETAIL_DATA_EQUAL_GET_SIZE_SEQ_D(d,data) \
0082     BOOST_PP_SEQ_SIZE(data) \
0083 /**/
0084 
0085 #define BOOST_VMD_DETAIL_DATA_EQUAL_GET_SIZE_TUPLE_D(d,data) \
0086     BOOST_PP_TUPLE_SIZE(data) \
0087 /**/
0088 
0089 #define BOOST_VMD_DETAIL_DATA_EQUAL_GET_ELEM(d,index,data,vtype) \
0090     BOOST_PP_IIF \
0091         ( \
0092         BOOST_VMD_DETAIL_EQUAL_TYPE_D(d,vtype,BOOST_VMD_TYPE_ARRAY), \
0093         BOOST_VMD_DETAIL_DATA_EQUAL_GET_ELEM_ARRAY, \
0094         BOOST_PP_IIF \
0095             ( \
0096             BOOST_VMD_DETAIL_EQUAL_TYPE_D(d,vtype,BOOST_VMD_TYPE_LIST), \
0097             BOOST_VMD_DETAIL_DATA_EQUAL_GET_ELEM_LIST, \
0098             BOOST_PP_IIF \
0099                 ( \
0100                 BOOST_VMD_DETAIL_EQUAL_TYPE_D(d,vtype,BOOST_VMD_TYPE_SEQ), \
0101                 BOOST_VMD_DETAIL_DATA_EQUAL_GET_ELEM_SEQ, \
0102                 BOOST_VMD_DETAIL_DATA_EQUAL_GET_ELEM_TUPLE \
0103                 ) \
0104             ) \
0105         ) \
0106     (d,index,data) \
0107 /**/
0108 
0109 #define BOOST_VMD_DETAIL_DATA_EQUAL_GET_SIZE(data,vtype) \
0110     BOOST_PP_IIF \
0111         ( \
0112         BOOST_VMD_DETAIL_EQUAL_TYPE(vtype,BOOST_VMD_TYPE_ARRAY), \
0113         BOOST_VMD_DETAIL_DATA_EQUAL_GET_SIZE_ARRAY, \
0114         BOOST_PP_IIF \
0115             ( \
0116             BOOST_VMD_DETAIL_EQUAL_TYPE(vtype,BOOST_VMD_TYPE_LIST), \
0117             BOOST_VMD_DETAIL_DATA_EQUAL_GET_SIZE_LIST, \
0118             BOOST_PP_IIF \
0119                 ( \
0120                 BOOST_VMD_DETAIL_EQUAL_TYPE(vtype,BOOST_VMD_TYPE_SEQ), \
0121                 BOOST_VMD_DETAIL_DATA_EQUAL_GET_SIZE_SEQ, \
0122                 BOOST_VMD_DETAIL_DATA_EQUAL_GET_SIZE_TUPLE \
0123                 ) \
0124             ) \
0125         ) \
0126     (data) \
0127 /**/
0128 
0129 #define BOOST_VMD_DETAIL_DATA_EQUAL_GET_SIZE_D(d,data,vtype) \
0130     BOOST_PP_IIF \
0131         ( \
0132         BOOST_VMD_DETAIL_EQUAL_TYPE_D(d,vtype,BOOST_VMD_TYPE_ARRAY), \
0133         BOOST_VMD_DETAIL_DATA_EQUAL_GET_SIZE_ARRAY_D, \
0134         BOOST_PP_IIF \
0135             ( \
0136             BOOST_VMD_DETAIL_EQUAL_TYPE_D(d,vtype,BOOST_VMD_TYPE_LIST), \
0137             BOOST_VMD_DETAIL_DATA_EQUAL_GET_SIZE_LIST_D, \
0138             BOOST_PP_IIF \
0139                 ( \
0140                 BOOST_VMD_DETAIL_EQUAL_TYPE_D(d,vtype,BOOST_VMD_TYPE_SEQ), \
0141                 BOOST_VMD_DETAIL_DATA_EQUAL_GET_SIZE_SEQ_D, \
0142                 BOOST_VMD_DETAIL_DATA_EQUAL_GET_SIZE_TUPLE_D \
0143                 ) \
0144             ) \
0145         ) \
0146     (d,data) \
0147 /**/
0148 
0149 #define BOOST_VMD_DETAIL_DATA_EQUAL_STATE_RESULT(state) \
0150     BOOST_PP_TUPLE_ELEM(0,state) \
0151 /**/
0152 
0153 #define BOOST_VMD_DETAIL_DATA_EQUAL_STATE_FIRST(state) \
0154     BOOST_PP_TUPLE_ELEM(1,state) \
0155 /**/
0156 
0157 #define BOOST_VMD_DETAIL_DATA_EQUAL_STATE_SECOND(state) \
0158     BOOST_PP_TUPLE_ELEM(2,state) \
0159 /**/
0160 
0161 #define BOOST_VMD_DETAIL_DATA_EQUAL_STATE_SIZE(state) \
0162     BOOST_PP_TUPLE_ELEM(3,state) \
0163 /**/
0164 
0165 #define BOOST_VMD_DETAIL_DATA_EQUAL_STATE_TYPE(state) \
0166     BOOST_PP_TUPLE_ELEM(4,state) \
0167 /**/
0168 
0169 #define BOOST_VMD_DETAIL_DATA_EQUAL_STATE_INDEX(state) \
0170     BOOST_PP_TUPLE_ELEM(5,state) \
0171 /**/
0172 
0173 #define BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP(state) \
0174     BOOST_PP_TUPLE_ELEM(6,state) \
0175 /**/
0176 
0177 #define BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP_PROCESSING(d,state) \
0178     BOOST_PP_BITAND \
0179         ( \
0180         BOOST_PP_EQUAL_D \
0181             ( \
0182             d, \
0183             BOOST_VMD_DETAIL_DATA_EQUAL_STATE_INDEX(state), \
0184             BOOST_VMD_DETAIL_DATA_EQUAL_STATE_SIZE(state) \
0185             ), \
0186         BOOST_PP_COMPL(BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP_EMPTY(state)) \
0187         ) \
0188 /**/
0189 
0190 #define BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP_EMPTY(state) \
0191     BOOST_VMD_IS_EMPTY(BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP(state)) \
0192 /**/
0193 
0194 #define BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP_INDEX(state) \
0195     BOOST_PP_IIF \
0196         ( \
0197         BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP_EMPTY(state), \
0198         BOOST_VMD_EMPTY, \
0199         BOOST_PP_TUPLE_ELEM \
0200         ) \
0201     (0,BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP(state)) \
0202 /**/
0203 
0204 #define BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP_POP_NE_EMPTY(d,state) \
0205     BOOST_PP_TUPLE_REPLACE_D \
0206         ( \
0207         d, \
0208         state, \
0209         6, \
0210         ) \
0211 /**/
0212 
0213 #define BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP_POP_NE_REMOVE(d,state) \
0214     BOOST_PP_TUPLE_REPLACE_D \
0215         ( \
0216         d, \
0217         state, \
0218         6, \
0219         BOOST_PP_TUPLE_POP_FRONT(BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP(state)) \
0220         ) \
0221 /**/
0222 
0223 #define BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP_POP(d,state) \
0224     BOOST_PP_IIF \
0225         ( \
0226         BOOST_PP_EQUAL_D(d,BOOST_PP_TUPLE_SIZE(BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP(state)),1), \
0227         BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP_POP_NE_EMPTY, \
0228         BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP_POP_NE_REMOVE \
0229         ) \
0230     (d,state) \
0231 /**/
0232 
0233 #define BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP_PUSH_CREATE(d,state) \
0234     BOOST_VMD_DETAIL_DATA_EQUAL_OP_SUCCESS \
0235         ( \
0236         d, \
0237         BOOST_PP_TUPLE_REPLACE_D \
0238             ( \
0239             d, \
0240             state, \
0241             6, \
0242             (BOOST_VMD_DETAIL_DATA_EQUAL_STATE_INDEX(state)) \
0243             ) \
0244         ) \
0245 /**/
0246 
0247 #define BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP_PUSH_ADD(d,state) \
0248     BOOST_VMD_DETAIL_DATA_EQUAL_OP_SUCCESS \
0249         ( \
0250         d, \
0251         BOOST_PP_TUPLE_REPLACE_D \
0252             ( \
0253             d, \
0254             state, \
0255             6, \
0256             BOOST_PP_TUPLE_PUSH_BACK \
0257                 ( \
0258                 BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP(state), \
0259                 BOOST_VMD_DETAIL_DATA_EQUAL_STATE_INDEX(state) \
0260                 ) \
0261             ) \
0262         ) \
0263 /**/
0264 
0265 #define BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP_PUSH(d,state) \
0266     BOOST_PP_IIF \
0267         ( \
0268         BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP_EMPTY(state), \
0269         BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP_PUSH_CREATE, \
0270         BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP_PUSH_ADD \
0271         ) \
0272     (d,state) \
0273 /**/
0274 
0275 #define BOOST_VMD_DETAIL_DATA_EQUAL_STATE_GET_INDEX(d,state) \
0276     BOOST_PP_IIF \
0277         ( \
0278         BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP_PROCESSING(d,state), \
0279         BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP_INDEX, \
0280         BOOST_VMD_DETAIL_DATA_EQUAL_STATE_INDEX \
0281         ) \
0282     (state) \
0283 /**/
0284 
0285 #define BOOST_VMD_DETAIL_DATA_EQUAL_STATE_GET_FIRST_ELEMENT(d,state) \
0286     BOOST_VMD_DETAIL_DATA_EQUAL_GET_ELEM \
0287         ( \
0288         d, \
0289         BOOST_VMD_DETAIL_DATA_EQUAL_STATE_GET_INDEX(d,state), \
0290         BOOST_VMD_DETAIL_DATA_EQUAL_STATE_FIRST(state), \
0291         BOOST_VMD_DETAIL_DATA_EQUAL_STATE_TYPE(state) \
0292         ) \
0293 /**/
0294 
0295 #define BOOST_VMD_DETAIL_DATA_EQUAL_STATE_GET_SECOND_ELEMENT(d,state) \
0296     BOOST_VMD_DETAIL_DATA_EQUAL_GET_ELEM \
0297         ( \
0298         d, \
0299         BOOST_VMD_DETAIL_DATA_EQUAL_STATE_GET_INDEX(d,state), \
0300         BOOST_VMD_DETAIL_DATA_EQUAL_STATE_SECOND(state), \
0301         BOOST_VMD_DETAIL_DATA_EQUAL_STATE_TYPE(state) \
0302         ) \
0303 /**/
0304 
0305 #define BOOST_VMD_DETAIL_DATA_EQUAL_PRED(d,state) \
0306     BOOST_PP_BITAND \
0307         ( \
0308         BOOST_PP_EQUAL_D \
0309             ( \
0310             d, \
0311             BOOST_VMD_DETAIL_DATA_EQUAL_STATE_RESULT(state), \
0312             1 \
0313             ), \
0314         BOOST_PP_BITOR \
0315             ( \
0316             BOOST_PP_NOT_EQUAL_D \
0317                 ( \
0318                 d, \
0319                 BOOST_VMD_DETAIL_DATA_EQUAL_STATE_INDEX(state), \
0320                 BOOST_VMD_DETAIL_DATA_EQUAL_STATE_SIZE(state) \
0321                 ), \
0322             BOOST_PP_COMPL \
0323                 ( \
0324                 BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP_EMPTY(state) \
0325                 ) \
0326             ) \
0327         ) \
0328 /**/
0329 
0330 #define BOOST_VMD_DETAIL_DATA_EQUAL_OP_SUCCESS_NCP(d,state) \
0331     BOOST_PP_TUPLE_REPLACE_D \
0332         ( \
0333         d, \
0334         state, \
0335         5, \
0336         BOOST_PP_INC(BOOST_VMD_DETAIL_DATA_EQUAL_STATE_INDEX(state)) \
0337         ) \
0338 /**/
0339 
0340 #define BOOST_VMD_DETAIL_DATA_EQUAL_OP_SUCCESS(d,state) \
0341     BOOST_PP_IIF \
0342         ( \
0343         BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP_PROCESSING(d,state), \
0344         BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP_POP, \
0345         BOOST_VMD_DETAIL_DATA_EQUAL_OP_SUCCESS_NCP \
0346         ) \
0347     (d,state) \
0348 /**/
0349 
0350 #define BOOST_VMD_DETAIL_DATA_EQUAL_OP_FAILURE(d,state) \
0351     BOOST_PP_TUPLE_REPLACE_D \
0352         ( \
0353         d, \
0354         state, \
0355         0, \
0356         0 \
0357         ) \
0358 /**/
0359 
0360 #define BOOST_VMD_DETAIL_DATA_EQUAL_OP_RESULT(d,state,result) \
0361     BOOST_PP_IIF \
0362         ( \
0363         BOOST_PP_EQUAL_D(d,result,0), \
0364         BOOST_VMD_DETAIL_DATA_EQUAL_OP_FAILURE, \
0365         BOOST_PP_IIF \
0366             ( \
0367             BOOST_PP_EQUAL_D(d,result,1), \
0368             BOOST_VMD_DETAIL_DATA_EQUAL_OP_SUCCESS, \
0369             BOOST_VMD_DETAIL_DATA_EQUAL_STATE_COMP_PUSH \
0370             ) \
0371         ) \
0372     (d,state) \
0373 /**/
0374 
0375 #define BOOST_VMD_DETAIL_DATA_EQUAL_TYPE(emf,ems,vtype) \
0376     BOOST_PP_BITAND \
0377         ( \
0378         BOOST_VMD_DETAIL_EQUAL_TYPE \
0379             ( \
0380             BOOST_VMD_GET_TYPE(emf), \
0381             vtype \
0382             ), \
0383         BOOST_VMD_DETAIL_EQUAL_TYPE \
0384             ( \
0385             BOOST_VMD_GET_TYPE(ems), \
0386             vtype \
0387             ) \
0388         ) \
0389 /**/
0390 
0391 #define BOOST_VMD_DETAIL_DATA_EQUAL_TYPE_D(d,emf,ems,vtype) \
0392     BOOST_PP_BITAND \
0393         ( \
0394         BOOST_VMD_DETAIL_EQUAL_TYPE_D \
0395             ( \
0396             d, \
0397             BOOST_VMD_GET_TYPE(emf), \
0398             vtype \
0399             ), \
0400         BOOST_VMD_DETAIL_EQUAL_TYPE_D \
0401             ( \
0402             d, \
0403             BOOST_VMD_GET_TYPE(ems), \
0404             vtype \
0405             ) \
0406         ) \
0407 /**/
0408 
0409 #endif /* BOOST_VMD_DETAIL_DATA_EQUAL_COMMON_HPP */