Back to home page

EIC code displayed by LXR

 
 

    


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

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_SEQUENCE_COMMON_HPP)
0008 #define BOOST_VMD_DETAIL_SEQUENCE_COMMON_HPP
0009 
0010 #include <boost/preprocessor/arithmetic/inc.hpp>
0011 #include <boost/preprocessor/array/push_back.hpp>
0012 #include <boost/preprocessor/cat.hpp>
0013 #include <boost/preprocessor/comparison/equal.hpp>
0014 #include <boost/preprocessor/comparison/less_equal.hpp>
0015 #include <boost/preprocessor/comparison/not_equal.hpp>
0016 #include <boost/preprocessor/control/iif.hpp>
0017 #include <boost/preprocessor/control/while.hpp>
0018 #include <boost/preprocessor/list/append.hpp>
0019 #include <boost/preprocessor/logical/bitor.hpp>
0020 #include <boost/preprocessor/punctuation/is_begin_parens.hpp>
0021 #include <boost/preprocessor/seq/push_back.hpp>
0022 #include <boost/preprocessor/seq/size.hpp>
0023 #include <boost/preprocessor/tuple/elem.hpp>
0024 #include <boost/preprocessor/tuple/push_back.hpp>
0025 #include <boost/preprocessor/tuple/replace.hpp>
0026 #include <boost/preprocessor/tuple/size.hpp>
0027 #include <boost/vmd/empty.hpp>
0028 #include <boost/vmd/identity.hpp>
0029 #include <boost/vmd/is_empty.hpp>
0030 #include <boost/vmd/is_empty_list.hpp>
0031 #include <boost/vmd/detail/array.hpp>
0032 #include <boost/vmd/detail/equal_type.hpp>
0033 #include <boost/vmd/detail/identifier.hpp>
0034 #include <boost/vmd/detail/identifier_type.hpp>
0035 #include <boost/vmd/detail/list.hpp>
0036 #include <boost/vmd/detail/modifiers.hpp>
0037 #include <boost/vmd/detail/mods.hpp>
0038 #include <boost/vmd/detail/seq.hpp>
0039 #include <boost/vmd/detail/tuple.hpp>
0040 
0041 #define BOOST_VMD_DETAIL_SEQUENCE_STATE_INPUT_ELEM 0
0042 #define BOOST_VMD_DETAIL_SEQUENCE_STATE_RESULT_ELEM 1
0043 #define BOOST_VMD_DETAIL_SEQUENCE_STATE_ELEM_ELEM 2
0044 #define BOOST_VMD_DETAIL_SEQUENCE_STATE_OUTTYPE_ELEM 3
0045 #define BOOST_VMD_DETAIL_SEQUENCE_STATE_FROM_ELEM 4
0046 #define BOOST_VMD_DETAIL_SEQUENCE_STATE_TYPES_ELEM 5
0047 #define BOOST_VMD_DETAIL_SEQUENCE_STATE_INDEX_ELEM 6
0048 
0049 #define BOOST_VMD_DETAIL_SEQUENCE_STATE_INPUT(state) \
0050     BOOST_PP_TUPLE_ELEM(BOOST_VMD_DETAIL_SEQUENCE_STATE_INPUT_ELEM,state) \
0051 /**/
0052 
0053 #define BOOST_VMD_DETAIL_SEQUENCE_STATE_RESULT(state) \
0054     BOOST_PP_TUPLE_ELEM(BOOST_VMD_DETAIL_SEQUENCE_STATE_RESULT_ELEM,state) \
0055 /**/
0056 
0057 #define BOOST_VMD_DETAIL_SEQUENCE_STATE_ELEM(state) \
0058         BOOST_PP_TUPLE_ELEM(BOOST_VMD_DETAIL_SEQUENCE_STATE_ELEM_ELEM,state) \
0059 /**/
0060 
0061 #define BOOST_VMD_DETAIL_SEQUENCE_STATE_OUTTYPE(state) \
0062         BOOST_PP_TUPLE_ELEM(BOOST_VMD_DETAIL_SEQUENCE_STATE_OUTTYPE_ELEM,state) \
0063 /**/
0064 
0065 #define BOOST_VMD_DETAIL_SEQUENCE_STATE_FROM(state) \
0066         BOOST_PP_TUPLE_ELEM(BOOST_VMD_DETAIL_SEQUENCE_STATE_FROM_ELEM,state) \
0067 /**/
0068 
0069 #define BOOST_VMD_DETAIL_SEQUENCE_STATE_IS_RETURN(d,from,number) \
0070     BOOST_PP_EQUAL_D \
0071         ( \
0072         d, \
0073         BOOST_PP_TUPLE_ELEM(0,from), \
0074         number \
0075         ) \
0076 /**/
0077 
0078 #define BOOST_VMD_DETAIL_SEQUENCE_STATE_IS_NO_RETURN(d,from) \
0079     BOOST_VMD_DETAIL_SEQUENCE_STATE_IS_RETURN(d,from,BOOST_VMD_DETAIL_MODS_NO_RETURN) \
0080 /**/
0081 
0082 #define BOOST_VMD_DETAIL_SEQUENCE_STATE_IS_EXACT_RETURN(d,from) \
0083     BOOST_VMD_DETAIL_SEQUENCE_STATE_IS_RETURN(d,from,BOOST_VMD_DETAIL_MODS_RETURN) \
0084 /**/
0085 
0086 #define BOOST_VMD_DETAIL_SEQUENCE_STATE_IS_GENERAL_RETURN(d,from) \
0087     BOOST_VMD_DETAIL_SEQUENCE_STATE_IS_RETURN(d,from,BOOST_VMD_DETAIL_MODS_RETURN_TUPLE) \
0088 /**/
0089 
0090 #define BOOST_VMD_DETAIL_SEQUENCE_STATE_IS_ARRAY_RETURN(d,from) \
0091     BOOST_VMD_DETAIL_SEQUENCE_STATE_IS_RETURN(d,from,BOOST_VMD_DETAIL_MODS_RETURN_ARRAY) \
0092 /**/
0093 
0094 #define BOOST_VMD_DETAIL_SEQUENCE_STATE_IS_LIST_RETURN(d,from) \
0095     BOOST_VMD_DETAIL_SEQUENCE_STATE_IS_RETURN(d,from,BOOST_VMD_DETAIL_MODS_RETURN_LIST) \
0096 /**/
0097 
0098 #define BOOST_VMD_DETAIL_SEQUENCE_STATE_IS_AFTER(from) \
0099     BOOST_PP_EQUAL \
0100         ( \
0101         BOOST_PP_TUPLE_ELEM(1,from), \
0102         BOOST_VMD_DETAIL_MODS_RETURN_AFTER \
0103         ) \
0104 /**/
0105 
0106 #define BOOST_VMD_DETAIL_SEQUENCE_STATE_IS_AFTER_D(d,from) \
0107     BOOST_PP_EQUAL_D \
0108         ( \
0109         d, \
0110         BOOST_PP_TUPLE_ELEM(1,from), \
0111         BOOST_VMD_DETAIL_MODS_RETURN_AFTER \
0112         ) \
0113 /**/
0114 
0115 #define BOOST_VMD_DETAIL_SEQUENCE_STATE_TYPES(state) \
0116         BOOST_PP_TUPLE_ELEM(BOOST_VMD_DETAIL_SEQUENCE_STATE_TYPES_ELEM,state) \
0117 /**/
0118 
0119 #define BOOST_VMD_DETAIL_SEQUENCE_STATE_INDEX(state) \
0120         BOOST_PP_TUPLE_ELEM(BOOST_VMD_DETAIL_SEQUENCE_STATE_INDEX_ELEM,state) \
0121 /**/
0122 
0123 #define BOOST_VMD_DETAIL_SEQUENCE_STATE_RESULT_IS_EMPTY(state) \
0124     BOOST_VMD_IS_EMPTY \
0125         ( \
0126         BOOST_VMD_DETAIL_SEQUENCE_STATE_RESULT(state) \
0127         ) \
0128 /**/
0129 
0130 #define BOOST_VMD_DETAIL_SEQUENCE_STATE_RESULT_ADD_FROM_EMPTY(state,data) \
0131     (data) \
0132 /**/
0133 
0134 #define BOOST_VMD_DETAIL_SEQUENCE_STATE_RESULT_ADD_TO_SEQ(state,data) \
0135     BOOST_PP_SEQ_PUSH_BACK(BOOST_VMD_DETAIL_SEQUENCE_STATE_RESULT(state),data) \
0136 /**/
0137 
0138 #define BOOST_VMD_DETAIL_SEQUENCE_STATE_RESULT_ADD_TO_TUPLE(state,data) \
0139     BOOST_PP_TUPLE_PUSH_BACK(BOOST_VMD_DETAIL_SEQUENCE_STATE_RESULT(state),data) \
0140 /**/
0141 
0142 // Array
0143 
0144 #define BOOST_VMD_DETAIL_SEQUENCE_STATE_RESULT_ADD_BOOST_VMD_TYPE_ARRAY(d,state,data) \
0145     BOOST_PP_ARRAY_PUSH_BACK(BOOST_VMD_DETAIL_SEQUENCE_STATE_RESULT(state),data) \
0146 /**/
0147 
0148 // List
0149 
0150 #define BOOST_VMD_DETAIL_SEQUENCE_STATE_RESULT_ADD_BOOST_VMD_TYPE_LIST(d,state,data) \
0151     BOOST_PP_LIST_APPEND_D(d,BOOST_VMD_DETAIL_SEQUENCE_STATE_RESULT(state),(data,BOOST_PP_NIL)) \
0152 /**/
0153 
0154 // Seq
0155 
0156 #define BOOST_VMD_DETAIL_SEQUENCE_STATE_RESULT_ADD_BOOST_VMD_TYPE_SEQ(d,state,data) \
0157     BOOST_PP_IIF \
0158          ( \
0159          BOOST_VMD_DETAIL_SEQUENCE_STATE_RESULT_IS_EMPTY(state), \
0160          BOOST_VMD_DETAIL_SEQUENCE_STATE_RESULT_ADD_FROM_EMPTY, \
0161          BOOST_VMD_DETAIL_SEQUENCE_STATE_RESULT_ADD_TO_SEQ \
0162          ) \
0163      (state,data) \
0164 /**/
0165 
0166 // Tuple
0167 
0168 #define BOOST_VMD_DETAIL_SEQUENCE_STATE_RESULT_ADD_BOOST_VMD_TYPE_TUPLE(d,state,data) \
0169     BOOST_PP_IIF \
0170          ( \
0171          BOOST_VMD_DETAIL_SEQUENCE_STATE_RESULT_IS_EMPTY(state), \
0172          BOOST_VMD_DETAIL_SEQUENCE_STATE_RESULT_ADD_FROM_EMPTY, \
0173          BOOST_VMD_DETAIL_SEQUENCE_STATE_RESULT_ADD_TO_TUPLE \
0174          ) \
0175      (state,data) \
0176 /**/
0177 
0178 #define BOOST_VMD_DETAIL_SEQUENCE_STATE_RESULT_ADD_GET_NAME(state) \
0179     BOOST_PP_CAT \
0180         ( \
0181         BOOST_VMD_DETAIL_SEQUENCE_STATE_RESULT_ADD_, \
0182         BOOST_VMD_DETAIL_SEQUENCE_STATE_OUTTYPE(state) \
0183         ) \
0184 /**/
0185 
0186 #define BOOST_VMD_DETAIL_SEQUENCE_STATE_RESULT_ADD_PROCESS(d,name,state,data) \
0187     name(d,state,data) \
0188 /**/
0189 
0190 #define BOOST_VMD_DETAIL_SEQUENCE_STATE_RESULT_ADD_GET_DATA(d,state,tuple) \
0191     BOOST_VMD_IDENTITY_RESULT \
0192         ( \
0193         BOOST_PP_IIF \
0194             ( \
0195             BOOST_VMD_DETAIL_SEQUENCE_STATE_IS_NO_RETURN \
0196                 ( \
0197                 d, \
0198                 BOOST_VMD_DETAIL_SEQUENCE_STATE_FROM(state) \
0199                 ), \
0200             BOOST_PP_TUPLE_ELEM, \
0201             BOOST_VMD_IDENTITY(tuple) \
0202             ) \
0203         (1,tuple) \
0204         ) \
0205 /**/
0206 
0207 #define BOOST_VMD_DETAIL_SEQUENCE_STATE_RESULT_ADD(d,state,ttuple) \
0208     BOOST_VMD_DETAIL_SEQUENCE_STATE_RESULT_ADD_PROCESS \
0209         ( \
0210         d, \
0211         BOOST_VMD_DETAIL_SEQUENCE_STATE_RESULT_ADD_GET_NAME(state), \
0212         state, \
0213         BOOST_VMD_DETAIL_SEQUENCE_STATE_RESULT_ADD_GET_DATA(d,state,ttuple) \
0214         ) \
0215 /**/
0216 
0217 #define BOOST_VMD_DETAIL_SEQUENCE_PROCESSING_ELEM_CHECK(d,state) \
0218     BOOST_PP_EQUAL_D \
0219         ( \
0220         d, \
0221         BOOST_PP_SEQ_SIZE(BOOST_VMD_DETAIL_SEQUENCE_STATE_RESULT(state)), \
0222         BOOST_VMD_DETAIL_SEQUENCE_STATE_ELEM(state) \
0223         ) \
0224 /**/
0225 
0226 #define BOOST_VMD_DETAIL_SEQUENCE_PROCESSING_ELEM(d,state) \
0227     BOOST_VMD_IDENTITY_RESULT \
0228         ( \
0229         BOOST_PP_IIF \
0230             ( \
0231             BOOST_VMD_IS_EMPTY(BOOST_VMD_DETAIL_SEQUENCE_STATE_ELEM(state)), \
0232             BOOST_VMD_IDENTITY(0), \
0233             BOOST_VMD_DETAIL_SEQUENCE_PROCESSING_ELEM_CHECK \
0234             ) \
0235         (d,state) \
0236         ) \
0237 /**/
0238 
0239 #define BOOST_VMD_DETAIL_SEQUENCE_STATE_GET_TYPE(state) \
0240         BOOST_PP_TUPLE_ELEM \
0241             ( \
0242             0, \
0243             BOOST_PP_TUPLE_ELEM(BOOST_VMD_DETAIL_SEQUENCE_STATE_INDEX(state),BOOST_VMD_DETAIL_SEQUENCE_STATE_TYPES(state)) \
0244             ) \
0245 /**/
0246 
0247 #define BOOST_VMD_DETAIL_SEQUENCE_STATE_GET_TYPE_REENTRANT(state) \
0248         BOOST_PP_TUPLE_ELEM \
0249             ( \
0250             1, \
0251             BOOST_PP_TUPLE_ELEM(BOOST_VMD_DETAIL_SEQUENCE_STATE_INDEX(state),BOOST_VMD_DETAIL_SEQUENCE_STATE_TYPES(state)) \
0252             ) \
0253 /**/
0254 
0255 #define BOOST_VMD_DETAIL_SEQUENCE_INNER_OP_UNKNOWN(d,state) \
0256     ( \
0257     , \
0258     BOOST_VMD_DETAIL_SEQUENCE_STATE_RESULT_ADD(d,state,(BOOST_VMD_TYPE_UNKNOWN,BOOST_VMD_DETAIL_SEQUENCE_STATE_INPUT(state))), \
0259     BOOST_VMD_DETAIL_SEQUENCE_STATE_ELEM(state), \
0260     BOOST_VMD_DETAIL_SEQUENCE_STATE_OUTTYPE(state), \
0261     BOOST_VMD_DETAIL_SEQUENCE_STATE_FROM(state), \
0262     BOOST_VMD_DETAIL_SEQUENCE_STATE_TYPES(state), \
0263     BOOST_PP_INC(BOOST_VMD_DETAIL_SEQUENCE_STATE_INDEX(state)) \
0264     ) \
0265 /**/
0266 
0267 #define    BOOST_VMD_DETAIL_SEQUENCE_GET_FULL_TYPE_CHECK_ID(d,type,id) \
0268     BOOST_VMD_IDENTITY_RESULT \
0269         ( \
0270         BOOST_PP_IIF \
0271             ( \
0272             BOOST_VMD_DETAIL_EQUAL_TYPE_D(d,type,BOOST_VMD_TYPE_IDENTIFIER), \
0273             BOOST_VMD_DETAIL_IDENTIFIER_TYPE_D, \
0274             BOOST_VMD_IDENTITY(type) \
0275             ) \
0276         (d,id) \
0277         ) \
0278 /**/
0279 
0280 #define    BOOST_VMD_DETAIL_SEQUENCE_GET_FULL_TYPE(d,state,tuple) \
0281     BOOST_VMD_DETAIL_SEQUENCE_GET_FULL_TYPE_CHECK_ID \
0282         ( \
0283         d, \
0284         BOOST_PP_CAT \
0285             ( \
0286             BOOST_VMD_TYPE_, \
0287             BOOST_VMD_DETAIL_SEQUENCE_STATE_GET_TYPE(state) \
0288             ), \
0289         BOOST_PP_TUPLE_ELEM(0,tuple) \
0290         ) \
0291 /**/
0292 
0293 #define    BOOST_VMD_DETAIL_SEQUENCE_TYPE_FOUND_PROCESS(d,state,tuple) \
0294     ( \
0295     BOOST_PP_TUPLE_ELEM(1,tuple), \
0296     BOOST_VMD_DETAIL_SEQUENCE_STATE_RESULT_ADD \
0297         ( \
0298         d, \
0299         state, \
0300             ( \
0301             BOOST_VMD_DETAIL_SEQUENCE_GET_FULL_TYPE(d,state,tuple), \
0302             BOOST_PP_TUPLE_ELEM(0,tuple) \
0303             ) \
0304         ), \
0305     BOOST_VMD_DETAIL_SEQUENCE_STATE_ELEM(state), \
0306     BOOST_VMD_DETAIL_SEQUENCE_STATE_OUTTYPE(state), \
0307     BOOST_VMD_DETAIL_SEQUENCE_STATE_FROM(state), \
0308     BOOST_VMD_DETAIL_SEQUENCE_STATE_TYPES(state), \
0309     BOOST_PP_INC(BOOST_PP_TUPLE_SIZE(BOOST_VMD_DETAIL_SEQUENCE_STATE_TYPES(state))) \
0310     ) \
0311 /**/
0312 
0313 #define    BOOST_VMD_DETAIL_SEQUENCE_TYPE_FOUND_SEQ_SINGLE(d,tuple) \
0314     BOOST_PP_EQUAL_D(d,BOOST_PP_SEQ_SIZE(BOOST_PP_TUPLE_ELEM(0,tuple)),1) \
0315 /**/
0316 
0317 #define    BOOST_VMD_DETAIL_SEQUENCE_TYPE_FOUND_SEQ(d,state,tuple) \
0318     BOOST_VMD_IDENTITY_RESULT \
0319         ( \
0320         BOOST_PP_IIF \
0321             ( \
0322             BOOST_VMD_DETAIL_EQUAL_TYPE_D \
0323                 ( \
0324                 d, \
0325                 BOOST_VMD_DETAIL_SEQUENCE_GET_FULL_TYPE(d,state,tuple), \
0326                 BOOST_VMD_TYPE_SEQ \
0327                 ), \
0328             BOOST_VMD_DETAIL_SEQUENCE_TYPE_FOUND_SEQ_SINGLE, \
0329             BOOST_VMD_IDENTITY(0) \
0330             ) \
0331         (d,tuple) \
0332         ) \
0333 /**/
0334 
0335 #define    BOOST_VMD_DETAIL_SEQUENCE_TYPE_FOUND(d,state,tuple) \
0336     BOOST_PP_IIF \
0337         ( \
0338         BOOST_VMD_DETAIL_SEQUENCE_TYPE_FOUND_SEQ(d,state,tuple), \
0339         BOOST_VMD_DETAIL_SEQUENCE_INCREMENT_INDEX, \
0340         BOOST_VMD_DETAIL_SEQUENCE_TYPE_FOUND_PROCESS \
0341         ) \
0342     (d,state,tuple) \
0343 /**/
0344 
0345 #define    BOOST_VMD_DETAIL_SEQUENCE_INCREMENT_INDEX(d,state,tuple) \
0346     BOOST_PP_TUPLE_REPLACE_D(d,state,BOOST_VMD_DETAIL_SEQUENCE_STATE_INDEX_ELEM,BOOST_PP_INC(BOOST_VMD_DETAIL_SEQUENCE_STATE_INDEX(state))) \
0347 /**/
0348 
0349 #define    BOOST_VMD_DETAIL_SEQUENCE_TEST_TYPE_TUPLE(d,state,tuple) \
0350     BOOST_PP_IIF \
0351         ( \
0352         BOOST_VMD_IS_EMPTY \
0353             ( \
0354             BOOST_PP_TUPLE_ELEM(0,tuple) \
0355             ), \
0356         BOOST_VMD_DETAIL_SEQUENCE_INCREMENT_INDEX, \
0357         BOOST_VMD_DETAIL_SEQUENCE_TYPE_FOUND \
0358         ) \
0359     (d,state,tuple) \
0360 /**/
0361 
0362 #define    BOOST_VMD_DETAIL_SEQUENCE_TEST_TYPE(d,call,state) \
0363     BOOST_VMD_DETAIL_SEQUENCE_TEST_TYPE_TUPLE \
0364         ( \
0365         d, \
0366         state, \
0367         call(BOOST_VMD_DETAIL_SEQUENCE_STATE_INPUT(state),BOOST_VMD_RETURN_AFTER) \
0368         ) \
0369 /**/
0370     
0371 #define    BOOST_VMD_DETAIL_SEQUENCE_TEST_TYPE_D(d,call,state) \
0372     BOOST_VMD_DETAIL_SEQUENCE_TEST_TYPE_TUPLE \
0373         ( \
0374         d, \
0375         state, \
0376         call(d,BOOST_VMD_DETAIL_SEQUENCE_STATE_INPUT(state),BOOST_VMD_RETURN_AFTER) \
0377         ) \
0378 /**/
0379     
0380 #define BOOST_VMD_DETAIL_SEQUENCE_GCLRT(state) \
0381     BOOST_PP_CAT \
0382         ( \
0383         BOOST_VMD_DETAIL_, \
0384         BOOST_PP_CAT(BOOST_VMD_DETAIL_SEQUENCE_STATE_GET_TYPE(state),_D) \
0385         ) \
0386 /**/
0387 
0388 #define BOOST_VMD_DETAIL_SEQUENCE_GCLPL(state) \
0389     BOOST_PP_CAT \
0390         ( \
0391         BOOST_VMD_DETAIL_, \
0392         BOOST_VMD_DETAIL_SEQUENCE_STATE_GET_TYPE(state) \
0393         ) \
0394 /**/
0395 
0396 #define BOOST_VMD_DETAIL_SEQUENCE_INNER_OP_TEST_GCL(state,rflag) \
0397     BOOST_PP_IIF \
0398         ( \
0399         rflag, \
0400         BOOST_VMD_DETAIL_SEQUENCE_GCLRT, \
0401         BOOST_VMD_DETAIL_SEQUENCE_GCLPL \
0402         ) \
0403     (state) \
0404 /**/
0405 
0406 #define BOOST_VMD_DETAIL_SEQUENCE_INNER_OP_TEST_RT_CALL(d,call,state,rflag) \
0407     BOOST_PP_IIF \
0408         ( \
0409         rflag, \
0410         BOOST_VMD_DETAIL_SEQUENCE_TEST_TYPE_D, \
0411         BOOST_VMD_DETAIL_SEQUENCE_TEST_TYPE \
0412         ) \
0413     (d,call,state) \
0414 /**/
0415 
0416 #define BOOST_VMD_DETAIL_SEQUENCE_INNER_OP_TEST_RT(d,state,rflag) \
0417     BOOST_VMD_DETAIL_SEQUENCE_INNER_OP_TEST_RT_CALL \
0418         ( \
0419         d, \
0420         BOOST_VMD_DETAIL_SEQUENCE_INNER_OP_TEST_GCL(state,rflag), \
0421         state, \
0422         rflag \
0423         ) \
0424 /**/
0425 
0426 #define BOOST_VMD_DETAIL_SEQUENCE_INNER_OP_TEST(d,state) \
0427     BOOST_VMD_DETAIL_SEQUENCE_INNER_OP_TEST_RT \
0428         ( \
0429         d, \
0430         state, \
0431         BOOST_VMD_DETAIL_SEQUENCE_STATE_GET_TYPE_REENTRANT(state) \
0432         ) \
0433 /**/
0434 
0435 #define BOOST_VMD_DETAIL_SEQUENCE_INNER_OP(d,state) \
0436     BOOST_PP_IIF \
0437         ( \
0438         BOOST_PP_EQUAL_D \
0439             ( \
0440             d, \
0441             BOOST_VMD_DETAIL_SEQUENCE_STATE_INDEX(state), \
0442             BOOST_PP_TUPLE_SIZE(BOOST_VMD_DETAIL_SEQUENCE_STATE_TYPES(state)) \
0443             ), \
0444         BOOST_VMD_DETAIL_SEQUENCE_INNER_OP_UNKNOWN, \
0445         BOOST_VMD_DETAIL_SEQUENCE_INNER_OP_TEST \
0446         ) \
0447     (d,state) \
0448 /**/
0449 
0450 #define BOOST_VMD_DETAIL_SEQUENCE_INNER_PRED(d,state) \
0451     BOOST_PP_NOT_EQUAL_D \
0452         ( \
0453         d, \
0454         BOOST_VMD_DETAIL_SEQUENCE_STATE_INDEX(state), \
0455         BOOST_PP_INC(BOOST_PP_TUPLE_SIZE(BOOST_VMD_DETAIL_SEQUENCE_STATE_TYPES(state))) \
0456         ) \
0457 /**/
0458 
0459 #define BOOST_VMD_DETAIL_SEQUENCE_OP_PAREN_TUPLE_TYPES_ELEM_FROM(d,from) \
0460     BOOST_PP_IIF \
0461         ( \
0462         BOOST_VMD_DETAIL_SEQUENCE_STATE_IS_GENERAL_RETURN(d,from), \
0463         ((SEQ,1),(TUPLE,1)), \
0464         BOOST_PP_IIF \
0465             ( \
0466             BOOST_VMD_DETAIL_SEQUENCE_STATE_IS_EXACT_RETURN(d,from), \
0467             ((SEQ,1),(LIST,1),(ARRAY,1),(TUPLE,1)), \
0468             BOOST_PP_IIF \
0469                 ( \
0470                 BOOST_VMD_DETAIL_SEQUENCE_STATE_IS_ARRAY_RETURN(d,from), \
0471                 ((SEQ,1),(ARRAY,1),(TUPLE,1)), \
0472                 BOOST_PP_IIF \
0473                     ( \
0474                     BOOST_VMD_DETAIL_SEQUENCE_STATE_IS_LIST_RETURN(d,from), \
0475                     ((SEQ,1),(LIST,1),(TUPLE,1)), \
0476                     ((SEQ,1),(TUPLE,1)) \
0477                     ) \
0478                 ) \
0479             ) \
0480         ) \
0481 /**/
0482 
0483 #define BOOST_VMD_DETAIL_SEQUENCE_OP_PAREN_TUPLE_TYPES_ELEM(d,state) \
0484     BOOST_VMD_DETAIL_SEQUENCE_OP_PAREN_TUPLE_TYPES_ELEM_FROM \
0485         ( \
0486         d, \
0487         BOOST_VMD_DETAIL_SEQUENCE_STATE_FROM(state) \
0488         ) \
0489 /**/
0490 
0491 #define BOOST_VMD_DETAIL_SEQUENCE_OP_PAREN_TUPLE_TYPES_ANY(d,state) \
0492     BOOST_VMD_IDENTITY_RESULT \
0493         ( \
0494         BOOST_PP_IIF \
0495             ( \
0496             BOOST_VMD_IS_EMPTY \
0497                 ( \
0498                 BOOST_VMD_DETAIL_SEQUENCE_STATE_ELEM(state) \
0499                 ), \
0500             BOOST_VMD_DETAIL_SEQUENCE_OP_PAREN_TUPLE_TYPES_ELEM, \
0501             BOOST_VMD_IDENTITY(((SEQ,1),(TUPLE,1))) \
0502             ) \
0503         (d,state) \
0504         ) \
0505 /**/
0506 
0507 #define BOOST_VMD_DETAIL_SEQUENCE_OP_PAREN_TUPLE_TYPES(d,state) \
0508     BOOST_PP_IIF \
0509         ( \
0510         BOOST_VMD_DETAIL_SEQUENCE_PROCESSING_ELEM(d,state), \
0511         BOOST_VMD_DETAIL_SEQUENCE_OP_PAREN_TUPLE_TYPES_ELEM, \
0512         BOOST_VMD_DETAIL_SEQUENCE_OP_PAREN_TUPLE_TYPES_ANY \
0513         ) \
0514     (d,state) \
0515 /**/
0516 
0517 #define BOOST_VMD_DETAIL_SEQUENCE_OP_PAREN(d,state) \
0518     BOOST_PP_WHILE_ ## d \
0519         ( \
0520         BOOST_VMD_DETAIL_SEQUENCE_INNER_PRED, \
0521         BOOST_VMD_DETAIL_SEQUENCE_INNER_OP, \
0522         BOOST_PP_TUPLE_PUSH_BACK \
0523             ( \
0524             BOOST_PP_TUPLE_PUSH_BACK \
0525                 ( \
0526                 state, \
0527                 BOOST_VMD_DETAIL_SEQUENCE_OP_PAREN_TUPLE_TYPES(d,state) \
0528                 ), \
0529             0 \
0530             ) \
0531         ) \
0532 /**/
0533 
0534 #define BOOST_VMD_DETAIL_SEQUENCE_OP_ID_LOOP(d,state) \
0535     BOOST_PP_WHILE_ ## d \
0536         ( \
0537         BOOST_VMD_DETAIL_SEQUENCE_INNER_PRED, \
0538         BOOST_VMD_DETAIL_SEQUENCE_INNER_OP, \
0539         BOOST_PP_TUPLE_PUSH_BACK(BOOST_PP_TUPLE_PUSH_BACK(state,((IDENTIFIER,1))),0) \
0540         ) \
0541 /**/
0542 
0543 #define BOOST_VMD_DETAIL_SEQUENCE_OP_ID_EL(d,state) \
0544     ( \
0545     BOOST_PP_TUPLE_ELEM(1,BOOST_VMD_DETAIL_LIST_D(d,BOOST_VMD_DETAIL_SEQUENCE_STATE_INPUT(state),BOOST_VMD_RETURN_AFTER)), \
0546     BOOST_VMD_DETAIL_SEQUENCE_STATE_RESULT_ADD(d,state,(BOOST_VMD_TYPE_LIST,BOOST_PP_NIL)), \
0547     BOOST_VMD_DETAIL_SEQUENCE_STATE_ELEM(state), \
0548     BOOST_VMD_DETAIL_SEQUENCE_STATE_OUTTYPE(state), \
0549     BOOST_VMD_DETAIL_SEQUENCE_STATE_FROM(state) \
0550     ) \
0551 /**/
0552 
0553 #define BOOST_VMD_DETAIL_SEQUENCE_OP_ID(d,state) \
0554     BOOST_PP_IIF \
0555         ( \
0556         BOOST_VMD_IS_EMPTY_LIST_D \
0557             ( \
0558             d, \
0559             BOOST_VMD_DETAIL_IDENTIFIER_D \
0560                 ( \
0561                 d, \
0562                 BOOST_VMD_DETAIL_SEQUENCE_STATE_INPUT(state) \
0563                 ) \
0564             ), \
0565         BOOST_VMD_DETAIL_SEQUENCE_OP_ID_EL, \
0566         BOOST_VMD_DETAIL_SEQUENCE_OP_ID_LOOP \
0567         ) \
0568     (d,state) \
0569 /**/
0570 
0571 #define BOOST_VMD_DETAIL_SEQUENCE_OP_REDUCE_STATE(state) \
0572     ( \
0573     BOOST_VMD_DETAIL_SEQUENCE_STATE_INPUT(state), \
0574     BOOST_VMD_DETAIL_SEQUENCE_STATE_RESULT(state), \
0575     BOOST_VMD_DETAIL_SEQUENCE_STATE_ELEM(state), \
0576     BOOST_VMD_DETAIL_SEQUENCE_STATE_OUTTYPE(state), \
0577     BOOST_VMD_DETAIL_SEQUENCE_STATE_FROM(state) \
0578     ) \
0579 /**/
0580 
0581 #define BOOST_VMD_DETAIL_SEQUENCE_OP(d,state) \
0582     BOOST_VMD_DETAIL_SEQUENCE_OP_REDUCE_STATE \
0583         ( \
0584         BOOST_PP_IIF \
0585             ( \
0586             BOOST_PP_IS_BEGIN_PARENS \
0587                 ( \
0588                 BOOST_VMD_DETAIL_SEQUENCE_STATE_INPUT(state) \
0589                 ), \
0590             BOOST_VMD_DETAIL_SEQUENCE_OP_PAREN, \
0591             BOOST_VMD_DETAIL_SEQUENCE_OP_ID \
0592             ) \
0593         (d,state) \
0594         ) \
0595 /**/
0596 
0597 #define BOOST_VMD_DETAIL_SEQUENCE_PRED_CELEM_SZ(d,state) \
0598     BOOST_PP_LESS_EQUAL_D \
0599         ( \
0600         d, \
0601         BOOST_PP_SEQ_SIZE(BOOST_VMD_DETAIL_SEQUENCE_STATE_RESULT(state)), \
0602         BOOST_VMD_DETAIL_SEQUENCE_STATE_ELEM(state) \
0603         ) \
0604 /**/
0605 
0606 #define BOOST_VMD_DETAIL_SEQUENCE_PRED_CELEM(d,state) \
0607     BOOST_VMD_IDENTITY_RESULT \
0608         ( \
0609         BOOST_PP_IIF \
0610             ( \
0611             BOOST_PP_BITOR \
0612                 ( \
0613                 BOOST_VMD_IS_EMPTY \
0614                     ( \
0615                     BOOST_VMD_DETAIL_SEQUENCE_STATE_ELEM(state) \
0616                     ), \
0617                 BOOST_VMD_IS_EMPTY \
0618                     ( \
0619                     BOOST_VMD_DETAIL_SEQUENCE_STATE_RESULT(state) \
0620                     ) \
0621                 ), \
0622             BOOST_VMD_IDENTITY(1), \
0623             BOOST_VMD_DETAIL_SEQUENCE_PRED_CELEM_SZ \
0624             ) \
0625         (d,state) \
0626         ) \
0627 /**/
0628 
0629 #define BOOST_VMD_DETAIL_SEQUENCE_PRED(d,state) \
0630     BOOST_VMD_IDENTITY_RESULT \
0631         ( \
0632         BOOST_PP_IIF \
0633             ( \
0634             BOOST_VMD_IS_EMPTY \
0635                 ( \
0636                 BOOST_VMD_DETAIL_SEQUENCE_STATE_INPUT(state) \
0637                 ), \
0638             BOOST_VMD_IDENTITY(0), \
0639             BOOST_VMD_DETAIL_SEQUENCE_PRED_CELEM \
0640             ) \
0641         (d,state) \
0642         ) \
0643 /**/
0644 
0645 #define BOOST_VMD_DETAIL_SEQUENCE_EMPTY_TYPE_CHECK(output) \
0646     BOOST_PP_IIF \
0647         ( \
0648         BOOST_VMD_DETAIL_EQUAL_TYPE(output,BOOST_VMD_TYPE_ARRAY), \
0649         (0,()), \
0650         BOOST_PP_NIL \
0651         ) \
0652 /**/
0653 
0654 #define BOOST_VMD_DETAIL_SEQUENCE_EMPTY_TYPE_CHECK_D(d,output) \
0655     BOOST_PP_IIF \
0656         ( \
0657         BOOST_VMD_DETAIL_EQUAL_TYPE_D(d,output,BOOST_VMD_TYPE_ARRAY), \
0658         (0,()), \
0659         BOOST_PP_NIL \
0660         ) \
0661 /**/
0662 
0663 #define BOOST_VMD_DETAIL_SEQUENCE_EMPTY_TYPE(output) \
0664     BOOST_PP_IIF \
0665         ( \
0666         BOOST_PP_BITOR \
0667             ( \
0668             BOOST_VMD_DETAIL_EQUAL_TYPE(output,BOOST_VMD_TYPE_SEQ), \
0669             BOOST_VMD_DETAIL_EQUAL_TYPE(output,BOOST_VMD_TYPE_TUPLE) \
0670             ), \
0671         BOOST_VMD_EMPTY, \
0672         BOOST_VMD_DETAIL_SEQUENCE_EMPTY_TYPE_CHECK \
0673         ) \
0674     (output) \
0675 /**/
0676 
0677 #define BOOST_VMD_DETAIL_SEQUENCE_EMPTY_TYPE_D(d,output) \
0678     BOOST_PP_IIF \
0679         ( \
0680         BOOST_PP_BITOR \
0681             ( \
0682             BOOST_VMD_DETAIL_EQUAL_TYPE_D(d,output,BOOST_VMD_TYPE_SEQ), \
0683             BOOST_VMD_DETAIL_EQUAL_TYPE_D(d,output,BOOST_VMD_TYPE_TUPLE) \
0684             ), \
0685         BOOST_VMD_EMPTY, \
0686         BOOST_VMD_DETAIL_SEQUENCE_EMPTY_TYPE_CHECK_D \
0687         ) \
0688     (d,output) \
0689 /**/
0690 
0691 #define BOOST_VMD_DETAIL_SEQUENCE_ELEM_PROCESS_TUPLE_GET(state) \
0692     BOOST_PP_IIF \
0693         ( \
0694         BOOST_VMD_DETAIL_SEQUENCE_STATE_IS_AFTER \
0695             ( \
0696             BOOST_VMD_DETAIL_SEQUENCE_STATE_FROM(state) \
0697             ), \
0698             ( \
0699             BOOST_VMD_DETAIL_SEQUENCE_STATE_RESULT(state), \
0700             BOOST_VMD_DETAIL_SEQUENCE_STATE_INPUT(state) \
0701             ), \
0702             BOOST_VMD_DETAIL_SEQUENCE_STATE_RESULT(state) \
0703         ) 
0704 /**/
0705 
0706 #define BOOST_VMD_DETAIL_SEQUENCE_ELEM_PROCESS_TUPLE_GET_D(d,state) \
0707     BOOST_PP_IIF \
0708         ( \
0709         BOOST_VMD_DETAIL_SEQUENCE_STATE_IS_AFTER_D \
0710             ( \
0711             d, \
0712             BOOST_VMD_DETAIL_SEQUENCE_STATE_FROM(state) \
0713             ), \
0714             ( \
0715             BOOST_VMD_DETAIL_SEQUENCE_STATE_RESULT(state), \
0716             BOOST_VMD_DETAIL_SEQUENCE_STATE_INPUT(state) \
0717             ), \
0718             BOOST_VMD_DETAIL_SEQUENCE_STATE_RESULT(state) \
0719         ) 
0720 /**/
0721 
0722 #define BOOST_VMD_DETAIL_SEQUENCE_ELEM_PROCESS_TUPLE(vseq,elem,output,from) \
0723     BOOST_VMD_DETAIL_SEQUENCE_ELEM_PROCESS_TUPLE_GET \
0724         ( \
0725         BOOST_PP_WHILE \
0726             ( \
0727             BOOST_VMD_DETAIL_SEQUENCE_PRED, \
0728             BOOST_VMD_DETAIL_SEQUENCE_OP, \
0729                 ( \
0730                 vseq, \
0731                 BOOST_VMD_DETAIL_SEQUENCE_EMPTY_TYPE \
0732                     ( \
0733                     output \
0734                     ), \
0735                 elem, \
0736                 output, \
0737                 from \
0738                 ) \
0739             ) \
0740         ) \
0741 /**/
0742 
0743 #define BOOST_VMD_DETAIL_SEQUENCE_ELEM_PROCESS_TUPLE_D(d,vseq,elem,output,from) \
0744     BOOST_VMD_DETAIL_SEQUENCE_ELEM_PROCESS_TUPLE_GET_D \
0745         ( \
0746         d, \
0747         BOOST_PP_WHILE_ ## d \
0748             ( \
0749             BOOST_VMD_DETAIL_SEQUENCE_PRED, \
0750             BOOST_VMD_DETAIL_SEQUENCE_OP, \
0751                 ( \
0752                 vseq, \
0753                 BOOST_VMD_DETAIL_SEQUENCE_EMPTY_TYPE_D \
0754                     ( \
0755                     d, \
0756                     output \
0757                     ), \
0758                 elem, \
0759                 output, \
0760                 from \
0761                 ) \
0762             ) \
0763         ) \
0764 /**/
0765 
0766 #endif /* BOOST_VMD_DETAIL_SEQUENCE_COMMON_HPP */