ecore: add ecore_pipe_freeze/thraw.
[profile/ivi/ecore.git] / src / lib / ecore / Ecore.h
1 /** 
2 @brief Ecore Library Public API Calls
3  
4 These routines are used for Ecore Library interaction
5 */
6
7 /**
8
9 @mainpage Ecore
10
11 @image html  e.png
12
13 @version @PACKAGE_VERSION@
14 @author Carsten Haitzler <raster@rasterman.com>
15 @author Tom Gilbert <tom@linuxbrit.co.uk>
16 @author Burra <burra@colorado.edu>
17 @author Chris Ross <chris@darkrock.co.uk>
18 @author Term <term@twistedpath.org>
19 @author Tilman Sauerbeck <tilman@code-monkey.de>
20 @author Ibukun Olumuyiwa <ibukun@computer.org>
21 @author Yuri <da2001@hotmail.ru>
22 @author Nicholas Curran <quasar@bigblue.net.au>
23 @author Howell Tam <pigeon@pigeond.net>
24 @author Nathan Ingersoll <rbdpngn@users.sourceforge.net>
25 @author Andrew Elcock <andy@elcock.org>
26 @author Kim Woelders <kim@woelders.dk>
27 @author Sebastian Dransfeld <sebastid@tango.flipp.net>
28 @author Simon Poole <simon.armlinux@themalago.net>
29 @author Jorge Luis Zapata Muga <jorgeluis.zapata@gmail.com>
30 @author dan sinclair <zero@everburning.com>
31 @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
32 @author David 'onefang' Seikel <onefang@gmail.com>
33 @author Hisham 'CodeWarrior' Mardam Bey <hisham@hisham.cc>
34 @author Brian 'rephorm' Mattern <rephorm@rephorm.com>
35 @author Tim Horton <hortont424@gmail.com>
36 @author Arnaud de Turckheim 'quarium' <quarium@gmail.com>
37 @author Matt Barclay <mbarclay@gmail.com>
38 @author Peter Wehrfritz <peter.wehrfritz@web.de>
39 @author Albin "Lutin" Tonnerre <albin.tonnerre@gmail.com>
40 @author Vincent Torri <vincent.torri@gmail.com>
41 @author Lars Munch <lars@segv.dk>
42 @author Andre Dieb <andre.dieb@gmail.com>
43 @author Mathieu Taillefumier <mathieu.taillefumier@free.fr>
44 @author Rui Miguel Silva Seabra <rms@1407.org>
45 @author Samsung Electronics
46 @author Samsung SAIT
47 @author Nicolas Aguirre <aguirre.nicolas@gmail.com>
48 @author Brett Nash <nash@nash.id.au>
49 @author Mike Blumenkrantz <mike@zentific.com>
50 @author Leif Middelschulte <leif.middelschulte@gmail.com>
51 @author Mike McCormack <mj.mccormack@samsung.com>
52 @author Sangho Park <gouache95@gmail.com>
53 @author Jihoon Kim <jihoon48.kim@samsung.com> <imfine98@gmail.com>
54 @author Daniel Juyung Seo <seojuyung2@gmail.com> <juyung.seo@samsung.com>
55 @date 2000-2011
56
57 @section intro Introduction
58
59 Ecore is a library of convenience functions.
60
61 The Ecore library provides the following modules:
62 @li @ref Ecore_Group
63 @li @ref Ecore_File_Group
64 @li @ref Ecore_Con_Group
65 @li @link Ecore_Evas.h   Ecore_Evas - Evas convenience functions. @endlink
66 @li @ref Ecore_FB_Group
67 @li @link Ecore_Ipc.h    Ecore_IPC - Inter Process Communication functions. @endlink
68 @li @link Ecore_X.h      Ecore_X - X Windows System wrapper. @endlink
69 @li @ref Ecore_Win32_Group
70 @li @ref Ecore_WinCE_Group
71
72 @section compiling How to compile using Ecore?
73 pkgconfig (.pc) files are installed for every ecore module.
74 Thus, to compile using any of them, you can use something like the following:
75
76 @verbatim
77 gcc *.c $(pkg-config ecore ecore-$x ecore-$y [...] --cflags --libs)
78 @endverbatim
79
80 @section install How is it installed?
81
82 Suggested configure options for evas for a Linux desktop X display:
83
84 @verbatim
85 ./configure \
86 --enable-ecore-x \
87 --enable-ecore-fb \
88 --enable-ecore-evas \
89 --enable-ecore-evas-gl \
90 --enable-ecore-con \
91 --enable-ecore-ipc
92 make CFLAGS="-O9 -mpentiumpro -march=pentiumpro -mcpu=pentiumpro"
93 @endverbatim
94
95 @todo (1.0) Document API
96 */
97
98 /*
99 @page Ecore_Main_Loop_Page The Ecore Main Loop
100
101 @section intro What is Ecore?
102
103 Ecore is a clean and tiny event loop library with many modules to do lots of
104 convenient things for a programmer, to save time and effort.
105
106 It's small and lean, designed to work on embedded systems all the way to
107 large and powerful multi-cpu workstations. It serialises all system signals,
108 events etc. into a single event queue, that is easily processed without
109 needing to worry about concurrency. A properly written, event-driven program
110 using this kind of programming doesn't need threads, nor has to worry about
111 concurrency. It turns a program into a state machine, and makes it very
112 robust and easy to follow.
113
114 Ecore gives you other handy primitives, such as timers to tick over for you
115 and call specified functions at particular times so the programmer can use
116 this to do things, like animate, or time out on connections or tasks that take
117 too long etc.
118
119 Idle handlers are provided too, as well as calls on entering an idle state
120 (often a very good time to update the state of the program). All events that
121 enter the system are passed to specific callback functions that the program
122 sets up to handle those events. Handling them is simple and other Ecore
123 modules produce more events on the queue, coming from other sources such as
124 file descriptors etc.
125
126 Ecore also lets you have functions called when file descriptors become active
127 for reading or writing, allowing for streamlined, non-blocking IO.
128
129 Here is an example of a simple program and its basic event loop flow:
130
131 @image html  prog_flow.png
132
133
134
135 @section work How does Ecore work?
136
137 Ecore is very easy to learn and use. All the function calls are designed to
138 be easy to remember, explicit in describing what they do, and heavily
139 name-spaced. Ecore programs can start and be very simple.
140
141 For example:
142
143 @code
144 #include <Ecore.h>
145
146 int main(int argc, const char **argv)
147 {
148   ecore_init();
149   ecore_app_args_set(argc, argv);
150   ecore_main_loop_begin();
151   ecore_shutdown();
152   return 0;
153 }
154 @endcode
155
156 This program is very simple and does't check for errors, but it does start up
157 and begin a main loop waiting for events or timers to tick off. This program
158 doesn't set up any, but now we can expand on this simple program a little
159 more by adding some event handlers and timers.
160
161 @code
162 #include <Ecore.h>
163
164 Ecore_Timer         *timer1     = NULL;
165 Ecore_Event_Handler *handler1   = NULL;
166 double               start_time = 0.0;
167
168 int timer_func(void *data)
169 {
170   printf("Tick timer. Sec: %3.2f\n", ecore_time_get() - start_time);
171   return 1;
172 }
173
174 int exit_func(void *data, int ev_type, void *ev)
175 {
176   Ecore_Event_Signal_Exit *e;
177
178   e = (Ecore_Event_Signal_Exit *)ev;
179   if (e->interrupt)      printf("Exit: interrupt\n");
180   else if (e->quit)      printf("Exit: quit\n");
181   else if (e->terminate) printf("Exit: terminate\n");
182   ecore_main_loop_quit();
183   return 1;
184 }
185
186 int main(int argc, const char **argv)
187 {
188   ecore_init();
189   ecore_app_args_set(argc, argv);  
190   start_time = ecore_time_get();
191   handler1 = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, exit_func, NULL);
192   timer1 = ecore_timer_add(0.5, timer_func, NULL);  
193   ecore_main_loop_begin();
194   ecore_shutdown();
195   return 0;
196 }
197 @endcode
198
199 In the previous example, we initialize our application and get the time at
200 which our program has started so we can calculate an offset. We set
201 up a timer to tick off in 0.5 seconds, and since it returns 1, will
202 keep ticking off every 0.5 seconds until it returns 0, or is deleted
203 by hand. An event handler is set up to call a function - exit_func(),
204 whenever an event of type ECORE_EVENT_SIGNAL_EXIT is received (CTRL-C
205 on the command line will cause such an event to happen). If this event
206 occurs it tells you what kind of exit signal was received, and asks
207 the main loop to quit when it is finished by calling
208 ecore_main_loop_quit().
209
210 The handles returned by ecore_timer_add() and ecore_event_handler_add() are 
211 only stored here as an example. If you don't need to address the timer or 
212 event handler again you don't need to store the result, so just call the 
213 function, and don't assign the result to any variable.
214
215 This program looks slightly more complex than needed to do these simple
216 things, but in principle, programs don't get any more complex. You add more
217 event handlers, for more events, will have more timers and such, BUT it all
218 follows the same principles as shown in this example.
219
220 */
221
222 /*
223 @page Ecore_Config_Page The Enlightened Property Library
224
225 The Enlightened Property Library (Ecore_Config) is an adbstraction
226 from the complexities of writing your own configuration. It provides
227 many features using the Enlightenment 17 development libraries.
228
229 To use the library, you:
230 @li Set the default values of your properties.
231 @li Load the configuration from a file.  You must set the default values
232     first, so that the library knows the correct type of each argument.
233
234 The following examples show how to use the Enlightened Property Library:
235 @li @link config_basic_example.c config_basic_example.c @endlink
236 @li @link config_listener_example.c config_listener_example.c @endlink
237
238 */
239
240 /**
241 @page X_Window_System_Page X Window System
242
243 The Ecore library includes a wrapper for handling the X window system.
244 This page briefly explains what the X window system is and various terms
245 that are used.
246 */
247
248 // EXAMPLES
249
250 /**
251 @example ecore_args_example.c
252 Shows how to set and retrieve the program arguments.
253 */
254
255 /**
256 @example ecore_event_handler_example.c
257 Shows how to use event handlers.
258 */
259
260 /**
261 @example ecore_fd_handler_example.c
262 Shows how to use fd handlers.
263 */
264
265 /**
266 @example ecore_timer_example.c
267 Demonstrates use of the ecore_timer.
268 */
269
270 /*
271 @example ecore_config_basic_example.c
272 Provides an example of how to use the basic configuration functions.
273 See the file Ecore_Config.h for the full list of available functions.
274 */
275
276 /*
277 @example ecore_config_listener_example.c
278 Shows how to set up a listener to listen for configuration changes.
279 */
280
281 /**
282 @example ecore_x_window_example.c
283 Shows the basics of using the X Windows system through Ecore functions.
284 */
285
286 #ifndef _ECORE_H
287 #define _ECORE_H
288
289 #ifdef _MSC_VER
290 # include <Evil.h>
291 #endif
292
293 #include <Eina.h>
294
295 #ifdef EAPI
296 # undef EAPI
297 #endif
298
299 #ifdef _WIN32
300 # ifdef EFL_ECORE_BUILD
301 #  ifdef DLL_EXPORT
302 #   define EAPI __declspec(dllexport)
303 #  else
304 #   define EAPI
305 #  endif /* ! DLL_EXPORT */
306 # else
307 #  define EAPI __declspec(dllimport)
308 # endif /* ! EFL_ECORE_BUILD */
309 #else
310 # ifdef __GNUC__
311 #  if __GNUC__ >= 4
312 #   define EAPI __attribute__ ((visibility("default")))
313 #  else
314 #   define EAPI
315 #  endif
316 # else
317 #  define EAPI
318 # endif
319 #endif /* ! _WIN32 */
320
321 #ifdef _WIN32
322 # include <winsock2.h>
323 #elif (defined (__FreeBSD__) && (__FreeBSD_version >= 420001)) || defined (__OpenBSD__)
324 # include <sys/select.h>
325 # include <signal.h>
326 #else
327 # include <sys/time.h>
328 # include <signal.h>
329 #endif
330
331 #include <sys/types.h>
332
333 #ifdef __cplusplus
334 extern "C" {
335 #endif
336
337   /**
338    * @file Ecore.h
339    * @defgroup Ecore_Group Ecore - Main Loop and Job Functions.
340    * @brief The file that provides the program utility, main loop and timer
341    *        functions.
342    *
343    * This header provides the Ecore event handling loop.  For more
344    * details, see @ref Ecore_Main_Loop_Group.
345    *
346    * For the main loop to be of any use, you need to be able to add events
347    * and event handlers.  Events for file descriptor events are covered in
348    * @ref Ecore_FD_Handler_Group.
349    *
350    * Time functions are covered in @ref Ecore_Time_Group.
351    *
352    * There is also provision for callbacks for when the loop enters or
353    * exits an idle state. See @ref Idle_Group for more information.
354    *
355    * Functions are also provided for spawning child processes using fork.
356    * See @ref Ecore_Exe_Group for more details.
357    *
358    * @{
359    */
360
361 #define ECORE_VERSION_MAJOR 1
362 #define ECORE_VERSION_MINOR 0
363
364    typedef struct _Ecore_Version
365      {
366         int major;
367         int minor;
368         int micro;
369         int revision;
370      } Ecore_Version;
371    
372    EAPI extern Ecore_Version *ecore_version;
373
374 #define ECORE_CALLBACK_CANCEL EINA_FALSE /**< Return value to remove a callback */
375 #define ECORE_CALLBACK_RENEW EINA_TRUE  /**< Return value to keep a callback */
376
377 #define ECORE_CALLBACK_PASS_ON EINA_TRUE /**< Return value to pass event to next handler */
378 #define ECORE_CALLBACK_DONE EINA_FALSE /**< Return value to stop event handling */
379
380 #define ECORE_EVENT_NONE            0
381 #define ECORE_EVENT_SIGNAL_USER     1 /**< User signal event */
382 #define ECORE_EVENT_SIGNAL_HUP      2 /**< Hup signal event */
383 #define ECORE_EVENT_SIGNAL_EXIT     3 /**< Exit signal event */
384 #define ECORE_EVENT_SIGNAL_POWER    4 /**< Power signal event */
385 #define ECORE_EVENT_SIGNAL_REALTIME 5 /**< Realtime signal event */
386 #define ECORE_EVENT_COUNT           6
387
388 #define ECORE_EXE_PRIORITY_INHERIT 9999
389    
390    EAPI extern int ECORE_EXE_EVENT_ADD; /**< A child process has been added */
391    EAPI extern int ECORE_EXE_EVENT_DEL; /**< A child process has been deleted (it exited, naming consistent with the rest of ecore). */
392    EAPI extern int ECORE_EXE_EVENT_DATA; /**< Data from a child process. */
393    EAPI extern int ECORE_EXE_EVENT_ERROR; /**< Errors from a child process. */
394
395    enum _Ecore_Fd_Handler_Flags
396      {
397         ECORE_FD_READ = 1, /**< Fd Read mask */
398         ECORE_FD_WRITE = 2, /**< Fd Write mask */
399         ECORE_FD_ERROR = 4 /**< Fd Error mask */
400      };
401    typedef enum _Ecore_Fd_Handler_Flags Ecore_Fd_Handler_Flags;
402
403    enum _Ecore_Exe_Flags /* flags for executing a child with its stdin and/or stdout piped back */
404      {
405         ECORE_EXE_NONE = 0, /**< No exe flags at all */
406         ECORE_EXE_PIPE_READ = 1, /**< Exe Pipe Read mask */
407         ECORE_EXE_PIPE_WRITE = 2, /**< Exe Pipe Write mask */
408         ECORE_EXE_PIPE_ERROR = 4, /**< Exe Pipe error mask */
409         ECORE_EXE_PIPE_READ_LINE_BUFFERED = 8, /**< Reads are buffered until a newline and delivered 1 event per line */
410         ECORE_EXE_PIPE_ERROR_LINE_BUFFERED = 16, /**< Errors are buffered until a newline and delivered 1 event per line */
411         ECORE_EXE_PIPE_AUTO = 32, /**< stdout and stderr are buffered automatically */
412         ECORE_EXE_RESPAWN = 64, /**< FIXME: Exe is restarted if it dies */
413         ECORE_EXE_USE_SH = 128, /**< Use /bin/sh to run the command. */
414         ECORE_EXE_NOT_LEADER = 256 /**< Do not use setsid() to have the executed process be its own session leader */
415      };
416    typedef enum _Ecore_Exe_Flags Ecore_Exe_Flags;
417
418    enum _Ecore_Exe_Win32_Priority
419      {
420        ECORE_EXE_WIN32_PRIORITY_IDLE, /**< Idle priority, for monitoring the system */
421        ECORE_EXE_WIN32_PRIORITY_BELOW_NORMAL, /**< Below default priority */
422        ECORE_EXE_WIN32_PRIORITY_NORMAL, /**< Default priority */
423        ECORE_EXE_WIN32_PRIORITY_ABOVE_NORMAL, /**< Above default priority */
424        ECORE_EXE_WIN32_PRIORITY_HIGH, /**< High priority, use with care as other threads in the system will not get processor time */
425        ECORE_EXE_WIN32_PRIORITY_REALTIME /**< Realtime priority, should be almost never used as it can interrupt system threads that manage mouse input, keyboard input, and background disk flushing */
426      };
427    typedef enum _Ecore_Exe_Win32_Priority Ecore_Exe_Win32_Priority;
428
429    enum _Ecore_Poller_Type /* Poller types */
430      {
431         ECORE_POLLER_CORE = 0 /**< The core poller interval */
432      };
433    typedef enum _Ecore_Poller_Type Ecore_Poller_Type;
434    
435    enum _Ecore_Pos_Map /* Position mappings */
436      {
437         ECORE_POS_MAP_LINEAR,     /**< Linear 0.0 -> 1.0 */
438         ECORE_POS_MAP_ACCELERATE, /**< Start slow then speed up */
439         ECORE_POS_MAP_DECELERATE, /**< Start fast then slow down */
440         ECORE_POS_MAP_SINUSOIDAL, /**< Start slow, speed up then slow down at end */
441         ECORE_POS_MAP_ACCELERATE_FACTOR, /**< Start slow then speed up, v1 being a power factor, 0.0 being linear, 1.0 being normal accelerate, 2.0 being much more pronounced accelerate (squared), 3.0 being cubed, etc. */
442         ECORE_POS_MAP_DECELERATE_FACTOR, /**< Start fast then slow down, v1 being a power factor, 0.0 being linear, 1.0 being normal decelerate, 2.0 being much more pronounced decelerate (squared), 3.0 being cubed, etc. */
443         ECORE_POS_MAP_SINUSOIDAL_FACTOR, /**< Start slow, speed up then slow down at end, v1 being a power factor, 0.0 being linear, 1.0 being normal sinusoidal, 2.0 being much more pronounced sinusoidal (squared), 3.0 being cubed, etc. */
444         ECORE_POS_MAP_DIVISOR_INTERP, /**< Start at gradient * v1, interpolated via power of v2 curve */
445         ECORE_POS_MAP_BOUNCE, /**< Start at 0.0 then "drop" like a ball bouncing to the ground at 1.0, and bounce v2 times, with decay factor of v1 */
446         ECORE_POS_MAP_SPRING  /**< Start at 0.0 then "wobble" like a sping rest position 1.0, and wobble v2 times, with decay factor of v1 */
447      };
448    typedef enum _Ecore_Pos_Map Ecore_Pos_Map;
449
450    enum _Ecore_Animator_Source /* Timing sources for animators */
451      {
452         ECORE_ANIMATOR_SOURCE_TIMER, /**< The default system clock/timer based animator that ticks every "frametime" seconds */
453         ECORE_ANIMATOR_SOURCE_CUSTOM /**< A custom animator trigger that you need to call ecore_animator_trigger() to make it tick */
454      };
455    typedef enum _Ecore_Animator_Source Ecore_Animator_Source;
456    
457    typedef struct _Ecore_Exe                   Ecore_Exe; /**< A handle for spawned processes */
458    typedef struct _Ecore_Timer                 Ecore_Timer; /**< A handle for timers */
459    typedef struct _Ecore_Idler                 Ecore_Idler; /**< A handle for idlers */
460    typedef struct _Ecore_Idle_Enterer          Ecore_Idle_Enterer; /**< A handle for idle enterers */
461    typedef struct _Ecore_Idle_Exiter           Ecore_Idle_Exiter; /**< A handle for idle exiters */
462    typedef struct _Ecore_Fd_Handler            Ecore_Fd_Handler; /**< A handle for Fd handlers */
463    typedef struct _Ecore_Win32_Handler         Ecore_Win32_Handler; /**< A handle for HANDLE handlers on Windows */
464    typedef struct _Ecore_Event_Handler         Ecore_Event_Handler; /**< A handle for an event handler */
465    typedef struct _Ecore_Event_Filter          Ecore_Event_Filter; /**< A handle for an event filter */
466    typedef struct _Ecore_Event                 Ecore_Event; /**< A handle for an event */
467    typedef struct _Ecore_Animator              Ecore_Animator; /**< A handle for animators */
468    typedef struct _Ecore_Pipe                  Ecore_Pipe; /**< A handle for pipes */
469    typedef struct _Ecore_Poller                Ecore_Poller; /**< A handle for pollers */
470    typedef struct _Ecore_Event_Signal_User     Ecore_Event_Signal_User; /**< User signal event */
471    typedef struct _Ecore_Event_Signal_Hup      Ecore_Event_Signal_Hup; /**< Hup signal event */
472    typedef struct _Ecore_Event_Signal_Exit     Ecore_Event_Signal_Exit; /**< Exit signal event */
473    typedef struct _Ecore_Event_Signal_Power    Ecore_Event_Signal_Power; /**< Power signal event */
474    typedef struct _Ecore_Event_Signal_Realtime Ecore_Event_Signal_Realtime; /**< Realtime signal event */
475    typedef struct _Ecore_Exe_Event_Add         Ecore_Exe_Event_Add; /**< Spawned Exe add event */
476    typedef struct _Ecore_Exe_Event_Del         Ecore_Exe_Event_Del; /**< Spawned Exe exit event */
477    typedef struct _Ecore_Exe_Event_Data_Line   Ecore_Exe_Event_Data_Line; /**< Lines from a child process */
478    typedef struct _Ecore_Exe_Event_Data        Ecore_Exe_Event_Data; /**< Data from a child process */
479    typedef struct _Ecore_Thread                Ecore_Thread;
480
481    /**
482     * @typedef Ecore_Data_Cb Ecore_Data_Cb
483     * A callback which is used to return data to the main function
484     */
485    typedef void *(*Ecore_Data_Cb) (void *data);
486    /**
487     * @typedef Ecore_Filter_Cb
488     * A callback used for filtering events from the main loop.
489     */
490    typedef Eina_Bool (*Ecore_Filter_Cb) (void *data, void *loop_data, int type, void *event);
491    /**
492     * @typedef Ecore_Eselect_Function Ecore_Eselect_Function
493     * A function which can be used to replace select() in the main loop
494     */
495    typedef int (*Ecore_Select_Function)(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
496    /**
497     * @typedef Ecore_End_Cb Ecore_End_Cb
498     * This is the callback which is called at the end of a function, usually for cleanup purposes.
499     */
500    typedef void (*Ecore_End_Cb) (void *user_data, void *func_data);
501    /**
502     * @typedef Ecore_Pipe_Cb Ecore_Pipe_Cb
503     * The callback that data written to the pipe is sent to.
504     */
505    typedef void (*Ecore_Pipe_Cb) (void *data, void *buffer, unsigned int nbyte);
506    /**
507     * @typedef Ecore_Exe_Cb Ecore_Exe_Cb
508     * A callback to run with the associated @ref Ecore_Exe, usually for cleanup purposes.
509     */
510    typedef void (*Ecore_Exe_Cb)(void *data, const Ecore_Exe *exe);
511    /**
512     * @typedef Ecore_Event_Handler_Cb Ecore_Event_Handler_Cb
513     * A callback used by the main loop to handle events of a specified type.
514     */
515    typedef Eina_Bool (*Ecore_Event_Handler_Cb) (void *data, int type, void *event);
516    /**
517     * @typedef Ecore_Thread_Cb Ecore_Thread_Cb
518     * A callback used by Ecore_Thread helper.
519     */
520   typedef void (*Ecore_Thread_Cb) (void *data, Ecore_Thread *thread);
521    /**
522     * @typedef Ecore_Thread_Notify_Cb Ecore_Thread_Notify_Cb
523     * A callback used by the main loop to receive data sent by an @ref Ecore_Thread_Group.
524     */
525   typedef void (*Ecore_Thread_Notify_Cb) (void *data, Ecore_Thread *thread, void *msg_data);
526    /**
527     * @typedef Ecore_Task_Cb Ecore_Task_Cb
528     * A callback run for a task (timer, idler, poller, animator, etc)
529     */
530    typedef Eina_Bool (*Ecore_Task_Cb) (void *data);
531    /**
532     * @typedef Ecore_Timeline_Cb Ecore_Timeline_Cb
533     * A callback run for a task (animators with runtimes)
534     */
535    typedef Eina_Bool (*Ecore_Timeline_Cb) (void *data, double pos);
536    /**
537     * @typedef Ecore_Cb Ecore_Cb
538     * A generic callback called as a hook when a certain point in execution is reached.
539     */
540    typedef void (*Ecore_Cb) (void *data);
541    /**
542     * @typedef Ecore_Fd_Cb Ecore_Fd_Cb
543     * A callback used by an @ref Ecore_Fd_Handler.
544     */
545    typedef Eina_Bool (*Ecore_Fd_Cb) (void *data, Ecore_Fd_Handler *fd_handler);
546    /**
547     * @typedef Ecore_Fd_Prep_Cb Ecore_Fd_Prep_Cb
548     * A callback used by an @ref Ecore_Fd_Handler.
549     */
550    typedef void (*Ecore_Fd_Prep_Cb) (void *data, Ecore_Fd_Handler *fd_handler);
551    /**
552     * @typedef Ecore_Win32_Handle_Cb Ecore_Win32_Handle_Cb
553     * A callback used by an @ref Ecore_Win32_Handler.
554     */
555    typedef Eina_Bool (*Ecore_Win32_Handle_Cb) (void *data, Ecore_Win32_Handler *wh);
556
557
558    typedef struct _Ecore_Job Ecore_Job; /**< A job handle */
559
560    struct _Ecore_Event_Signal_User /** User signal event */
561      {
562         int   number; /**< The signal number. Either 1 or 2 */
563         void *ext_data; /**< Extension data - not used */
564
565 #ifndef _WIN32
566         siginfo_t data; /**< Signal info */
567 #endif
568      };
569
570    struct _Ecore_Event_Signal_Hup /** Hup signal event */
571      {
572         void *ext_data; /**< Extension data - not used */
573
574 #ifndef _WIN32
575         siginfo_t data; /**< Signal info */
576 #endif
577      };
578
579    struct _Ecore_Event_Signal_Exit /** Exit request event */
580      {
581         Eina_Bool   interrupt : 1; /**< Set if the exit request was an interrupt  signal*/
582         Eina_Bool   quit      : 1; /**< set if the exit request was a quit signal */
583         Eina_Bool   terminate : 1; /**< Set if the exit request was a terminate singal */
584         void          *ext_data; /**< Extension data - not used */
585
586 #ifndef _WIN32
587         siginfo_t data; /**< Signal info */
588 #endif
589      };
590
591    struct _Ecore_Event_Signal_Power /** Power event */
592      {
593         void *ext_data; /**< Extension data - not used */
594
595 #ifndef _WIN32
596         siginfo_t data; /**< Signal info */
597 #endif
598      };
599
600    struct _Ecore_Event_Signal_Realtime /** Realtime event */
601      {
602         int num; /**< The realtime signal's number */
603
604 #ifndef _WIN32
605         siginfo_t data; /**< Signal info */
606 #endif
607      };
608
609    struct _Ecore_Exe_Event_Add /** Process add event */
610      {
611         Ecore_Exe *exe; /**< The handle to the added process */
612         void      *ext_data; /**< Extension data - not used */
613      };
614
615    struct _Ecore_Exe_Event_Del /** Process exit event */
616      {
617         pid_t         pid; /**< The process ID of the process that exited */
618         int           exit_code; /**< The exit code of the process */
619         Ecore_Exe    *exe; /**< The handle to the exited process, or NULL if not found */
620         int           exit_signal; /** < The signal that caused the process to exit */
621         Eina_Bool  exited    : 1; /** < set to 1 if the process exited of its own accord */
622         Eina_Bool  signalled : 1; /** < set to 1 id the process exited due to uncaught signal */
623         void         *ext_data; /**< Extension data - not used */
624 #ifndef _WIN32
625         siginfo_t     data; /**< Signal info */
626 #endif
627      };
628
629    struct _Ecore_Exe_Event_Data_Line /**< Lines from a child process */
630       {
631          char *line;
632          int   size;
633       };
634
635    struct _Ecore_Exe_Event_Data /** Data from a child process event */
636      {
637         Ecore_Exe *exe; /**< The handle to the process */
638         void *data; /**< the raw binary data from the child process that was received */
639         int   size; /**< the size of this data in bytes */
640         Ecore_Exe_Event_Data_Line *lines; /**< an array of line data if line buffered, the last one has it's line member set to NULL */
641      };
642
643   /**
644    * @defgroup Ecore_Init_Group Ecore initialisation and shutdown functions.
645    */
646
647    EAPI int  ecore_init(void);
648    EAPI int  ecore_shutdown(void);
649
650   /**
651    * @}
652    */
653
654   /**
655    * @defgroup Ecore_Application_Group Ecore Application functions
656    *
657    * @{
658    */
659
660    EAPI void ecore_app_args_set(int argc, const char **argv);
661    EAPI void ecore_app_args_get(int *argc, char ***argv);
662    EAPI void ecore_app_restart(void);
663
664   /**
665    * @}
666    */
667
668   /**
669    * @defgroup Ecore_Event_Group Ecore Event functions
670    *
671    * @{
672    */
673
674    EAPI Ecore_Event_Handler *ecore_event_handler_add(int type, Ecore_Event_Handler_Cb func, const void *data);
675    EAPI void                *ecore_event_handler_del(Ecore_Event_Handler *event_handler);
676    EAPI Ecore_Event         *ecore_event_add(int type, void *ev, Ecore_End_Cb func_free, void *data);
677    EAPI void                *ecore_event_del(Ecore_Event *event);
678    EAPI void                *ecore_event_handler_data_get(Ecore_Event_Handler *eh);
679    EAPI void                *ecore_event_handler_data_set(Ecore_Event_Handler *eh, void *data);
680    EAPI int                  ecore_event_type_new(void);
681    EAPI Ecore_Event_Filter  *ecore_event_filter_add(Ecore_Data_Cb func_start, Ecore_Filter_Cb func_filter, Ecore_End_Cb func_end, const void *data);
682    EAPI void                *ecore_event_filter_del(Ecore_Event_Filter *ef);
683    EAPI int                  ecore_event_current_type_get(void);
684    EAPI void                *ecore_event_current_event_get(void);
685
686   /**
687    * @}
688    */
689
690   /**
691    * @defgroup Ecore_Exe_Group Process Spawning Functions
692    *
693    * @{
694    */
695
696    EAPI void        ecore_exe_run_priority_set(int pri);
697    EAPI int         ecore_exe_run_priority_get(void);
698    EAPI Ecore_Exe  *ecore_exe_run(const char *exe_cmd, const void *data);
699    EAPI Ecore_Exe  *ecore_exe_pipe_run(const char *exe_cmd, Ecore_Exe_Flags flags, const void *data);
700    EAPI void        ecore_exe_callback_pre_free_set(Ecore_Exe *exe, Ecore_Exe_Cb func);
701    EAPI Eina_Bool   ecore_exe_send(Ecore_Exe *exe, const void *data, int size);
702    EAPI void        ecore_exe_close_stdin(Ecore_Exe *exe);
703    EAPI void        ecore_exe_auto_limits_set(Ecore_Exe *exe, int start_bytes, int end_bytes, int start_lines, int end_lines);
704    EAPI Ecore_Exe_Event_Data *ecore_exe_event_data_get(Ecore_Exe *exe, Ecore_Exe_Flags flags);
705    EAPI void        ecore_exe_event_data_free(Ecore_Exe_Event_Data *data);
706    EAPI void       *ecore_exe_free(Ecore_Exe *exe);
707    EAPI pid_t       ecore_exe_pid_get(const Ecore_Exe *exe);
708    EAPI void        ecore_exe_tag_set(Ecore_Exe *exe, const char *tag);
709    EAPI const char *ecore_exe_tag_get(const Ecore_Exe *exe);
710    EAPI const char *ecore_exe_cmd_get(const Ecore_Exe *exe);
711    EAPI void       *ecore_exe_data_get(const Ecore_Exe *exe);
712    EAPI void       *ecore_exe_data_set(Ecore_Exe *exe, void *data);
713    EAPI Ecore_Exe_Flags ecore_exe_flags_get(const Ecore_Exe *exe);
714    EAPI void        ecore_exe_pause(Ecore_Exe *exe);
715    EAPI void        ecore_exe_continue(Ecore_Exe *exe);
716    EAPI void        ecore_exe_interrupt(Ecore_Exe *exe);
717    EAPI void        ecore_exe_quit(Ecore_Exe *exe);
718    EAPI void        ecore_exe_terminate(Ecore_Exe *exe);
719    EAPI void        ecore_exe_kill(Ecore_Exe *exe);
720    EAPI void        ecore_exe_signal(Ecore_Exe *exe, int num);
721    EAPI void        ecore_exe_hup(Ecore_Exe *exe);
722
723   /**
724    * @}
725    */
726
727   /**
728    * @defgroup Ecore_Idle_Group Ecore Idle functions
729    *
730    * @{
731    */
732
733    EAPI Ecore_Idler *ecore_idler_add(Ecore_Task_Cb func, const void *data);
734    EAPI void        *ecore_idler_del(Ecore_Idler *idler);
735
736    EAPI Ecore_Idle_Enterer *ecore_idle_enterer_add(Ecore_Task_Cb func, const void *data);
737    EAPI Ecore_Idle_Enterer *ecore_idle_enterer_before_add(Ecore_Task_Cb func, const void *data);
738    EAPI void               *ecore_idle_enterer_del(Ecore_Idle_Enterer *idle_enterer);
739
740    EAPI Ecore_Idle_Exiter *ecore_idle_exiter_add(Ecore_Task_Cb func, const void *data);
741    EAPI void              *ecore_idle_exiter_del(Ecore_Idle_Exiter *idle_exiter);
742
743   /**
744    * @}
745    */
746
747   /**
748    * @defgroup Ecore_Main Loop_Group Ecore Main Loop functions
749    *
750    * @{
751    */
752
753    EAPI void              ecore_main_loop_iterate(void);
754
755    EAPI void              ecore_main_loop_select_func_set(Ecore_Select_Function func);
756    EAPI Ecore_Select_Function ecore_main_loop_select_func_get(void);
757
758    EAPI Eina_Bool         ecore_main_loop_glib_integrate(void);
759    EAPI void              ecore_main_loop_glib_always_integrate_disable(void);
760        
761    EAPI void              ecore_main_loop_begin(void);
762    EAPI void              ecore_main_loop_quit(void);
763    EAPI Ecore_Fd_Handler *ecore_main_fd_handler_add(int fd, Ecore_Fd_Handler_Flags flags, Ecore_Fd_Cb func, const void *data,
764                                                     Ecore_Fd_Cb buf_func, const void *buf_data);
765    EAPI void              ecore_main_fd_handler_prepare_callback_set(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Prep_Cb func, const void *data);
766    EAPI void             *ecore_main_fd_handler_del(Ecore_Fd_Handler *fd_handler);
767    EAPI int               ecore_main_fd_handler_fd_get(Ecore_Fd_Handler *fd_handler);
768    EAPI Eina_Bool         ecore_main_fd_handler_active_get(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Handler_Flags flags);
769    EAPI void              ecore_main_fd_handler_active_set(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Handler_Flags flags);
770
771    EAPI Ecore_Win32_Handler *ecore_main_win32_handler_add(void *h, Ecore_Win32_Handle_Cb func, const void *data);
772    EAPI void                *ecore_main_win32_handler_del(Ecore_Win32_Handler *win32_handler);
773
774   /**
775    * @}
776    */
777
778   /**
779    * @defgroup Ecore_Pipe_Group Pipe wrapper
780    *
781    * @{
782    */
783
784    EAPI Ecore_Pipe  *ecore_pipe_add(Ecore_Pipe_Cb handler, const void *data);
785    EAPI void        *ecore_pipe_del(Ecore_Pipe *p);
786    EAPI Eina_Bool    ecore_pipe_write(Ecore_Pipe *p, const void *buffer, unsigned int nbytes);
787    EAPI void         ecore_pipe_write_close(Ecore_Pipe *p);
788    EAPI void         ecore_pipe_read_close(Ecore_Pipe *p);
789    EAPI void         ecore_pipe_thraw(Ecore_Pipe *p);
790    EAPI void         ecore_pipe_freeze(Ecore_Pipe *p);
791
792   /**
793    * @}
794    */
795
796   /**
797    * @defgroup Ecore_Thread_Group Ecore Thread functions
798    *
799    * @{
800    */
801
802    EAPI Ecore_Thread *ecore_thread_run(Ecore_Thread_Cb func_blocking,
803                                        Ecore_Thread_Cb func_end,
804                                        Ecore_Thread_Cb func_cancel,
805                                        const void *data);
806    EAPI Ecore_Thread *ecore_thread_feedback_run(Ecore_Thread_Cb func_heavy,
807                                                 Ecore_Thread_Notify_Cb func_notify,
808                                                 Ecore_Thread_Cb func_end,
809                                                 Ecore_Thread_Cb func_cancel,
810                                                 const void *data,
811                                                 Eina_Bool try_no_queue);
812    EAPI Eina_Bool     ecore_thread_cancel(Ecore_Thread *thread);
813    EAPI Eina_Bool     ecore_thread_check(Ecore_Thread *thread);
814    EAPI Eina_Bool     ecore_thread_feedback(Ecore_Thread *thread, const void *msg_data);
815    EAPI Eina_Bool     ecore_thread_reschedule(Ecore_Thread *thread);
816    EAPI int           ecore_thread_active_get(void);
817    EAPI int           ecore_thread_pending_get(void);
818    EAPI int           ecore_thread_pending_feedback_get(void);
819    EAPI int           ecore_thread_pending_total_get(void);
820    EAPI int           ecore_thread_max_get(void);
821    EAPI void          ecore_thread_max_set(int num);
822    EAPI void          ecore_thread_max_reset(void);
823    EAPI int           ecore_thread_available_get(void);
824    EAPI Eina_Bool     ecore_thread_local_data_add(Ecore_Thread *thread, const char *key, void *value, Eina_Free_Cb cb, Eina_Bool direct);
825    EAPI void         *ecore_thread_local_data_set(Ecore_Thread *thread, const char *key, void *value, Eina_Free_Cb cb);
826    EAPI void         *ecore_thread_local_data_find(Ecore_Thread *thread, const char *key);
827    EAPI Eina_Bool     ecore_thread_local_data_del(Ecore_Thread *thread, const char *key);
828
829    EAPI Eina_Bool     ecore_thread_global_data_add(const char *key, void *value, Eina_Free_Cb cb, Eina_Bool direct);
830    EAPI void         *ecore_thread_global_data_set(const char *key, void *value, Eina_Free_Cb cb);
831    EAPI void         *ecore_thread_global_data_find(const char *key);
832    EAPI Eina_Bool     ecore_thread_global_data_del(const char *key);
833    EAPI void         *ecore_thread_global_data_wait(const char *key, double seconds);
834
835   /**
836    * @}
837    */
838
839   /**
840    * @defgroup Ecore_Time_Group Ecore Time functions
841    *
842    * @{
843    */
844
845    EAPI double ecore_time_get(void);
846    EAPI double ecore_time_unix_get(void);
847    EAPI double ecore_loop_time_get(void);
848
849    EAPI Ecore_Timer *ecore_timer_add(double in, Ecore_Task_Cb func, const void *data);
850    EAPI Ecore_Timer *ecore_timer_loop_add(double in, Ecore_Task_Cb func, const void *data);
851    EAPI void        *ecore_timer_del(Ecore_Timer *timer);
852    EAPI void         ecore_timer_interval_set(Ecore_Timer *timer, double in);
853    EAPI double       ecore_timer_interval_get(Ecore_Timer *timer);
854    EAPI void         ecore_timer_freeze(Ecore_Timer *timer);
855    EAPI void         ecore_timer_thaw(Ecore_Timer *timer);
856    EAPI void         ecore_timer_delay(Ecore_Timer *timer, double add);
857    EAPI double       ecore_timer_pending_get(Ecore_Timer *timer);
858    EAPI double       ecore_timer_precision_get(void);
859    EAPI void         ecore_timer_precision_set(double precision);
860    EAPI char        *ecore_timer_dump(void);
861
862   /**
863    * @}
864    */
865
866   /**
867    * @defgroup Ecore_Animator_Group Ecore Animator functions
868    *
869    * @{
870    */
871
872    EAPI Ecore_Animator *ecore_animator_add(Ecore_Task_Cb func, const void *data);
873    EAPI Ecore_Animator *ecore_animator_timeline_add(double runtime, Ecore_Timeline_Cb func, const void *data);
874    EAPI void           *ecore_animator_del(Ecore_Animator *animator);
875    EAPI void            ecore_animator_freeze(Ecore_Animator *animator);
876    EAPI void            ecore_animator_thaw(Ecore_Animator *animator);
877    EAPI void            ecore_animator_frametime_set(double frametime);
878    EAPI double          ecore_animator_frametime_get(void);
879    EAPI double          ecore_animator_pos_map(double pos, Ecore_Pos_Map map, double v1, double v2);
880    EAPI void            ecore_animator_source_set(Ecore_Animator_Source source);
881    EAPI Ecore_Animator_Source ecore_animator_source_get(void);
882    EAPI void            ecore_animator_custom_source_tick_begin_callback_set(Ecore_Cb func, const void *data);
883    EAPI void            ecore_animator_custom_source_tick_end_callback_set(Ecore_Cb func, const void *data);
884    EAPI void            ecore_animator_custom_tick(void);
885          
886   /**
887    * @}
888    */
889
890   /**
891    * @defgroup Ecore_Poller_Group Ecore Poll functions
892    *
893    * @{
894    */
895
896    EAPI void          ecore_poller_poll_interval_set(Ecore_Poller_Type type, double poll_time);
897    EAPI double        ecore_poller_poll_interval_get(Ecore_Poller_Type type);
898    EAPI Eina_Bool     ecore_poller_poller_interval_set(Ecore_Poller *poller, int interval);
899    EAPI int           ecore_poller_poller_interval_get(Ecore_Poller *poller);
900    EAPI Ecore_Poller *ecore_poller_add(Ecore_Poller_Type type, int interval, Ecore_Task_Cb func, const void *data);
901    EAPI void         *ecore_poller_del(Ecore_Poller *poller);
902
903   /**
904    * @}
905    */
906
907   /**
908    * @defgroup Ecore_Job_Group Ecore Job functions
909    *
910    * @{
911    */
912
913    EAPI Ecore_Job *ecore_job_add(Ecore_Cb func, const void *data);
914    EAPI void      *ecore_job_del(Ecore_Job *job);
915
916   /**
917    * @}
918    */
919
920   /**
921    * @}
922    */
923
924 #ifdef __cplusplus
925 }
926 #endif
927 #endif