[PREPROCESSOR] Working around the 256 element limit for sequences
We define exception error codes and other useful information like this: #define EXCEPTION_TABLE \ ( (enumName0, "description string", "another sting", "yet another string") ) \ ( (enumName1, "description string", "another sting", "yet another string") ) \ . . . // End EXCEPTION_TABLE def Then we write a macro that creates an enum like this: #define ENUM_ERROR_CODES(EXCEPTION_TABLE_MACRO_NAME, firstErrorCodeValue)\ public: typedef enum \ { \ \ BOOST_PP_SEQ_FOR_EACH_I(MAKE_EXCEPTION_CODE_ENUM, ~, EXCEPTION_TABLE_MACRO_NAME) \ } ErrorCodesT; \ // End macro definition and we invoke ENUM_ERROR_CODES as: ENUM_EROR_CODEAS(EXCEPTION_TABLE, 1) This has worked just beautifully until recently. Now we're trying to use this code to define an enum (and other things) based on an EXCEPTION_TABLE that carries error code for a hardware device. There are about 500 of them. I ran into the 256 element limitation for sequences. I have tried rewriting the enum macro like this: #define ENUM_ERROR_CODES(EXCEPTION_TABLE_MACRO_NAME, firstErrorCodeValue)\ public: typedef enum \ { \ \ BOOST_PP_SEQ_FOR_EACH_I(MAKE_EXCEPTION_CODE_ENUM, ~, BOOST_PP_SEQ_SUBSEQ(EXCEPTION_TABLE_MACRO_NAME, 0, 250))\ BOOST_PP_SEQ_FOR_EACH_I(MAKE_EXCEPTION_CODE_ENUM, ~, BOOST_PP_SEQ_SUBSEQ(EXCEPTION_TABLE_MACRO_NAME, 250, 250))\ BOOST_PP_SEQ_FOR_EACH_I(MAKE_EXCEPTION_CODE_ENUM, ~, BOOST_PP_SEQ_SUBSEQ(EXCEPTION_TABLE_MACRO_NAME, 500, 250))\ BOOST_PP_SEQ_FOR_EACH_I(MAKE_EXCEPTION_CODE_ENUM, ~, BOOST_PP_SEQ_SUBSEQ(EXCEPTION_TABLE_MACRO_NAME, 750, 250))\ } ErrorCodesT; \ // End macro definition thinking that I could just peel off groups of 250, but that doesn't work. I can peel off the first N, where N is <= the size of the sequence, but I certainly can't do what I wrote. Each of our exception classes is defined this way, and the number of elements in each EXCEPTION_TABLE is different for each. Is there some standard method for working around this problem? Thanks, Rush
participants (1)
-
Rush Manbert