Hi Dennis,
Could you please clarify how I would define the X-Macro in SE's preprocessor option? And this would be a global SE option wouldn't it (as opposed to a project/workspace define)?
Here's a pretty simple example that I have:
//#define FRAMER_MEMBER(enumName, parser, formatter, maxSize)
#define FRAMER_TABLE \
FRAMER_MEMBER(UNSET, NULL, NULL, 0 ) \
FRAMER_MEMBER(RAW, RawFrameParse, RawFrameFormat, RAW_FRAME_MAX_SIZE ) \
FRAMER_MEMBER(LINE, LineFrameParse, LineFrameFormat,LINE_FRAME_MAX_SIZE )
Then I have various uses of my table:
typedef enum
{
#define FRAMER_MEMBER(enumName, parser, formatter, maxSize) \
FRAMER_##enumName,
FRAMER_TABLE
#undef FRAMER_MEMBER
NUM_FRAMERS
}LINK_FRAMERS;
static const struct FRAMER_POINTERS framers[NUM_FRAMERS] = {
#define FRAMER_MEMBER(enumName, parser, formatter, maxSize) \
{parser, formatter, maxSize},
FRAMER_TABLE
#undef FRAMER_MEMBER
};
char const * eStr_LINK_FRAMERS[] = {
#define FRAMER_MEMBER(enumName, parser, formatter, maxSize) \
#enumName,
FRAMER_TABLE
#undef FRAMER_MEMBER
};