Enlightenment CVS committal

Author  : raster
Project : e17
Module  : libs/ecore

Dir     : e17/libs/ecore


Modified Files:
      Tag: SPLIT
        ecore.c.in 


Log Message:


more docs...
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/Attic/ecore.c.in,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -3 -r1.1.2.2 -r1.1.2.3
--- ecore.c.in  21 Feb 2003 04:59:11 -0000      1.1.2.2
+++ ecore.c.in  25 Feb 2003 08:06:00 -0000      1.1.2.3
@@ -28,11 +28,31 @@
 
 @section intro What is Ecore?
 
-Ecore is a clean and tiny event loop library with many modules.
+Ecore is a clean and tiny event loop library with many modules to do lots of
+convenient things for a programmer, to save time and effort.
 
 It's small and lean, designed to work on embedded systems all the way to
-large and powerful multi-cpu workstations.
+large and powerful multi-cpu workstations. It serialises all system signals,
+events etc. into a single event queue, that is easily processed without
+needing to worry about concurrency. A properly written, event-driven program
+using this kind of programming doesn't need threads, nor has to worry about
+concurrency. It turns a program into a state machine, and makes it very
+robust and easy to follow.
+
+Ecore gives you other handy primitives, such as timers to tick over for you
+and call specified functions at particular times so the programmer can use
+this to do things, like animate, or ime out on connections or tasks thattake
+too long etc.
+
+Idle handlers are provided too, as well and calls on entering an idle state
+(often a very good time to update the state of the program). All events that
+enter the system are passed to specific callback functions that he program
+sets up to handle those events. Handling them is simple and other Ecore
+modules produce more events on the queue, coming from other sources such as
+file descriptors etc.
 
+Ecore also lets you have functions called when file descriptors become active
+for reading or writing, allowing for streamlined, non-blocking IO.
 
 
 
@@ -49,24 +69,90 @@
 
 
 
[EMAIL PROTECTED] work How does Ecore work?
-
-For example:
-
[EMAIL PROTECTED]
-init();
-setup_program_gui();
-main_loop();
-shudtown();
[EMAIL PROTECTED]
-
-
-
 
[EMAIL PROTECTED] work How does Ecore work?
 
+Ecore is very easy to learn and use. All the function calls are designed to
+be easy to remember, explicit in describing what they do, and heavily
+name-spaced. Ecore programs can start and be very simple.
 
+For example:
 
[EMAIL PROTECTED]
+#include <Ecore.h>
 
+int main(int argc, char **argv)
+{
+  ecore_init();
+  ecore_app_args_set(argc, argv);
+  ecore_main_loop_begin();
+  ecore_evas_shutdown();
+  return 0;
+}
[EMAIL PROTECTED]
+
+This program is very simple and does't check for errors, but it does start up
+and begin a main loop waiting for events or timers to tick off. This program
+doesn't set up any, but now we can expand on this simple program a litlte
+more by adding some event handlers and timers.
+
[EMAIL PROTECTED]
+#include <Ecore.h>
+
+Ecore_Timer         *timer1     = NULL;
+Ecore_Event_Handler *handler1   = NULL;
+double               start_time = 0;0;
+
+int timer_func(void *data)
+{
+  printf("Tick timer. Sec: %3.2f\n", ecore_time_get() - start_time);
+  return 1;
+}
+
+int exit_func(int ev_type, void *ev, void *data)
+{
+  Ecore_Event_Signal_Exit *e;
+
+  e = (Ecore_Event_Signal_Exit *)ev;
+  if (e->interrupt)      printf("Exit: interrupt\n");
+  else if (e->quit)      printf("Exit: quit\n");
+  else if (e->terminate) printf("Exit: terminate\n");
+  ecore_main_loop_quit();
+  return 1;
+}
+
+int main(int argc, char **argv)
+{
+  ecore_init();
+  ecore_app_args_set(argc, argv);  
+  start_time = ecore_time_get();
+  handler1 = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, exit_func, NULL);
+  timer1 = ecore_timer_add(0.5, timer_func, NULL);  
+  ecore_main_loop_begin();
+  ecore_evas_shutdown();
+  return 0;
+}
[EMAIL PROTECTED]
+
+In the previous example, we initialize out application, get the time at which
+our program has started so we can calculate an offset. We set up a timer to
+tick off in 0.5 seconds, and since it returns 1, will keep ticking off every
+0.5 seconds until it returns 0, or is deleted by hand. An event handler is set
+up to call a function - exit_func(), whenever an event of type 
+ECORE_EVENT_SIGNAL_EXIT is recieved (CTRL-C on the command line will cause
+such an event to happen). If this event occurs it telsl you what kind of
+exit signal was recieved, and asks the main loop to quit when it is finished
+by calling ecore_main_loop_quit().
+
+The handles returned by ecore_timer_add() and ecore_event_handler_add() are 
+only stored here as an example. If you don't need ot address the timer or 
+event handler again you don't need to store the result, so just call the 
+function, and dont assign the result to any variable.
+
+This program looks slightly more complex than needed to do these simple
+things, but in principle, programs don't get any more complex. You add more
+event handlers, for more events, will have more timers and such, BUT it all
+follows the same principles as shown in this example.
 
 
 
@@ -77,7 +163,7 @@
 
 @section compiling How to compile using Ecore?
 
-
+To be documented...
 
 
 
@@ -94,8 +180,6 @@
 
 
 @section install How is it installed?
-
-To be documented...
 
 Suggested configure options for evas for a P2/AMD/P3/P4 desktop X display:
 




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to