27#include <wx/dynload.h>
30#include <wx/translation.h>
70 if( aFullFileName.empty() )
80 aFullFileName.ToUTF8() );
98 "incompatible plugin (missing function 'GetKicadPluginClass')" ),
99 __FILE__, __FUNCTION__, __LINE__ );
110 "incompatible plugin (missing function 'GetClassVersion')" ),
111 __FILE__, __FUNCTION__, __LINE__ );
126 "incompatible plugin (missing function 'CheckClassVersion')" ),
127 __FILE__, __FUNCTION__, __LINE__ );
143 "incompatible plugin (missing function 'GetKicadPluginName')" ),
144 __FILE__, __FUNCTION__, __LINE__ );
160 "incompatible plugin (missing function 'GetVersion')" ),
161 __FILE__, __FUNCTION__, __LINE__ );
174 m_error =
"incompatible plugin interface (missing functions)";
185 if( !pclassName || strcmp( aPluginClass, pclassName ) )
188 m_error.append( aPluginClass );
189 m_error.append(
") does not match Plugin type (" );
203 unsigned char lMajor;
204 unsigned char lMinor;
205 unsigned char lPatch;
206 unsigned char lRevno;
207 unsigned char pMajor;
208 unsigned char pMinor;
209 unsigned char pPatch;
210 unsigned char pRevno;
216 if( pMajor != lMajor )
218 std::ostringstream ostr;
219 ostr <<
"Loader Major version (" << lMajor;
220 ostr <<
") does not match Plugin Major version (" << pMajor <<
")";
229 std::ostringstream ostr;
230 ostr <<
"Plugin Version (" << pMajor <<
"." << pMinor <<
"." << pPatch <<
"." << pRevno;
231 ostr <<
") does not support Loader Version (" << pMajor <<
"." << pMinor;
232 ostr <<
"." << pPatch <<
"." << pRevno <<
")";
243 " * [INFO] opened plugin '%s'" ),
244 __FILE__, __FUNCTION__, __LINE__,
m_fileName );
250 std::ostringstream ostr;
251 unsigned char r0, r1, r2, r3;
253 ostr <<
":" << (
unsigned int)r0 <<
"." << (
unsigned int)r1;
254 ostr <<
"." << (
unsigned int)r2 <<
"." << (
unsigned int)r3;
284 return Open( fname );
301 m_error =
"[INFO] no open plugin / plugin could not be opened";
308 m_error =
"[BUG] GetPluginClass is not linked";
312 __FILE__, __FUNCTION__, __LINE__,
m_error );;
322 unsigned char* Patch,
unsigned char* Revision )
346 m_error =
"[INFO] no open plugin / plugin could not be opened";
353 m_error =
"[BUG] CheckClassVersion is not linked";
357 __FILE__, __FUNCTION__, __LINE__,
m_error );;
381 unsigned char Patch,
unsigned char Revision )
388 m_error =
"[INFO] no open plugin / plugin could not be opened";
395 m_error =
"[BUG] CheckClassVersion is not linked";
399 __FILE__, __FUNCTION__, __LINE__,
m_error );;
415 m_error =
"[INFO] no open plugin / plugin could not be opened";
422 m_error =
"[BUG] GetKicadPluginName is not linked";
426 __FILE__, __FUNCTION__, __LINE__,
m_error );;
436 unsigned char* Patch,
unsigned char* Revision )
443 m_error =
"[INFO] no open plugin / plugin could not be opened";
450 m_error =
"[BUG] GetKicadPluginName is not linked";
454 __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)