orx  1.11
Portable Game Engine
orxPluginCore.h
Go to the documentation of this file.
1 /* Orx - Portable Game Engine
2  *
3  * Copyright (c) 2008-2020 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 
97 extern orxDLLAPI void orxFASTCALL orxPlugin_AddCoreInfo(orxPLUGIN_CORE_ID _ePluginCoreID, orxMODULE_ID _eModuleID, const orxPLUGIN_CORE_FUNCTION *_astCoreFunction, orxU32 _u32CoreFunctionNumber);
98 
99 #ifdef __orxEMBEDDED__
100 
106 extern orxDLLAPI void orxFASTCALL orxPlugin_BindCoreInfo(orxPLUGIN_CORE_ID _ePluginCoreID, orxPLUGIN_INIT_FUNCTION _pfnPluginInit);
107 
108 #endif /* __orxEMBEDDED__ */
109 
113 extern orxDLLAPI void *orxFASTCALL orxPlugin_DefaultCoreFunction(const orxSTRING _zFunctionName, const orxSTRING _zFileName, orxU32 _u32Line);
114 
115 
116 /***************************************************************************
117  ***************************************************************************
118  ****** CORE FUNCTION NAME HANDLING ******
119  ***************************************************************************
120  ***************************************************************************/
121 
122 /* *** Core function pointer name *** */
123 #define orxPLUGIN_CORE_FUNCTION_POINTER_NAME(FUNCTION_NAME) _orxCoreFunctionPointer_##FUNCTION_NAME
124 
125 /* *** Core function default name *** */
126 #define orxPLUGIN_DEFAULT_CORE_FUNCTION_NAME(FUNCTION_NAME) _orxDefaultCoreFunction_##FUNCTION_NAME
127 
128 /* *** Default core function declaration *** */
129 #define orxPLUGIN_DEFAULT_CORE_FUNCTION_DEFINE(FUNCTION_NAME) \
130  extern orxDLLAPI void *orxFASTCALL orxPLUGIN_DEFAULT_CORE_FUNCTION_NAME(FUNCTION_NAME)() \
131  { \
132  return(orxPlugin_DefaultCoreFunction(#FUNCTION_NAME, __FILE__, __LINE__)); \
133  }
134 
135 
136 /***************************************************************************
137  ***************************************************************************
138  ****** CORE FUNCTION DEFINITION HANDLING ******
139  ***************************************************************************
140  ***************************************************************************/
141 
142 /* *** Definition macro *** */
143 #ifdef __orxMSVC__
144 #pragma warning(disable : 4113)
145 #endif /* __orxMSVC__ */
146 
147 #define orxPLUGIN_DEFINE_CORE_FUNCTION(FUNCTION_NAME, RETURN, ...) \
148  orxPLUGIN_DEFAULT_CORE_FUNCTION_DEFINE(FUNCTION_NAME) \
149  \
150  RETURN (orxFASTCALL *orxPLUGIN_CORE_FUNCTION_POINTER_NAME(FUNCTION_NAME))(__VA_ARGS__) = (RETURN(orxFASTCALL *)(__VA_ARGS__)) (&orxPLUGIN_DEFAULT_CORE_FUNCTION_NAME(FUNCTION_NAME))
151 
152 
153 /***************************************************************************
154  ***************************************************************************
155  ****** CORE INFO ARRAY HANDLING ******
156  ***************************************************************************
157  ***************************************************************************/
158 
159 /* *** Core info array begin macro *** */
160 #define orxPLUGIN_BEGIN_CORE_FUNCTION_ARRAY(PLUGIN_SUFFIX) \
161  static const orxPLUGIN_CORE_FUNCTION sastPluginFunctionInfo_##PLUGIN_SUFFIX[orxPLUGIN_FUNCTION_BASE_ID_##PLUGIN_SUFFIX##_NUMBER] = \
162  {
163 
164 /* *** Core info array add macro *** */
165 #define orxPLUGIN_ADD_CORE_FUNCTION_ARRAY(PLUGIN_SUFFIX, FUNCTION_SUFFIX, FUNCTION_NAME) \
166  {(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)},
167 
168 /* *** Core info array end macro *** */
169 #define orxPLUGIN_END_CORE_FUNCTION_ARRAY(PLUGIN_SUFFIX) \
170  }; \
171  extern orxIMPORT orxSTATUS orxPLUGIN_K_CORE_INIT_FUNCTION_NAME(PLUGIN_SUFFIX)(orxU32 *, orxPLUGIN_USER_FUNCTION_INFO **); \
172  extern orxDLLAPI void orxPLUGIN_CORE_REGISTER_FUNCTION_NAME(PLUGIN_SUFFIX)() \
173  { \
174  orxPLUGIN_REGISTER_CORE_INFO(PLUGIN_SUFFIX); \
175  return; \
176  }
177 
178 
179 /***************************************************************************
180  ***************************************************************************
181  ****** CORE INFO REGISTRATION HANDLING ******
182  ***************************************************************************
183  ***************************************************************************/
184 
185  #ifdef __orxEMBEDDED__
186 
187  /* *** Core info register macro *** */
188  #define orxPLUGIN_REGISTER_CORE_INFO(PLUGIN_SUFFIX) \
189  orxPlugin_AddCoreInfo(orxPLUGIN_CORE_ID_##PLUGIN_SUFFIX, orxMODULE_ID_##PLUGIN_SUFFIX, sastPluginFunctionInfo_##PLUGIN_SUFFIX, sizeof(sastPluginFunctionInfo_##PLUGIN_SUFFIX) / sizeof(orxPLUGIN_CORE_FUNCTION)); \
190  orxPlugin_BindCoreInfo(orxPLUGIN_CORE_ID_##PLUGIN_SUFFIX, orxPLUGIN_K_CORE_INIT_FUNCTION_NAME(PLUGIN_SUFFIX))
191 
192  #else /* __orxEMBEDDED__ */
193 
194  /* *** Core info register macro *** */
195  #define orxPLUGIN_REGISTER_CORE_INFO(PLUGIN_SUFFIX) \
196  orxPlugin_AddCoreInfo(orxPLUGIN_CORE_ID_##PLUGIN_SUFFIX, orxMODULE_ID_##PLUGIN_SUFFIX, sastPluginFunctionInfo_##PLUGIN_SUFFIX, sizeof(sastPluginFunctionInfo_##PLUGIN_SUFFIX) / sizeof(orxPLUGIN_CORE_FUNCTION));
197 
198  #endif /* __orxEMBEDDED__ */
199 
200 #endif /* _orxPLUGIN_CORE_H_ */
201 
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:246
orxPLUGIN_FUNCTION pfnFunction
Definition: orxPluginCore.h:74
#define orxDLLAPI
Definition: orxDecl.h:381
orxPLUGIN_FUNCTION_ID eFunctionID
Definition: orxPluginCore.h:73
orxPLUGIN_FUNCTION pfnDefaultFunction
Definition: orxPluginCore.h:66
orxPLUGIN_CORE_ID

Generated for orx by doxygen 1.8.11