MORE MACROS

I just can't stop myself!
This commit is contained in:
James R 2021-07-06 20:23:38 -07:00
parent 331329306c
commit ae57b6ca86
2 changed files with 14 additions and 8 deletions

View file

@ -90,9 +90,13 @@ grepped and found in the lists above.
#define HOOK(name) hook_ ## name
#define STRING_HOOK(name) stringhook_ ## name
enum { MOBJ_HOOK_LIST (MOBJ_HOOK) MOBJ_HOOK(MAX) };
enum { HOOK_LIST (HOOK) HOOK(MAX) };
enum { STRING_HOOK_LIST (STRING_HOOK) STRING_HOOK(MAX) };
#define ENUM(X) enum { X ## _LIST (X) X(MAX) }
ENUM (MOBJ_HOOK);
ENUM (HOOK);
ENUM (STRING_HOOK);
#undef ENUM
/* dead simple, LUA_HOOK(GameQuit) */
#define LUA_HOOK(type) LUA_HookVoid(HOOK(type))

View file

@ -31,12 +31,14 @@
ABSTRACTION
========================================================================= */
static const char * const mobjHookNames[] = { MOBJ_HOOK_LIST (TOSTR) NULL };
static const char * const hookNames[] = { HOOK_LIST (TOSTR) NULL };
#define LIST(id, M) \
static const char * const id [] = { M (TOSTR) NULL }
static const char * const stringHookNames[] = {
STRING_HOOK_LIST (TOSTR) NULL
};
LIST (mobjHookNames, MOBJ_HOOK_LIST);
LIST (hookNames, HOOK_LIST);
LIST (stringHookNames, STRING_HOOK_LIST);
#undef LIST
typedef struct {
int numHooks;