23#include <wx/dynload.h>
26#include <wx/translation.h>
66 if( aFullFileName.empty() )
76 aFullFileName.ToUTF8() );
94 "incompatible plugin (missing function 'GetKicadPluginClass')" ),
95 __FILE__, __FUNCTION__, __LINE__ );
106 "incompatible plugin (missing function 'GetClassVersion')" ),
107 __FILE__, __FUNCTION__, __LINE__ );
122 "incompatible plugin (missing function 'CheckClassVersion')" ),
123 __FILE__, __FUNCTION__, __LINE__ );
139 "incompatible plugin (missing function 'GetKicadPluginName')" ),
140 __FILE__, __FUNCTION__, __LINE__ );
156 "incompatible plugin (missing function 'GetVersion')" ),
157 __FILE__, __FUNCTION__, __LINE__ );
170 m_error =
"incompatible plugin interface (missing functions)";
181 if( !pclassName || strcmp( aPluginClass, pclassName ) )
184 m_error.append( aPluginClass );
185 m_error.append(
") does not match Plugin type (" );
199 unsigned char lMajor;
200 unsigned char lMinor;
201 unsigned char lPatch;
202 unsigned char lRevno;
203 unsigned char pMajor;
204 unsigned char pMinor;
205 unsigned char pPatch;
206 unsigned char pRevno;
212 if( pMajor != lMajor )
214 std::ostringstream ostr;
215 ostr <<
"Loader Major version (" << lMajor;
216 ostr <<
") does not match Plugin Major version (" << pMajor <<
")";
225 std::ostringstream ostr;
226 ostr <<
"Plugin Version (" << pMajor <<
"." << pMinor <<
"." << pPatch <<
"." << pRevno;
227 ostr <<
") does not support Loader Version (" << pMajor <<
"." << pMinor;
228 ostr <<
"." << pPatch <<
"." << pRevno <<
")";
239 " * [INFO] opened plugin '%s'" ),
240 __FILE__, __FUNCTION__, __LINE__,
m_fileName );
246 std::ostringstream ostr;
247 unsigned char r0, r1, r2, r3;
249 ostr <<
":" << (
unsigned int)r0 <<
"." << (
unsigned int)r1;
250 ostr <<
"." << (
unsigned int)r2 <<
"." << (
unsigned int)r3;
280 return Open( fname );
297 m_error =
"[INFO] no open plugin / plugin could not be opened";
304 m_error =
"[BUG] GetPluginClass is not linked";
308 __FILE__, __FUNCTION__, __LINE__,
m_error );;
318 unsigned char* Patch,
unsigned char* Revision )
342 m_error =
"[INFO] no open plugin / plugin could not be opened";
349 m_error =
"[BUG] CheckClassVersion is not linked";
353 __FILE__, __FUNCTION__, __LINE__,
m_error );;
377 unsigned char Patch,
unsigned char Revision )
384 m_error =
"[INFO] no open plugin / plugin could not be opened";
391 m_error =
"[BUG] CheckClassVersion is not linked";
395 __FILE__, __FUNCTION__, __LINE__,
m_error );;
411 m_error =
"[INFO] no open plugin / plugin could not be opened";
418 m_error =
"[BUG] GetKicadPluginName is not linked";
422 __FILE__, __FUNCTION__, __LINE__,
m_error );;
432 unsigned char* Patch,
unsigned char* Revision )
439 m_error =
"[INFO] no open plugin / plugin could not be opened";
446 m_error =
"[BUG] GetKicadPluginName is not linked";
450 __FILE__, __FUNCTION__, __LINE__,
m_error );;
virtual void GetLoaderVersion(unsigned char *Major, unsigned char *Minor, unsigned char *Patch, unsigned char *Revision) const =0
Return the version information of the Plugin Loader for plugin compatibility checking.
CHECK_CLASS_VERSION m_checkClassVersion
std::string GetLastError(void) const
Return the value of the internal error string.
char const * GetKicadPluginClass(void)
GET_PLUGIN_CLASS m_getPluginClass
GET_CLASS_VERSION m_getClassVersion
virtual void Close(void)=0
Clean up and closes/unloads the plugin.
virtual bool Open(const wxString &aFullFileName)=0
Open a plugin of the given class, performs version compatibility checks, and links all required funct...
bool CheckClassVersion(unsigned char Major, unsigned char Minor, unsigned char Patch, unsigned char Revision)
GET_PLUGIN_NAME m_getPluginName
void GetPluginInfo(std::string &aPluginInfo)
bool open(const wxString &aFullFileName, const char *aPluginClass)
Open a plugin of the specified class and links the extensions required by kicad_plugin.
bool GetClassVersion(unsigned char *Major, unsigned char *Minor, unsigned char *Patch, unsigned char *Revision)
wxDynamicLibrary m_PluginLoader
bool GetVersion(unsigned char *Major, unsigned char *Minor, unsigned char *Patch, unsigned char *Revision)
const char * GetKicadPluginName(void)
virtual ~KICAD_PLUGIN_LDR()
void close(void)
Nullify internal pointers in preparation for closing the plugin.
bool reopen(void)
Reopen a plugin.
const wxChar *const tracePluginLoader
Flag to enable plugin loader trace output.
defines the most basic functions which all kicad plugin loaders require.
void(* GET_VERSION)(unsigned char *, unsigned char *, unsigned char *, unsigned char *)
void(* GET_CLASS_VERSION)(unsigned char *, unsigned char *, unsigned char *, unsigned char *)
bool(* CHECK_CLASS_VERSION)(unsigned char, unsigned char, unsigned char, unsigned char)
char const *(* GET_PLUGIN_CLASS)(void)
const char *(* GET_PLUGIN_NAME)(void)
#define LINK_ITEM(funcPtr, funcType, funcName)