You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

112 lines
4.3 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2015 Cirilo Bernardo <cirilo.bernardo@gmail.com>
  5. * Copyright (C) 2017 KiCad Developers, see AUTHORS.txt for contributors.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version 2
  10. * of the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, you may find one here:
  19. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  20. * or you may search the http://www.gnu.org website for the version 2 license,
  21. * or you may write to the Free Software Foundation, Inc.,
  22. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  23. */
  24. /**
  25. * @file include/plugins/kicad_plugin.h
  26. * defines the most basic functions which all kicad plugins must implement.
  27. * In the implementation the definitions must make use of the KICAD_PLUGIN_EXPORT
  28. * to ensure symbol visibility.
  29. */
  30. #ifndef KICAD_PLUGIN_H
  31. #define KICAD_PLUGIN_H
  32. #ifndef _WIN32
  33. #ifndef KICAD_PLUGIN_EXPORT
  34. #define KICAD_PLUGIN_EXPORT extern "C" __attribute__((__visibility__("default")))
  35. #endif
  36. #else
  37. #ifndef KICAD_PLUGIN_EXPORT
  38. #define KICAD_PLUGIN_EXPORT extern "C" __declspec( dllexport )
  39. #endif
  40. #endif
  41. /**
  42. * Function GetKicadPluginClass
  43. * returns the name of the implemented plugin class; for
  44. * example 3DPLUGIN. This should be implemented in a source
  45. * module which is compiled as part of every implementation
  46. * of a specific plugin class.
  47. *
  48. * @return is the NULL-terminated UTF-8 string representing the
  49. * plugin class
  50. */
  51. KICAD_PLUGIN_EXPORT char const* GetKicadPluginClass( void );
  52. /**
  53. * Function GetClassVersion
  54. * retrieves the version of the Plugin Class. This value is used to
  55. * ensure API compatibility of a plugin as per typical practice. This must
  56. * be implemented in a source module which is compiled as part of every
  57. * implementation of a specific plugin class
  58. *
  59. * @param Major will hold the Plugin Class Major version
  60. * @param Minor will hold the Plugin Class Minor version
  61. * @param Revision will hold the Plugin Class Revision
  62. * @param Patch will hold the Plugin Class Patch level
  63. */
  64. KICAD_PLUGIN_EXPORT void GetClassVersion( unsigned char* Major,
  65. unsigned char* Minor, unsigned char* Patch, unsigned char* Revision );
  66. /**
  67. * Function CheckClassVersion
  68. * returns true if the class version reported by the Plugin Loader
  69. * is compatible with the specific implementation of a plugin.
  70. * This function must be defined by each specific plugin and it is
  71. * the plugin developer's responsibility to ensure that the Plugin
  72. * is in fact compatible with the Plugin Loader. The Plugin Loader
  73. * shall reject any Plugin with a different Major number regardless
  74. * of the return value of this function.
  75. */
  76. KICAD_PLUGIN_EXPORT bool CheckClassVersion( unsigned char Major,
  77. unsigned char Minor, unsigned char Patch, unsigned char Revision );
  78. /**
  79. * Function GetKicadPluginName
  80. * returns the name of the plugin instance; for example IDFv3.
  81. * This string may be used to check for name conflicts or to
  82. * display informational messages about loaded plugins. This method
  83. * must be implemented in specific instantiations of a plugin class.
  84. *
  85. * @return is the NULL-terminated UTF-8 string representing the
  86. * plugin name
  87. */
  88. KICAD_PLUGIN_EXPORT const char* GetKicadPluginName( void );
  89. /**
  90. * Function GetPluginVersion
  91. * retrieves the version of the instantiated plugin for informational
  92. * purposes. Do not confuse this with GetClassVersion which is used to
  93. * determine API compatibility.
  94. *
  95. * @param Major will hold the Plugin Major version
  96. * @param Minor will hold the Plugin Minor version
  97. * @param Patch will hold the Plugin Patch level
  98. * @param Revision will hold the Plugin Revision
  99. */
  100. KICAD_PLUGIN_EXPORT void GetPluginVersion( unsigned char* Major,
  101. unsigned char* Minor, unsigned char* Patch, unsigned char* Revision );
  102. #endif // KICAD_PLUGIN_H