aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/eina/src/include/eina_types.h
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/eina/src/include/eina_types.h')
-rw-r--r--libraries/eina/src/include/eina_types.h282
1 files changed, 282 insertions, 0 deletions
diff --git a/libraries/eina/src/include/eina_types.h b/libraries/eina/src/include/eina_types.h
new file mode 100644
index 0000000..8c77cdf
--- /dev/null
+++ b/libraries/eina/src/include/eina_types.h
@@ -0,0 +1,282 @@
1/* EINA - EFL data type library
2 * Copyright (C) 2007-2008 Carsten Haitzler, Vincent Torri, Jorge Luis Zapata Muga
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library;
16 * if not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef EINA_TYPES_H_
20#define EINA_TYPES_H_
21
22/**
23 * @addtogroup Eina_Core_Group Core
24 *
25 * @{
26 */
27
28/**
29 * @defgroup Eina_Types_Group Types
30 *
31 * @{
32 */
33
34#ifdef EAPI
35# undef EAPI
36#endif
37
38#ifdef _WIN32
39# ifdef EFL_EINA_BUILD
40# ifdef DLL_EXPORT
41# define EAPI __declspec(dllexport)
42# else
43# define EAPI
44# endif /* ! DLL_EXPORT */
45# else
46# define EAPI __declspec(dllimport)
47# endif /* ! EFL_EINA_BUILD */
48#else
49# ifdef __GNUC__
50# if __GNUC__ >= 4
51# define EAPI __attribute__ ((visibility("default")))
52# else
53# define EAPI
54# endif
55# else
56# define EAPI
57# endif
58#endif
59
60#include "eina_config.h"
61
62#ifdef EINA_WARN_UNUSED_RESULT
63# undef EINA_WARN_UNUSED_RESULT
64#endif
65#ifdef EINA_ARG_NONNULL
66# undef EINA_ARG_NONNULL
67#endif
68#ifdef EINA_DEPRECATED
69# undef EINA_DEPRECATED
70#endif
71#ifdef EINA_MALLOC
72# undef EINA_MALLOC
73#endif
74#ifdef EINA_PURE
75# undef EINA_PURE
76#endif
77#ifdef EINA_PRINTF
78# undef EINA_PRINTF
79#endif
80#ifdef EINA_SCANF
81# undef EINA_SCANF
82#endif
83#ifdef EINA_FORMAT
84# undef EINA_FORMAT
85#endif
86#ifdef EINA_CONST
87# undef EINA_CONST
88#endif
89#ifdef EINA_NOINSTRUMENT
90# undef EINA_NOINSTRUMENT
91#endif
92#ifdef EINA_UNLIKELY
93# undef EINA_UNLIKELY
94#endif
95#ifdef EINA_LIKELY
96# undef EINA_LIKELY
97#endif
98
99#ifdef __GNUC__
100# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
101# define EINA_WARN_UNUSED_RESULT __attribute__ ((warn_unused_result))
102# else
103# define EINA_WARN_UNUSED_RESULT
104# endif
105
106# if (!defined(EINA_SAFETY_CHECKS)) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
107# define EINA_ARG_NONNULL(idx, ...) __attribute__ ((nonnull(idx, ## __VA_ARGS__)))
108# else
109# define EINA_ARG_NONNULL(idx, ...)
110# endif
111
112# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
113# define EINA_DEPRECATED __attribute__ ((__deprecated__))
114# else
115# define EINA_DEPRECATED
116# endif
117
118# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
119# define EINA_MALLOC __attribute__ ((malloc))
120# define EINA_PURE __attribute__ ((pure))
121# else
122# define EINA_MALLOC
123# define EINA_PURE
124# endif
125
126# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
127# define EINA_PRINTF(fmt, arg) __attribute__((format (printf, fmt, arg)))
128# define EINA_SCANF(fmt, arg) __attribute__((format (scanf, fmt, arg)))
129# define EINA_FORMAT(fmt) __attribute__((format_arg(fmt)))
130# define EINA_CONST __attribute__((const))
131# define EINA_NOINSTRUMENT __attribute__((no_instrument_function))
132# define EINA_UNLIKELY(exp) __builtin_expect((exp), 0)
133# define EINA_LIKELY(exp) __builtin_expect((exp), 1)
134# else
135# define EINA_PRINTF(fmt, arg)
136# define EINA_SCANF(fmt, arg)
137# define EINA_FORMAT(fmt)
138# define EINA_CONST
139# define EINA_NOINSTRUMENT
140# define EINA_UNLIKELY(exp) exp
141# define EINA_LIKELY(exp) exp
142# endif
143
144#elif defined(_WIN32)
145# define EINA_WARN_UNUSED_RESULT
146# define EINA_ARG_NONNULL(idx, ...)
147# if defined(_MSC_VER) && _MSC_VER >= 1300
148# define EINA_DEPRECATED __declspec(deprecated)
149# else
150# define EINA_DEPRECATED
151# endif
152# define EINA_MALLOC
153# define EINA_PURE
154# define EINA_PRINTF(fmt, arg)
155# define EINA_SCANF(fmt, arg)
156# define EINA_FORMAT(fmt)
157# define EINA_CONST
158# define EINA_NOINSTRUMENT
159# define EINA_UNLIKELY(exp) exp
160# define EINA_LIKELY(exp) exp
161
162#elif defined(__SUNPRO_C)
163# define EINA_WARN_UNUSED_RESULT
164# define EINA_ARG_NONNULL(...)
165# define EINA_DEPRECATED
166# if __SUNPRO_C >= 0x590
167# define EINA_MALLOC __attribute__ ((malloc))
168# define EINA_PURE __attribute__ ((pure))
169# else
170# define EINA_MALLOC
171# define EINA_PURE
172# endif
173# define EINA_PRINTF(fmt, arg)
174# define EINA_SCANF(fmt, arg)
175# define EINA_FORMAT(fmt)
176# if __SUNPRO_C >= 0x590
177# define EINA_CONST __attribute__ ((const))
178# else
179# define EINA_CONST
180# endif
181# define EINA_NOINSTRUMENT
182# define EINA_UNLIKELY(exp) exp
183# define EINA_LIKELY(exp) exp
184
185#else /* ! __GNUC__ && ! _WIN32 && ! __SUNPRO_C */
186
187/**
188 * @def EINA_WARN_UNUSED_RESULT
189 * Used to warn when the returned value of the function is not used.
190 */
191# define EINA_WARN_UNUSED_RESULT
192
193/**
194 * @def EINA_ARG_NONNULL
195 * Used to warn when the specified arguments of the function are @c NULL.
196 */
197# define EINA_ARG_NONNULL(idx, ...)
198
199/**
200 * @def EINA_DEPRECATED
201 * Used to warn when the function is considered as deprecated.
202 */
203# define EINA_DEPRECATED
204# define EINA_MALLOC
205# define EINA_PURE
206# define EINA_PRINTF(fmt, arg)
207# define EINA_SCANF(fmt, arg)
208# define EINA_FORMAT(fmt)
209# define EINA_CONST
210# define EINA_NOINSTRUMENT
211# define EINA_UNLIKELY(exp) exp
212# define EINA_LIKELY(exp) exp
213#endif /* ! __GNUC__ && ! _WIN32 && ! __SUNPRO_C */
214
215/**
216 * @typedef Eina_Bool
217 * Type to mimic a boolean.
218 *
219 * @note it differs from stdbool.h as this is defined as an unsigned
220 * char to make it usable by bitfields (Eina_Bool name:1) and
221 * also take as few bytes as possible.
222 */
223typedef unsigned char Eina_Bool;
224
225/**
226 * @def EINA_FALSE
227 * boolean value FALSE (numerical value 0)
228 */
229#define EINA_FALSE ((Eina_Bool)0)
230
231/**
232 * @def EINA_TRUE
233 * boolean value TRUE (numerical value 1)
234 */
235#define EINA_TRUE ((Eina_Bool)1)
236
237EAPI extern const unsigned int eina_prime_table[];
238
239/**
240 * @typedef Eina_Compare_Cb
241 * Function used in functions using sorting. It compares @p data1 and
242 * @p data2. If @p data1 is 'less' than @p data2, -1 must be returned,
243 * if it is 'greater', 1 must be returned, and if they are equal, 0
244 * must be returned.
245 */
246typedef int (*Eina_Compare_Cb)(const void *data1, const void *data2);
247
248/**
249 * @def EINA_COMPARE_CB
250 * Macro to cast to Eina_Compare_Cb.
251 */
252#define EINA_COMPARE_CB(function) ((Eina_Compare_Cb)function)
253
254typedef Eina_Bool (*Eina_Each_Cb)(const void *container, void *data, void *fdata);
255
256/**
257 * @def EINA_EACH_CB
258 * Macro to cast to Eina_Each.
259 */
260#define EINA_EACH_CB(Function) ((Eina_Each_Cb)Function)
261
262/**
263 * @typedef Eina_Free_Cb
264 * A callback type used to free data when iterating over a container.
265 */
266typedef void (*Eina_Free_Cb)(void *data);
267
268/**
269 * @def EINA_FREE_CB
270 * Macro to cast to Eina_Free_Cb.
271 */
272#define EINA_FREE_CB(Function) ((Eina_Free_Cb)Function)
273
274/**
275 * @}
276 */
277
278/**
279 * @}
280 */
281
282#endif /* EINA_TYPES_H_ */