#ifndef REGISTRY_H #define REGISTRY_H #define REGISTER(initfunc, ns, array, counter, id, class) \ entity ns##_##id; \ void Register_##ns##_##id##_init(entity this) { } \ void Register_##ns##_##id() { \ entity this = NEW(class); \ ns##_##id = this; \ this.m_id = ns##_COUNT; \ array[counter++] = this; \ Register_##ns##_##id##_init(this); \ } \ ACCUMULATE_FUNCTION(initfunc, Register_##ns##_##id) \ [[accumulate]] void Register_##ns##_##id##_init(entity this) #endif