version.c 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /*
  2. * This file is part of the libsigrok project.
  3. *
  4. * Copyright (C) 2012 Uwe Hermann <uwe@hermann-uwe.de>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. #include "libsigrok.h"
  21. /**
  22. * @file
  23. *
  24. * Version number querying functions, definitions, and macros.
  25. */
  26. /**
  27. * @defgroup grp_versions Versions
  28. *
  29. * Version number querying functions, definitions, and macros.
  30. *
  31. * This set of API calls returns two different version numbers related
  32. * to libsigrok. The "package version" is the release version number of the
  33. * libsigrok tarball in the usual "major.minor.micro" format, e.g. "0.1.0".
  34. *
  35. * The "library version" is independent of that; it is the libtool version
  36. * number in the "current:revision:age" format, e.g. "2:0:0".
  37. * See http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning for details.
  38. *
  39. * Both version numbers (and/or individual components of them) can be
  40. * retrieved via the API calls at runtime, and/or they can be checked at
  41. * compile/preprocessor time using the respective macros.
  42. *
  43. * @{
  44. */
  45. /**
  46. * Get the major libsigrok package version number.
  47. *
  48. * @return The major package version number.
  49. *
  50. * @since 0.1.0
  51. */
  52. SR_API int sr_package_version_major_get(void)
  53. {
  54. return SR_PACKAGE_VERSION_MAJOR;
  55. }
  56. /**
  57. * Get the minor libsigrok package version number.
  58. *
  59. * @return The minor package version number.
  60. *
  61. * @since 0.1.0
  62. */
  63. SR_API int sr_package_version_minor_get(void)
  64. {
  65. return SR_PACKAGE_VERSION_MINOR;
  66. }
  67. /**
  68. * Get the micro libsigrok package version number.
  69. *
  70. * @return The micro package version number.
  71. *
  72. * @since 0.1.0
  73. */
  74. SR_API int sr_package_version_micro_get(void)
  75. {
  76. return SR_PACKAGE_VERSION_MICRO;
  77. }
  78. /**
  79. * Get the libsigrok package version number as a string.
  80. *
  81. * @return The package version number string. The returned string is
  82. * static and thus should NOT be free'd by the caller.
  83. *
  84. * @since 0.1.0
  85. */
  86. SR_API const char *sr_package_version_string_get(void)
  87. {
  88. return SR_PACKAGE_VERSION_STRING;
  89. }
  90. /**
  91. * Get the "current" part of the libsigrok library version number.
  92. *
  93. * @return The "current" library version number.
  94. *
  95. * @since 0.1.0
  96. */
  97. SR_API int sr_lib_version_current_get(void)
  98. {
  99. return SR_LIB_VERSION_CURRENT;
  100. }
  101. /**
  102. * Get the "revision" part of the libsigrok library version number.
  103. *
  104. * @return The "revision" library version number.
  105. *
  106. * @since 0.1.0
  107. */
  108. SR_API int sr_lib_version_revision_get(void)
  109. {
  110. return SR_LIB_VERSION_REVISION;
  111. }
  112. /**
  113. * Get the "age" part of the libsigrok library version number.
  114. *
  115. * @return The "age" library version number.
  116. *
  117. * @since 0.1.0
  118. */
  119. SR_API int sr_lib_version_age_get(void)
  120. {
  121. return SR_LIB_VERSION_AGE;
  122. }
  123. /**
  124. * Get the libsigrok library version number as a string.
  125. *
  126. * @return The library version number string. The returned string is
  127. * static and thus should NOT be free'd by the caller.
  128. *
  129. * @since 0.1.0
  130. */
  131. SR_API const char *sr_lib_version_string_get(void)
  132. {
  133. return SR_LIB_VERSION_STRING;
  134. }
  135. /** @} */