32 #ifndef OPAL_LIDS_LIDPLUGIN_H
33 #define OPAL_LIDS_LIDPLUGIN_H
42 # ifdef PLUGIN_DLL_EXPORTS
43 # define PLUGIN_DLL_API __declspec(dllexport)
45 # define PLUGIN_DLL_API __declspec(dllimport)
50 #define PLUGIN_DLL_API
54 #ifdef PWLIB_PLUGIN_API_VERSION
55 #undef PWLIB_PLUGIN_API_VERSION
57 #define PWLIB_PLUGIN_API_VERSION 1
63 #define PLUGIN_LID_VERSION 1 // initial version
209 unsigned lowFrequency,
210 unsigned highFrequency,
212 unsigned numCadences,
213 const unsigned * onTimes,
214 const unsigned * offTimes);
237 #define PLUGIN_LID_CTOR() \
238 static void * Create(const struct PluginLID_Definition * definition) { return new Context; } \
241 #define PLUGIN_LID_DTOR() \
242 static void Destroy(const struct PluginLID_Definition * definition, void * context) { delete (Context *)context; } \
245 #define PLUGIN_FUNCTION_ARG0(fn) \
246 static PluginLID_Errors fn(void * context) { return context == NULL ? PluginLID_BadContext : ((Context *)context)->fn(); } \
247 PluginLID_Errors fn( )
249 #define PLUGIN_FUNCTION_ARG0(fn) \
250 static PluginLID_Errors fn(void * context) { return context == NULL ? PluginLID_BadContext : ((Context *)context)->fn(); } \
251 PluginLID_Errors fn( )
253 #define PLUGIN_FUNCTION_ARG1(fn, type1,var1) \
254 static PluginLID_Errors fn(void * context, type1 var1) { return context == NULL ? PluginLID_BadContext : ((Context *)context)->fn(var1); } \
255 PluginLID_Errors fn( type1 var1)
257 #define PLUGIN_FUNCTION_ARG2(fn, type1,var1, type2,var2) \
258 static PluginLID_Errors fn(void * context, type1 var1, type2 var2) { return context == NULL ? PluginLID_BadContext : ((Context *)context)->fn(var1, var2); } \
259 PluginLID_Errors fn( type1 var1, type2 var2)
261 #define PLUGIN_FUNCTION_ARG3(fn, type1,var1, type2,var2, type3,var3) \
262 static PluginLID_Errors fn(void * context, type1 var1, type2 var2, type3 var3) { return context == NULL ? PluginLID_BadContext : ((Context *)context)->fn(var1, var2, var3); } \
263 PluginLID_Errors fn( type1 var1, type2 var2, type3 var3)
265 #define PLUGIN_FUNCTION_ARG4(fn, type1,var1, type2,var2, type3,var3, type4,var4) \
266 static PluginLID_Errors fn(void * context, type1 var1, type2 var2, type3 var3, type4 var4) { return context == NULL ? PluginLID_BadContext : ((Context *)context)->fn(var1, var2, var3, var4); } \
267 PluginLID_Errors fn( type1 var1, type2 var2, type3 var3, type4 var4)
269 #define PLUGIN_FUNCTION_ARG8(fn, type1,var1, type2,var2, type3,var3, type4,var4, type5,var5, type6,var6, type7,var7, type8,var8) \
270 static PluginLID_Errors fn(void * context, type1 var1, type2 var2, type3 var3, type4 var4, type5 var5, type6 var6, type7 var7, type8 var8) { return context == NULL ? PluginLID_BadContext : ((Context *)context)->fn(var1, var2, var3, var4, var5, var6, var7, var8); } \
271 PluginLID_Errors fn( type1 var1, type2 var2, type3 var3, type4 var4, type5 var5, type6 var6, type7 var7, type8 var8)
273 #endif // __cplusplus
276 #define PLUGIN_LID_API_VER_FN PWLibPlugin_GetAPIVersion
277 #define PLUGIN_LID_API_VER_FN_STR "PWLibPlugin_GetAPIVersion"
279 #define PLUGIN_LID_GET_LIDS_FN OpalPluginLID_GetDefinitions
280 #define PLUGIN_LID_GET_LIDS_FN_STR "OpalPluginLID_GetDefinitions"
283 typedef struct PluginLID_Definition * (* PluginLID_GetDefinitionsFunction)(
unsigned * ,
unsigned );
286 #define PLUGIN_LID_IMPLEMENTATION(defs) \
288 PLUGIN_DLL_API unsigned int PLUGIN_LID_API_VER_FN() { return PWLIB_PLUGIN_API_VERSION; } \
289 PLUGIN_DLL_API PluginLID_Definition * PLUGIN_LID_GET_LIDS_FN(unsigned * count, unsigned version) \
290 { *count = sizeof(defs)/sizeof(defs[0]); return defs; } \
298 #endif // OPAL_LIDS_LIDPLUGIN_H