Enlightenment CVS committal
Author : raster
Project : e17
Module : libs/ecore
Dir : e17/libs/ecore/src/lib/ecore
Modified Files:
Tag: SPLIT
Ecore.h ecore.c ecore_app.c ecore_events.c ecore_exe.c
ecore_idle_enterer.c ecore_idler.c ecore_main.c
ecore_private.h ecore_signal.c ecore_timer.c
Log Message:
doc doc doc... :)
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore/Attic/Ecore.h,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -3 -r1.1.2.4 -r1.1.2.5
--- Ecore.h 5 Feb 2003 00:10:19 -0000 1.1.2.4
+++ Ecore.h 20 Feb 2003 06:56:40 -0000 1.1.2.5
@@ -12,66 +12,66 @@
#endif
#define ECORE_EVENT_NONE 0
-#define ECORE_EVENT_EXE_EXIT 1
-#define ECORE_EVENT_SIGNAL_USER 2
-#define ECORE_EVENT_SIGNAL_HUP 3
-#define ECORE_EVENT_SIGNAL_EXIT 4
-#define ECORE_EVENT_SIGNAL_POWER 5
+#define ECORE_EVENT_EXE_EXIT 1 /**< Spawned Exe has exit event */
+#define ECORE_EVENT_SIGNAL_USER 2 /**< User signal event */
+#define ECORE_EVENT_SIGNAL_HUP 3 /**< Hup signal event */
+#define ECORE_EVENT_SIGNAL_EXIT 4 /**< Exit signal event */
+#define ECORE_EVENT_SIGNAL_POWER 5 /**< Power signal event */
#define ECORE_EVENT_COUNT 6
#ifndef _ECORE_PRIVATE_H
enum _Ecore_Fd_Handler_Flags
{
- ECORE_FD_READ = 1,
- ECORE_FD_WRITE = 2
+ ECORE_FD_READ = 1, /**< Fd Read mask */
+ ECORE_FD_WRITE = 2 /**< Fd Write mask */
};
typedef enum _Ecore_Fd_Handler_Flags Ecore_Fd_Handler_Flags;
- typedef void Ecore_Exe;
- typedef void Ecore_Timer;
- typedef void Ecore_Idler;
- typedef void Ecore_Idle_Enterer;
- typedef void Ecore_Fd_Handler;
- typedef void Ecore_Event_Handler;
- typedef void Ecore_Event_Filter;
- typedef void Ecore_Event;
+ typedef void Ecore_Exe; /**< A handle for spawned processes */
+ typedef void Ecore_Timer; /**< A handle for timers */
+ typedef void Ecore_Idler; /**< A handle for idlers */
+ typedef void Ecore_Idle_Enterer; /**< A handle for idle enterers */
+ typedef void Ecore_Fd_Handler; /**< A handle for Fd hanlders */
+ typedef void Ecore_Event_Handler; /**< A handle for an event handler */
+ typedef void Ecore_Event_Filter; /**< A handle for an event filter */
+ typedef void Ecore_Event; /**< A handle for an event */
#endif
- typedef struct _Ecore_Event_Exe_Exit Ecore_Event_Exe_Exit;
- typedef struct _Ecore_Event_Signal_User Ecore_Event_Signal_User;
- typedef struct _Ecore_Event_Signal_Hup Ecore_Event_Signal_Hup;
- typedef struct _Ecore_Event_Signal_Exit Ecore_Event_Signal_Exit;
- typedef struct _Ecore_Event_Signal_Power Ecore_Event_Signal_Power;
+ typedef struct _Ecore_Event_Exe_Exit Ecore_Event_Exe_Exit; /**< Spawned Exe
+exit event */
+ typedef struct _Ecore_Event_Signal_User Ecore_Event_Signal_User; /**< User signal
+event */
+ typedef struct _Ecore_Event_Signal_Hup Ecore_Event_Signal_Hup; /**< Hup signal
+event */
+ typedef struct _Ecore_Event_Signal_Exit Ecore_Event_Signal_Exit; /**< Exit signal
+event */
+ typedef struct _Ecore_Event_Signal_Power Ecore_Event_Signal_Power; /**< Power
+signal event */
- struct _Ecore_Event_Exe_Exit
+ struct _Ecore_Event_Exe_Exit /** Process exit event */
{
- pid_t pid;
- int exit_code;
- Ecore_Exe *exe;
- void *ext_data;
+ pid_t pid; /**< The process ID of the process that exited */
+ int exit_code; /**< The exit code of the process */
+ Ecore_Exe *exe; /**< The handle to the exited process, or NULL if not found */
+ void *ext_data; /**< Extension data - not used */
};
- struct _Ecore_Event_Signal_User
+ struct _Ecore_Event_Signal_User /** User signal event */
{
- int number;
- void *ext_data;
+ int number; /**< The signal number. Either 1 or 2 */
+ void *ext_data; /**< Extension data - not used */
};
- struct _Ecore_Event_Signal_Hup
+ struct _Ecore_Event_Signal_Hup /** Hup signal event */
{
- void *ext_data;
+ void *ext_data; /**< Extension data - not used */
};
- struct _Ecore_Event_Signal_Exit
+ struct _Ecore_Event_Signal_Exit /** Exit request event */
{
- int interrupt : 1;
- int quit : 1;
- int terminate : 1;
- void *ext_data;
+ int interrupt : 1; /**< Set if the exit request was an interrupt signal*/
+ int quit : 1; /**< set if the exit request was a quit signal */
+ int terminate : 1; /**< Set if the exit request was a terminate singal */
+ void *ext_data; /**< Extension data - not used */
};
- struct _Ecore_Event_Signal_Power
+ struct _Ecore_Event_Signal_Power /** Power event */
{
- void *ext_data;
+ void *ext_data; /**< Extension data - not used */
};
int ecore_init(void);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore/Attic/ecore.c,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -3 -r1.1.2.5 -r1.1.2.6
--- ecore.c 25 Jan 2003 02:25:54 -0000 1.1.2.5
+++ ecore.c 20 Feb 2003 06:56:40 -0000 1.1.2.6
@@ -5,7 +5,7 @@
/**
* Set up connections, signal handlers, sockets etc.
- * @return 1 on success, 0 otherwise
+ * @return 1 or greater on success, 0 otherwise
*
* This function sets up all singal handlers and the basic event loop.
*/
@@ -19,11 +19,20 @@
/**
* Shut down connections, signal handlers sockets etc.
*
- * This function shuts all things set up in ecore_init() and cleans up
+ * This function shuts all things set up in ecore_init() and cleans up all
+ * event queues, handles, filters, timers, idlers, idle enterers etc. set up
+ * after ecore_init() was called.
*/
void
ecore_shutdown(void)
{
+ _ecore_exe_shutdown();
+ _ecore_idle_enterer_shutdown();
+ _ecore_idler_shutdown();
+ _ecore_timer_shutdown();
+ _ecore_event_shutdown();
+ _ecore_main_shutdown();
+ _ecore_signal_shutdown();
}
void
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore/Attic/ecore_app.c,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -3 -r1.1.2.1 -r1.1.2.2
--- ecore_app.c 16 Jan 2003 08:48:51 -0000 1.1.2.1
+++ ecore_app.c 20 Feb 2003 06:56:40 -0000 1.1.2.2
@@ -27,7 +27,9 @@
* @param argv A pointer to the return value to hold argv
*
* When called, this funciton returns the arguments for the program stored by
- * ecore_app_args_set().
+ * ecore_app_args_set(). The integer pointed to by @p argc will be filled, if
+ * the pointer is not NULL, and the string array pointer @p argv will be filled
+ * also if the pointer is not NULL.
*/
void
ecore_app_args_get(int *argc, char ***argv)
@@ -43,9 +45,11 @@
* using the command-line arguments stored by ecore_app_args_set(). This is
* an easy way for a program to restart itself for cleanup purposes,
* configuration reasons or in the event of a crash.
+ *
+ * FIXME: Currently not implimented.
*/
void
ecore_app_restart(void)
{
- /* FIXME: exec selt using argv, argc etc. */
+ /* FIXME: exec self using argv, argc etc. */
}
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore/Attic/ecore_events.c,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -u -3 -r1.1.2.6 -r1.1.2.7
--- ecore_events.c 5 Feb 2003 00:10:19 -0000 1.1.2.6
+++ ecore_events.c 20 Feb 2003 06:56:40 -0000 1.1.2.7
@@ -14,12 +14,19 @@
/**
* Add an event handler
- * @param type
- * @param func
- * @param data
- * @return Handler handle
- *
- * Add an event handler
+ * @param type The type of the event this handler will get called for
+ * @param func The function to call when the event is found in the queue
+ * @param data A data pointer to pass to the called function @p func
+ * @return Handler handle, or NULL on failure
+ *
+ * Add an event handler to the list of handlers. This will, on success return
+ * a handle to the event handler that can be used later to remove the handler
+ * using ecore_event_handler_del(). The @p type parameter is the iteger of the
+ * event type that will trigger this callback to be called. The callback
+ * @p func is called when this event is processed and will be passed the
+ * event type, a pointer to the private event structure that is specific to
+ * that event type, and a data pointer that is provided in this call as the
+ * @p data parameter.
*/
Ecore_Event_Handler *
ecore_event_handler_add(int type, int (*func) (int type, void *event, void *data),
const void *data)
@@ -40,10 +47,13 @@
/**
* Delete an event handler
- * @param event_handler
+ * @param event_handler Event handler handle to delete
* @return Data passed to handler
*
- * Delete a specified event handler
+ * Delete a specified event handler from the handler list. On success this will
+ * delete the event handler and return the pointer passed as @p data when the
+ * handler was added by ecore_event_handler_add(). On failure NULL will be
+ * returned.
*/
void *
ecore_event_handler_del(Ecore_Event_Handler *event_handler)
@@ -61,13 +71,20 @@
/**
* Add an event to the event queue
- * @param type
- * @param ev
- * @param func_free
- * @param data
+ * @param type The event type to add to the end of the event queue
+ * @param ev The private data structure for this event type
+ * @param func_free The function to be called to free this private structure
+ * @param data The data pointer to be passed to the free function
* @return A Handle for that event
*
- * This adds an event to the event queue/
+ * On success this function returns a handle to an event on the event queue, or
+ * NULL if it fails. If it succeeds, an event of type @p type will be added
+ * to the queue for processing by event handlers added by
+ * ecore_event_handler_add(). The @p ev parameter will be a pointer to the event
+ * private data that is specific to that event type. When the event is no
+ * longer needed, @p func_Free will be called and passed the private sructure
+ * pointer for cleaning up. If @p func_free is NULL, nothnig will be called.
+ * This function is passed @p data as its data parameter.
*/
Ecore_Event *
ecore_event_add(int type, void *ev, void (*func_free) (void *ev, void *data), void
*data)
@@ -81,10 +98,14 @@
/**
* Delete an event from the queue
- * @param event
- * @return The data pointer originally set for the event
+ * @param event The event handle to delete
+ * @return The data pointer originally set for the event free function
*
- * Delete the specified event from the event queue
+ * This deleted the event @p event from the event queue, and returns the
+ * @p data parameer originally set when adding it with ecore_event_add(). This
+ * does not immediately call the free function, and it may be called later on
+ * cleanup, and so if the free function depends on the data pointer to work,
+ * you should defer cleaning of this till the free function is called later.
*/
void *
ecore_event_del(Ecore_Event *event)
@@ -103,7 +124,11 @@
* Allocate a new event type id sensibly and return the new id
* @return A new event type id.
*
- * This function allocates a new event type id and returns it.
+ * This function allocates a new event type id and returns it. Once an event
+ * type has been allocated it can never be de-allocated during the life of
+ * the program. There is no guarantee of the contents of this event ID, or how
+ * it is calculated, except that the ID will be unique to the current instance
+ * of the process.
*/
int
ecore_event_type_new(void)
@@ -112,16 +137,25 @@
return event_id_max - 1;
}
-#if 1
/**
* Add a filter the current event queue
- * @param func_start
- * @param func_filter
- * @param func_end
- * @param data
- * @return filter handle
- *
- * Add a filter to call callbacks to loop through the event queue and filter
+ * @param func_start Function to call just before filtering and return data
+ * @param func_filter Function to call on each event
+ * @param func_end Function to call after the queu has been filtered
+ * @param data Data to pass to the filter functions
+ * @return A filter handle
+ *
+ * This adds a filter to call callbacks to loop through the event queue and
+ * filter events out of the queue. On failure NULL is returned. On success a
+ * Filter handle is returned. Filters are called on the queue just before
+ * Event handler processing to try and remoe redundant events. Just as
+ * processing starts @p func_start is called and passed the @p data pointer.
+ * This function returned a pointer to loop_data that is now passed to
+ * @p func_filter as loop_data. @p func_filter is also passed @p data and the
+ * event type and private event structure. If this callback returns 0, the
+ * event is removed from the queue. If it returns 1, the event is kept. When
+ * processing is finished @p func_end is called and is passed the loop_data
+ * and @p data pointer to clean up.
*/
Ecore_Event_Filter *
ecore_event_filter_add(void * (*func_start) (void *data), int (*func_filter) (int
type, void *event, void *loop_data, void *data), void (*func_end) (void *loop_data,
void *data), const void *data)
@@ -142,10 +176,12 @@
/**
* Delete an event filter
- * @param ef
+ * @param ef The event filter handle
* @return The data set for the filter
*
- * Delete a filter that has been added
+ * Delete a filter that has been added by its @p ef handle. On success this
+ * will return the data pointer set when this filter was added. On failure
+ * NULL is returned.
*/
void *
ecore_event_filter_del(Ecore_Event_Filter *ef)
@@ -161,8 +197,32 @@
return ef->data;
}
-#endif
-
+void
+_ecore_event_shutdown(void)
+{
+ while (events) _ecore_event_del(events);
+ while (event_handlers)
+ {
+ Ecore_Event_Handler *eh;
+
+ eh = event_handlers;
+ event_handlers = _ecore_list_remove(event_handlers, eh);
+ ECORE_MAGIC_SET(eh, ECORE_MAGIC_NONE);
+ free(eh);
+ }
+ event_handlers_delete_me = 0;
+ while (event_filters)
+ {
+ Ecore_Event_Filter *ef;
+
+ ef = event_filters;
+ event_filters = _ecore_list_remove(event_filters, ef);
+ ECORE_MAGIC_SET(ef, ECORE_MAGIC_NONE);
+ free(ef);
+ }
+ event_filters_delete_me = 0;
+}
+
int
_ecore_event_exist(void)
{
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore/Attic/ecore_exe.c,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -3 -r1.1.2.5 -r1.1.2.6
--- ecore_exe.c 25 Jan 2003 02:17:02 -0000 1.1.2.5
+++ ecore_exe.c 20 Feb 2003 06:56:40 -0000 1.1.2.6
@@ -57,7 +57,8 @@
*
* This frees an exe handle (but does not affect the process that was spawned
* that this handle was a result of) and returns the data pointer set on
- * executable start
+ * executable start. This does mean there is no handle for the spawned
+ * process anymore.
*/
void *
ecore_exe_free(Ecore_Exe *exe)
@@ -111,10 +112,10 @@
}
/**
- * Control an executed child
- * @param exe The process handleto control
+ * Pause a spawned process
+ * @param exe The process handle to control
*
- * This function controls an executed process
+ * This function pauses a process that was spawned.
*/
void
ecore_exe_pause(Ecore_Exe *exe)
@@ -129,10 +130,11 @@
}
/**
- * Control an executed child
- * @param exe The process handleto control
+ * Continue a paused process
+ * @param exe The process handle to control
*
- * This function controls an executed process
+ * This Continues a process. This is only useful if the process has already
+ * been paused by something like ecore_exe_pause().
*/
void
ecore_exe_continue(Ecore_Exe *exe)
@@ -147,10 +149,10 @@
}
/**
- * Control an executed child
- * @param exe The process handleto control
+ * Terminate a process.
+ * @param exe The process handle to control
*
- * This function controls an executed process
+ * This function asks a process to terminate.
*/
void
ecore_exe_terminate(Ecore_Exe *exe)
@@ -165,10 +167,12 @@
}
/**
- * Control an executed child
- * @param exe The process handleto control
+ * Kill a process
+ * @param exe The process handle to control
*
- * This function controls an executed process
+ * This function ills off a process, and that process has no choice and will
+ * exit as a result of this function, without having a chance to clean up,
+ * save data, or safely shut down.
*/
void
ecore_exe_kill(Ecore_Exe *exe)
@@ -183,10 +187,12 @@
}
/**
- * Control an executed child
- * @param exe The process handleto control
+ * Send a user signal to a process
+ * @param exe The process handle to control
*
- * This function controls an executed process
+ * This function sends a user signal (SIGUSR) to a process. @p num determines
+ * what numbered user signal to send. This may be either 1 or 2. Other values
+ * are illegal and will be ignored, with this function doing nothing.
*/
void
ecore_exe_signal(Ecore_Exe *exe, int num)
@@ -204,10 +210,10 @@
}
/**
- * Control an executed child
- * @param exe The process handleto control
+ * Send a HUP signal to a process
+ * @param exe The process handle to control
*
- * This function controls an executed process
+ * This function sends a HUP signal to the specified process.
*/
void
ecore_exe_hup(Ecore_Exe *exe)
@@ -219,6 +225,12 @@
return;
}
kill(exe->pid, SIGHUP);
+}
+
+void
+_ecore_exe_shutdown(void)
+{
+ while (exes) _ecore_exe_free(exes);
}
Ecore_Exe *
===================================================================
RCS file:
/cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore/Attic/ecore_idle_enterer.c,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -3 -r1.1.2.4 -r1.1.2.5
--- ecore_idle_enterer.c 25 Jan 2003 02:17:02 -0000 1.1.2.4
+++ ecore_idle_enterer.c 20 Feb 2003 06:56:40 -0000 1.1.2.5
@@ -6,11 +6,18 @@
/**
* Add an idle enterer handler
- * @param func
- * @param data
- * @return
+ * @param func The function to call when entering an idle state.
+ * @param data The data to be passed to the @p func call
+ * @return A handle to the idle enterer callback
*
- * This function adds an idle enterer handler and returns its handle
+ * This function adds an idle enterer handler and returns its handle on success
+ * or NULL on failure. Idle enterers are called just before he program goes
+ * int an idle state where it is waiting on timers to time out, data to come
+ * in on file descriptors, etc. The program will be in a "sleeping" state
+ * after all the idle enterer callbacks are called. This is a good callback to
+ * use to update your program's state if it has a state engine. Do all your
+ * heavy processing here to update state (like drawing etc.). When @p func
+ * is called, it will be passed the pointer @p data.
*/
Ecore_Idle_Enterer *
ecore_idle_enterer_add(int (*func) (void *data), const void *data)
@@ -29,10 +36,12 @@
/**
* Delete an idle enter handler
- * @param idle_enterer
+ * @param idle_enterer The idle enterer to delete
*
* Delete the specified @p idle_enterer from the set of idle_enterers that are
- * executed during main loop execution.
+ * executed during main loop execution. On success the data pointer that was
+ * being passed to the idle handler function, set by ecore_idle_enterer_add()
+ * will be returned.
*/
void *
ecore_idle_enterer_del(Ecore_Idle_Enterer *idle_enterer)
@@ -46,6 +55,21 @@
idle_enterer->delete_me = 1;
idle_enterers_delete_me = 1;
return idle_enterer->data;
+}
+
+void
+_ecore_idle_enterer_shutdown(void)
+{
+ while (idle_enterers)
+ {
+ Ecore_Idle_Enterer *ie;
+
+ ie = idle_enterers;
+ idle_enterers = _ecore_list_remove(idle_enterers, ie);
+ ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE);
+ free(ie);
+ }
+ idle_enterers_delete_me = 0;
}
void
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore/Attic/ecore_idler.c,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -3 -r1.1.2.4 -r1.1.2.5
--- ecore_idler.c 25 Jan 2003 02:17:02 -0000 1.1.2.4
+++ ecore_idler.c 20 Feb 2003 06:56:40 -0000 1.1.2.5
@@ -1,16 +1,24 @@
#include "ecore_private.h"
#include "Ecore.h"
-static Ecore_Idle_Enterer *idlers = NULL;
-static int idlers_delete_me = 0;
+static Ecore_Idler *idlers = NULL;
+static int idlers_delete_me = 0;
/**
- * Add an idle handler
- * @param func
- * @param data
- * @return
+ * Add an idler handler
+ * @param func The function to call when idling.
+ * @param data The data to be passed to this @p func call
+ * @return A idler handle
*
- * This function adds an idle handler and returns its handle
+ * This function adds an idler handler and returns its handle on success, or
+ * NULL on failure. Idlers will get called after idle enterer calls have all
+ * been called and the program is in an idle state waiting on data or timers.
+ * If no idler functions are set the process literally goes to sleep and uses
+ * no CPU. If You have idler functions set they will be called continuously
+ * during this "idle" time with your process consuming as much CPU as it can
+ * get to do so. This is useful for when there are interfaces that require
+ * polling and timers will mean too slow a response from the process if polling
+ * is done by timers.
*/
Ecore_Idler *
ecore_idler_add(int (*func) (void *data), const void *data)
@@ -28,11 +36,13 @@
}
/**
- * Delete an idle handler
- * @param idler
+ * Delete an idler handler
+ * @param idler The idler to delete
*
* Delete the specified @p idler from the set of idlers that are executed
- * during main loop execution.
+ * during main loop execution. On success the data pointer set by
+ * ecore_idler_add() and passed to the idler function is returned, or NULL
+ * on failure.
*/
void *
ecore_idler_del(Ecore_Idler *idler)
@@ -46,6 +56,21 @@
idler->delete_me = 1;
idlers_delete_me = 1;
return idler->data;
+}
+
+void
+_ecore_idler_shutdown(void)
+{
+ while (idlers)
+ {
+ Ecore_Idler *ie;
+
+ ie = idlers;
+ idlers = _ecore_list_remove(idlers, ie);
+ ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE);
+ free(ie);
+ }
+ idlers_delete_me = 0;
}
int
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore/Attic/ecore_main.c,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -3 -r1.1.2.5 -r1.1.2.6
--- ecore_main.c 25 Jan 2003 06:46:38 -0000 1.1.2.5
+++ ecore_main.c 20 Feb 2003 06:56:40 -0000 1.1.2.6
@@ -20,7 +20,8 @@
*
* This function does not return until ecore_main_loop_quit() is called. It
* will keep looping internally and call all callbacks set up to handle timers,
- * idle state and events Ecore recieves from X, IPC, signals etc.
+ * idle state and events Ecore recieves from X, fd's, IPC, signals etc. and
+ * anything else that has registered a handler with ecore itself.
*/
void
ecore_main_loop_begin(void)
@@ -133,15 +134,13 @@
/* process signals into events .... */
while (_ecore_signal_count_get()) _ecore_signal_call();
- /* filter events to remove useless ones etc. ... */
- /* FIXME: implement some other day... */
-
/* handle events ... */
_ecore_event_call();
_ecore_main_fd_handlers_cleanup();
}
while (_ecore_main_fd_handlers_buf_call());
}
+ quit = 0;
}
/**
@@ -158,14 +157,28 @@
}
/**
- * Add a handler for read/write of a fd
- * @param fd
- * @param flags
- * @param func
- * @param data
- * @return A handler handle
+ * Add a handler for read/write notification of a file descriptor
+ * @param fd The file descriptor to watch
+ * @param flags To watch it for read and/or write ability
+ * @param func The function to call when the file descriptor becomes active
+ * @param data The data to pass to the @p func call
+ * @return A fd handler handle
+ *
+ * This adds a fd handler, calling @p func whenever the fd is active for
+ * read or write (or both) depending what flags were set as @p flags. On
+ * failure NULL is returned. The @p func call will the triggered during
+ * execution of ecore_main_loop_begin() when a file descriptor (fd) is
+ * available for reading or writing (or both).
+ *
+ * Example:
*
- * This adds a fd handler, calling @p func whenever the fd is active
+ * @code
+ * int fd;
+ * Ecore_Fd_Handler *fdh;
+ *
+ * fd = open("/tmp/fifo", O_RDONLY);
+ * fdh = ecore_main_fd_handler_add(fd, ECORE_FD_READ, func_read_fifo, NULL);
+ * @endcode
*/
Ecore_Fd_Handler *
ecore_main_fd_handler_add(int fd, Ecore_Fd_Handler_Flags flags, int (*func)
(Ecore_Fd_Handler *fd_handler, void *data), const void *data, int (*buf_func)
(Ecore_Fd_Handler *fd_handler, void *buf_data), const void *buf_data)
@@ -192,12 +205,14 @@
}
/**
- * Delete a handler for fd's
+ * Delete a handler for file descriptors.
*
- * @param fd_handler
+ * @param fd_handler The handler to delete
* @return The data pointer set for the fd_handler
*
- * This deletes a fd handler
+ * This deletes a file descriptore (fd) handler and on success returns the data
+ * pointer that was being passed to it, set by ecore_main_fd_handler_add().
+ * NUll is returned on failure.
*/
void *
ecore_main_fd_handler_del(Ecore_Fd_Handler *fd_handler)
@@ -214,11 +229,11 @@
}
/**
- * Return the fd the handler is handling
- * @param fd_handler
+ * Return the file descriptor that the handler is handling
+ * @param fd_handler The fd handler to query
* @return The fd the handler is watching
*
- * This returns the fd the handler is monitoring
+ * This returns the fd the @p fd_handler is monitoring.
*/
int
ecore_main_fd_handler_fd_get(Ecore_Fd_Handler *fd_handler)
@@ -234,11 +249,15 @@
/**
* Return if read or write is active on the fd
- * @param fd_handler
- * @param flags
- * @return the active state of read or write on the fd, or both
+ * @param fd_handler The handler to query
+ * @param flags The flags to query
+ * @return The active state of read or write on the fd, or both
*
- * Return if the fd the handler is watching is active ro read, write or both
+ * Return if the fd the handler is watching is active for read, write or both.
+ * The @p flags parameter determines what youw ant to query, and 1 is returned
+ * if the hanldere reports an active state for any of the values in
+ * @p flags since this is the same bitmask the handler was set up with. 0 is
+ * returned if the fd is not active for the @p flags passed in.
*/
int
ecore_main_fd_handler_active_get(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Handler_Flags
flags)
@@ -256,7 +275,22 @@
if ((flags & ECORE_FD_WRITE) && (fd_handler->write_active)) ret = 1;
return ret;
}
-
+
+void
+_ecore_main_shutdown(void)
+{
+ while (fd_handlers)
+ {
+ Ecore_Fd_Handler *fdh;
+
+ fdh = fd_handlers;
+ fd_handlers = _ecore_list_remove(fd_handlers, fdh);
+ ECORE_MAGIC_SET(fdh, ECORE_MAGIC_NONE);
+ free(fdh);
+ }
+ fd_handlers_delete_me = 0;
+}
+
static int
_ecore_main_select(double timeout)
{
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore/Attic/ecore_private.h,v
retrieving revision 1.1.2.8
retrieving revision 1.1.2.9
diff -u -3 -r1.1.2.8 -r1.1.2.9
--- ecore_private.h 12 Feb 2003 11:27:32 -0000 1.1.2.8
+++ ecore_private.h 20 Feb 2003 06:56:40 -0000 1.1.2.9
@@ -137,16 +137,20 @@
#endif
void _ecore_magic_fail(void *d, Ecore_Magic m, Ecore_Magic req_m, const char
*fname);
-
+
+void _ecore_timer_shutdown(void);
double _ecore_timer_next_get(void);
int _ecore_timer_call(double when);
+void _ecore_idler_shutdown(void);
int _ecore_idler_call(void);
int _ecore_idler_exist(void);
+void _ecore_idle_enterer_shutdown(void);
void _ecore_idle_enterer_call(void);
int _ecore_idle_enterer_exist(void);
+void _ecore_event_shutdown(void);
int _ecore_event_exist(void);
Ecore_Event *_ecore_event_add(int type, void *ev, void (*func_free) (void *ev, void
*data), void *data);
void *_ecore_event_del(Ecore_Event *event);
@@ -163,10 +167,14 @@
void *_ecore_event_signal_power_new(void);
void _ecore_event_signal_power_free(void *ev, void *data);
+void _ecore_main_shutdown(void);
+
+void _ecore_signal_shutdown(void);
void _ecore_signal_init(void);
int _ecore_signal_count_get(void);
void _ecore_signal_call(void);
+void _ecore_exe_shutdown(void);
Ecore_Exe *_ecore_exe_find(pid_t pid);
void *_ecore_exe_free(Ecore_Exe *exe);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore/Attic/ecore_signal.c,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -3 -r1.1.2.1 -r1.1.2.2
--- ecore_signal.c 16 Jan 2003 08:48:51 -0000 1.1.2.1
+++ ecore_signal.c 20 Feb 2003 06:56:40 -0000 1.1.2.2
@@ -29,6 +29,32 @@
static int sig_count = 0;
void
+_ecore_signal_shutdown(void)
+{
+ _ecore_signal_callback_set(SIGPIPE, SIG_DFL);
+ _ecore_signal_callback_set(SIGALRM, SIG_DFL);
+ _ecore_signal_callback_set(SIGCHLD, SIG_DFL);
+ _ecore_signal_callback_set(SIGUSR1, SIG_DFL);
+ _ecore_signal_callback_set(SIGUSR2, SIG_DFL);
+ _ecore_signal_callback_set(SIGHUP, SIG_DFL);
+ _ecore_signal_callback_set(SIGQUIT, SIG_DFL);
+ _ecore_signal_callback_set(SIGINT, SIG_DFL);
+ _ecore_signal_callback_set(SIGTERM, SIG_DFL);
+ #ifdef SIGPWR
+ _ecore_signal_callback_set(SIGPWR, SIG_DFL);
+ #endif
+ sigchld_count = 0;
+ sigusr1_count = 0;
+ sigusr2_count = 0;
+ sighup_count = 0;
+ sigquit_count = 0;
+ sigint_count = 0;
+ sigterm_count = 0;
+ sigpwr_count = 0;
+ sig_count = 0;
+}
+
+void
_ecore_signal_init(void)
{
_ecore_signal_callback_set(SIGPIPE, _ecore_signal_callback_ignore);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore/Attic/ecore_timer.c,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -3 -r1.1.2.4 -r1.1.2.5
--- ecore_timer.c 25 Jan 2003 02:17:02 -0000 1.1.2.4
+++ ecore_timer.c 20 Feb 2003 06:56:40 -0000 1.1.2.5
@@ -14,7 +14,10 @@
* @param data The data to pass to the function
* @return
*
- * This function adds a timer and returns its handle.
+ * This function adds a timer and returns its handle on success and NULL on
+ * failure. The function @p func will be called in @p in seconds from the
+ * time this function call was made. The function @p func is passed the
+ * @p data pointer as its parameter.
*/
Ecore_Timer *
ecore_timer_add(double in, int (*func) (void *data), const void *data)
@@ -56,6 +59,20 @@
ECORE_MAGIC_SET(timer, ECORE_MAGIC_NONE);
free(timer);
return data;
+}
+
+void
+_ecore_timer_shutdown(void)
+{
+ while (timers)
+ {
+ Ecore_Timer *timer;
+
+ timer = timers;
+ timers = _ecore_list_remove(timers, timer);
+ ECORE_MAGIC_SET(timer, ECORE_MAGIC_NONE);
+ free(timer);
+ }
}
double
-------------------------------------------------------
This SF.net email is sponsored by: SlickEdit Inc. Develop an edge.
The most comprehensive and flexible code editor you can use.
Code faster. C/C++, C#, Java, HTML, XML, many more. FREE 30-Day Trial.
www.slickedit.com/sourceforge
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs