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.

106 lines
4.2 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 The 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. * Return the name of the implemented plugin class, for example 3DPLUGIN.
  43. *
  44. * This should be implemented in a source module which is compiled as part of every implementation
  45. * of a specific plugin class.
  46. *
  47. * @return is the NULL-terminated UTF-8 string representing the plugin class.
  48. */
  49. KICAD_PLUGIN_EXPORT char const* GetKicadPluginClass( void );
  50. /**
  51. * Retrieve the version of the Plugin Class.
  52. *
  53. * This value is used to ensure API compatibility of a plugin as per typical practice. This must
  54. * be implemented in a source module which is compiled as part of every implementation of a
  55. * specific plugin class.
  56. *
  57. * @param Major will hold the Plugin Class Major version.
  58. * @param Minor will hold the Plugin Class Minor version.
  59. * @param Revision will hold the Plugin Class Revision.
  60. * @param Patch will hold the Plugin Class Patch level.
  61. */
  62. KICAD_PLUGIN_EXPORT void GetClassVersion( unsigned char* Major, unsigned char* Minor,
  63. unsigned char* Patch, unsigned char* Revision );
  64. /**
  65. * Return true if the class version reported by the Plugin Loader is compatible with the specific
  66. * implementation of a plugin.
  67. *
  68. * This function must be defined by each specific plugin and it is the plugin developer's
  69. * responsibility to ensure that the Plugin is in fact compatible with the Plugin Loader. The
  70. * Plugin Loader shall reject any Plugin with a different Major number regardless of the return
  71. * value of this function.
  72. */
  73. KICAD_PLUGIN_EXPORT bool CheckClassVersion( unsigned char Major, unsigned char Minor,
  74. unsigned char Patch, unsigned char Revision );
  75. /**
  76. * Return the name of the plugin instance, for example IDFv3.
  77. *
  78. * This string may be used to check for name conflicts or to display informational messages about
  79. * loaded plugins. This method must be implemented in specific instantiations of a plugin class.
  80. *
  81. * @return is the NULL-terminated UTF-8 string representing the plugin name.
  82. */
  83. KICAD_PLUGIN_EXPORT const char* GetKicadPluginName( void );
  84. /**
  85. * Retrieve the version of the instantiated plugin for informational purposes.
  86. *
  87. * Do not confuse this with GetClassVersion which is used to determine API compatibility.
  88. *
  89. * @param Major will hold the Plugin Major version.
  90. * @param Minor will hold the Plugin Minor version.
  91. * @param Patch will hold the Plugin Patch level.
  92. * @param Revision will hold the Plugin Revision.
  93. */
  94. KICAD_PLUGIN_EXPORT void GetPluginVersion( unsigned char* Major, unsigned char* Minor,
  95. unsigned char* Patch, unsigned char* Revision );
  96. #endif // KICAD_PLUGIN_H