+#define REGISTRY_PUSH(registry, fld, it) MACRO_BEGIN { \
+ it.fld = registry##_COUNT; \
+ _R_SET(_##registry, registry##_COUNT, it); \
+ ++registry##_COUNT; \
+ if (!registry##_first) registry##_first = it; \
+ if (registry##_last) registry##_last.REGISTRY_NEXT = it; \
+ registry##_last = it; \
+} MACRO_END
+
+#define REGISTRY_RESERVE(registry, fld, id, suffix) MACRO_BEGIN { \
+ entity e = new_pure(registry_reserved); \
+ e.registered_id = #id "/" #suffix; \
+ REGISTRY_PUSH(registry, fld, e); \
+} MACRO_END
+