4 * An OpenGL based 'interactive canvas' library.
6 * Authored By Matthew Allum <mallum@openedhand.com>
8 * Copyright (C) 2006 OpenedHand
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2 of the License, or (at your option) any later version.
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
26 #if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
27 #error "Only <clutter/clutter.h> can be included directly."
31 * SECTION:clutter-version
32 * @short_description: Versioning utility macros
34 * Clutter offers a set of macros for checking the version of the library
35 * at compile time; it also provides a function to perform the same check
38 * Clutter adds version information to both API deprecations and additions;
39 * by definining the macros %CLUTTER_VERSION_MIN_REQUIRED and
40 * %CLUTTER_VERSION_MAX_ALLOWED, you can specify the range of Clutter versions
41 * whose API you want to use. Functions that were deprecated before, or
42 * introduced after, this range will trigger compiler warnings. For instance,
43 * if we define the following symbols:
46 * CLUTTER_VERSION_MIN_REQUIRED = CLUTTER_VERSION_1_6
47 * CLUTTER_VERSION_MAX_ALLOWED = CLUTTER_VERSION_1_8
50 * and we have the following functions annotated in the Clutter headers:
53 * void clutter_function_A (void) CLUTTER_DEPRECATED_IN_1_4;
54 * void clutter_function_B (void) CLUTTER_DEPRECATED_IN_1_6;
55 * void clutter_function_C (void) CLUTTER_AVAILABLE_IN_1_8;
56 * void clutter_function_D (void) CLUTTER_AVAILABLE_IN_1_10;
59 * then any application code using the functions above will get the output:
62 * clutter_function_A: deprecation warning
63 * clutter_function_B: no warning
64 * clutter_function_C: no warning
65 * clutter_function_D: symbol not available warning
68 * It is possible to disable the compiler warnings by defining the macro
69 * %CLUTTER_DISABLE_DEPRECATION_WARNINGS before including the clutter.h
73 #ifndef __CLUTTER_VERSION_H__
74 #define __CLUTTER_VERSION_H__
81 * CLUTTER_MAJOR_VERSION:
83 * The major version of the Clutter library (1, if %CLUTTER_VERSION is 1.2.3)
85 #define CLUTTER_MAJOR_VERSION (1)
88 * CLUTTER_MINOR_VERSION:
90 * The minor version of the Clutter library (2, if %CLUTTER_VERSION is 1.2.3)
92 #define CLUTTER_MINOR_VERSION (10)
95 * CLUTTER_MICRO_VERSION:
97 * The micro version of the Clutter library (3, if %CLUTTER_VERSION is 1.2.3)
99 #define CLUTTER_MICRO_VERSION (0)
104 * The full version of the Clutter library, like 1.2.3
106 #define CLUTTER_VERSION 1.10.0
111 * The full version of the Clutter library, in string form (suited for
112 * string concatenation)
114 #define CLUTTER_VERSION_S "1.10.0"
117 * CLUTTER_VERSION_HEX:
119 * Numerically encoded version of the Clutter library, like 0x010203
121 #define CLUTTER_VERSION_HEX ((CLUTTER_MAJOR_VERSION << 24) | \
122 (CLUTTER_MINOR_VERSION << 16) | \
123 (CLUTTER_MICRO_VERSION << 8))
125 /* XXX - Every new stable minor release bump should add a macro here */
128 * CLUTTER_VERSION_1_0:
130 * A macro that evaluates to the 1.0 version of Clutter, in a format
131 * that can be used by the C pre-processor.
135 #define CLUTTER_VERSION_1_0 (G_ENCODE_VERSION (1, 0))
138 * CLUTTER_VERSION_1_2:
140 * A macro that evaluates to the 1.2 version of Clutter, in a format
141 * that can be used by the C pre-processor.
145 #define CLUTTER_VERSION_1_2 (G_ENCODE_VERSION (1, 2))
148 * CLUTTER_VERSION_1_4:
150 * A macro that evaluates to the 1.4 version of Clutter, in a format
151 * that can be used by the C pre-processor.
155 #define CLUTTER_VERSION_1_4 (G_ENCODE_VERSION (1, 4))
158 * CLUTTER_VERSION_1_6:
160 * A macro that evaluates to the 1.6 version of Clutter, in a format
161 * that can be used by the C pre-processor.
165 #define CLUTTER_VERSION_1_6 (G_ENCODE_VERSION (1, 6))
168 * CLUTTER_VERSION_1_8:
170 * A macro that evaluates to the 1.8 version of Clutter, in a format
171 * that can be used by the C pre-processor.
175 #define CLUTTER_VERSION_1_8 (G_ENCODE_VERSION (1, 8))
178 * CLUTTER_VERSION_1_10:
180 * A macro that evaluates to the 1.10 version of Clutter, in a format
181 * that can be used by the C pre-processor.
185 #define CLUTTER_VERSION_1_10 (G_ENCODE_VERSION (1, 10))
187 /* evaluates to the current stable version; for development cycles,
188 * this means the next stable target
190 #if (CLUTTER_MINOR_VERSION % 2)
191 # define CLUTTER_VERSION_CUR_STABLE (G_ENCODE_VERSION (CLUTTER_MAJOR_VERSION, CLUTTER_MINOR_VERSION + 1))
193 # define CLUTTER_VERSION_CUR_STABLE (G_ENCODE_VERSION (CLUTTER_MAJOR_VERSION, CLUTTER_MINOR_VERSION))
196 /* evaluates to the previous stable version */
197 #if (CLUTTER_MINOR_VERSION % 2)
198 # define CLUTTER_VERSION_PREV_STABLE (G_ENCODE_VERSION (CLUTTER_MAJOR_VERSION, CLUTTER_MINOR_VERSION - 1))
200 # define CLUTTER_VERSION_PREV_STABLE (G_ENCODE_VERSION (CLUTTER_MAJOR_VERSION, CLUTTER_MINOR_VERSION - 2))
204 * CLUTTER_CHECK_VERSION:
205 * @major: major version, like 1 in 1.2.3
206 * @minor: minor version, like 2 in 1.2.3
207 * @micro: micro version, like 3 in 1.2.3
209 * Evaluates to %TRUE if the version of the Clutter library is greater
210 * than @major, @minor and @micro
212 #define CLUTTER_CHECK_VERSION(major,minor,micro) \
213 (CLUTTER_MAJOR_VERSION > (major) || \
214 (CLUTTER_MAJOR_VERSION == (major) && CLUTTER_MINOR_VERSION > (minor)) || \
215 (CLUTTER_MAJOR_VERSION == (major) && CLUTTER_MINOR_VERSION == (minor) && CLUTTER_MICRO_VERSION >= (micro)))
217 /* annotation for exported variables
219 * XXX: this has to be defined here because clutter-macro.h imports this
223 # ifdef CLUTTER_COMPILATION
224 # define CLUTTER_VAR __declspec(dllexport)
226 # define CLUTTER_VAR extern __declspec(dllimport)
229 # define CLUTTER_VAR extern
233 * clutter_major_version:
235 * The major component of the Clutter library version, e.g. 1 if the version
238 * This value can be used for run-time version checks
240 * For a compile-time check, use %CLUTTER_MAJOR_VERSION
244 CLUTTER_VAR const guint clutter_major_version;
247 * clutter_minor_version:
249 * The minor component of the Clutter library version, e.g. 2 if the version
252 * This value can be used for run-time version checks
254 * For a compile-time check, use %CLUTTER_MINOR_VERSION
258 CLUTTER_VAR const guint clutter_minor_version;
261 * clutter_micro_version:
263 * The micro component of the Clutter library version, e.g. 3 if the version
266 * This value can be used for run-time version checks
268 * For a compile-time check, use %CLUTTER_MICRO_VERSION
272 CLUTTER_VAR const guint clutter_micro_version;
274 gboolean clutter_check_version (guint major,
278 gboolean clutter_check_windowing_backend (const char *backend_type);
282 #endif /* __CLUTTER_VERSION_H__ */