1/* ATK - Accessibility Toolkit
2 *
3 * Copyright (C) 2012 Igalia, S.L.
4 * Copyright (C) 2014 Chun-wei Fan
5 *
6 * Author: Alejandro PiƱeiro Iglesias <apinheiro@igalia.com>
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
17 *
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the
20 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 * Boston, MA 02111-1307, USA.
22 */
23
24#if defined(ATK_DISABLE_SINGLE_INCLUDES) && !defined (__ATK_H_INSIDE__) && !defined (ATK_COMPILATION)
25#error "Only <atk/atk.h> can be included directly."
26#endif
27
28#ifndef __ATK_VERSION_H__
29#define __ATK_VERSION_H__
30
31#include <glib.h>
32
33/**
34 * ATK_MAJOR_VERSION:
35 *
36 * Like atk_get_major_version(), but from the headers used at
37 * application compile time, rather than from the library linked
38 * against at application run time.
39 *
40 * Since: 2.7.4
41 */
42#define ATK_MAJOR_VERSION (2)
43
44/**
45 * ATK_MINOR_VERSION:
46 *
47 * Like atk_get_minor_version(), but from the headers used at
48 * application compile time, rather than from the library linked
49 * against at application run time.
50 *
51 * Since: 2.7.4
52 */
53#define ATK_MINOR_VERSION (52)
54
55/**
56 * ATK_MICRO_VERSION:
57 *
58 * Like atk_get_micro_version(), but from the headers used at
59 * application compile time, rather than from the library linked
60 * against at application run time.
61 *
62 * Since: 2.7.4
63 */
64#define ATK_MICRO_VERSION (0)
65
66/**
67 * ATK_BINARY_AGE:
68 *
69 * Like atk_get_binary_age(), but from the headers used at
70 * application compile time, rather than from the library linked
71 * against at application run time.
72 *
73 * Since: 2.7.4
74 */
75#define ATK_BINARY_AGE (25210)
76
77/**
78 * ATK_INTERFACE_AGE:
79 *
80 * Like atk_get_interface_age(), but from the headers used at
81 * application compile time, rather than from the library linked
82 * against at application run time.
83 *
84 * Since: 2.7.4
85 */
86#define ATK_INTERFACE_AGE (1)
87
88/**
89 * ATK_CHECK_VERSION:
90 * @major: major version (e.g. 1 for version 1.2.5)
91 * @minor: minor version (e.g. 2 for version 1.2.5)
92 * @micro: micro version (e.g. 5 for version 1.2.5)
93 *
94 * Returns %TRUE if the version of the ATK header files is the same as
95 * or newer than the passed-in version.
96 *
97 * Since: 2.7.4
98 */
99#define ATK_CHECK_VERSION(major,minor,micro) \
100 (ATK_MAJOR_VERSION > (major) || \
101 (ATK_MAJOR_VERSION == (major) && ATK_MINOR_VERSION > (minor)) || \
102 (ATK_MAJOR_VERSION == (major) && ATK_MINOR_VERSION == (minor) && \
103 ATK_MICRO_VERSION >= (micro)))
104
105#ifndef _ATK_EXTERN
106#define _ATK_EXTERN extern
107#endif
108
109/**
110 * ATK_VERSION_2_2:
111 *
112 * A macro that evaluates to the 2.2 version of ATK, in a format
113 * that can be used by the C pre-processor.
114 *
115 * Since: 2.14
116 */
117#define ATK_VERSION_2_2 (G_ENCODE_VERSION (2, 2))
118
119/**
120 * ATK_VERSION_2_4:
121 *
122 * A macro that evaluates to the 2.4 version of ATK, in a format
123 * that can be used by the C pre-processor.
124 *
125 * Since: 2.14
126 */
127#define ATK_VERSION_2_4 (G_ENCODE_VERSION (2, 4))
128
129/**
130 * ATK_VERSION_2_6:
131 *
132 * A macro that evaluates to the 2.6 version of ATK, in a format
133 * that can be used by the C pre-processor.
134 *
135 * Since: 2.14
136 */
137#define ATK_VERSION_2_6 (G_ENCODE_VERSION (2, 6))
138
139/**
140 * ATK_VERSION_2_8:
141 *
142 * A macro that evaluates to the 2.8 version of ATK, in a format
143 * that can be used by the C pre-processor.
144 *
145 * Since: 2.14
146 */
147#define ATK_VERSION_2_8 (G_ENCODE_VERSION (2, 8))
148
149/**
150 * ATK_VERSION_2_10:
151 *
152 * A macro that evaluates to the 2.10 version of ATK, in a format
153 * that can be used by the C pre-processor.
154 *
155 * Since: 2.14
156 */
157
158#define ATK_VERSION_2_10 (G_ENCODE_VERSION (2, 10))
159/**
160 * ATK_VERSION_2_12:
161 *
162 * A macro that evaluates to the 2.12 version of ATK, in a format
163 * that can be used by the C pre-processor.
164 *
165 * Since: 2.14
166 */
167#define ATK_VERSION_2_12 (G_ENCODE_VERSION (2, 12))
168
169/**
170 * ATK_VERSION_2_14:
171 *
172 * A macro that evaluates to the 2.14 version of ATK, in a format
173 * that can be used by the C pre-processor.
174 *
175 * Since: 2.14
176 */
177#define ATK_VERSION_2_14 (G_ENCODE_VERSION (2, 14))
178
179/**
180 * ATK_VERSION_2_30:
181 *
182 * A macro that evaluates to the 2.30 version of ATK, in a format
183 * that can be used by the C pre-processor.
184 *
185 * Since: 2.30
186 */
187#define ATK_VERSION_2_30 (G_ENCODE_VERSION (2, 30))
188
189/**
190 * ATK_VERSION_2_32:
191 *
192 * A macro that evaluates to the 2.30 version of ATK, in a format
193 * that can be used by the C pre-processor.
194 *
195 * Since: 2.52
196 */
197#define ATK_VERSION_2_32 (G_ENCODE_VERSION (2, 32))
198
199/**
200 * ATK_VERSION_2_36:
201 *
202 * A macro that evaluates to the 2.36 version of ATK, in a format
203 * that can be used by the C pre-processor.
204 *
205 * Since: 2.36
206 */
207#define ATK_VERSION_2_36 (G_ENCODE_VERSION (2, 36))
208
209/**
210 * ATK_VERSION_2_52:
211 *
212 * A macro that evaluates to the 2.52 version of ATK, in a format
213 * that can be used by the C pre-processor.
214 *
215 * Since: 2.52
216 */
217#define ATK_VERSION_2_52 (G_ENCODE_VERSION (2, 52))
218
219/* evaluates to the current stable version; for development cycles,
220 * this means the next stable target
221 */
222#if (ATK_MINOR_VERSION % 2)
223#define ATK_VERSION_CUR_STABLE (G_ENCODE_VERSION (ATK_MAJOR_VERSION, ATK_MINOR_VERSION + 1))
224#else
225#define ATK_VERSION_CUR_STABLE (G_ENCODE_VERSION (ATK_MAJOR_VERSION, ATK_MINOR_VERSION))
226#endif
227
228/* evaluates to the previous stable version */
229#if (ATK_MINOR_VERSION % 2)
230#define ATK_VERSION_PREV_STABLE (G_ENCODE_VERSION (ATK_MAJOR_VERSION, ATK_MINOR_VERSION - 1))
231#else
232#define ATK_VERSION_PREV_STABLE (G_ENCODE_VERSION (ATK_MAJOR_VERSION, ATK_MINOR_VERSION - 2))
233#endif
234
235/**
236 * ATK_VERSION_MIN_REQUIRED:
237 *
238 * A macro that should be defined by the user prior to including
239 * the atk/atk.h header.
240 * The definition should be one of the predefined ATK version
241 * macros: %ATK_VERSION_2_12, %ATK_VERSION_2_14,...
242 *
243 * This macro defines the earliest version of ATK that the package is
244 * required to be able to compile against.
245 *
246 * If the compiler is configured to warn about the use of deprecated
247 * functions, then using functions that were deprecated in version
248 * %ATK_VERSION_MIN_REQUIRED or earlier will cause warnings (but
249 * using functions deprecated in later releases will not).
250 *
251 * Since: 2.14
252 */
253/* If the package sets ATK_VERSION_MIN_REQUIRED to some future
254 * ATK_VERSION_X_Y value that we don't know about, it will compare as
255 * 0 in preprocessor tests.
256 */
257#ifndef ATK_VERSION_MIN_REQUIRED
258# define ATK_VERSION_MIN_REQUIRED (ATK_VERSION_CUR_STABLE)
259#elif ATK_VERSION_MIN_REQUIRED == 0
260# undef ATK_VERSION_MIN_REQUIRED
261# define ATK_VERSION_MIN_REQUIRED (ATK_VERSION_CUR_STABLE + 2)
262#endif
263
264/**
265 * ATK_VERSION_MAX_ALLOWED:
266 *
267 * A macro that should be defined by the user prior to including
268 * the atk/atk.h header.
269 * The definition should be one of the predefined ATK version
270 * macros: %ATK_VERSION_2_12, %ATK_VERSION_2_14,...
271 *
272 * This macro defines the latest version of the ATK API that the
273 * package is allowed to make use of.
274 *
275 * If the compiler is configured to warn about the use of deprecated
276 * functions, then using functions added after version
277 * %ATK_VERSION_MAX_ALLOWED will cause warnings.
278 *
279 * Unless you are using ATK_CHECK_VERSION() or the like to compile
280 * different code depending on the ATK version, then this should be
281 * set to the same value as %ATK_VERSION_MIN_REQUIRED.
282 *
283 * Since: 2.14
284 */
285#if !defined (ATK_VERSION_MAX_ALLOWED) || (ATK_VERSION_MAX_ALLOWED == 0)
286# undef ATK_VERSION_MAX_ALLOWED
287# define ATK_VERSION_MAX_ALLOWED (ATK_VERSION_CUR_STABLE)
288#endif
289
290/* sanity checks */
291#if ATK_VERSION_MIN_REQUIRED > ATK_VERSION_CUR_STABLE
292#error "ATK_VERSION_MIN_REQUIRED must be <= ATK_VERSION_CUR_STABLE"
293#endif
294#if ATK_VERSION_MAX_ALLOWED < ATK_VERSION_MIN_REQUIRED
295#error "ATK_VERSION_MAX_ALLOWED must be >= ATK_VERSION_MIN_REQUIRED"
296#endif
297#if ATK_VERSION_MIN_REQUIRED < ATK_VERSION_2_2
298#error "ATK_VERSION_MIN_REQUIRED must be >= ATK_VERSION_2_2"
299#endif
300
301/* these macros are used to mark deprecated functions, and thus have to be
302 * exposed in a public header.
303 *
304 * do *not* use them in other libraries depending on Atk: use G_DEPRECATED
305 * and G_DEPRECATED_FOR, or use your own wrappers around them.
306 */
307#ifdef ATK_DISABLE_DEPRECATION_WARNINGS
308#define ATK_DEPRECATED _ATK_EXTERN
309#define ATK_DEPRECATED_FOR(f) _ATK_EXTERN
310#define ATK_UNAVAILABLE(maj,min) _ATK_EXTERN
311#else
312#define ATK_DEPRECATED G_DEPRECATED _ATK_EXTERN
313#define ATK_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) _ATK_EXTERN
314#define ATK_UNAVAILABLE(maj,min) G_UNAVAILABLE(maj,min) _ATK_EXTERN
315#endif
316
317#define ATK_AVAILABLE_IN_ALL _ATK_EXTERN
318
319/* XXX: Every new stable minor release should add a set of macros here */
320
321#if ATK_VERSION_MIN_REQUIRED >= ATK_VERSION_2_2
322# define ATK_DEPRECATED_IN_2_2 ATK_DEPRECATED
323# define ATK_DEPRECATED_IN_2_2_FOR(f) ATK_DEPRECATED_FOR(f)
324#else
325# define ATK_DEPRECATED_IN_2_2 _ATK_EXTERN
326# define ATK_DEPRECATED_IN_2_2_FOR(f) _ATK_EXTERN
327#endif
328
329#if ATK_VERSION_MAX_ALLOWED < ATK_VERSION_2_2
330# define ATK_AVAILABLE_IN_2_2 ATK_UNAVAILABLE(2, 2)
331#else
332# define ATK_AVAILABLE_IN_2_2 _ATK_EXTERN
333#endif
334
335#if ATK_VERSION_MIN_REQUIRED >= ATK_VERSION_2_4
336# define ATK_DEPRECATED_IN_2_4 ATK_DEPRECATED
337# define ATK_DEPRECATED_IN_2_4_FOR(f) ATK_DEPRECATED_FOR(f)
338#else
339# define ATK_DEPRECATED_IN_2_4 _ATK_EXTERN
340# define ATK_DEPRECATED_IN_2_4_FOR(f) _ATK_EXTERN
341#endif
342
343#if ATK_VERSION_MAX_ALLOWED < ATK_VERSION_2_4
344# define ATK_AVAILABLE_IN_2_4 ATK_UNAVAILABLE(2, 4)
345#else
346# define ATK_AVAILABLE_IN_2_4 _ATK_EXTERN
347#endif
348
349#if ATK_VERSION_MIN_REQUIRED >= ATK_VERSION_2_6
350# define ATK_DEPRECATED_IN_2_6 ATK_DEPRECATED
351# define ATK_DEPRECATED_IN_2_6_FOR(f) ATK_DEPRECATED_FOR(f)
352#else
353# define ATK_DEPRECATED_IN_2_6 _ATK_EXTERN
354# define ATK_DEPRECATED_IN_2_6_FOR(f) _ATK_EXTERN
355#endif
356
357#if ATK_VERSION_MAX_ALLOWED < ATK_VERSION_2_6
358# define ATK_AVAILABLE_IN_2_6 ATK_UNAVAILABLE(2, 6)
359#else
360# define ATK_AVAILABLE_IN_2_6 _ATK_EXTERN
361#endif
362
363#if ATK_VERSION_MIN_REQUIRED >= ATK_VERSION_2_8
364# define ATK_DEPRECATED_IN_2_8 ATK_DEPRECATED
365# define ATK_DEPRECATED_IN_2_8_FOR(f) ATK_DEPRECATED_FOR(f)
366#else
367# define ATK_DEPRECATED_IN_2_8 _ATK_EXTERN
368# define ATK_DEPRECATED_IN_2_8_FOR(f) _ATK_EXTERN
369#endif
370
371#if ATK_VERSION_MAX_ALLOWED < ATK_VERSION_2_8
372# define ATK_AVAILABLE_IN_2_8 ATK_UNAVAILABLE(2, 8)
373#else
374# define ATK_AVAILABLE_IN_2_8 _ATK_EXTERN
375#endif
376
377#if ATK_VERSION_MIN_REQUIRED >= ATK_VERSION_2_10
378# define ATK_DEPRECATED_IN_2_10 ATK_DEPRECATED
379# define ATK_DEPRECATED_IN_2_10_FOR(f) ATK_DEPRECATED_FOR(f)
380#else
381# define ATK_DEPRECATED_IN_2_10 _ATK_EXTERN
382# define ATK_DEPRECATED_IN_2_10_FOR(f) _ATK_EXTERN
383#endif
384
385#if ATK_VERSION_MAX_ALLOWED < ATK_VERSION_2_10
386# define ATK_AVAILABLE_IN_2_10 ATK_UNAVAILABLE(2, 10)
387#else
388# define ATK_AVAILABLE_IN_2_10 _ATK_EXTERN
389#endif
390
391#if ATK_VERSION_MIN_REQUIRED >= ATK_VERSION_2_12
392# define ATK_DEPRECATED_IN_2_12 ATK_DEPRECATED
393# define ATK_DEPRECATED_IN_2_12_FOR(f) ATK_DEPRECATED_FOR(f)
394#else
395# define ATK_DEPRECATED_IN_2_12 _ATK_EXTERN
396# define ATK_DEPRECATED_IN_2_12_FOR(f) _ATK_EXTERN
397#endif
398
399#if ATK_VERSION_MAX_ALLOWED < ATK_VERSION_2_12
400# define ATK_AVAILABLE_IN_2_12 ATK_UNAVAILABLE(2, 12)
401#else
402# define ATK_AVAILABLE_IN_2_12 _ATK_EXTERN
403#endif
404
405#if ATK_VERSION_MIN_REQUIRED >= ATK_VERSION_2_14
406# define ATK_DEPRECATED_IN_2_14 ATK_DEPRECATED
407# define ATK_DEPRECATED_IN_2_14_FOR(f) ATK_DEPRECATED_FOR(f)
408#else
409# define ATK_DEPRECATED_IN_2_14 _ATK_EXTERN
410# define ATK_DEPRECATED_IN_2_14_FOR(f) _ATK_EXTERN
411#endif
412
413#if ATK_VERSION_MAX_ALLOWED < ATK_VERSION_2_14
414# define ATK_AVAILABLE_IN_2_14 ATK_UNAVAILABLE(2, 14)
415#else
416# define ATK_AVAILABLE_IN_2_14 _ATK_EXTERN
417#endif
418
419#if ATK_VERSION_MIN_REQUIRED >= ATK_VERSION_2_30
420# define ATK_DEPRECATED_IN_2_30 ATK_DEPRECATED
421# define ATK_DEPRECATED_IN_2_30_FOR(f) ATK_DEPRECATED_FOR(f)
422#else
423# define ATK_DEPRECATED_IN_2_30 _ATK_EXTERN
424# define ATK_DEPRECATED_IN_2_30_FOR(f) _ATK_EXTERN
425#endif
426
427#if ATK_VERSION_MAX_ALLOWED < ATK_VERSION_2_30
428# define ATK_AVAILABLE_IN_2_30 ATK_UNAVAILABLE(2, 30)
429#else
430# define ATK_AVAILABLE_IN_2_30 _ATK_EXTERN
431#endif
432
433#if ATK_VERSION_MAX_ALLOWED < ATK_VERSION_2_32
434# define ATK_AVAILABLE_IN_2_32 ATK_UNAVAILABLE(2, 32)
435#else
436# define ATK_AVAILABLE_IN_2_32 _ATK_EXTERN
437#endif
438
439#if ATK_VERSION_MIN_REQUIRED >= ATK_VERSION_2_36
440# define ATK_DEPRECATED_IN_2_36 ATK_DEPRECATED
441# define ATK_DEPRECATED_IN_2_36_FOR(f) ATK_DEPRECATED_FOR(f)
442#else
443# define ATK_DEPRECATED_IN_2_36 _ATK_EXTERN
444# define ATK_DEPRECATED_IN_2_36_FOR(f) _ATK_EXTERN
445#endif
446
447#if ATK_VERSION_MAX_ALLOWED < ATK_VERSION_2_36
448# define ATK_AVAILABLE_IN_2_36 ATK_UNAVAILABLE(2, 36)
449#else
450# define ATK_AVAILABLE_IN_2_36 _ATK_EXTERN
451#endif
452
453#if ATK_VERSION_MAX_ALLOWED < ATK_VERSION_2_52
454# define ATK_AVAILABLE_IN_2_52 ATK_UNAVAILABLE(2, 52)
455#else
456# define ATK_AVAILABLE_IN_2_52 _ATK_EXTERN
457#endif
458
459ATK_AVAILABLE_IN_2_8
460guint atk_get_major_version (void) G_GNUC_CONST;
461ATK_AVAILABLE_IN_2_8
462guint atk_get_minor_version (void) G_GNUC_CONST;
463ATK_AVAILABLE_IN_2_8
464guint atk_get_micro_version (void) G_GNUC_CONST;
465ATK_AVAILABLE_IN_2_8
466guint atk_get_binary_age (void) G_GNUC_CONST;
467ATK_AVAILABLE_IN_2_8
468guint atk_get_interface_age (void) G_GNUC_CONST;
469
470#define atk_major_version atk_get_major_version ()
471#define atk_minor_version atk_get_minor_version ()
472#define atk_micro_version atk_get_micro_version ()
473#define atk_binary_age atk_get_binary_age ()
474#define atk_interface_age atk_get_interface_age ()
475
476#endif /* __ATK_VERSION_H__ */
477

source code of include/atk-1.0/atk/atkversion.h