Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00043 #ifndef _orxPLUGIN_USER_H_
00044 #define _orxPLUGIN_USER_H_
00045
00046
00047 #include "orxInclude.h"
00048
00049 #include "plugin/orxPluginType.h"
00050 #include "plugin/define/orxPlugin_CoreDefine.h"
00051
00052 #include "memory/orxMemory.h"
00053 #include "utils/orxString.h"
00054
00055
00056
00057
00058
00059
00060
00061 #define orxPLUGIN_DECLARE_ENTRY_POINT(ENTRY_FUNCTION) \
00062 extern orxIMPORT orxDLLEXPORT orxSTATUS orxPLUGIN_K_INIT_FUNCTION_NAME(orxS32 *_ps32Number, orxPLUGIN_USER_FUNCTION_INFO **_ppstInfo) \
00063 { \
00064 orxSTATUS eResult; \
00065 \
00066 \
00067 eResult = ENTRY_FUNCTION(); \
00068 \
00069 \
00070 *_ps32Number = 0; \
00071 *_ppstInfo = orxNULL; \
00072 \
00073 \
00074 return eResult; \
00075 }
00076
00077
00078
00079
00080
00081
00082
00083 #define _orxPLUGIN_USER_FUNCTION_ADD_LOW_LEVEL(FUNCTION, FUNCTION_ID, NAME, ARGS) \
00084 if(u32UserPluginFunctionCounter < u32UserPluginFunctionMaxNumber) \
00085 { \
00086 pstUserPluginFunctionInfo[u32UserPluginFunctionCounter].pfnFunction = (orxPLUGIN_FUNCTION) FUNCTION; \
00087 pstUserPluginFunctionInfo[u32UserPluginFunctionCounter].eFunctionID = FUNCTION_ID; \
00088 pstUserPluginFunctionInfo[u32UserPluginFunctionCounter].zFunctionName = #NAME; \
00089 orxString_NCopy(pstUserPluginFunctionInfo[u32UserPluginFunctionCounter].zFunctionArgs, ARGS, orxPLUGIN_KU32_FUNCTION_ARG_SIZE - 1); \
00090 pstUserPluginFunctionInfo[u32UserPluginFunctionCounter].zFunctionArgs[orxPLUGIN_KU32_FUNCTION_ARG_SIZE - 1] = orxCHAR_NULL; \
00091 u32UserPluginFunctionCounter++; \
00092 } \
00093 else \
00094 { \
00095 \
00096 orxDEBUG_PRINT(orxDEBUG_LEVEL_SYSTEM, "Maximum number of plugin functions reached."); \
00097 }
00098
00099 #define orxPLUGIN_USER_FUNCTION_START(STRUCTURE) \
00100 { \
00101 orxU32 u32UserPluginFunctionCounter = 0; \
00102 orxU32 u32UserPluginFunctionMaxNumber = sizeof(STRUCTURE) / sizeof(orxPLUGIN_USER_FUNCTION_INFO); \
00103 orxPLUGIN_USER_FUNCTION_INFO *pstUserPluginFunctionInfo = STRUCTURE; \
00104 orxMemory_Zero(pstUserPluginFunctionInfo, u32UserPluginFunctionMaxNumber * sizeof(orxPLUGIN_USER_FUNCTION_INFO));
00105
00106 #define orxPLUGIN_USER_FUNCTION_ADD(FUNCTION, ARGS, PLUGIN_ID, FUNCTION_BASE_ID, NAME) \
00107 _orxPLUGIN_USER_FUNCTION_ADD_LOW_LEVEL(&FUNCTION, \
00108 orxPLUGIN_MAKE_FUNCTION_ID(PLUGIN_ID, FUNCTION_BASE_ID), \
00109 NAME, \
00110 ARGS)
00111
00112 #define orxPLUGIN_USER_FUNCTION_END(NUMBER_ADDRESS, STRUCTURE_ADDRESS) \
00113 *NUMBER_ADDRESS = u32UserPluginFunctionCounter; \
00114 *STRUCTURE_ADDRESS = pstUserPluginFunctionInfo; \
00115 }
00116
00117 #define orxPLUGIN_USER_CORE_FUNCTION_START(PLUGIN_SUFFIX) \
00118 static orxPLUGIN_USER_FUNCTION_INFO sau32##PLUGIN_SUFFIX##_Function[orxPLUGIN_FUNCTION_BASE_ID_##PLUGIN_SUFFIX##_NUMBER]; \
00119 extern orxIMPORT orxDLLEXPORT orxSTATUS orxPLUGIN_K_CORE_INIT_FUNCTION_NAME(PLUGIN_SUFFIX)(orxS32 *_ps32Number, orxPLUGIN_USER_FUNCTION_INFO **_ppstInfo) \
00120 { \
00121 orxSTATUS eResult = orxSTATUS_SUCCESS; \
00122 orxPLUGIN_USER_FUNCTION_START(sau32##PLUGIN_SUFFIX##_Function);
00123
00124 #define orxPLUGIN_USER_CORE_FUNCTION_ADD(FUNCTION, PLUGIN_SUFFIX, NAME_SUFFIX) \
00125 _orxPLUGIN_USER_FUNCTION_ADD_LOW_LEVEL(&FUNCTION, \
00126 orxPLUGIN_MAKE_CORE_FUNCTION_ID(orxPLUGIN_CORE_ID_##PLUGIN_SUFFIX, orxPLUGIN_FUNCTION_BASE_ID_##PLUGIN_SUFFIX##_##NAME_SUFFIX), \
00127 PLUGIN_SUFFIX##_##NAME_SUFFIX, \
00128 orxSTRING_EMPTY)
00129
00130 #define orxPLUGIN_USER_CORE_FUNCTION_END() \
00131 orxPLUGIN_USER_FUNCTION_END(_ps32Number, _ppstInfo); \
00132 return eResult; \
00133 }
00134
00135 #endif
00136