-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
* @param data The data to pass to the function
* @return A handle to the new animator
* @ingroup Ecore_Animator_Group
- *
+ *
* This function adds a animator and returns its handle on success and NULL on
* failure. The function @p func will be called every N seconds where N is the
* frametime interval set by ecore_animator_frametime_set(). The function will
* be passed the @p data pointer as its parameter.
- *
- * When the animator @p func is called, it must return a value of either 1 or 0.
- * If it returns 1 (or ECORE_CALLBACK_RENEW), it will be called again at the
- * next tick, or if it returns 0 (or ECORE_CALLBACK_CANCEL) it will be deleted
+ *
+ * When the animator @p func is called, it must return a value of either 1 or 0.
+ * If it returns 1 (or ECORE_CALLBACK_RENEW), it will be called again at the
+ * next tick, or if it returns 0 (or ECORE_CALLBACK_CANCEL) it will be deleted
* automatically making any references/handles for it invalid.
*/
EAPI Ecore_Animator *
ecore_animator_add(int (*func) (void *data), const void *data)
{
Ecore_Animator *animator;
-
+
if (!func) return NULL;
animator = calloc(1, sizeof(Ecore_Animator));
if (!animator) return NULL;
* @param animator The animator to delete
* @return The data pointer set for the animator
* @ingroup Ecore_Animator_Group
- *
+ *
* Delete the specified @p aqnimator from the set of animators that are executed
* during main loop execution. This function returns the data parameter that
* was being passed to the callback on success, or NULL on failure. After this
/**
* Set the animator call interval in seconds.
* @param frametime The time in seconds in between animator ticks.
- *
+ *
* This function sets the time interval (in seconds) inbetween animator ticks.
*/
EAPI void
/**
* Get the animator call interval in seconds.
* @return The time in second in between animator ticks.
- *
+ *
* this function retrieves the time inbetween animator ticks, in seconds.
*/
EAPI double
{
ecore_timer_del(timer);
timer = NULL;
- }
+ }
while (animators)
{
Ecore_Animator *animator;
-
+
animator = animators;
animators = _ecore_list2_remove(animators, animator);
ECORE_MAGIC_SET(animator, ECORE_MAGIC_NONE);
for (l = (Ecore_List2 *)animators; l;)
{
Ecore_Animator *animator;
-
+
animator = (Ecore_Animator *)l;
l = l->next;
if (!animator->delete_me)
for (l = (Ecore_List2 *)animators; l;)
{
Ecore_Animator *animator;
-
+
animator = (Ecore_Animator *)l;
l = l->next;
if (animator->delete_me)
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
* Set up the programs command-line arguments.
* @param argc The same as passed as argc to the programs main() function
* @param argv The same as passed as argv to the programs main() function
- *
+ *
* A call to this function will store the programs command-line arguments
* for later use by ecore_app_restart() or ecore_app_args_get().
*/
* Return the programs stored command-line arguments.
* @param argc A pointer to the return value to hold argc
* @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(). 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
/**
* Restart the program executable with the command-line arguments stored.
- *
+ *
* This function will restart & re-execute this program in place of itself
* 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,
{
char *args[4096];
int i;
-
+
if ((app_argc < 1) || (!app_argv)) return;
if (app_argc >= 4096) return;
for (i = 0; i < app_argc; i++) args[i] = app_argv[i];
* @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 A new Event handler, or NULL on failure
- *
+ *
* Add an event handler to the list of handlers. This will, on success, return
* a handle to the event handler object that was created, that can be used
- * later to remove the handler using ecore_event_handler_del(). The @p type
+ * 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
+ * structure that is specific to that event type, and a data pointer that is
* provided in this call as the @p data parameter.
- *
- * When the callback @p func is called, it must return 1 or 0. If it returns
- * 1 (or ECORE_CALLBACK_RENEW), It will keep being called as per normal, for
- * each handler set up for that event type. If it returns 0 (or
+ *
+ * When the callback @p func is called, it must return 1 or 0. If it returns
+ * 1 (or ECORE_CALLBACK_RENEW), It will keep being called as per normal, for
+ * each handler set up for that event type. If it returns 0 (or
* ECORE_CALLBACK_CANCEL), it will cease processing handlers for that particular
- * event, so all handler set to handle that event type that have not already
+ * event, so all handler set to handle that event type that have not already
* been called, will not be.
*/
EAPI Ecore_Event_Handler *
if (type >= (event_handlers_num - 1))
{
int p_alloc_num;
-
+
p_alloc_num = event_handlers_alloc_num;
event_handlers_num = type + 1;
if (event_handlers_num > event_handlers_alloc_num)
{
Ecore_Event_Handler **new_handlers;
int i;
-
+
event_handlers_alloc_num = ((event_handlers_num + 16) / 16) * 16;
new_handlers = realloc(event_handlers, event_handlers_alloc_num * sizeof(Ecore_Event_Handler *));
if (!new_handlers)
* Delete an event handler.
* @param event_handler Event handler handle to delete
* @return Data passed to 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
ecore_event_handler_del(Ecore_Event_Handler *event_handler)
{
Ecore_List2_Data *node;
-
- if (!ECORE_MAGIC_CHECK(event_handler, ECORE_MAGIC_EVENT_HANDLER))
+
+ if (!ECORE_MAGIC_CHECK(event_handler, ECORE_MAGIC_EVENT_HANDLER))
{
ECORE_MAGIC_FAIL(event_handler, ECORE_MAGIC_EVENT_HANDLER,
"ecore_event_handler_del");
return event_handler->data;
}
-static void
+static void
_ecore_event_generic_free (void *data __UNUSED__, void *event)
{
free (event);
* @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
- *
+ *
* 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
+ * 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 structure
* Delete an event from the queue.
* @param event The event handle to delete
* @return The data pointer originally set for the event free function
- *
+ *
* This deletes 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
EAPI void *
ecore_event_del(Ecore_Event *event)
{
- if (!ECORE_MAGIC_CHECK(event, ECORE_MAGIC_EVENT))
+ if (!ECORE_MAGIC_CHECK(event, ECORE_MAGIC_EVENT))
{
- ECORE_MAGIC_FAIL(event, ECORE_MAGIC_EVENT, "ecore_event_del");
+ ECORE_MAGIC_FAIL(event, ECORE_MAGIC_EVENT, "ecore_event_del");
return NULL;
}
event->delete_me = 1;
/**
* 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. Once an event
+ *
+ * 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
* @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
+ *
+ * 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 remove redundant events. Just as
ecore_event_filter_add(void * (*func_start) (void *data), int (*func_filter) (void *data, void *loop_data, int type, void *event), void (*func_end) (void *data, void *loop_data), const void *data)
{
Ecore_Event_Filter *ef;
-
+
if (!func_filter) return NULL;
ef = calloc(1, sizeof(Ecore_Event_Filter));
if (!ef) return NULL;
* Delete an event filter.
* @param ef The event filter handle
* @return The data set for the filter
- *
+ *
* 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.
*/
EAPI void *
ecore_event_filter_del(Ecore_Event_Filter *ef)
-{
+{
if (!ECORE_MAGIC_CHECK(ef, ECORE_MAGIC_EVENT_FILTER))
{
ECORE_MAGIC_FAIL(ef, ECORE_MAGIC_EVENT_FILTER, "ecore_event_filter_del");
/**
* Return the current event type being handled.
* @return The current event type being handled if inside a handler callback
- *
+ *
* If the program is currently inside an Ecore event handler callback this
* will return the type of the current event being processed. If Ecore is
* not inside an event handler, ECORE_EVENT_NONE is returned.
- *
+ *
* This is useful when certain Ecore modules such as Ecore_Evas "swallow"
* events and not all the original information is passed on. In special cases
* this extra information may be useful or needed and using this call can let
/**
* Return the current event type pointer handled.
* @return The current event pointer being handled if inside a handler callback
- *
+ *
* If the program is currently inside an Ecore event handler callback this
* will return the pointer of the current event being processed. If Ecore is
* not inside an event handler, NULL will be returned.
- *
+ *
* This is useful when certain Ecore modules such as Ecore_Evas "swallow"
* events and not all the original information is passed on. In special cases
* this extra information may be useful or needed and using this call can let
_ecore_event_shutdown(void)
{
int i;
-
+
while (events) _ecore_event_del(events);
for (i = 0; i < event_handlers_num; i++)
{
while (event_handlers[i])
{
Ecore_Event_Handler *eh;
-
+
eh = event_handlers[i];
event_handlers[i] = _ecore_list2_remove(event_handlers[i], eh);
ECORE_MAGIC_SET(eh, ECORE_MAGIC_NONE);
while (event_handlers_delete_list)
{
Ecore_List2_Data *ehd;
-
+
ehd = event_handlers_delete_list;
event_handlers_delete_list = _ecore_list2_remove(event_handlers_delete_list, ehd);
free(ehd);
while (event_filters)
{
Ecore_Event_Filter *ef;
-
+
ef = event_filters;
- event_filters = _ecore_list2_remove(event_filters, ef);
+ event_filters = _ecore_list2_remove(event_filters, ef);
ECORE_MAGIC_SET(ef, ECORE_MAGIC_NONE);
free(ef);
}
_ecore_event_add(int type, void *ev, void (*func_free) (void *data, void *ev), void *data)
{
Ecore_Event *e;
-
+
e = calloc(1, sizeof(Ecore_Event));
if (!e) return NULL;
ECORE_MAGIC_SET(e, ECORE_MAGIC_EVENT);
_ecore_event_del(Ecore_Event *event)
{
void *data;
-
+
data = event->data;
if (event->func_free) event->func_free(event->data, event->event);
events = _ecore_list2_remove(events, event);
// printf("EVENT BATCH DONE\n");
ecore_raw_event_type = ECORE_EVENT_NONE;
ecore_raw_event_event = NULL;
-
+
while (events) _ecore_event_del(events);
while (event_handlers_delete_list)
{
_ecore_event_signal_user_new(void)
{
Ecore_Event_Signal_User *e;
-
+
e = calloc(1, sizeof(Ecore_Event_Signal_User));
return e;
}
_ecore_event_signal_hup_new(void)
{
Ecore_Event_Signal_Hup *e;
-
+
e = calloc(1, sizeof(Ecore_Event_Signal_Hup));
return e;
}
_ecore_event_signal_exit_new(void)
{
Ecore_Event_Signal_Exit *e;
-
+
e = calloc(1, sizeof(Ecore_Event_Signal_Exit));
return e;
}
_ecore_event_signal_power_new(void)
{
Ecore_Event_Signal_Power *e;
-
+
e = calloc(1, sizeof(Ecore_Event_Signal_Power));
return e;
}
/**
* Sets the priority at which to launch processes
*
- * This sets the priority of processes run by ecore_exe_run() and
+ * This sets the priority of processes run by ecore_exe_run() and
* ecore_exe_pipe_run(). If set to ECORE_EXE_PRIORITY_INHERIT child processes
* inherit the priority of their parent. This is the default.
- *
+ *
* @param pri value -20 to 19 or ECORE_EXE_PRIORITY_INHERIT
* @ingroup Ecore_Exe_Basic_Group
*/
/**
* Gets the priority at which to launch processes
*
- * This gets ths priority of launched processes. See
+ * This gets ths priority of launched processes. See
* ecore_exe_run_priority_set() for details. This just returns the value set
* by this call.
- *
+ *
* @return the value set by ecore_exe_run_priority_set()
* @ingroup Ecore_Exe_Basic_Group
*/
if ((flags & ECORE_EXE_PIPE_AUTO) && (!(flags & ECORE_EXE_PIPE_ERROR))
&& (!(flags & ECORE_EXE_PIPE_READ)))
/* We need something to auto pipe. */
- flags |= ECORE_EXE_PIPE_READ | ECORE_EXE_PIPE_ERROR;
+ flags |= ECORE_EXE_PIPE_READ | ECORE_EXE_PIPE_ERROR;
exe->child_fd_error = -1;
exe->child_fd_read = -1;
{
pid_t pid = 0;
volatile int vfork_exec_errno = 0;
-
+
/* FIXME: I should double check this. After a quick look around, this is already done, but via a more modern method. */
/* signal(SIGPIPE, SIG_IGN); We only want EPIPE on errors */
pid = fork();
-
+
if (pid == -1)
{
fprintf(stderr, "Failed to fork process\n");
if (flags & ECORE_EXE_PIPE_WRITE)
E_NO_ERRNO(result, close(writePipe[0]), ok);
E_NO_ERRNO(result, close(statusPipe[1]), ok);
-
+
_exit(-1);
}
else /* parent */
/* Close the unused pipes. */
E_NO_ERRNO(result, close(statusPipe[1]), ok);
- /* FIXME: after having a good look at the current e fd
+ /* FIXME: after having a good look at the current e fd
* handling, investigate fcntl(dataPipe[x], F_SETSIG, ...) */
/* FIXME: above F_SETSIG etc. - this is async SIGIO based IO
* which is also linux specific so we probably don't want to
* do this as long as select() is working fine. the only time
* we really want to think of SIGIO async IO is when it all
- * actually works basically everywhere and we can turn all
+ * actually works basically everywhere and we can turn all
* IO into DMA async activities (i.e. you do a read() then
* the read is complete not on return but when you get a
* SIGIO - the read() just starts the transfer and it is
for (;;)
{
char buf;
-
+
E_NO_ERRNO(result, read(statusPipe[0], &buf, 1), ok);
if (result == 0)
{
ok = 0;
}
}
-
+
exes = _ecore_list2_append(exes, exe);
n = 0;
}
else
{
Ecore_Exe_Event_Add *e;
-
+
e = _ecore_exe_event_add_new();
e->exe = exe;
if (e) /* Send the event. */
_ecore_exe_event_add_free, NULL);
/* printf("Running as %d for %s.\n", exe->pid, exe->cmd); */
}
-
+
errno = n;
return exe;
}
lost_exe = 0;
errno = 0;
if ((num = read(child_fd, buf, READBUFSIZ)) < 1)
- /* FIXME: SPEED/SIZE TRADE OFF - add a smaller READBUFSIZE
+ /* FIXME: SPEED/SIZE TRADE OFF - add a smaller READBUFSIZE
* (currently 64k) to inbuf, use that instead of buf, and
* save ourselves a memcpy(). */
{
* @return @c TRUE on success, @c FALSE on error.
* @ingroup Ecore_Data_Hash_ADT_Destruction_Group
*/
-EAPI void
+EAPI void
ecore_hash_destroy(Ecore_Hash *hash)
{
unsigned int i = 0;
* @return TRUE on success, FALSE otherwise.
* @ingroup Ecore_Data_Hash_ADT_Traverse_Group
*/
-EAPI int
+EAPI int
ecore_hash_for_each_node(Ecore_Hash *hash, Ecore_For_Each for_each_func, void *user_data)
{
unsigned int i = 0;
while (idle_enterers)
{
Ecore_Idle_Enterer *ie;
-
+
ie = idle_enterers;
idle_enterers = _ecore_list2_remove(idle_enterers, ie);
ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE);
_ecore_idle_enterer_call(void)
{
Ecore_List2 *l;
-
+
for (l = (Ecore_List2 *)idle_enterers; l; l = l->next)
{
Ecore_Idle_Enterer *ie;
-
+
ie = (Ecore_Idle_Enterer *)l;
if (!ie->delete_me)
{
for (l = (Ecore_List2 *)idle_enterers; l;)
{
Ecore_Idle_Enterer *ie;
-
+
ie = (Ecore_Idle_Enterer *)l;
l = l->next;
if (ie->delete_me)
while (idle_exiters)
{
Ecore_Idle_Exiter *ie;
-
+
ie = idle_exiters;
idle_exiters = _ecore_list2_remove(idle_exiters, ie);
ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE);
_ecore_idle_exiter_call(void)
{
Ecore_List2 *l;
-
+
for (l = (Ecore_List2 *)idle_exiters; l; l = l->next)
{
Ecore_Idle_Exiter *ie;
-
+
ie = (Ecore_Idle_Exiter *)l;
if (!ie->delete_me)
{
for (l = (Ecore_List2 *)idle_exiters; l;)
{
Ecore_Idle_Exiter *ie;
-
+
ie = (Ecore_Idle_Exiter *)l;
l = l->next;
if (ie->delete_me)
*
* Add an idler handle to the event loop, returning a handle on success and
* NULL otherwise. The function @p func will be called repeatedly while
- * no other events are ready to be processed, as long as it returns 1
- * (or ECORE_CALLBACK_RENEW). A return of 0 (or ECORE_CALLBACK_CANCEL) deletes
+ * no other events are ready to be processed, as long as it returns 1
+ * (or ECORE_CALLBACK_RENEW). A return of 0 (or ECORE_CALLBACK_CANCEL) deletes
* the idler.
*
* Idlers are useful for progressively prossessing data without blocking.
while (idlers)
{
Ecore_Idler *ie;
-
+
ie = idlers;
idlers = _ecore_list2_remove(idlers, ie);
ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE);
for (l = (Ecore_List2 *)idlers; l; l = l->next)
{
Ecore_Idler *ie;
-
+
ie = (Ecore_Idler *)l;
if (!ie->delete_me)
{
for (l = (Ecore_List2 *)idlers; l;)
{
Ecore_Idler *ie;
-
+
ie = (Ecore_Idler *)l;
l = l->next;
if (ie->delete_me)
/* Sorting functions */
static Ecore_List_Node *_ecore_list_node_mergesort(Ecore_List_Node *first,
int n, Ecore_Compare_Cb compare, int order);
-static Ecore_List_Node *_ecore_list_node_merge(Ecore_List_Node *first,
+static Ecore_List_Node *_ecore_list_node_merge(Ecore_List_Node *first,
Ecore_List_Node *second,
Ecore_Compare_Cb compare,
int order);
static Ecore_List_Node *_ecore_dlist_node_mergesort(Ecore_List_Node *first,
int n, Ecore_Compare_Cb compare, int order);
-static Ecore_List_Node *_ecore_dlist_node_merge(Ecore_List_Node *first,
+static Ecore_List_Node *_ecore_dlist_node_merge(Ecore_List_Node *first,
Ecore_List_Node *second,
Ecore_Compare_Cb compare,
int order);
* @return @c TRUE if successful, @c FALSE if an error occurs.
* @ingroup Ecore_Data_List_Creation_Group
*/
-EAPI int
+EAPI int
ecore_list_init(Ecore_List *list)
{
CHECK_PARAM_POINTER_RETURN("list", list, FALSE);
* @param list The list to be freed.
* @ingroup Ecore_Data_List_Creation_Group
*/
-EAPI void
+EAPI void
ecore_list_destroy(Ecore_List *list)
{
void *data;
* @param free_func The function that will free the key data.
* @return @c TRUE on successful set, @c FALSE otherwise.
*/
-EAPI int
+EAPI int
ecore_list_free_cb_set(Ecore_List *list, Ecore_Free_Cb free_func)
{
CHECK_PARAM_POINTER_RETURN("list", list, FALSE);
* @param list The list to check for nodes
* @return @c TRUE if no nodes in list, @c FALSE if the list contains nodes
*/
-EAPI int
+EAPI int
ecore_list_empty_is(Ecore_List *list)
{
int ret = TRUE;
* @param list The list to return the number of the current node.
* @return The number of the current node in the list.
*/
-EAPI int
+EAPI int
ecore_list_index(Ecore_List *list)
{
int ret;
* @param list The list to find the number of nodes
* @return The number of nodes in the list.
*/
-EAPI int
+EAPI int
ecore_list_count(Ecore_List *list)
{
int ret = 0;
* @return @c FALSE if an error occurs, @c TRUE if appended successfully
* @ingroup Ecore_Data_List_Add_Item_Group
*/
-EAPI inline int
+EAPI inline int
ecore_list_append(Ecore_List *list, void *data)
{
int ret;
}
/* For adding items to the end of the list */
-static int
+static int
_ecore_list_append_0(Ecore_List *list, Ecore_List_Node *end)
{
if (list->last)
* @return @c FALSE if an error occurs, @c TRUE if prepended successfully.
* @ingroup Ecore_Data_List_Add_Item_Group
*/
-EAPI inline int
+EAPI inline int
ecore_list_prepend(Ecore_List *list, void *data)
{
int ret;
}
/* For adding items to the beginning of the list */
-static int
+static int
_ecore_list_prepend_0(Ecore_List *list, Ecore_List_Node *start)
{
/* Put it at the beginning of the list */
* @return @c FALSE if there is an error, @c TRUE on success
* @ingroup Ecore_Data_List_Add_Item_Group
*/
-EAPI inline int
+EAPI inline int
ecore_list_insert(Ecore_List *list, void *data)
{
int ret;
}
/* For adding items in front of the current position in the list */
-static int
+static int
_ecore_list_insert(Ecore_List *list, Ecore_List_Node *new_node)
{
/*
* @ingroup Ecore_Data_List_Add_Item_Group
*/
-EAPI int
+EAPI int
ecore_list_append_list(Ecore_List *list, Ecore_List *append)
{
CHECK_PARAM_POINTER_RETURN("list", list, FALSE);
* @return @c FALSE if an error occurs, @c TRUE if prepended successfully.
* @ingroup Ecore_Data_List_Add_Item_Group
*/
-EAPI int
+EAPI int
ecore_list_prepend_list(Ecore_List *list, Ecore_List *prepend)
{
CHECK_PARAM_POINTER_RETURN("list", list, FALSE);
* @return @c TRUE on success, @c FALSE on error
* @ingroup Ecore_Data_List_Remove_Item_Group
*/
-EAPI int
+EAPI int
ecore_list_remove_destroy(Ecore_List *list)
{
void *data;
if (index > ecore_list_count(list) || index < 0)
return NULL;
- if (index < list->index)
+ if (index < list->index)
{
_ecore_list_first_goto(list);
i = 0;
* @note The data for each item on the list is not freed by
* @c ecore_list_clear().
*/
-EAPI int
+EAPI int
ecore_list_clear(Ecore_List *list)
{
CHECK_PARAM_POINTER_RETURN("list", list, FALSE);
* @return Returns @c TRUE on success, @c FALSE on failure.
* @ingroup Ecore_Data_List_Traverse_Group
*/
-EAPI int
+EAPI int
ecore_list_for_each(Ecore_List *list, Ecore_For_Each function, void *user_data)
{
int ret;
}
/* The real meat of executing the function for each data node */
-static int
+static int
_ecore_list_for_each(Ecore_List *list, Ecore_For_Each function, void *user_data)
{
void *value;
ecore_list_sort(Ecore_List *list, Ecore_Compare_Cb compare, char order)
{
CHECK_PARAM_POINTER_RETURN("list", list, 0);
-
+
if (list->nodes < 2)
return 1;
if (list->nodes < ECORE_MERGESORT_LIMIT)
return ecore_list_mergesort(list, compare, order);
if (!ecore_list_heapsort(list, compare, order))
return ecore_list_mergesort(list, compare, order);
-
+
return 1;
}
* ECORE_SORT_MAX
* @return true on success
*
- * Mergesort is a stable, in-place sorting algorithm
+ * Mergesort is a stable, in-place sorting algorithm
*/
EAPI int
ecore_list_mergesort(Ecore_List *list, Ecore_Compare_Cb compare, char order)
ecore_list_append_list(list, l2);
return;
}
-
+
if (order == ECORE_SORT_MIN)
order = 1;
else
order = -1;
list->first = _ecore_list_node_merge(list->first, l2->first, compare, order);
-
+
if ((order * compare(list->last->data, l2->last->data)) < 0)
list->last = l2->last;
}
/* Initialize a node to starting values */
-EAPI int
+EAPI int
ecore_list_node_init(Ecore_List_Node *node)
{
CHECK_PARAM_POINTER_RETURN("node", node, FALSE);
* @return @c TRUE.
* @ingroup Ecore_Data_List_Node_Group
*/
-EAPI int
+EAPI int
ecore_list_node_destroy(Ecore_List_Node *node, Ecore_Free_Cb free_func)
{
CHECK_PARAM_POINTER_RETURN("node", node, FALSE);
* @return @c TRUE if successful, @c FALSE if an error occurs.
* @ingroup Ecore_Data_DList_Creation_Group
*/
-EAPI int
+EAPI int
ecore_dlist_init(Ecore_DList *list)
{
CHECK_PARAM_POINTER_RETURN("list", list, FALSE);
* @param list The doubly linked list to be freed.
* @ingroup Ecore_Data_DList_Creation_Group
*/
-EAPI void
+EAPI void
ecore_dlist_destroy(Ecore_DList *list)
{
void *data;
* @return @c TRUE on success, @c FALSE on failure.
* @ingroup Ecore_Data_DList_Creation_Group
*/
-EAPI int
+EAPI int
ecore_dlist_free_cb_set(Ecore_DList *list, Ecore_Free_Cb free_func)
{
CHECK_PARAM_POINTER_RETURN("list", list, FALSE);
* @param list The given doubly linked list.
* @return @c TRUE if there are nodes, @c FALSE otherwise.
*/
-EAPI int
+EAPI int
ecore_dlist_empty_is(Ecore_DList *list)
{
CHECK_PARAM_POINTER_RETURN("list", list, FALSE);
* @param list The given doubly linked list.
* @return The index of the current node.
*/
-EAPI inline int
+EAPI inline int
ecore_dlist_index(Ecore_DList *list)
{
CHECK_PARAM_POINTER_RETURN("list", list, FALSE);
* @return @c TRUE if the data is successfully appended, @c FALSE otherwise.
* @ingroup Ecore_Data_DList_Add_Item_Group
*/
-EAPI int
+EAPI int
ecore_dlist_append(Ecore_DList *list, void *data)
{
int ret;
* @return @c TRUE if the data is successfully prepended, @c FALSE otherwise.
* @ingroup Ecore_Data_DList_Add_Item_Group
*/
-EAPI int
+EAPI int
ecore_dlist_prepend(Ecore_DList *list, void *data)
{
int ret;
* @return @c TRUE on success, @c FALSE otherwise.
* @ingroup Ecore_Data_DList_Add_Item_Group
*/
-EAPI int
+EAPI int
ecore_dlist_insert(Ecore_DList *list, void *data)
{
int ret = TRUE;
* @return @c TRUE if the data is successfully appended, @c FALSE otherwise.
* @ingroup Ecore_Data_DList_Add_Item_Group
*/
-EAPI int
+EAPI int
ecore_dlist_append_list(Ecore_DList *list, Ecore_DList *append)
{
CHECK_PARAM_POINTER_RETURN("list", list, FALSE);
* @return @c TRUE if the data is successfully prepended, @c FALSE otherwise.
* @ingroup Ecore_Data_DList_Add_Item_Group
*/
-EAPI int
+EAPI int
ecore_dlist_prepend_list(Ecore_DList *list, Ecore_DList *prepend)
{
CHECK_PARAM_POINTER_RETURN("list", list, FALSE);
* @return @c TRUE on success, @c FALSE otherwise.
* @ingroup Ecore_Data_DList_Remove_Item_Group
*/
-EAPI int
+EAPI int
ecore_dlist_remove_destroy(Ecore_DList *list)
{
void *data;
*
* @return Returns TRUE on success, FALSE on errors
*/
-EAPI int
+EAPI int
ecore_dlist_clear(Ecore_DList *list)
{
CHECK_PARAM_POINTER_RETURN("list", list, FALSE);
ecore_dlist_sort(Ecore_List *list, Ecore_Compare_Cb compare, char order)
{
CHECK_PARAM_POINTER_RETURN("list", list, 0);
-
+
if (list->nodes < 2)
return 1;
if (list->nodes < ECORE_MERGESORT_LIMIT)
return ecore_dlist_mergesort(list, compare, order);
if (!ecore_dlist_heapsort(list, compare, order))
return ecore_dlist_mergesort(list, compare, order);
-
+
return 1;
}
* ECORE_SORT_MAX
* @return true on success
*
- * Mergesort is a stable, in-place sorting algorithm
+ * Mergesort is a stable, in-place sorting algorithm
*/
EAPI int
ecore_dlist_mergesort(Ecore_DList *list, Ecore_Compare_Cb compare, char order)
ecore_dlist_append_list(list, l2);
return;
}
-
+
if (order == ECORE_SORT_MIN)
order = 1;
else
order = -1;
list->first = _ecore_dlist_node_merge(list->first, l2->first, compare, order);
-
+
if ((order * compare(list->last->data, l2->last->data)) < 0)
list->last = l2->last;
}
/* append the rest or set it to NULL */
- if (first)
+ if (first)
{
ECORE_DLIST_NODE(first)->previous = ECORE_DLIST_NODE(l);
l->next = first;
}
else if (second)
{
- ECORE_DLIST_NODE(second)->previous = ECORE_DLIST_NODE(l);
+ ECORE_DLIST_NODE(second)->previous = ECORE_DLIST_NODE(l);
l->next = second;
}
else
* @param node: the node to initialize
* @return Returns TRUE on success, FALSE on errors
*/
-EAPI int
+EAPI int
ecore_dlist_node_init(Ecore_DList_Node *node)
{
int ret;
* @param free_func: the callback function to execute on the data
* @return Returns TRUE on success, FALSE on error
*/
-EAPI int
+EAPI int
ecore_dlist_node_destroy(Ecore_DList_Node * node, Ecore_Free_Cb free_func)
{
CHECK_PARAM_POINTER_RETURN("node", node, FALSE);
*
* Normally the return value from the @p func is "zero means this handler is
* finished and can be deleted" as is usual for handler callbacks. However,
- * if the @p buf_func is supplied, then the return value from the @p func is
+ * if the @p buf_func is supplied, then the return value from the @p func is
* "non zero means the handler should be called again in a tight loop".
*
* @p buf_func is called during event loop handling to check if data that has
* read. Some systems (notably xlib) handle their own buffering, and would
* otherwise not work with select(). These systems should use a @p buf_func.
* This is a most annoying hack, only ecore_x uses it, so refer to that for
- * an example. NOTE - @p func should probably return "one" always if
- * @p buf_func is used, to avoid confusion with the other return value
+ * an example. NOTE - @p func should probably return "one" always if
+ * @p buf_func is used, to avoid confusion with the other return value
* semantics.
*
* @param fd The file descriptor to watch.
CHECK_PARAM_POINTER("path", path);
if (!group->paths)
- {
- group->paths = ecore_list_new();
+ {
+ group->paths = ecore_list_new();
ecore_list_free_cb_set(group->paths, free);
}
return avail;
}
-
static double poll_interval = 0.125;
static double poll_cur_interval = 0.0;
static double last_tick = 0.0;
-static Ecore_Poller *pollers[16] =
+static Ecore_Poller *pollers[16] =
{
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL
};
-static unsigned short poller_counters[16] =
+static unsigned short poller_counters[16] =
{
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0
{
int i;
double interval;
-
+
min_interval = -1;
for (i = 0; i < 15; i++)
{
else
{
double t;
-
+
if (!timer)
timer = ecore_timer_add(interval, _ecore_poller_cb_timer, NULL);
else
/* delete the timer and reset it to tick off in the new
* time interval. at the tick this will be adjusted */
ecore_timer_del(timer);
- timer = ecore_timer_add(interval - t,
+ timer = ecore_timer_add(interval - t,
_ecore_poller_cb_timer, NULL);
}
}
/* wrap back to 0 if we exceed out loop count for the counter */
if (poller_counters[i] >= (1 << i)) poller_counters[i] = 0;
}
-
+
just_added_poller = 0;
/* walk the pollers now */
poller_walking++;
}
}
poller_walking--;
-
+
/* handle deletes afterwards */
if (poller_delete_count > 0)
{
just_added_poller = 0;
poller_delete_count = 0;
-
+
at_tick--;
-
+
/* if the timer was deleted then there is no point returning 1 - ambiguous
- * if we do as it im plies "keep running me" but we have been deleted
+ * if we do as it im plies "keep running me" but we have been deleted
* anyway */
if (!timer) return 0;
* @param type The ticker type to adjust
* @param poll_time The time (in seconds) between ticks of the clock
* @ingroup Ecore_Poller_Group
- *
+ *
* This will adjust the time between ticks of the given ticker type defined
* by @p type to the time period defined by @p poll_time.
*/
* @param type The ticker type to query
* @return The time in seconds between ticks of the ticker clock
* @ingroup Ecore_Poller_Group
- *
+ *
* This will get the time between ticks of the specifider ticker clock.
*/
EAPI double
* save power as the CPU has more of a chance to go into a low power state
* the longer it is asleep for, so this should be used if you are at all
* power conscious.
- *
+ *
* The @p type parameter defines the poller tick type (there is a virtual
* clock ticking all the time - though ecore avoids making it tick when
* there will not be any work to do at that tick point). There is only one
* expansion if multiple clocks with different frequencies are really required.
* The default time between ticks for the ECORE_POLLER_CORE ticker is 0.125
* seconds.
- *
+ *
* The @p interval is the number of ticker ticks that will pass by in between
* invocations of the @p func callback. This must be between 1 and 32768
* inclusive, and must be a power of 2 (i.e. 1, 2, 4, 8, 16, ... 16384, 32768).
* which tick is undefined, as only the interval between calls can be defined.
* Ecore will endeavour to keep pollers synchronised and to call as many in
* 1 wakeup event as possible.
- *
+ *
* This function adds a poller and returns its handle on success and NULL on
* failure. The function @p func will be called at tick intervals described
* above. The function will be passed the @p data pointer as its parameter.
- *
- * When the poller @p func is called, it must return a value of either
- * 1 (or ECORE_CALLBACK_RENEW) or 0 (or ECORE_CALLBACK_CANCEL). If it
+ *
+ * When the poller @p func is called, it must return a value of either
+ * 1 (or ECORE_CALLBACK_RENEW) or 0 (or ECORE_CALLBACK_CANCEL). If it
* returns 1, it will be called again at the next tick, or if it returns
* 0 it will be deleted automatically making any references/handles for it
* invalid.
{
Ecore_Poller *poller;
int ibit;
-
+
if (!func) return NULL;
if (interval < 1) interval = 1;
-
+
poller = calloc(1, sizeof(Ecore_Poller));
if (!poller) return NULL;
ECORE_MAGIC_SET(poller, ECORE_MAGIC_POLLER);
}
/* only allow up to 32768 - i.e. ibit == 15, so limit it */
if (ibit > 15) ibit = 15;
-
+
poller->ibit = ibit;
poller->func = func;
poller->data = (void *)data;
ecore_poller_del(Ecore_Poller *poller)
{
void *data;
-
+
if (!ECORE_MAGIC_CHECK(poller, ECORE_MAGIC_POLLER))
{
ECORE_MAGIC_FAIL(poller, ECORE_MAGIC_POLLER,
int i;
Ecore_List2 *l;
Ecore_Poller *poller;
-
+
for (i = 0; i < 15; i++)
{
for (l = (Ecore_List2 *)pollers[i]; l;)
* @param size The number of elements to allow in the heap
* @return TRUE on success, FALSE on failure
*/
-EAPI int
+EAPI int
ecore_sheap_init(Ecore_Sheap *heap, Ecore_Compare_Cb compare, int size)
{
CHECK_PARAM_POINTER_RETURN("heap", heap, FALSE);
*
* @param heap The heap to be freed
*/
-EAPI void
+EAPI void
ecore_sheap_destroy(Ecore_Sheap *heap)
{
int i;
* @param free_func The function that will free the key data.
* @return @c TRUE on successful set, @c FALSE otherwise.
*/
-EAPI int
+EAPI int
ecore_sheap_free_cb_set(Ecore_Sheap *heap, Ecore_Free_Cb free_func)
{
CHECK_PARAM_POINTER_RETURN("heap", heap, FALSE);
* @return TRUE on success, NULL on failure. Increases the size of the heap if
* it becomes larger than available space.
*/
-EAPI int
+EAPI int
ecore_sheap_insert(Ecore_Sheap *heap, void *data)
{
int i;
* @note The heap does not free the old data since it must be passed
* in, so the caller can perform the free if desired.
*/
-EAPI int
+EAPI int
ecore_sheap_change(Ecore_Sheap *heap, void *item, void *newval)
{
int i;
* The comparison function is changed to @compare and the heap is heapified
* by the new comparison.
*/
-EAPI int
+EAPI int
ecore_sheap_compare_set(Ecore_Sheap *heap, Ecore_Compare_Cb compare)
{
CHECK_PARAM_POINTER_RETURN("heap", heap, FALSE);
* Changes the heap order of @heap and re-heapifies the data to this new
* order. The default order is a min heap.
*/
-EAPI void
+EAPI void
ecore_sheap_order_set(Ecore_Sheap *heap, char order)
{
CHECK_PARAM_POINTER("heap", heap);
* Sorts the data in the heap into the order that is used for the heap's
* data.
*/
-EAPI void
+EAPI void
ecore_sheap_sort(Ecore_Sheap *heap)
{
int i = 0;
* @param heap The heap to regain heap properties
* @param i The position to start heapifying
*/
-static void
+static void
_ecore_sheap_heapify(Ecore_Sheap *heap, int i)
{
int extreme;
}
}
-static void
+static void
_ecore_sheap_update_data(Ecore_Sheap *heap)
{
int i, old_size;
#endif
volatile sig_atomic_t n;
sigset_t oldset, newset;
-
+
if (sig_count == 0) return;
sigemptyset(&newset);
sigaddset(&newset, SIGPIPE);
#ifdef SIGRTMIN
for (i = 0; i < num; i++)
sigaddset(&newset, SIGRTMIN + i);
-#endif
+#endif
sigprocmask(SIG_BLOCK, &newset, &oldset);
if (sigchld_count > MAXSIGQ)
printf("ECORE WARNING. %i SIGCHLD in queue. max queue size %i. losing "
sig_count--;
}
sigchld_count = 0;
-
+
if (sigusr1_count > MAXSIGQ)
printf("ECORE WARNING. %i SIGUSR1 in queue. max queue size %i. losing "
"siginfo for extra signals.\n", sigusr1_count, MAXSIGQ);
sig_count--;
}
sigusr1_count = 0;
-
+
if (sigusr2_count > MAXSIGQ)
printf("ECORE WARNING. %i SIGUSR2 in queue. max queue size %i. losing "
"siginfo for extra signals.\n", sigusr2_count, MAXSIGQ);
sig_count--;
}
sigusr2_count = 0;
-
+
if (sighup_count > MAXSIGQ)
printf("ECORE WARNING. %i SIGHUP in queue. max queue size %i. losing "
"siginfo for extra signals.\n", sighup_count, MAXSIGQ);
sig_count--;
}
sighup_count = 0;
-
+
if (sigquit_count > MAXSIGQ)
printf("ECORE WARNING. %i SIGQUIT in queue. max queue size %i. losing "
"siginfo for extra signals.\n", sigquit_count, MAXSIGQ);
sig_count--;
}
sigint_count = 0;
-
+
if (sigterm_count > MAXSIGQ)
printf("ECORE WARNING. %i SIGTERM in queue. max queue size %i. losing "
"siginfo for extra signals.\n", sigterm_count, MAXSIGQ);
sig_count--;
}
sigterm_count = 0;
-
+
#ifdef SIGPWR
if (sigpwr_count > MAXSIGQ)
printf("ECORE WARNING. %i SIGPWR in queue. max queue size %i. losing "
#include "ecore_private.h"
#include "Ecore_Str.h"
-static int ecore_str_has_suffix_helper(const char *str, const char *suffix,
+static int ecore_str_has_suffix_helper(const char *str, const char *suffix,
int (*cmp)(const char *, const char *));
/**
* @param dst the destination
* @param dst the destination
* @param src the source
* @param siz the size of the destination
- * @return the length of the source string plus MIN(siz, strlen(initial dst))
+ * @return the length of the source string plus MIN(siz, strlen(initial dst))
* @brief append a c-string
*
* Appends src to string dst of size siz (unlike strncat, siz is the
{
CHECK_PARAM_POINTER_RETURN("str", str, 0);
CHECK_PARAM_POINTER_RETURN("suffix", suffix, 0);
-
+
return ecore_str_has_suffix_helper(str, suffix, strcmp);
}
{
CHECK_PARAM_POINTER_RETURN("str", str, 0);
CHECK_PARAM_POINTER_RETURN("ext", ext, 0);
-
+
return ecore_str_has_suffix_helper(str, ext, strcasecmp);
}
/*
- * Internal helper function used by ecore_str_has_suffix() and
+ * Internal helper function used by ecore_str_has_suffix() and
* ecore_str_has_extension()
*/
static int
-ecore_str_has_suffix_helper(const char *str, const char *suffix,
+ecore_str_has_suffix_helper(const char *str, const char *suffix,
int (*cmp)(const char *, const char *))
{
size_t str_len;
* string array contains the remainder of string.
*
* @param str A string to split.
- * @param delim A string which specifies the places at which to split the
- * string. The delimiter is not included in any of the
+ * @param delim A string which specifies the places at which to split the
+ * string. The delimiter is not included in any of the
* resulting strings, unless max_tokens is reached.
- * @param max_tokens The maximum number of strings to split string into.
+ * @param max_tokens The maximum number of strings to split string into.
* If this is less than 1, the string is split completely.
* @return A newly-allocated NULL-terminated array of strings.
* To free it: free the first element of the array
dlen = strlen(delim);
s = strdup(str);
str_array = malloc(sizeof(char *) * (len + 1));
- for (i = 0; (i < max_tokens) && (sep = strstr(s, delim)); i++)
+ for (i = 0; (i < max_tokens) && (sep = strstr(s, delim)); i++)
{
str_array[i] = s;
s = sep + dlen;
str_array[i++] = s;
str_array = realloc(str_array, sizeof(char *) * (i + 1));
str_array[i] = NULL;
-
+
return str_array;
}
-
EAPI void
ecore_strbuf_free(Ecore_Strbuf *buf)
{
- CHECK_PARAM_POINTER("buf", buf);
+ CHECK_PARAM_POINTER("buf", buf);
free(buf->buf);
free(buf);
}
size_t l;
size_t off = 0;
- CHECK_PARAM_POINTER("buf", buf);
- CHECK_PARAM_POINTER("str", str);
+ CHECK_PARAM_POINTER("buf", buf);
+ CHECK_PARAM_POINTER("str", str);
l = ecore_strlcpy(buf->buf + buf->len, str, buf->size - buf->len);
- while (l > buf->size - buf->len)
+ while (l > buf->size - buf->len)
{
/* we successfully appended this much */
off += buf->size - buf->len - 1;
{
size_t len;
- CHECK_PARAM_POINTER("buf", buf);
+ CHECK_PARAM_POINTER("buf", buf);
CHECK_PARAM_POINTER("str", str);
if (pos >= buf->len)
EAPI void
ecore_strbuf_append_char(Ecore_Strbuf *buf, char c)
{
- CHECK_PARAM_POINTER("buf", buf);
+ CHECK_PARAM_POINTER("buf", buf);
if (buf->len >= buf->size - 1)
{
buf->size += buf->step;
EAPI const char *
ecore_strbuf_string_get(Ecore_Strbuf *buf)
{
- CHECK_PARAM_POINTER_RETURN("buf", buf, NULL);
+ CHECK_PARAM_POINTER_RETURN("buf", buf, NULL);
return buf->buf;
}
EAPI size_t
ecore_strbuf_length_get(Ecore_Strbuf *buf)
{
- CHECK_PARAM_POINTER_RETURN("buf", buf, 0);
+ CHECK_PARAM_POINTER_RETURN("buf", buf, 0);
return buf->len;
}
* @param buf the Ecore_Strbuf to work with
* @param str the string to replace
* @param with the replaceing string
- * @param n the number of the fitting string
+ * @param n the number of the fitting string
*
* @return true on success
*/
char *spos;
size_t pos;
- CHECK_PARAM_POINTER_RETURN("buf", buf, 0);
+ CHECK_PARAM_POINTER_RETURN("buf", buf, 0);
CHECK_PARAM_POINTER_RETURN("str", str, 0);
CHECK_PARAM_POINTER_RETURN("with", with, 0);
while (n--)
{
spos = strstr(spos, str);
- if (!spos || *spos == '\0')
+ if (!spos || *spos == '\0')
return 0;
if (n) spos++;
}
pos = spos - buf->buf;
- len1 = strlen(str);
+ len1 = strlen(str);
len2 = strlen(with);
if (len1 != len2)
{
/* resize the buffer if necessary */
if (!_ecore_strbuf_resize(buf, buf->len - len1 + len2))
return 0;
- /* move the existing text */
- memmove(buf->buf + pos + len2, buf->buf + pos + len1,
+ /* move the existing text */
+ memmove(buf->buf + pos + len2, buf->buf + pos + len1,
buf->len - pos - len1);
}
/* and now insert the given string */
size_t pos_tmp, start_tmp;
int n = 0;
- CHECK_PARAM_POINTER_RETURN("buf", buf, 0);
+ CHECK_PARAM_POINTER_RETURN("buf", buf, 0);
CHECK_PARAM_POINTER_RETURN("str", str, 0);
CHECK_PARAM_POINTER_RETURN("with", with, 0);
if (!spos || *spos == '\0')
return 0;
- len1 = strlen(str);
+ len1 = strlen(str);
len2 = strlen(with);
/* if the size of the two string is equal, it is fairly easy to replace them
}
return n;
}
-
+
pos = pos_tmp = spos - buf->buf;
tmp_buf = buf->buf;
buf->buf = malloc(buf->size);
len = (len + len1) - len2;
break;
}
-
- /* copy the untouched text */
- memcpy(buf->buf + start, tmp_buf + start_tmp, pos - start);
+
+ /* copy the untouched text */
+ memcpy(buf->buf + start, tmp_buf + start_tmp, pos - start);
/* copy the new string */
memcpy(buf->buf + pos, with, len2);
* @param buf the buffer to resize
* @param size the minimum size of the buffer
*/
-static int
+static int
_ecore_strbuf_resize(Ecore_Strbuf *buf, size_t size)
{
char *buffer;
new_step *= 2;
}
}
- else
+ else
{
/* shrink the buffer */
/*
buffer = realloc(buf->buf, new_size);
if (!buffer)
return 0;
-
+
buf->buf = buffer;
buf->size = new_size;
buf->step = new_step;
return 1;
}
-
* Initialize the ecore string internal structure.
* @return Zero on failure, non-zero on successful initialization.
*/
-EAPI int
+EAPI int
ecore_string_init()
{
/*
* @param string The given string.
* @ingroup Ecore_String_Group
*/
-EAPI void
+EAPI void
ecore_string_release(const char *string)
{
Ecore_String *str;
/**
* Shutdown the ecore string internal structures
*/
-EAPI void
+EAPI void
ecore_string_shutdown()
{
--ecore_string_init_count;
}
}
-static void
+static void
ecore_string_free_cb(void *data)
{
Ecore_String *str;
/**
* Retrieves the current system time as a floating point value in seconds.
- *
+ *
* Also see ecore_loop_time_get().
- *
+ *
* @return The number of seconds since 12.00AM 1st January 1970.
* @ingroup Ecore_Time_Group
*/
/**
* Retrieves the time at which the last loop stopped waiting for timeouts or events
- *
+ *
* This gets the time (since Jan 1st, 1970, 12:00AM) that the main loop ceased
* waiting for timouts and/or events to come in or for signals or any other
* interrupt source. This should be considered a reference point fo all
* current actual timepoint - then use ecore_time_get(). If this is called
* before any loop has ever been run, then it will call ecore_time_get() for
* you the first time and thus have an initial time reference.
- *
+ *
* @return The number of seconds since 12.00AM 1st January 1970.
* @ingroup Ecore_Time_Group
*/
* This function adds a timer and returns its handle on success and NULL on
* failure. The function @p func will be called every @in@ seconds. The
* function will be passed the @p data pointer as its parameter.
- *
- * When the timer @p func is called, it must return a value of either 1
- * (or ECORE_CALLBACK_RENEW) or 0 (or ECORE_CALLBACK_CANCEL).
+ *
+ * When the timer @p func is called, it must return a value of either 1
+ * (or ECORE_CALLBACK_RENEW) or 0 (or ECORE_CALLBACK_CANCEL).
* If it returns 1, it will be called again at the next tick, or if it returns
* 0 it will be deleted automatically making any references/handles for it
* invalid.
while (timers)
{
Ecore_Timer *timer;
-
+
timer = timers;
timers = _ecore_list2_remove(timers, timer);
ECORE_MAGIC_SET(timer, ECORE_MAGIC_NONE);
for (l = (Ecore_List2 *)timers; l;)
{
Ecore_Timer *timer;
-
+
timer = (Ecore_Timer *)l;
l = l->next;
if (timer->delete_me)
for (l = (Ecore_List2 *)suspended; l;)
{
Ecore_Timer *timer;
-
+
timer = (Ecore_Timer *)l;
l = l->next;
if (timer->delete_me)
void
_ecore_timer_enable_new(void)
{
- Ecore_List2 *l;
+ Ecore_List2 *l;
if (!timers_added) return;
timers_added = 0;
for (l = (Ecore_List2 *)timers; l; l = l->next)
{
Ecore_Timer *timer;
-
+
timer = (Ecore_Timer *)l;
timer->just_added = 0;
}
int
_ecore_timer_call(double when)
{
- Ecore_List2 *l;
+ Ecore_List2 *l;
Ecore_Timer *timer;
if (!timers) return 0;
}
}
return 0;
-}
+}
static void
_ecore_timer_set(Ecore_Timer *timer, double at, double in, int (*func) (void *data), void *data)
{
Ecore_List2 *l;
-
+
timers_added = 1;
timer->at = at;
timer->in = in;
for (l = ((Ecore_List2 *)(timers))->last; l; l = l->prev)
{
Ecore_Timer *t2;
-
+
t2 = (Ecore_Timer *)l;
if (timer->at > t2->at)
{
* @param compare_func: the function used to compare node keys
* @return Returns TRUE on successful initialization, FALSE on an error
*/
-EAPI int
+EAPI int
ecore_tree_init(Ecore_Tree *new_tree, Ecore_Compare_Cb compare_func)
{
CHECK_PARAM_POINTER_RETURN("new_tree", new_tree, FALSE);
* @param free_func: the function that will be passed the node being freed
* @return Returns TRUE on successful set, FALSE otherwise.
*/
-EAPI int
+EAPI int
ecore_tree_free_value_cb_set(Ecore_Tree *tree, Ecore_Free_Cb free_value)
{
CHECK_PARAM_POINTER_RETURN("tree", tree, FALSE);
* @param free_key: the function that will be passed the node being freed
* @return Returns TRUE on successful set, FALSE otherwise.
*/
-EAPI int
+EAPI int
ecore_tree_free_key_cb_set(Ecore_Tree *tree, Ecore_Free_Cb free_key)
{
CHECK_PARAM_POINTER_RETURN("tree", tree, FALSE);
* @brief Initialize a new tree node
* @return Returns FALSE if the operation fails, otherwise TRUE
*/
-EAPI int
+EAPI int
ecore_tree_node_init(Ecore_Tree_Node *new_node)
{
CHECK_PARAM_POINTER_RETURN("new_node", new_node, FALSE);
*
* If you don't want the children free'd then you need to remove the node first.
*/
-EAPI int
+EAPI int
ecore_tree_node_destroy(Ecore_Tree_Node *node, Ecore_Free_Cb value_free, Ecore_Free_Cb key_free)
{
CHECK_PARAM_POINTER_RETURN("node", node, FALSE);
* @param value: the value to set the node to.
* @return Returns TRUE if the node is set successfully, FALSE if not.
*/
-EAPI int
+EAPI int
ecore_tree_node_value_set(Ecore_Tree_Node *node, void *value)
{
CHECK_PARAM_POINTER_RETURN("node", node, FALSE);
* @param key: the value to set it's key to.
* @return Returns TRUE if the node is set successfully, FALSE if not.
*/
-EAPI int
+EAPI int
ecore_tree_node_key_set(Ecore_Tree_Node *node, void *key)
{
CHECK_PARAM_POINTER_RETURN("node", node, FALSE);
*
* @return Returns TRUE if tree destroyed successfully, FALSE if not.
*/
-EAPI int
+EAPI int
ecore_tree_destroy(Ecore_Tree *tree)
{
Ecore_Tree_Node *node;
* @param value Value to set the found node.
* @return TRUE if successful, FALSE if not.
*/
-EAPI int
+EAPI int
ecore_tree_set(Ecore_Tree *tree, void *key, void *value)
{
Ecore_Tree_Node *node = NULL;
if (!ecore_tree_node_add(tree, node))
return FALSE;
}
- else
+ else
{
- if (tree->free_key)
+ if (tree->free_key)
tree->free_key(key);
if (node->value && tree->free_value)
tree->free_value(node->value);
* @param node The node to add to @a tree.
* @return TRUE on a successful add, FALSE otherwise.
*/
-EAPI int
+EAPI int
ecore_tree_node_add(Ecore_Tree *tree, Ecore_Tree_Node *node)
{
Ecore_Tree_Node *travel = NULL;
* @param node The node to remove from @a tree.
* @return TRUE on a successful remove, FALSE otherwise.
*/
-EAPI int
+EAPI int
ecore_tree_node_remove(Ecore_Tree *tree, Ecore_Tree_Node *node)
{
Ecore_Tree_Node *traverse;
* @param key The key to remove from @a tree.
* @return TRUE on a successful remove, FALSE otherwise.
*/
-EAPI int
+EAPI int
ecore_tree_remove(Ecore_Tree *tree, const void *key)
{
Ecore_Tree_Node *node;
* @param tree: the tree to check for nodes
* @return Returns TRUE if no nodes exist, FALSE otherwise
*/
-EAPI int
+EAPI int
ecore_tree_empty_is(Ecore_Tree *tree)
{
CHECK_PARAM_POINTER_RETURN("tree", tree, FALSE);
* @param user_data: data passed to each for_each_func call
* @return Returns TRUE on success, FALSE on failure.
*/
-EAPI int
+EAPI int
ecore_tree_for_each_node_value(Ecore_Tree *tree, Ecore_For_Each for_each_func, void *user_data)
{
CHECK_PARAM_POINTER_RETURN("tree", tree, FALSE);
* @param user_data: data passed to each for_each_func call
* @return Returns TRUE on success, FALSE on failure.
*/
-EAPI int
+EAPI int
ecore_tree_for_each_node(Ecore_Tree *tree, Ecore_For_Each for_each_func, void *user_data)
{
CHECK_PARAM_POINTER_RETURN("tree", tree, FALSE);
}
/* Balance the tree with respect to node */
-static int
+static int
tree_node_balance(Ecore_Tree *tree, Ecore_Tree_Node *top_node)
{
int balance;
}
/* Tree is overbalanced to the left, so rotate nodes to the right. */
-static int
+static int
tree_node_rotate_right(Ecore_Tree *tree, Ecore_Tree_Node *top_node)
{
Ecore_Tree_Node *temp;
}
/* The tree is overbalanced to the right, so we rotate nodes to the left */
-static int
+static int
tree_node_rotate_left(Ecore_Tree *tree, Ecore_Tree_Node *top_node)
{
Ecore_Tree_Node *temp;
* @param user_data: data passed to each for_each_func call
* @return Returns FALSE if an error condition occurs, otherwise TRUE
*/
-static int
+static int
tree_for_each_node(Ecore_Tree_Node * node, Ecore_For_Each for_each_func, void *user_data)
{
CHECK_PARAM_POINTER_RETURN("node", node, FALSE);
* @param for_each_func: the function to pass the nodes values as data
* @return Returns FALSE if an error condition occurs, otherwise TRUE
*/
-static int
+static int
tree_for_each_node_value(Ecore_Tree_Node *node, Ecore_For_Each for_each_func, void *user_data)
{
CHECK_PARAM_POINTER_RETURN("node", node, FALSE);
2097143, 4194301, 8388617, 16777213
};
-EAPI void
+EAPI void
ecore_print_warning(const char *function, const char *sparam)
{
fprintf(stderr, "***** Developer Warning ***** :\n"
* @param key The key to return compute a hash value
* @return The key cast to an unsigned int.
*/
-EAPI unsigned int
+EAPI unsigned int
ecore_direct_hash(const void *key)
{
#ifdef __LP64__
* @param key A pointer to the string to compute a hash value
* @return A computed hash value for @a key.
*/
-EAPI unsigned int
+EAPI unsigned int
ecore_str_hash(const void *key)
{
int i;
* @param key2 The second key to compare
* @return A strcmp style value to indicate the larger key
*/
-EAPI int
+EAPI int
ecore_direct_compare(const void *key1, const void *key2)
{
unsigned int k1, k2;
* @param key2 The second key to compare
* @return A strcmp style value to indicate the larger key
*/
-EAPI int
+EAPI int
ecore_str_compare(const void *key1, const void *key2)
{
const char *k1, *k2;