I'm trying to create a macro to replace a function definition. This macro should register the name of the function in some array so that some other macro can do something with the elements of the array.
I'd like to do this to have a list of functions that can be used in a console without having to edit the list whenever I add a new function (it's actually multiple lists).
After reading up a bit I've taken a look at the boost preprocessor. Unfortunately it appears there is no way to 'save' the new array. What I'd like to do is something like this:
#define SOME_ARRAY (0, ())
#define CONSOLE_COMMAND(a) \
#redefine SOME_ARRAY BOOST_PP_ARRAY_PUSH_BACK(SOME_ARRAY, #a) \
void a(some_arguments)
Unfortunately, to my knowledge, redefine doesn't exist and #define can't be used in a macro (please correct me if I'm wrong).
I took a look at boost's precompiler's SLOTs but I don't think I can change the variable in it once set either.
Is there any way to do this other than writing my own preprocessor? Is not, what would be a good start in learning how to write one? (Using MinGW with Code::Blocks).