7e2afa0872239585e6524e05acf2667c7926fa84
[profile/ivi/ecore.git] / src / lib / ecore / ecore_private.h
1 #ifndef _ECORE_PRIVATE_H
2 #define _ECORE_PRIVATE_H
3
4 extern int _ecore_log_dom ;
5 #ifdef  _ECORE_DEFAULT_LOG_DOM
6 # undef _ECORE_DEFAULT_LOG_DOM
7 #endif
8 #define _ECORE_DEFAULT_LOG_DOM _ecore_log_dom
9
10 #ifdef ECORE_DEFAULT_LOG_COLOR
11 # undef ECORE_DEFAULT_LOG_COLOR
12 #endif
13 #define ECORE_DEFAULT_LOG_COLOR EINA_COLOR_BLUE
14
15 #ifdef ERR
16 # undef ERR
17 #endif
18 #define ERR(...) EINA_LOG_DOM_ERR(_ECORE_DEFAULT_LOG_DOM, __VA_ARGS__)
19
20 #ifdef DBG
21 # undef DBG
22 #endif
23 #define DBG(...) EINA_LOG_DOM_DBG(_ECORE_DEFAULT_LOG_DOM, __VA_ARGS__)
24
25 #ifdef INF
26 # undef INF
27 #endif
28 #define INF(...) EINA_LOG_DOM_INFO(_ECORE_DEFAULT_LOG_DOM, __VA_ARGS__)
29
30 #ifdef WRN
31 # undef WRN
32 #endif
33 #define WRN(...) EINA_LOG_DOM_WARN(_ECORE_DEFAULT_LOG_DOM, __VA_ARGS__)
34
35 #ifdef CRIT
36 # undef CRIT
37 #endif
38 #define CRIT(...) EINA_LOG_DOM_CRIT(_ECORE_DEFAULT_LOG_DOM, __VA_ARGS__)
39
40 #ifndef PATH_MAX
41 # define PATH_MAX 4096
42 #endif
43
44 #ifndef MIN
45 # define MIN(x, y) (((x) > (y)) ? (y) : (x))
46 #endif
47
48 #ifndef MAX
49 # define MAX(x, y) (((x) > (y)) ? (x) : (y))
50 #endif
51
52 #ifndef ABS
53 # define ABS(x) ((x) < 0 ? -(x) : (x))
54 #endif
55
56 #ifndef CLAMP
57 # define CLAMP(x, min, max) (((x) > (max)) ? (max) : (((x) < (min)) ? (min) : (x)))
58 #endif
59
60 #define EVAS_FRAME_QUEUING 1 /* for test */
61
62 #define READBUFSIZ 65536
63
64 #define ECORE_MAGIC_NONE            0x1234fedc
65 #define ECORE_MAGIC_EXE             0xf7e812f5
66 #define ECORE_MAGIC_TIMER           0xf7d713f4
67 #define ECORE_MAGIC_IDLER           0xf7c614f3
68 #define ECORE_MAGIC_IDLE_ENTERER    0xf7b515f2
69 #define ECORE_MAGIC_IDLE_EXITER     0xf7601afd
70 #define ECORE_MAGIC_FD_HANDLER      0xf7a416f1
71 #define ECORE_MAGIC_EVENT_HANDLER   0xf79317f0
72 #define ECORE_MAGIC_EVENT_FILTER    0xf78218ff
73 #define ECORE_MAGIC_EVENT           0xf77119fe
74 #define ECORE_MAGIC_ANIMATOR        0xf7643ea5
75 #define ECORE_MAGIC_POLLER          0xf7568127
76 #define ECORE_MAGIC_PIPE            0xf7458226
77 #define ECORE_MAGIC_WIN32_HANDLER   0xf7e8f1a3
78 #define ECORE_MAGIC_JOB             0x76543210
79
80
81 #define ECORE_MAGIC                 Ecore_Magic  __magic
82
83 #define ECORE_MAGIC_SET(d, m)       (d)->__magic = (m)
84 #define ECORE_MAGIC_CHECK(d, m)     ((d) && ((d)->__magic == (m)))
85 #define ECORE_MAGIC_FAIL(d, m, fn)  _ecore_magic_fail((d), (d) ? (d)->__magic : 0, (m), (fn));
86
87 /* undef the following, we want our version */
88 #undef FREE
89 #define FREE(ptr) free(ptr); ptr = NULL;
90
91 #undef IF_FREE
92 #define IF_FREE(ptr) if (ptr) free(ptr); ptr = NULL;
93
94 #undef IF_FN_DEL
95 #define IF_FN_DEL(_fn, ptr) if (ptr) { _fn(ptr); ptr = NULL; }
96
97 EAPI void ecore_print_warning(const char *function, const char *sparam);
98
99 /* convenience macros for checking pointer parameters for non-NULL */
100 #undef CHECK_PARAM_POINTER_RETURN
101 #define CHECK_PARAM_POINTER_RETURN(sparam, param, ret) \
102      if (!(param)) \
103          { \
104             ecore_print_warning(__FUNCTION__, sparam); \
105             return ret; \
106          }
107
108 #undef CHECK_PARAM_POINTER
109 #define CHECK_PARAM_POINTER(sparam, param) \
110      if (!(param)) \
111          { \
112             ecore_print_warning(__FUNCTION__, sparam); \
113             return; \
114          }
115
116 typedef unsigned int              Ecore_Magic;
117
118 EAPI void          _ecore_magic_fail(const void *d, Ecore_Magic m, Ecore_Magic req_m, const char *fname);
119
120 void          _ecore_time_init(void);
121 void          _ecore_fd_valid(void);
122
123 void          _ecore_timer_shutdown(void);
124 void          _ecore_timer_cleanup(void);
125 void          _ecore_timer_enable_new(void);
126 double        _ecore_timer_next_get(void);
127 int           _ecore_timers_exists(void);
128 int           _ecore_timer_call(double when);
129
130 void          _ecore_idler_shutdown(void);
131 int           _ecore_idler_call(void);
132 int           _ecore_idler_exist(void);
133
134 void          _ecore_idle_enterer_shutdown(void);
135 void          _ecore_idle_enterer_call(void);
136 int           _ecore_idle_enterer_exist(void);
137
138 void          _ecore_idle_exiter_shutdown(void);
139 void          _ecore_idle_exiter_call(void);
140 int           _ecore_idle_exiter_exist(void);
141
142 void          _ecore_event_shutdown(void);
143 int           _ecore_event_exist(void);
144 Ecore_Event  *_ecore_event_add(int type, void *ev, Ecore_End_Cb func_free, void *data);
145 void          _ecore_event_call(void);
146
147 Ecore_Timer  *_ecore_exe_doomsday_clock_get(Ecore_Exe *exe);
148 void          _ecore_exe_doomsday_clock_set(Ecore_Exe *exe, Ecore_Timer *dc);
149
150 EAPI void    *_ecore_event_signal_user_new(void);
151 void         *_ecore_event_signal_hup_new(void);
152 void         *_ecore_event_signal_exit_new(void);
153 void         *_ecore_event_signal_power_new(void);
154 void         *_ecore_event_signal_realtime_new(void);
155
156 void          _ecore_main_shutdown(void);
157
158 #ifdef _WIN32
159 static inline void _ecore_signal_shutdown(void) { }
160 static inline void _ecore_signal_init(void) { }
161 static inline int  _ecore_signal_count_get(void) { return 0; }
162 static inline void _ecore_signal_call(void) { }
163 #else
164 void          _ecore_signal_shutdown(void);
165 void          _ecore_signal_init(void);
166 int           _ecore_signal_count_get(void);
167 void          _ecore_signal_call(void);
168 #endif
169
170 void          _ecore_exe_init(void);
171 void          _ecore_exe_shutdown(void);
172 #ifndef _WIN32
173 Ecore_Exe    *_ecore_exe_find(pid_t pid);
174 void         *_ecore_exe_event_del_new(void);
175 void          _ecore_exe_event_del_free(void *data, void *ev);
176 #endif
177
178 void          _ecore_animator_shutdown(void);
179
180 void          _ecore_poller_shutdown(void);
181
182 void          _ecore_fps_debug_init(void);
183 void          _ecore_fps_debug_shutdown(void);
184 void          _ecore_fps_debug_runtime_add(double t);
185
186 void _ecore_thread_init(void);
187 void _ecore_thread_shutdown(void);
188
189 void _ecore_glib_init(void);
190 void _ecore_glib_shutdown(void);
191
192 void _ecore_job_init(void);
193 void _ecore_job_shutdown(void);
194
195 void _ecore_main_loop_init(void);
196 void _ecore_main_loop_shutdown(void);
197
198 extern int    _ecore_fps_debug;
199 extern double _ecore_time_loop_time;
200 extern Eina_Bool _ecore_glib_always_integrate;
201
202 #endif