orx  stable
Portable Game Engine
orxPluginCore.h
Go to the documentation of this file.
1 /* Orx - Portable Game Engine
2  *
3  * Copyright (c) 2008-2017 Orx-Project
4  *
5  * This software is provided 'as-is', without any express or implied
6  * warranty. In no event will the authors be held liable for any damages
7  * arising from the use of this software.
8  *
9  * Permission is granted to anyone to use this software for any purpose,
10  * including commercial applications, and to alter it and redistribute it
11  * freely, subject to the following restrictions:
12  *
13  * 1. The origin of this software must not be misrepresented; you must not
14  * claim that you wrote the original software. If you use this software
15  * in a product, an acknowledgment in the product documentation would be
16  * appreciated but is not required.
17  *
18  * 2. Altered source versions must be plainly marked as such, and must not be
19  * misrepresented as being the original software.
20  *
21  * 3. This notice may not be removed or altered from any source
22  * distribution.
23  */
24 
43 #ifndef _orxPLUGIN_CORE_H_
44 #define _orxPLUGIN_CORE_H_
45 
46 
47 /*********************************************
48  Constants
49  *********************************************/
50 
51 #include "orxInclude.h"
52 
53 #include "plugin/orxPluginType.h"
55 
56 
57 /*********************************************
58  Structures
59  *********************************************/
60 
61 /* Structure */
62 typedef struct __orxPLUGIN_CORE_FUNCTION_t
63 {
69 
70 /* Structure */
71 typedef struct __orxPLUGIN_USER_FUNCTION_INFO_t
72 {
75  orxCHAR zFunctionArgs[orxPLUGIN_KU32_FUNCTION_ARG_SIZE];
76  const orxSTRING zFunctionName;
79 
80 
83 typedef orxSTATUS (*orxPLUGIN_INIT_FUNCTION)(orxU32 *_peUserFunctionNumber, orxPLUGIN_USER_FUNCTION_INFO **_pastUserFunctionInfo);
84 
85 
86 /*********************************************
87  Function prototypes
88  *********************************************/
89 
98 extern orxDLLAPI void orxFASTCALL orxPlugin_AddCoreInfo(orxPLUGIN_CORE_ID _ePluginCoreID, orxMODULE_ID _eModuleID, const orxPLUGIN_CORE_FUNCTION *_astCoreFunction, orxU32 _u32CoreFunctionNumber);
99 
100 #ifdef __orxEMBEDDED__
101 
108 extern orxDLLAPI void orxFASTCALL orxPlugin_BindCoreInfo(orxPLUGIN_CORE_ID _ePluginCoreID, orxPLUGIN_INIT_FUNCTION _pfnPluginInit);
109 
110 #endif /* __orxEMBEDDED__ */
111 
115 extern orxDLLAPI void *orxFASTCALL orxPlugin_DefaultCoreFunction(const orxSTRING _zFunctionName, const orxSTRING _zFileName, orxU32 _u32Line);
116 
117 
118 /***************************************************************************
119  ***************************************************************************
120  ****** CORE FUNCTION NAME HANDLING ******
121  ***************************************************************************
122  ***************************************************************************/
123 
124 /* *** Core function pointer name *** */
125 #define orxPLUGIN_CORE_FUNCTION_POINTER_NAME(FUNCTION_NAME) _orxCoreFunctionPointer_##FUNCTION_NAME
126 
127 /* *** Core function default name *** */
128 #define orxPLUGIN_DEFAULT_CORE_FUNCTION_NAME(FUNCTION_NAME) _orxDefaultCoreFunction_##FUNCTION_NAME
129 
130 /* *** Default core function declaration *** */
131 #define orxPLUGIN_DEFAULT_CORE_FUNCTION_DEFINE(FUNCTION_NAME) \
132  extern orxDLLAPI void *orxFASTCALL orxPLUGIN_DEFAULT_CORE_FUNCTION_NAME(FUNCTION_NAME)() \
133  { \
134  return(orxPlugin_DefaultCoreFunction(#FUNCTION_NAME, __FILE__, __LINE__)); \
135  }
136 
137 
138 /***************************************************************************
139  ***************************************************************************
140  ****** CORE FUNCTION DEFINITION HANDLING ******
141  ***************************************************************************
142  ***************************************************************************/
143 
144 /* *** Definition macro *** */
145 #ifdef __orxMSVC__
146 #pragma warning(disable : 4113)
147 #endif /* __orxMSVC__ */
148 
149 #define orxPLUGIN_DEFINE_CORE_FUNCTION(FUNCTION_NAME, RETURN, ...) \
150  orxPLUGIN_DEFAULT_CORE_FUNCTION_DEFINE(FUNCTION_NAME) \
151  \
152  RETURN (orxFASTCALL *orxPLUGIN_CORE_FUNCTION_POINTER_NAME(FUNCTION_NAME))(__VA_ARGS__) = (RETURN(orxFASTCALL *)(__VA_ARGS__)) (&orxPLUGIN_DEFAULT_CORE_FUNCTION_NAME(FUNCTION_NAME))
153 
154 
155 /***************************************************************************
156  ***************************************************************************
157  ****** CORE INFO ARRAY HANDLING ******
158  ***************************************************************************
159  ***************************************************************************/
160 
161 /* *** Core info array begin macro *** */
162 #define orxPLUGIN_BEGIN_CORE_FUNCTION_ARRAY(PLUGIN_SUFFIX) \
163  static const orxPLUGIN_CORE_FUNCTION sastPluginFunctionInfo_##PLUGIN_SUFFIX[orxPLUGIN_FUNCTION_BASE_ID_##PLUGIN_SUFFIX##_NUMBER] = \
164  {
165 
166 /* *** Core info array add macro *** */
167 #define orxPLUGIN_ADD_CORE_FUNCTION_ARRAY(PLUGIN_SUFFIX, FUNCTION_SUFFIX, FUNCTION_NAME) \
168  {(orxPLUGIN_FUNCTION_ID)orxPLUGIN_FUNCTION_BASE_ID_##PLUGIN_SUFFIX##_##FUNCTION_SUFFIX, (orxPLUGIN_FUNCTION *)&orxPLUGIN_CORE_FUNCTION_POINTER_NAME(FUNCTION_NAME), (orxPLUGIN_FUNCTION)&orxPLUGIN_DEFAULT_CORE_FUNCTION_NAME(FUNCTION_NAME)},
169 
170 /* *** Core info array end macro *** */
171 #define orxPLUGIN_END_CORE_FUNCTION_ARRAY(PLUGIN_SUFFIX) \
172  }; \
173  extern orxIMPORT orxSTATUS orxPLUGIN_K_CORE_INIT_FUNCTION_NAME(PLUGIN_SUFFIX)(orxU32 *, orxPLUGIN_USER_FUNCTION_INFO **); \
174  extern orxDLLAPI void orxPLUGIN_CORE_REGISTER_FUNCTION_NAME(PLUGIN_SUFFIX)() \
175  { \
176  orxPLUGIN_REGISTER_CORE_INFO(PLUGIN_SUFFIX); \
177  return; \
178  }
179 
180 
181 /***************************************************************************
182  ***************************************************************************
183  ****** CORE INFO REGISTRATION HANDLING ******
184  ***************************************************************************
185  ***************************************************************************/
186 
187  #ifdef __orxEMBEDDED__
188 
189  /* *** Core info register macro *** */
190  #define orxPLUGIN_REGISTER_CORE_INFO(PLUGIN_SUFFIX) \
191  orxPlugin_AddCoreInfo(orxPLUGIN_CORE_ID_##PLUGIN_SUFFIX, orxMODULE_ID_##PLUGIN_SUFFIX, sastPluginFunctionInfo_##PLUGIN_SUFFIX, sizeof(sastPluginFunctionInfo_##PLUGIN_SUFFIX) / sizeof(orxPLUGIN_CORE_FUNCTION)); \
192  orxPlugin_BindCoreInfo(orxPLUGIN_CORE_ID_##PLUGIN_SUFFIX, orxPLUGIN_K_CORE_INIT_FUNCTION_NAME(PLUGIN_SUFFIX))
193 
194  #else /* __orxEMBEDDED__ */
195 
196  /* *** Core info register macro *** */
197  #define orxPLUGIN_REGISTER_CORE_INFO(PLUGIN_SUFFIX) \
198  orxPlugin_AddCoreInfo(orxPLUGIN_CORE_ID_##PLUGIN_SUFFIX, orxMODULE_ID_##PLUGIN_SUFFIX, sastPluginFunctionInfo_##PLUGIN_SUFFIX, sizeof(sastPluginFunctionInfo_##PLUGIN_SUFFIX) / sizeof(orxPLUGIN_CORE_FUNCTION));
199 
200  #endif /* __orxEMBEDDED__ */
201 
202 #endif /* _orxPLUGIN_CORE_H_ */
203 
orxPLUGIN_FUNCTION_ID eFunctionID
Definition: orxPluginCore.h:64
orxPLUGIN_FUNCTION_ID
Definition: orxPluginType.h:92
#define orxPLUGIN_KU32_FUNCTION_ARG_SIZE
Definition: orxPluginType.h:61
orxPLUGIN_FUNCTION * pfnFunction
Definition: orxPluginCore.h:65
orxDLLAPI void orxFASTCALL orxPlugin_AddCoreInfo(orxPLUGIN_CORE_ID _ePluginCoreID, orxMODULE_ID _eModuleID, const orxPLUGIN_CORE_FUNCTION *_astCoreFunction, orxU32 _u32CoreFunctionNumber)
orxMODULE_ID
Definition: orxModule.h:53
orxDLLAPI void *orxFASTCALL orxPlugin_DefaultCoreFunction(const orxSTRING _zFunctionName, const orxSTRING _zFileName, orxU32 _u32Line)
orxSTATUS(* orxPLUGIN_INIT_FUNCTION)(orxU32 *_peUserFunctionNumber, orxPLUGIN_USER_FUNCTION_INFO **_pastUserFunctionInfo)
Definition: orxPluginCore.h:83
const orxSTRING zFunctionName
Definition: orxPluginCore.h:76
orxSTATUS(orxFASTCALL * orxPLUGIN_FUNCTION)()
Definition: orxPluginType.h:98
orxSTATUS
Definition: orxType.h:243
orxPLUGIN_FUNCTION pfnFunction
Definition: orxPluginCore.h:74
#define orxDLLAPI
Definition: orxDecl.h:387
orxPLUGIN_FUNCTION_ID eFunctionID
Definition: orxPluginCore.h:73
orxPLUGIN_FUNCTION pfnDefaultFunction
Definition: orxPluginCore.h:66
orxPLUGIN_CORE_ID

Generated for orx by doxygen 1.5.6