2 @brief Ecore Library Public API Calls
4 These routines are used for Ecore Library interaction
11 @image latex ecore_big.eps width=5cm
15 @author Carsten Haitzler <raster\@rasterman.com>
16 @author Tom Gilbert <tom\@linuxbrit.co.uk>
17 @author Burra <burra\@colorado.edu>
18 @author Chris Ross <chris\@darkrock.co.uk>
19 @author Term <term\@twistedpath.org>
20 @author Tilman Sauerbeck <tilman\@code-monkey.de>
21 @author Nathan Ingersoll <rbdpngn\@users.sourceforge.net>
24 @section intro Introduction
26 Ecore is a library of convenience functions.
28 The Ecore library provides the following modules:
29 @li @link Ecore.h Ecore - Main Loop Functions. @endlink
30 @li @link Ecore_Con.h Ecore_Con - Connection functions. @endlink
31 @li @link Ecore_Config.h Ecore_Config - Configuration functions. @endlink
32 @li @link Ecore_Evas.h Ecore_Evas - Evas convenience functions. @endlink
33 @li @link Ecore_Fb.h Ecore_FB - Frame buffer convenience functions. @endlink
34 @li @link Ecore_Ipc.h Ecore_IPC - Inter Process Communication functions. @endlink
35 @li @link Ecore_Job.h Ecore_Job - Job functions, to be used in the Ecore main loop. @endlink
36 @li @link Ecore_Txt.h Ecore_Txt - Text encoding conversion. @endlink
37 @li @link Ecore_X.h Ecore_X - X Windows System wrapper. @endlink
39 @section compiling How to compile using Ecore?
41 This section has to be documented. Below is just a quick line to handle all
42 Ecore modules at once.
46 -I/usr/local/include -I/usr/X11R6/include \
47 -L/usr/local/lib -L/usr/X11R6/lib \
48 -lecore -lecore_evas -lecore_x -lecore_fb -lecore_job \
49 `evas-config --cflags --libs`
52 @section install How is it installed?
54 Suggested configure options for evas for a Linux desktop X display:
61 --enable-ecore-evas-gl \
66 make CFLAGS="-O9 -mpentiumpro -march=pentiumpro -mcpu=pentiumpro"
69 @todo (1.0) Document API
74 @page Ecore_Main_Loop_Page The Ecore Main Loop
76 @section intro What is Ecore?
78 Ecore is a clean and tiny event loop library with many modules to do lots of
79 convenient things for a programmer, to save time and effort.
81 It's small and lean, designed to work on embedded systems all the way to
82 large and powerful multi-cpu workstations. It serialises all system signals,
83 events etc. into a single event queue, that is easily processed without
84 needing to worry about concurrency. A properly written, event-driven program
85 using this kind of programming doesn't need threads, nor has to worry about
86 concurrency. It turns a program into a state machine, and makes it very
87 robust and easy to follow.
89 Ecore gives you other handy primitives, such as timers to tick over for you
90 and call specified functions at particular times so the programmer can use
91 this to do things, like animate, or time out on connections or tasks that take
94 Idle handlers are provided too, as well as calls on entering an idle state
95 (often a very good time to update the state of the program). All events that
96 enter the system are passed to specific callback functions that the program
97 sets up to handle those events. Handling them is simple and other Ecore
98 modules produce more events on the queue, coming from other sources such as
101 Ecore also lets you have functions called when file descriptors become active
102 for reading or writing, allowing for streamlined, non-blocking IO.
104 Here is an exmaple of a simple program and its basic event loop flow:
106 @image html prog_flow.png
110 @section work How does Ecore work?
112 Ecore is very easy to learn and use. All the function calls are designed to
113 be easy to remember, explicit in describing what they do, and heavily
114 name-spaced. Ecore programs can start and be very simple.
121 int main(int argc, const char **argv)
124 ecore_app_args_set(argc, argv);
125 ecore_main_loop_begin();
131 This program is very simple and does't check for errors, but it does start up
132 and begin a main loop waiting for events or timers to tick off. This program
133 doesn't set up any, but now we can expand on this simple program a little
134 more by adding some event handlers and timers.
139 Ecore_Timer *timer1 = NULL;
140 Ecore_Event_Handler *handler1 = NULL;
141 double start_time = 0.0;
143 int timer_func(void *data)
145 printf("Tick timer. Sec: %3.2f\n", ecore_time_get() - start_time);
149 int exit_func(void *data, int ev_type, void *ev)
151 Ecore_Event_Signal_Exit *e;
153 e = (Ecore_Event_Signal_Exit *)ev;
154 if (e->interrupt) printf("Exit: interrupt\n");
155 else if (e->quit) printf("Exit: quit\n");
156 else if (e->terminate) printf("Exit: terminate\n");
157 ecore_main_loop_quit();
161 int main(int argc, const char **argv)
164 ecore_app_args_set(argc, argv);
165 start_time = ecore_time_get();
166 handler1 = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, exit_func, NULL);
167 timer1 = ecore_timer_add(0.5, timer_func, NULL);
168 ecore_main_loop_begin();
174 In the previous example, we initialize our application and get the time at
175 which our program has started so we can calculate an offset. We set
176 up a timer to tick off in 0.5 seconds, and since it returns 1, will
177 keep ticking off every 0.5 seconds until it returns 0, or is deleted
178 by hand. An event handler is set up to call a function - exit_func(),
179 whenever an event of type ECORE_EVENT_SIGNAL_EXIT is received (CTRL-C
180 on the command line will cause such an event to happen). If this event
181 occurs it tells you what kind of exit signal was received, and asks
182 the main loop to quit when it is finished by calling
183 ecore_main_loop_quit().
185 The handles returned by ecore_timer_add() and ecore_event_handler_add() are
186 only stored here as an example. If you don't need to address the timer or
187 event handler again you don't need to store the result, so just call the
188 function, and don't assign the result to any variable.
190 This program looks slightly more complex than needed to do these simple
191 things, but in principle, programs don't get any more complex. You add more
192 event handlers, for more events, will have more timers and such, BUT it all
193 follows the same principles as shown in this example.
198 @page Ecore_Config_Page The Enlightened Property Library
200 The Enlightened Property Library (Ecore_Config) is an adbstraction
201 from the complexities of writing your own configuration. It provides
202 many features using the Enlightenment 17 development libraries.
204 To use the library, you:
205 @li Set the default values of your properties.
206 @li Load the configuration from a file. You must set the default values
207 first, so that the library knows the correct type of each argument.
209 The following examples show how to use the Enlightened Property Library:
210 @li @link config_basic_example.c config_basic_example.c @endlink
211 @li @link config_listener_example.c config_listener_example.c @endlink
216 @page Ecore_ADT_Page Ecore Abstract Data Types
218 This page briefly describes the different abstract data types
219 that are provided by the Ecore library for general usage. You need to
220 include the @link Ecore_Data.h Ecore_Data.h @endlink to use them.
222 @section Ecore_ADT_List List
224 A list is a simple data type where one each piece of data points to
225 another piece of data.
227 Associated modules that describe the List ADT include:
228 @li @ref Ecore_Data_List_Creation_Group
229 @li @ref Ecore_Data_List_Add_Item_Group
230 @li @ref Ecore_Data_List_Remove_Item_Group
231 @li @ref Ecore_Data_List_Traverse_Group
232 @li @ref Ecore_Data_List_Node_Group
234 Examples involving lists include:
235 @li @link list_example.c list_example.c @endlink
237 @section Ecore_ADT_DList Doubly Linked List
239 A doubly linked list is like a linked list, only each piece of data
240 can also point to the piece before it. In other words, you can traverse
241 a doubly linked list in both directions.
243 Associated modules that describe the DList ADT include:
244 @li @ref Ecore_Data_DList_Creation_Group
245 @li @ref Ecore_Data_DList_Add_Item_Group
246 @li @ref Ecore_Data_DList_Remove_Item_Group
248 @section Ecore_ADT_Hash Hash
250 A hash is an abstract data type where one value is associated with another
251 value. Instead of each element of the group being accessible using a
252 number, each element is accessed using another object.
254 Associated modules that describe the Hash ADT include:
255 @li @ref Ecore_Data_Hash_ADT_Creation_Group
256 @li @ref Ecore_Data_Hash_ADT_Destruction_Group
257 @li @ref Ecore_Data_Hash_ADT_Data_Group
263 @page X_Window_System_Page X Window System
265 The Ecore library includes a wrapper for handling the X window system.
266 This page briefly explains what the X window system is and various terms
273 @defgroup Ecore_Timer_Group Ecore Timer
275 The timer allows callbacks to be called at specific intervals.
279 @defgroup Ecore_Job_Group Ecore Jobs
281 You can queue jobs that are to be done by the main loop when the current
286 @defgroup Idle_Group Idle Handlers
288 Callbacks that are called when the program enters or exits an idle state.
290 The ecore main loop enters an idle state when it is waiting for timers
291 to time out, data to come in on a file descriptor or any other event
292 to occur. You can set callbacks to be called when the main loop
293 enters an idle state, during an idle state or just after the program
296 Enterer callbacks are good for updating your program's state, if it
297 has a state engine. Once all of the enterer handlers are called, the
298 program will enter a "sleeping" state.
300 Idler callbacks are called when the main loop has called all enterer
301 handlers. They are useful for interfaces that require polling and
302 timers would be too slow to use.
304 If no idler callbacks are specified, then the process literally goes
305 to sleep. Otherwise, the idler callbacks are called continuously
306 while the loop is "idle", using as much CPU as is available to the
309 Exiter callbacks are called when the main loop wakes up from an idle
315 @defgroup Ecore_Config_Create_Group Ecore Config Create Functions
317 Convenience functions that set default values, bounds, option values and
318 descriptions in one call.
322 @defgroup Ecore_Config_File_Group Ecore Config File Functions
324 Functions that are used to load and save properties from and to files.
330 @example args_example.c
331 Shows how to set and retrieve the program arguments.
335 @example con_server_example.c
336 Shows how to write a simple server using the Ecore_Con library.
340 @example con_client_example.c
341 Shows how to write a simple client, that connects to the example server.
345 @example event_handler_example.c
346 Shows how to use event handlers.
350 @example timer_example.c
351 Demonstrates use of the ecore_timer.
355 @example config_basic_example.c
356 Provides an example of how to use the basic configuration functions.
357 See the file Ecore_Config.h for the full list of available functions.
361 @example config_listener_example.c
362 Shows how to set up a listener to listen for configuration changes.
366 @example list_example.c
367 Provides a basic example of how to append to and traverse a list.
371 @example list_destroy_example.c
372 Shows how to set and use a destructor for an Ecore_List.
376 @example x_window_example.c
377 Shows the basics of using the X Windows system through Ecore functions.