X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Flib%2Fstatic.qh;h=e1cfeb8721ce54f6b29a9f440e410d2c29bf5626;hb=183446e33f4bf303f632e7270ebceea9d7e37cb6;hp=d51a8717532677a9e55b54d9119096fd4b90a1d2;hpb=5607e279fe7b0dc9f92e15556ed6dc33f17f549c;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/lib/static.qh b/qcsrc/lib/static.qh index d51a87175..e1cfeb872 100644 --- a/qcsrc/lib/static.qh +++ b/qcsrc/lib/static.qh @@ -1,17 +1,20 @@ -#ifndef STATIC_H -#define STATIC_H +#pragma once -void __static_init_early() { } -void __static_init() { CALL_ACCUMULATED_FUNCTION(__static_init_early); } +void __static_init() {} #define static_init() CALL_ACCUMULATED_FUNCTION(__static_init) -#define REGISTER_REGISTRY(func) ACCUMULATE_FUNCTION(__static_init_early, func) +void __static_init_late() {} +#define static_init_late() CALL_ACCUMULATED_FUNCTION(__static_init_late) +void __static_init_precache() {} +#define static_init_precache() CALL_ACCUMULATED_FUNCTION(__static_init_precache) +void __shutdown() {} +#define shutdownhooks() CALL_ACCUMULATED_FUNCTION(__shutdown) #define _STATIC_INIT(where, func) \ - void _static_##func(); \ - ACCUMULATE_FUNCTION(where, _static_##func) \ - void _static_##func() + void _static_##func(); \ + ACCUMULATE_FUNCTION(where, _static_##func) \ + void _static_##func() -#define STATIC_INIT(func) _STATIC_INIT(__static_init_early, func##_early) -#define STATIC_INIT_LATE(func) _STATIC_INIT(__static_init, func) - -#endif +#define STATIC_INIT(func) _STATIC_INIT(__static_init, func) +#define STATIC_INIT_LATE(func) _STATIC_INIT(__static_init_late, func##_late) +#define PRECACHE(func) _STATIC_INIT(__static_init_precache, func##_precache) +#define SHUTDOWN(func) _STATIC_INIT(__shutdown, func##_shutdown)