Uwe Hermann | 787c439 | 2012-04-15 20:33:45 +0200 | [diff] [blame] | 1 | /* |
Uwe Hermann | 50985c2 | 2013-04-23 22:24:30 +0200 | [diff] [blame] | 2 | * This file is part of the libsigrok project. |
Uwe Hermann | 787c439 | 2012-04-15 20:33:45 +0200 | [diff] [blame] | 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 | |
Bert Vermeulen | 45c59c8 | 2012-07-05 00:55:07 +0200 | [diff] [blame] | 21 | #include "libsigrok.h" |
Uwe Hermann | 787c439 | 2012-04-15 20:33:45 +0200 | [diff] [blame] | 22 | |
Uwe Hermann | 7b870c3 | 2012-10-21 16:13:36 +0200 | [diff] [blame] | 23 | /** |
Uwe Hermann | 393fb9c | 2012-10-22 00:30:12 +0200 | [diff] [blame] | 24 | * @file |
| 25 | * |
Uwe Hermann | c27e5f1 | 2013-04-06 19:25:03 +0200 | [diff] [blame] | 26 | * Version number querying functions, definitions, and macros. |
Uwe Hermann | 393fb9c | 2012-10-22 00:30:12 +0200 | [diff] [blame] | 27 | */ |
| 28 | |
| 29 | /** |
Uwe Hermann | 7b870c3 | 2012-10-21 16:13:36 +0200 | [diff] [blame] | 30 | * @defgroup grp_versions Versions |
| 31 | * |
Uwe Hermann | c27e5f1 | 2013-04-06 19:25:03 +0200 | [diff] [blame] | 32 | * Version number querying functions, definitions, and macros. |
Uwe Hermann | 7b870c3 | 2012-10-21 16:13:36 +0200 | [diff] [blame] | 33 | * |
Uwe Hermann | 9fb5f2d | 2013-04-13 18:58:11 +0200 | [diff] [blame] | 34 | * This set of API calls returns two different version numbers related |
| 35 | * to libsigrok. The "package version" is the release version number of the |
| 36 | * libsigrok tarball in the usual "major.minor.micro" format, e.g. "0.1.0". |
| 37 | * |
| 38 | * The "library version" is independent of that; it is the libtool version |
| 39 | * number in the "current:revision:age" format, e.g. "2:0:0". |
| 40 | * See http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning for details. |
| 41 | * |
| 42 | * Both version numbers (and/or individual components of them) can be |
| 43 | * retrieved via the API calls at runtime, and/or they can be checked at |
| 44 | * compile/preprocessor time using the respective macros. |
| 45 | * |
Uwe Hermann | 7b870c3 | 2012-10-21 16:13:36 +0200 | [diff] [blame] | 46 | * @{ |
| 47 | */ |
| 48 | |
Uwe Hermann | 9fb5f2d | 2013-04-13 18:58:11 +0200 | [diff] [blame] | 49 | /** |
| 50 | * Get the major libsigrok package version number. |
| 51 | * |
| 52 | * @return The major package version number. |
| 53 | * |
| 54 | * @since 0.1.0 |
| 55 | */ |
Uwe Hermann | 787c439 | 2012-04-15 20:33:45 +0200 | [diff] [blame] | 56 | SR_API int sr_package_version_major_get(void) |
| 57 | { |
| 58 | return SR_PACKAGE_VERSION_MAJOR; |
| 59 | } |
| 60 | |
Uwe Hermann | 9fb5f2d | 2013-04-13 18:58:11 +0200 | [diff] [blame] | 61 | /** |
| 62 | * Get the minor libsigrok package version number. |
| 63 | * |
| 64 | * @return The minor package version number. |
| 65 | * |
| 66 | * @since 0.1.0 |
| 67 | */ |
Uwe Hermann | 787c439 | 2012-04-15 20:33:45 +0200 | [diff] [blame] | 68 | SR_API int sr_package_version_minor_get(void) |
| 69 | { |
| 70 | return SR_PACKAGE_VERSION_MINOR; |
| 71 | } |
| 72 | |
Uwe Hermann | 9fb5f2d | 2013-04-13 18:58:11 +0200 | [diff] [blame] | 73 | /** |
| 74 | * Get the micro libsigrok package version number. |
| 75 | * |
| 76 | * @return The micro package version number. |
| 77 | * |
| 78 | * @since 0.1.0 |
| 79 | */ |
Uwe Hermann | 787c439 | 2012-04-15 20:33:45 +0200 | [diff] [blame] | 80 | SR_API int sr_package_version_micro_get(void) |
| 81 | { |
| 82 | return SR_PACKAGE_VERSION_MICRO; |
| 83 | } |
| 84 | |
Uwe Hermann | 9fb5f2d | 2013-04-13 18:58:11 +0200 | [diff] [blame] | 85 | /** |
| 86 | * Get the libsigrok package version number as a string. |
| 87 | * |
| 88 | * @return The package version number string. The returned string is |
| 89 | * static and thus should NOT be free'd by the caller. |
| 90 | * |
| 91 | * @since 0.1.0 |
| 92 | */ |
Uwe Hermann | 787c439 | 2012-04-15 20:33:45 +0200 | [diff] [blame] | 93 | SR_API const char *sr_package_version_string_get(void) |
| 94 | { |
| 95 | return SR_PACKAGE_VERSION_STRING; |
| 96 | } |
| 97 | |
Uwe Hermann | 9fb5f2d | 2013-04-13 18:58:11 +0200 | [diff] [blame] | 98 | /** |
| 99 | * Get the "current" part of the libsigrok library version number. |
| 100 | * |
| 101 | * @return The "current" library version number. |
| 102 | * |
| 103 | * @since 0.1.0 |
| 104 | */ |
Uwe Hermann | 787c439 | 2012-04-15 20:33:45 +0200 | [diff] [blame] | 105 | SR_API int sr_lib_version_current_get(void) |
| 106 | { |
| 107 | return SR_LIB_VERSION_CURRENT; |
| 108 | } |
| 109 | |
Uwe Hermann | 9fb5f2d | 2013-04-13 18:58:11 +0200 | [diff] [blame] | 110 | /** |
| 111 | * Get the "revision" part of the libsigrok library version number. |
| 112 | * |
| 113 | * @return The "revision" library version number. |
| 114 | * |
| 115 | * @since 0.1.0 |
| 116 | */ |
Uwe Hermann | 787c439 | 2012-04-15 20:33:45 +0200 | [diff] [blame] | 117 | SR_API int sr_lib_version_revision_get(void) |
| 118 | { |
| 119 | return SR_LIB_VERSION_REVISION; |
| 120 | } |
| 121 | |
Uwe Hermann | 9fb5f2d | 2013-04-13 18:58:11 +0200 | [diff] [blame] | 122 | /** |
| 123 | * Get the "age" part of the libsigrok library version number. |
| 124 | * |
| 125 | * @return The "age" library version number. |
| 126 | * |
| 127 | * @since 0.1.0 |
| 128 | */ |
Uwe Hermann | 787c439 | 2012-04-15 20:33:45 +0200 | [diff] [blame] | 129 | SR_API int sr_lib_version_age_get(void) |
| 130 | { |
| 131 | return SR_LIB_VERSION_AGE; |
| 132 | } |
| 133 | |
Uwe Hermann | 9fb5f2d | 2013-04-13 18:58:11 +0200 | [diff] [blame] | 134 | /** |
| 135 | * Get the libsigrok library version number as a string. |
| 136 | * |
| 137 | * @return The library version number string. The returned string is |
| 138 | * static and thus should NOT be free'd by the caller. |
| 139 | * |
| 140 | * @since 0.1.0 |
| 141 | */ |
Uwe Hermann | 787c439 | 2012-04-15 20:33:45 +0200 | [diff] [blame] | 142 | SR_API const char *sr_lib_version_string_get(void) |
| 143 | { |
| 144 | return SR_LIB_VERSION_STRING; |
| 145 | } |
Uwe Hermann | 7b870c3 | 2012-10-21 16:13:36 +0200 | [diff] [blame] | 146 | |
| 147 | /** @} */ |