Hi,
I want to create macros that will insert a parameter into a function call. For example, I have function Action() declared below. Action takes as it's inputs an enum for the state number and a formatted string with optional args for the string.
I want to define macros so that instead of calling Action( ActionState1, "someText %d", &arg) with ActionState1 for the state parameter, I can just call State1("someText %d", &arg) instead. That way the macro would stick in the ActionState1 for the state param for me. I'm thinking of something like the following:
#define State1(formatedString, ...) Action(ActionState1, formatedString, ...)
#define State2(formatedString, ...) Action(ActionState2, formatedString, ...)
#define State3(formatedString, ...) Action(ActionState3, formatedString, ...)
enum {
ActionState1,
ActionState2,
ActionState3
}
static void Action( State state, String formatedString, ...);
Does anyone know what the proper format for this would be?
Thanks