bba9f494195d2f70289ddb55c12fa2eb87aee4ab
[platform/upstream/atk.git] / atk / atkversion.h.in
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 (@ATK_MAJOR_VERSION@)
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 (@ATK_MINOR_VERSION@)
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 (@ATK_MICRO_VERSION@)
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    (@ATK_BINARY_AGE@)
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 (@ATK_INTERFACE_AGE@)
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 /* evaluates to the current stable version; for development cycles,
180  * this means the next stable target
181  */
182 #if (ATK_MINOR_VERSION % 2)
183 #define ATK_VERSION_CUR_STABLE         (G_ENCODE_VERSION (ATK_MAJOR_VERSION, ATK_MINOR_VERSION + 1))
184 #else
185 #define ATK_VERSION_CUR_STABLE         (G_ENCODE_VERSION (ATK_MAJOR_VERSION, ATK_MINOR_VERSION))
186 #endif
187
188 /* evaluates to the previous stable version */
189 #if (ATK_MINOR_VERSION % 2)
190 #define ATK_VERSION_PREV_STABLE        (G_ENCODE_VERSION (ATK_MAJOR_VERSION, ATK_MINOR_VERSION - 1))
191 #else
192 #define ATK_VERSION_PREV_STABLE        (G_ENCODE_VERSION (ATK_MAJOR_VERSION, ATK_MINOR_VERSION - 2))
193 #endif
194
195 /**
196  * ATK_VERSION_MIN_REQUIRED:
197  *
198  * A macro that should be defined by the user prior to including
199  * the atk/atk.h header.
200  * The definition should be one of the predefined ATK version
201  * macros: %ATK_VERSION_2_12, %ATK_VERSION_2_14,...
202  *
203  * This macro defines the earliest version of ATK that the package is
204  * required to be able to compile against.
205  *
206  * If the compiler is configured to warn about the use of deprecated
207  * functions, then using functions that were deprecated in version
208  * %ATK_VERSION_MIN_REQUIRED or earlier will cause warnings (but
209  * using functions deprecated in later releases will not).
210  *
211  * Since: 2.14
212  */
213 /* If the package sets ATK_VERSION_MIN_REQUIRED to some future
214  * ATK_VERSION_X_Y value that we don't know about, it will compare as
215  * 0 in preprocessor tests.
216  */
217 #ifndef ATK_VERSION_MIN_REQUIRED
218 # define ATK_VERSION_MIN_REQUIRED      (ATK_VERSION_CUR_STABLE)
219 #elif ATK_VERSION_MIN_REQUIRED == 0
220 # undef  ATK_VERSION_MIN_REQUIRED
221 # define ATK_VERSION_MIN_REQUIRED      (ATK_VERSION_CUR_STABLE + 2)
222 #endif
223
224 /**
225  * ATK_VERSION_MAX_ALLOWED:
226  *
227  * A macro that should be defined by the user prior to including
228  * the atk/atk.h header.
229  * The definition should be one of the predefined ATK version
230  * macros: %ATK_VERSION_2_12, %ATK_VERSION_2_14,...
231  *
232  * This macro defines the latest version of the ATK API that the
233  * package is allowed to make use of.
234  *
235  * If the compiler is configured to warn about the use of deprecated
236  * functions, then using functions added after version
237  * %ATK_VERSION_MAX_ALLOWED will cause warnings.
238  *
239  * Unless you are using ATK_CHECK_VERSION() or the like to compile
240  * different code depending on the ATK version, then this should be
241  * set to the same value as %ATK_VERSION_MIN_REQUIRED.
242  *
243  * Since: 2.14
244  */
245 #if !defined (ATK_VERSION_MAX_ALLOWED) || (ATK_VERSION_MAX_ALLOWED == 0)
246 # undef ATK_VERSION_MAX_ALLOWED
247 # define ATK_VERSION_MAX_ALLOWED      (ATK_VERSION_CUR_STABLE)
248 #endif
249
250 /* sanity checks */
251 #if ATK_VERSION_MIN_REQUIRED > ATK_VERSION_CUR_STABLE
252 #error "ATK_VERSION_MIN_REQUIRED must be <= ATK_VERSION_CUR_STABLE"
253 #endif
254 #if ATK_VERSION_MAX_ALLOWED < ATK_VERSION_MIN_REQUIRED
255 #error "ATK_VERSION_MAX_ALLOWED must be >= ATK_VERSION_MIN_REQUIRED"
256 #endif
257 #if ATK_VERSION_MIN_REQUIRED < ATK_VERSION_2_2
258 #error "ATK_VERSION_MIN_REQUIRED must be >= ATK_VERSION_2_2"
259 #endif
260
261 /* these macros are used to mark deprecated functions, and thus have to be
262  * exposed in a public header.
263  *
264  * do *not* use them in other libraries depending on Atk: use G_DEPRECATED
265  * and G_DEPRECATED_FOR, or use your own wrappers around them.
266  */
267 #ifdef ATK_DISABLE_DEPRECATION_WARNINGS
268 #define ATK_DEPRECATED _ATK_EXTERN
269 #define ATK_DEPRECATED_FOR(f) _ATK_EXTERN
270 #define ATK_UNAVAILABLE(maj,min) _ATK_EXTERN
271 #else
272 #define ATK_DEPRECATED G_DEPRECATED _ATK_EXTERN
273 #define ATK_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) _ATK_EXTERN
274 #define ATK_UNAVAILABLE(maj,min) G_UNAVAILABLE(maj,min) _ATK_EXTERN
275 #endif
276
277 #define ATK_AVAILABLE_IN_ALL _ATK_EXTERN
278
279 /* XXX: Every new stable minor release should add a set of macros here */
280
281 #if ATK_VERSION_MIN_REQUIRED >= ATK_VERSION_2_2
282 # define ATK_DEPRECATED_IN_2_2                ATK_DEPRECATED
283 # define ATK_DEPRECATED_IN_2_2_FOR(f)         ATK_DEPRECATED_FOR(f)
284 #else
285 # define ATK_DEPRECATED_IN_2_2                _ATK_EXTERN
286 # define ATK_DEPRECATED_IN_2_2_FOR(f)         _ATK_EXTERN
287 #endif
288
289 #if ATK_VERSION_MAX_ALLOWED < ATK_VERSION_2_2
290 # define ATK_AVAILABLE_IN_2_2                 ATK_UNAVAILABLE(2, 2)
291 #else
292 # define ATK_AVAILABLE_IN_2_2                 _ATK_EXTERN
293 #endif
294
295 #if ATK_VERSION_MIN_REQUIRED >= ATK_VERSION_2_4
296 # define ATK_DEPRECATED_IN_2_4                ATK_DEPRECATED
297 # define ATK_DEPRECATED_IN_2_4_FOR(f)         ATK_DEPRECATED_FOR(f)
298 #else
299 # define ATK_DEPRECATED_IN_2_4                _ATK_EXTERN
300 # define ATK_DEPRECATED_IN_2_4_FOR(f)         _ATK_EXTERN
301 #endif
302
303 #if ATK_VERSION_MAX_ALLOWED < ATK_VERSION_2_4
304 # define ATK_AVAILABLE_IN_2_4                 ATK_UNAVAILABLE(2, 4)
305 #else
306 # define ATK_AVAILABLE_IN_2_4                 _ATK_EXTERN
307 #endif
308
309 #if ATK_VERSION_MIN_REQUIRED >= ATK_VERSION_2_6
310 # define ATK_DEPRECATED_IN_2_6                ATK_DEPRECATED
311 # define ATK_DEPRECATED_IN_2_6_FOR(f)         ATK_DEPRECATED_FOR(f)
312 #else
313 # define ATK_DEPRECATED_IN_2_6                _ATK_EXTERN
314 # define ATK_DEPRECATED_IN_2_6_FOR(f)         _ATK_EXTERN
315 #endif
316
317 #if ATK_VERSION_MAX_ALLOWED < ATK_VERSION_2_6
318 # define ATK_AVAILABLE_IN_2_6                 ATK_UNAVAILABLE(2, 6)
319 #else
320 # define ATK_AVAILABLE_IN_2_6                 _ATK_EXTERN
321 #endif
322
323 #if ATK_VERSION_MIN_REQUIRED >= ATK_VERSION_2_8
324 # define ATK_DEPRECATED_IN_2_8                ATK_DEPRECATED
325 # define ATK_DEPRECATED_IN_2_8_FOR(f)         ATK_DEPRECATED_FOR(f)
326 #else
327 # define ATK_DEPRECATED_IN_2_8                _ATK_EXTERN
328 # define ATK_DEPRECATED_IN_2_8_FOR(f)         _ATK_EXTERN
329 #endif
330
331 #if ATK_VERSION_MAX_ALLOWED < ATK_VERSION_2_8
332 # define ATK_AVAILABLE_IN_2_8                 ATK_UNAVAILABLE(2, 8)
333 #else
334 # define ATK_AVAILABLE_IN_2_8                 _ATK_EXTERN
335 #endif
336
337 #if ATK_VERSION_MIN_REQUIRED >= ATK_VERSION_2_10
338 # define ATK_DEPRECATED_IN_2_10                ATK_DEPRECATED
339 # define ATK_DEPRECATED_IN_2_10_FOR(f)         ATK_DEPRECATED_FOR(f)
340 #else
341 # define ATK_DEPRECATED_IN_2_10                _ATK_EXTERN
342 # define ATK_DEPRECATED_IN_2_10_FOR(f)         _ATK_EXTERN
343 #endif
344
345 #if ATK_VERSION_MAX_ALLOWED < ATK_VERSION_2_10
346 # define ATK_AVAILABLE_IN_2_10                 ATK_UNAVAILABLE(2, 10)
347 #else
348 # define ATK_AVAILABLE_IN_2_10                 _ATK_EXTERN
349 #endif
350
351 #if ATK_VERSION_MIN_REQUIRED >= ATK_VERSION_2_12
352 # define ATK_DEPRECATED_IN_2_12                ATK_DEPRECATED
353 # define ATK_DEPRECATED_IN_2_12_FOR(f)         ATK_DEPRECATED_FOR(f)
354 #else
355 # define ATK_DEPRECATED_IN_2_12                _ATK_EXTERN
356 # define ATK_DEPRECATED_IN_2_12_FOR(f)         _ATK_EXTERN
357 #endif
358
359 #if ATK_VERSION_MAX_ALLOWED < ATK_VERSION_2_12
360 # define ATK_AVAILABLE_IN_2_12                 ATK_UNAVAILABLE(2, 12)
361 #else
362 # define ATK_AVAILABLE_IN_2_12                 _ATK_EXTERN
363 #endif
364
365 #if ATK_VERSION_MIN_REQUIRED >= ATK_VERSION_2_14
366 # define ATK_DEPRECATED_IN_2_14                ATK_DEPRECATED
367 # define ATK_DEPRECATED_IN_2_14_FOR(f)         ATK_DEPRECATED_FOR(f)
368 #else
369 # define ATK_DEPRECATED_IN_2_14                _ATK_EXTERN
370 # define ATK_DEPRECATED_IN_2_14_FOR(f)         _ATK_EXTERN
371 #endif
372
373 #if ATK_VERSION_MAX_ALLOWED < ATK_VERSION_2_14
374 # define ATK_AVAILABLE_IN_2_14                 ATK_UNAVAILABLE(2, 14)
375 #else
376 # define ATK_AVAILABLE_IN_2_14                 _ATK_EXTERN
377 #endif
378
379 ATK_AVAILABLE_IN_2_8
380 guint atk_get_major_version (void) G_GNUC_CONST;
381 ATK_AVAILABLE_IN_2_8
382 guint atk_get_minor_version (void) G_GNUC_CONST;
383 ATK_AVAILABLE_IN_2_8
384 guint atk_get_micro_version (void) G_GNUC_CONST;
385 ATK_AVAILABLE_IN_2_8
386 guint atk_get_binary_age    (void) G_GNUC_CONST;
387 ATK_AVAILABLE_IN_2_8
388 guint atk_get_interface_age (void) G_GNUC_CONST;
389
390 #define atk_major_version atk_get_major_version ()
391 #define atk_minor_version atk_get_minor_version ()
392 #define atk_micro_version atk_get_micro_version ()
393 #define atk_binary_age atk_get_binary_age ()
394 #define atk_interface_age atk_get_interface_age ()
395
396 #endif /* __ATK_VERSION_H__ */