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.

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