Add header for globals.c

With DECLARE_SYMBOLS and DECLARE_EXTERNS macros
hw extern for hw.so handler
Externs engine and client symbol pointers (and originals)
globals_init function
This commit is contained in:
8dcc 2023-07-20 01:37:28 +02:00
parent eb64855797
commit 12b3af41c1
1 changed files with 32 additions and 0 deletions

32
src/include/globals.h Normal file
View File

@ -0,0 +1,32 @@
#ifndef _GLOBALS_H
#define _GLOBALS_H
#include "sdk.h"
/*----------------------------------------------------------------------------*/
/*
* prefix | meaning
* -------+----------------
* gp_* | global pointer
* go_* | global original
*/
#define DECLARE_SYMBOLS(type, name) \
type* gp_##name = NULL; \
type go_##name;
#define DECLARE_EXTERNS(type, name) \
extern type* gp_##name; \
extern type go_##name;
/*----------------------------------------------------------------------------*/
extern void* hw;
DECLARE_EXTERNS(cl_enginefunc_t, engine);
DECLARE_EXTERNS(cl_clientfunc_t, client);
/*----------------------------------------------------------------------------*/
bool globals_init(void);
#endif /* _GLOBALS_H */