]>
Commit | Line | Data |
---|---|---|
0c081c63 | 1 | /* |
50bd5d25 | 2 | * This file is part of the libsigrokdecode project. |
0c081c63 | 3 | * |
8c664ca2 | 4 | * Copyright (C) 2012-2013 Uwe Hermann <uwe@hermann-uwe.de> |
0c081c63 UH |
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 | |
4539e9ca | 17 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
0c081c63 UH |
18 | */ |
19 | ||
36784362 | 20 | #include <config.h> |
cdb49509 | 21 | #include "libsigrokdecode-internal.h" /* First, so we avoid a _POSIX_C_SOURCE warning. */ |
c1f86f02 | 22 | #include "libsigrokdecode.h" |
0c081c63 | 23 | |
54fdeeef UH |
24 | /** |
25 | * @file | |
26 | * | |
8c664ca2 | 27 | * Version number querying functions, definitions, and macros. |
54fdeeef UH |
28 | */ |
29 | ||
4895418c UH |
30 | /** |
31 | * @defgroup grp_versions Versions | |
32 | * | |
8c664ca2 UH |
33 | * Version number querying functions, definitions, and macros. |
34 | * | |
35 | * This set of API calls returns two different version numbers related | |
36 | * to libsigrokdecode. The "package version" is the release version number | |
37 | * of the libsigrokdecode tarball in the usual "major.minor.micro" format, | |
38 | * e.g. "0.1.0". | |
39 | * | |
40 | * The "library version" is independent of that; it is the libtool version | |
41 | * number in the "current:revision:age" format, e.g. "2:0:0". | |
42 | * See http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning for details. | |
43 | * | |
44 | * Both version numbers (and/or individual components of them) can be | |
45 | * retrieved via the API calls at runtime, and/or they can be checked at | |
46 | * compile/preprocessor time using the respective macros. | |
4895418c UH |
47 | * |
48 | * @{ | |
49 | */ | |
50 | ||
8c664ca2 UH |
51 | /** |
52 | * Get the major libsigrokdecode package version number. | |
53 | * | |
54 | * @return The major package version number. | |
55 | * | |
56 | * @since 0.1.0 | |
57 | */ | |
0c081c63 UH |
58 | SRD_API int srd_package_version_major_get(void) |
59 | { | |
60 | return SRD_PACKAGE_VERSION_MAJOR; | |
61 | } | |
62 | ||
8c664ca2 UH |
63 | /** |
64 | * Get the minor libsigrokdecode package version number. | |
65 | * | |
66 | * @return The minor package version number. | |
67 | * | |
68 | * @since 0.1.0 | |
69 | */ | |
0c081c63 UH |
70 | SRD_API int srd_package_version_minor_get(void) |
71 | { | |
72 | return SRD_PACKAGE_VERSION_MINOR; | |
73 | } | |
74 | ||
8c664ca2 UH |
75 | /** |
76 | * Get the micro libsigrokdecode package version number. | |
77 | * | |
78 | * @return The micro package version number. | |
79 | * | |
80 | * @since 0.1.0 | |
81 | */ | |
0c081c63 UH |
82 | SRD_API int srd_package_version_micro_get(void) |
83 | { | |
84 | return SRD_PACKAGE_VERSION_MICRO; | |
85 | } | |
86 | ||
8c664ca2 UH |
87 | /** |
88 | * Get the libsigrokdecode package version number as a string. | |
89 | * | |
90 | * @return The package version number string. The returned string is | |
91 | * static and thus should NOT be free'd by the caller. | |
92 | * | |
93 | * @since 0.1.0 | |
94 | */ | |
0c081c63 UH |
95 | SRD_API const char *srd_package_version_string_get(void) |
96 | { | |
97 | return SRD_PACKAGE_VERSION_STRING; | |
98 | } | |
99 | ||
8c664ca2 UH |
100 | /** |
101 | * Get the "current" part of the libsigrokdecode library version number. | |
102 | * | |
103 | * @return The "current" library version number. | |
104 | * | |
105 | * @since 0.1.0 | |
106 | */ | |
0c081c63 UH |
107 | SRD_API int srd_lib_version_current_get(void) |
108 | { | |
109 | return SRD_LIB_VERSION_CURRENT; | |
110 | } | |
111 | ||
8c664ca2 UH |
112 | /** |
113 | * Get the "revision" part of the libsigrokdecode library version number. | |
114 | * | |
115 | * @return The "revision" library version number. | |
116 | * | |
117 | * @since 0.1.0 | |
118 | */ | |
0c081c63 UH |
119 | SRD_API int srd_lib_version_revision_get(void) |
120 | { | |
121 | return SRD_LIB_VERSION_REVISION; | |
122 | } | |
123 | ||
8c664ca2 UH |
124 | /** |
125 | * Get the "age" part of the libsigrokdecode library version number. | |
126 | * | |
127 | * @return The "age" library version number. | |
128 | * | |
129 | * @since 0.1.0 | |
130 | */ | |
0c081c63 UH |
131 | SRD_API int srd_lib_version_age_get(void) |
132 | { | |
133 | return SRD_LIB_VERSION_AGE; | |
134 | } | |
135 | ||
8c664ca2 UH |
136 | /** |
137 | * Get the libsigrokdecode library version number as a string. | |
138 | * | |
139 | * @return The library version number string. The returned string is | |
140 | * static and thus should NOT be free'd by the caller. | |
141 | * | |
142 | * @since 0.1.0 | |
143 | */ | |
0c081c63 UH |
144 | SRD_API const char *srd_lib_version_string_get(void) |
145 | { | |
146 | return SRD_LIB_VERSION_STRING; | |
147 | } | |
4895418c | 148 | |
cdb49509 UH |
149 | SRD_API GSList *srd_buildinfo_libs_get(void) |
150 | { | |
151 | GSList *l = NULL, *m = NULL; | |
152 | ||
153 | m = g_slist_append(NULL, g_strdup("glib")); | |
154 | m = g_slist_append(m, g_strdup_printf("%d.%d.%d (rt: %d.%d.%d/%d:%d)", | |
155 | GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION, | |
156 | glib_major_version, glib_minor_version, glib_micro_version, | |
157 | glib_binary_age, glib_interface_age)); | |
158 | l = g_slist_append(l, m); | |
159 | ||
160 | m = g_slist_append(NULL, g_strdup("Python")); | |
161 | m = g_slist_append(m, g_strdup_printf("%s / 0x%x (API %s, ABI %s)", | |
162 | PY_VERSION, PY_VERSION_HEX, PYTHON_API_STRING, PYTHON_ABI_STRING)); | |
163 | l = g_slist_append(l, m); | |
164 | ||
165 | return l; | |
166 | } | |
167 | ||
168 | SRD_API char *srd_buildinfo_host_get(void) | |
169 | { | |
170 | return g_strdup_printf("%s, %s-endian", CONF_HOST, | |
171 | #ifdef WORDS_BIGENDIAN | |
172 | "big" | |
173 | #else | |
174 | "little" | |
175 | #endif | |
176 | ); | |
177 | } | |
178 | ||
4895418c | 179 | /** @} */ |