diff options
Diffstat (limited to 'libraries/ecore/src/lib/ecore/ecore_private.h')
-rw-r--r-- | libraries/ecore/src/lib/ecore/ecore_private.h | 353 |
1 files changed, 353 insertions, 0 deletions
diff --git a/libraries/ecore/src/lib/ecore/ecore_private.h b/libraries/ecore/src/lib/ecore/ecore_private.h new file mode 100644 index 0000000..f328605 --- /dev/null +++ b/libraries/ecore/src/lib/ecore/ecore_private.h | |||
@@ -0,0 +1,353 @@ | |||
1 | #ifndef _ECORE_PRIVATE_H | ||
2 | #define _ECORE_PRIVATE_H | ||
3 | |||
4 | #include <assert.h> | ||
5 | |||
6 | extern int _ecore_log_dom; | ||
7 | #ifdef _ECORE_DEFAULT_LOG_DOM | ||
8 | # undef _ECORE_DEFAULT_LOG_DOM | ||
9 | #endif | ||
10 | #define _ECORE_DEFAULT_LOG_DOM _ecore_log_dom | ||
11 | |||
12 | #ifdef ECORE_DEFAULT_LOG_COLOR | ||
13 | # undef ECORE_DEFAULT_LOG_COLOR | ||
14 | #endif | ||
15 | #define ECORE_DEFAULT_LOG_COLOR EINA_COLOR_BLUE | ||
16 | |||
17 | #ifdef ERR | ||
18 | # undef ERR | ||
19 | #endif | ||
20 | #define ERR(...) EINA_LOG_DOM_ERR(_ECORE_DEFAULT_LOG_DOM, __VA_ARGS__) | ||
21 | |||
22 | #ifdef DBG | ||
23 | # undef DBG | ||
24 | #endif | ||
25 | #define DBG(...) EINA_LOG_DOM_DBG(_ECORE_DEFAULT_LOG_DOM, __VA_ARGS__) | ||
26 | |||
27 | #ifdef INF | ||
28 | # undef INF | ||
29 | #endif | ||
30 | #define INF(...) EINA_LOG_DOM_INFO(_ECORE_DEFAULT_LOG_DOM, __VA_ARGS__) | ||
31 | |||
32 | #ifdef WRN | ||
33 | # undef WRN | ||
34 | #endif | ||
35 | #define WRN(...) EINA_LOG_DOM_WARN(_ECORE_DEFAULT_LOG_DOM, __VA_ARGS__) | ||
36 | |||
37 | #ifdef CRIT | ||
38 | # undef CRIT | ||
39 | #endif | ||
40 | #define CRIT(...) EINA_LOG_DOM_CRIT(_ECORE_DEFAULT_LOG_DOM, __VA_ARGS__) | ||
41 | |||
42 | #ifndef PATH_MAX | ||
43 | # define PATH_MAX 4096 | ||
44 | #endif | ||
45 | |||
46 | #ifndef MIN | ||
47 | # define MIN(x, y) (((x) > (y)) ? (y) : (x)) | ||
48 | #endif | ||
49 | |||
50 | #ifndef MAX | ||
51 | # define MAX(x, y) (((x) > (y)) ? (x) : (y)) | ||
52 | #endif | ||
53 | |||
54 | #ifndef ABS | ||
55 | # define ABS(x) ((x) < 0 ? -(x) : (x)) | ||
56 | #endif | ||
57 | |||
58 | #ifndef CLAMP | ||
59 | # define CLAMP(x, min, max) (((x) > (max)) ? (max) : (((x) < (min)) ? (min) : (x))) | ||
60 | #endif | ||
61 | |||
62 | #define EVAS_FRAME_QUEUING 1 /* for test */ | ||
63 | |||
64 | #define READBUFSIZ 65536 | ||
65 | |||
66 | #define ECORE_MAGIC_NONE 0x1234fedc | ||
67 | #define ECORE_MAGIC_EXE 0xf7e812f5 | ||
68 | #define ECORE_MAGIC_TIMER 0xf7d713f4 | ||
69 | #define ECORE_MAGIC_IDLER 0xf7c614f3 | ||
70 | #define ECORE_MAGIC_IDLE_ENTERER 0xf7b515f2 | ||
71 | #define ECORE_MAGIC_IDLE_EXITER 0xf7601afd | ||
72 | #define ECORE_MAGIC_FD_HANDLER 0xf7a416f1 | ||
73 | #define ECORE_MAGIC_EVENT_HANDLER 0xf79317f0 | ||
74 | #define ECORE_MAGIC_EVENT_FILTER 0xf78218ff | ||
75 | #define ECORE_MAGIC_EVENT 0xf77119fe | ||
76 | #define ECORE_MAGIC_ANIMATOR 0xf7643ea5 | ||
77 | #define ECORE_MAGIC_POLLER 0xf7568127 | ||
78 | #define ECORE_MAGIC_PIPE 0xf7458226 | ||
79 | #define ECORE_MAGIC_WIN32_HANDLER 0xf7e8f1a3 | ||
80 | #define ECORE_MAGIC_JOB 0x76543210 | ||
81 | |||
82 | #define ECORE_MAGIC Ecore_Magic __magic | ||
83 | |||
84 | #define ECORE_MAGIC_SET(d, m) (d)->__magic = (m) | ||
85 | #define ECORE_MAGIC_CHECK(d, m) ((d) && ((d)->__magic == (m))) | ||
86 | #define ECORE_MAGIC_FAIL(d, m, fn) _ecore_magic_fail((d), (d) ? (d)->__magic : 0, (m), (fn)); | ||
87 | |||
88 | /* undef the following, we want our version */ | ||
89 | #undef FREE | ||
90 | #define FREE(ptr) free(ptr); ptr = NULL; | ||
91 | |||
92 | #undef IF_FREE | ||
93 | #define IF_FREE(ptr) if (ptr) free(ptr); ptr = NULL; | ||
94 | |||
95 | #undef IF_FN_DEL | ||
96 | #define IF_FN_DEL(_fn, ptr) if (ptr) { _fn(ptr); ptr = NULL; } | ||
97 | |||
98 | EAPI void | ||
99 | ecore_print_warning(const char *function, | ||
100 | const char *sparam); | ||
101 | |||
102 | /* convenience macros for checking pointer parameters for non-NULL */ | ||
103 | #undef CHECK_PARAM_POINTER_RETURN | ||
104 | #define CHECK_PARAM_POINTER_RETURN(sparam, param, ret) \ | ||
105 | if (!(param)) \ | ||
106 | { \ | ||
107 | ecore_print_warning(__FUNCTION__, sparam); \ | ||
108 | return ret; \ | ||
109 | } | ||
110 | |||
111 | #undef CHECK_PARAM_POINTER | ||
112 | #define CHECK_PARAM_POINTER(sparam, param) \ | ||
113 | if (!(param)) \ | ||
114 | { \ | ||
115 | ecore_print_warning(__FUNCTION__, sparam); \ | ||
116 | return; \ | ||
117 | } | ||
118 | |||
119 | typedef unsigned int Ecore_Magic; | ||
120 | |||
121 | EAPI void _ecore_magic_fail(const void *d, | ||
122 | Ecore_Magic m, | ||
123 | Ecore_Magic req_m, | ||
124 | const char *fname); | ||
125 | |||
126 | void _ecore_time_init(void); | ||
127 | |||
128 | Ecore_Timer *_ecore_timer_loop_add(double in, | ||
129 | Ecore_Task_Cb func, | ||
130 | const void *data); | ||
131 | void *_ecore_timer_del(Ecore_Timer *timer); | ||
132 | void _ecore_timer_delay(Ecore_Timer *timer, | ||
133 | double add); | ||
134 | void _ecore_timer_shutdown(void); | ||
135 | void _ecore_timer_cleanup(void); | ||
136 | void _ecore_timer_enable_new(void); | ||
137 | double _ecore_timer_next_get(void); | ||
138 | void _ecore_timer_expired_timers_call(double when); | ||
139 | int _ecore_timers_exists(void); | ||
140 | |||
141 | int _ecore_timer_expired_call(double when); | ||
142 | |||
143 | void _ecore_idler_shutdown(void); | ||
144 | int _ecore_idler_all_call(void); | ||
145 | int _ecore_idler_exist(void); | ||
146 | |||
147 | void _ecore_idle_enterer_shutdown(void); | ||
148 | void _ecore_idle_enterer_call(void); | ||
149 | int _ecore_idle_enterer_exist(void); | ||
150 | |||
151 | void _ecore_idle_exiter_shutdown(void); | ||
152 | void _ecore_idle_exiter_call(void); | ||
153 | int _ecore_idle_exiter_exist(void); | ||
154 | |||
155 | void _ecore_event_shutdown(void); | ||
156 | int _ecore_event_exist(void); | ||
157 | Ecore_Event *_ecore_event_add(int type, | ||
158 | void *ev, | ||
159 | Ecore_End_Cb func_free, | ||
160 | void *data); | ||
161 | void _ecore_event_call(void); | ||
162 | void *_ecore_event_handler_del(Ecore_Event_Handler *event_handler); | ||
163 | |||
164 | Ecore_Timer *_ecore_exe_doomsday_clock_get(Ecore_Exe *exe); | ||
165 | void _ecore_exe_doomsday_clock_set(Ecore_Exe *exe, | ||
166 | Ecore_Timer *dc); | ||
167 | |||
168 | EAPI void *_ecore_event_signal_user_new(void); | ||
169 | void *_ecore_event_signal_hup_new(void); | ||
170 | void *_ecore_event_signal_exit_new(void); | ||
171 | void *_ecore_event_signal_power_new(void); | ||
172 | void *_ecore_event_signal_realtime_new(void); | ||
173 | |||
174 | void *_ecore_main_fd_handler_del(Ecore_Fd_Handler *fd_handler); | ||
175 | |||
176 | void _ecore_main_shutdown(void); | ||
177 | |||
178 | #if defined (_WIN32) || defined (__lv2ppu__) | ||
179 | static inline void _ecore_signal_shutdown(void) { } | ||
180 | |||
181 | static inline void _ecore_signal_init(void) { } | ||
182 | |||
183 | static inline void _ecore_signal_received_process(void) { } | ||
184 | |||
185 | static inline int _ecore_signal_count_get(void) { return 0; } | ||
186 | |||
187 | static inline void _ecore_signal_call(void) { } | ||
188 | |||
189 | #else | ||
190 | void _ecore_signal_shutdown(void); | ||
191 | void _ecore_signal_init(void); | ||
192 | void _ecore_signal_received_process(void); | ||
193 | int _ecore_signal_count_get(void); | ||
194 | void _ecore_signal_call(void); | ||
195 | #endif | ||
196 | |||
197 | void _ecore_exe_init(void); | ||
198 | void _ecore_exe_shutdown(void); | ||
199 | #ifndef _WIN32 | ||
200 | Ecore_Exe *_ecore_exe_find(pid_t pid); | ||
201 | void *_ecore_exe_event_del_new(void); | ||
202 | void _ecore_exe_event_del_free(void *data, | ||
203 | void *ev); | ||
204 | #endif | ||
205 | |||
206 | void _ecore_animator_shutdown(void); | ||
207 | |||
208 | void _ecore_poller_shutdown(void); | ||
209 | |||
210 | void _ecore_fps_debug_init(void); | ||
211 | void _ecore_fps_debug_shutdown(void); | ||
212 | void _ecore_fps_debug_runtime_add(double t); | ||
213 | |||
214 | void _ecore_thread_init(void); | ||
215 | void _ecore_thread_shutdown(void); | ||
216 | |||
217 | void _ecore_glib_init(void); | ||
218 | void _ecore_glib_shutdown(void); | ||
219 | |||
220 | void _ecore_job_init(void); | ||
221 | void _ecore_job_shutdown(void); | ||
222 | |||
223 | void _ecore_main_loop_init(void); | ||
224 | void _ecore_main_loop_shutdown(void); | ||
225 | |||
226 | void _ecore_throttle(void); | ||
227 | |||
228 | extern int _ecore_main_lock_count; | ||
229 | extern Eina_Lock _ecore_main_loop_lock; | ||
230 | |||
231 | static inline void | ||
232 | _ecore_lock(void) | ||
233 | { | ||
234 | #ifdef HAVE_THREAD_SAFETY | ||
235 | eina_lock_take(&_ecore_main_loop_lock); | ||
236 | #else | ||
237 | /* at least check we're not being called from a thread */ | ||
238 | EINA_MAIN_LOOP_CHECK_RETURN; | ||
239 | #endif | ||
240 | _ecore_main_lock_count++; | ||
241 | assert(_ecore_main_lock_count == 1); | ||
242 | } | ||
243 | |||
244 | static inline void | ||
245 | _ecore_unlock(void) | ||
246 | { | ||
247 | _ecore_main_lock_count--; | ||
248 | assert(_ecore_main_lock_count == 0); | ||
249 | #ifdef HAVE_THREAD_SAFETY | ||
250 | eina_lock_release(&_ecore_main_loop_lock); | ||
251 | #endif | ||
252 | } | ||
253 | |||
254 | /* | ||
255 | * Callback wrappers all assume that ecore _ecore_lock has been called | ||
256 | */ | ||
257 | static inline Eina_Bool | ||
258 | _ecore_call_task_cb(Ecore_Task_Cb func, | ||
259 | void *data) | ||
260 | { | ||
261 | Eina_Bool r; | ||
262 | |||
263 | _ecore_unlock(); | ||
264 | r = func(data); | ||
265 | _ecore_lock(); | ||
266 | |||
267 | return r; | ||
268 | } | ||
269 | |||
270 | static inline void * | ||
271 | _ecore_call_data_cb(Ecore_Data_Cb func, | ||
272 | void *data) | ||
273 | { | ||
274 | void *r; | ||
275 | |||
276 | _ecore_unlock(); | ||
277 | r = func(data); | ||
278 | _ecore_lock(); | ||
279 | |||
280 | return r; | ||
281 | } | ||
282 | |||
283 | static inline void | ||
284 | _ecore_call_end_cb(Ecore_End_Cb func, | ||
285 | void *user_data, | ||
286 | void *func_data) | ||
287 | { | ||
288 | _ecore_unlock(); | ||
289 | func(user_data, func_data); | ||
290 | _ecore_lock(); | ||
291 | } | ||
292 | |||
293 | static inline Eina_Bool | ||
294 | _ecore_call_filter_cb(Ecore_Filter_Cb func, | ||
295 | void *data, | ||
296 | void *loop_data, | ||
297 | int type, | ||
298 | void *event) | ||
299 | { | ||
300 | Eina_Bool r; | ||
301 | |||
302 | _ecore_unlock(); | ||
303 | r = func(data, loop_data, type, event); | ||
304 | _ecore_lock(); | ||
305 | |||
306 | return r; | ||
307 | } | ||
308 | |||
309 | static inline Eina_Bool | ||
310 | _ecore_call_handler_cb(Ecore_Event_Handler_Cb func, | ||
311 | void *data, | ||
312 | int type, | ||
313 | void *event) | ||
314 | { | ||
315 | Eina_Bool r; | ||
316 | |||
317 | _ecore_unlock(); | ||
318 | r = func(data, type, event); | ||
319 | _ecore_lock(); | ||
320 | |||
321 | return r; | ||
322 | } | ||
323 | |||
324 | static inline void | ||
325 | _ecore_call_prep_cb(Ecore_Fd_Prep_Cb func, | ||
326 | void *data, | ||
327 | Ecore_Fd_Handler *fd_handler) | ||
328 | { | ||
329 | _ecore_unlock(); | ||
330 | func(data, fd_handler); | ||
331 | _ecore_lock(); | ||
332 | } | ||
333 | |||
334 | static inline Eina_Bool | ||
335 | _ecore_call_fd_cb(Ecore_Fd_Cb func, | ||
336 | void *data, | ||
337 | Ecore_Fd_Handler *fd_handler) | ||
338 | { | ||
339 | Eina_Bool r; | ||
340 | |||
341 | _ecore_unlock(); | ||
342 | r = func(data, fd_handler); | ||
343 | _ecore_lock(); | ||
344 | |||
345 | return r; | ||
346 | } | ||
347 | |||
348 | extern int _ecore_fps_debug; | ||
349 | extern double _ecore_time_loop_time; | ||
350 | extern Eina_Bool _ecore_glib_always_integrate; | ||
351 | extern Ecore_Select_Function main_loop_select; | ||
352 | |||
353 | #endif | ||