43#ifndef _orxPLUGIN_USER_H_
44#define _orxPLUGIN_USER_H_
65#define orxPLUGIN_DECLARE_INIT_ENTRY_POINT(ENTRY_FUNCTION) \
66extern orxIMPORT orxDLLEXPORT orxSTATUS orxPLUGIN_K_INIT_FUNCTION_NAME(orxS32 *_ps32Number, orxPLUGIN_USER_FUNCTION_INFO **_ppstInfo) \
71 eResult = ((orxPLUGIN_ENTRY_POINT)ENTRY_FUNCTION)(orxPLUGIN_ENTRY_MODE_INIT); \
75 *_ppstInfo = orxNULL; \
82#define orxPLUGIN_DECLARE_EXIT_ENTRY_POINT(ENTRY_FUNCTION) \
83extern orxIMPORT orxDLLEXPORT orxSTATUS orxPLUGIN_K_EXIT_FUNCTION_NAME() \
86 return ((orxPLUGIN_ENTRY_POINT)ENTRY_FUNCTION)(orxPLUGIN_ENTRY_MODE_EXIT); \
90#define orxPLUGIN_DECLARE_SWAP_ENTRY_POINT(ENTRY_FUNCTION) \
91extern orxIMPORT orxDLLEXPORT orxSTATUS orxPLUGIN_K_SWAP_FUNCTION_NAME(orxPLUGIN_ENTRY_MODE _eMode) \
94 return ((orxPLUGIN_ENTRY_POINT)ENTRY_FUNCTION)(_eMode); \
98#define orxPLUGIN_DECLARE_ENTRY_POINT(ENTRY_FUNCTION) \
99orxPLUGIN_DECLARE_INIT_ENTRY_POINT(ENTRY_FUNCTION); \
100orxPLUGIN_DECLARE_EXIT_ENTRY_POINT(ENTRY_FUNCTION); \
101orxPLUGIN_DECLARE_SWAP_ENTRY_POINT(ENTRY_FUNCTION);
109#define _orxPLUGIN_USER_FUNCTION_ADD_LOW_LEVEL(FUNCTION, FUNCTION_ID, NAME, ARGS) \
110 if(u32UserPluginFunctionCount < u32UserPluginFunctionMaxNumber) \
112 pstUserPluginFunctionInfo[u32UserPluginFunctionCount].pfnFunction = (orxPLUGIN_FUNCTION) FUNCTION; \
113 pstUserPluginFunctionInfo[u32UserPluginFunctionCount].eFunctionID = FUNCTION_ID; \
114 pstUserPluginFunctionInfo[u32UserPluginFunctionCount].zFunctionName = #NAME; \
115 orxString_NCopy(pstUserPluginFunctionInfo[u32UserPluginFunctionCount].zFunctionArgs, ARGS, orxPLUGIN_KU32_FUNCTION_ARG_SIZE - 1); \
116 pstUserPluginFunctionInfo[u32UserPluginFunctionCount].zFunctionArgs[orxPLUGIN_KU32_FUNCTION_ARG_SIZE - 1] = orxCHAR_NULL; \
117 u32UserPluginFunctionCount++; \
122 orxDEBUG_PRINT(orxDEBUG_LEVEL_SYSTEM, "Maximum number of plugin functions reached."); \
125#define orxPLUGIN_USER_FUNCTION_START(STRUCTURE) \
127 orxU32 u32UserPluginFunctionCount = 0; \
128 orxU32 u32UserPluginFunctionMaxNumber = sizeof(STRUCTURE) / sizeof(orxPLUGIN_USER_FUNCTION_INFO); \
129 orxPLUGIN_USER_FUNCTION_INFO *pstUserPluginFunctionInfo = STRUCTURE; \
130 orxMemory_Zero(pstUserPluginFunctionInfo, u32UserPluginFunctionMaxNumber * sizeof(orxPLUGIN_USER_FUNCTION_INFO));
132#define orxPLUGIN_USER_FUNCTION_ADD(FUNCTION, ARGS, PLUGIN_ID, FUNCTION_BASE_ID, NAME) \
133 _orxPLUGIN_USER_FUNCTION_ADD_LOW_LEVEL(&FUNCTION, \
134 orxPLUGIN_MAKE_FUNCTION_ID(PLUGIN_ID, FUNCTION_BASE_ID), \
138#define orxPLUGIN_USER_FUNCTION_END(NUMBER_ADDRESS, STRUCTURE_ADDRESS) \
139 *NUMBER_ADDRESS = u32UserPluginFunctionCount; \
140 *STRUCTURE_ADDRESS = pstUserPluginFunctionInfo; \
143#define orxPLUGIN_USER_CORE_FUNCTION_START(PLUGIN_SUFFIX) \
144 static orxPLUGIN_USER_FUNCTION_INFO sau32##PLUGIN_SUFFIX##_Function[orxPLUGIN_FUNCTION_BASE_ID_##PLUGIN_SUFFIX##_NUMBER]; \
145 extern orxIMPORT orxDLLEXPORT orxSTATUS orxPLUGIN_K_CORE_INIT_FUNCTION_NAME(PLUGIN_SUFFIX)(orxS32 *_ps32Number, orxPLUGIN_USER_FUNCTION_INFO **_ppstInfo) \
147 orxSTATUS eResult = orxSTATUS_SUCCESS; \
148 orxPLUGIN_USER_FUNCTION_START(sau32##PLUGIN_SUFFIX##_Function);
150#define orxPLUGIN_USER_CORE_FUNCTION_ADD(FUNCTION, PLUGIN_SUFFIX, NAME_SUFFIX) \
151 _orxPLUGIN_USER_FUNCTION_ADD_LOW_LEVEL(&FUNCTION, \
152 orxPLUGIN_MAKE_CORE_FUNCTION_ID(orxPLUGIN_CORE_ID_##PLUGIN_SUFFIX, orxPLUGIN_FUNCTION_BASE_ID_##PLUGIN_SUFFIX##_##NAME_SUFFIX), \
153 PLUGIN_SUFFIX##_##NAME_SUFFIX, \
156#define orxPLUGIN_USER_CORE_FUNCTION_END() \
157 orxPLUGIN_USER_FUNCTION_END(_ps32Number, _ppstInfo); \
orxSTATUS(orxFASTCALL * orxPLUGIN_ENTRY_POINT)(orxPLUGIN_ENTRY_MODE _eMode)