c-scripting/symbol_set/symbol_set.init.h

41 lines
977 B
C

#if !defined(SY__INIT_H)
#define SY__INIT_H
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~ SY Init Definitions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
typedef void SY_InitFunc(void*);
typedef struct SY_InitRecord{
SY_InitFunc *func;
} SY_InitRecord;
#define SYMBOL_SET_DEFINE SY_INIT
#define SY_INIT_Type SY_InitRecord
#define SY_INIT_section ".sy.init"
#define SY_INIT_marker init
#include "mr4th_symbol_set.define.h"
#define SY_INIT_DEF(N,T) \
static void syinit__##N(T*); \
SyDefine(SY_INIT, N) = { syinit__##N }; \
static void syinit__##N(T*ptr)
void sy__run_init(void);
#endif //SY__INIT_H
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~ Function Definitions ~~~~~~~~~~~~~~~~~~~~~~~~~*/
#if SY__MAIN && !defined(SY__INIT_DEFINITIONS)
#define SY__INIT_DEFINITIONS 1
void sy__run_init(void){
for (SyEach(SY_INIT, init)){
init->func();
}
}
#endif //SY__INIT_DEFINITIONS