forked from enlightenment/efl
ran ecrustify on ecore. some manual fixing too.
SVN revision: 64238
This commit is contained in:
parent
8893a9ff35
commit
58cbf16625
File diff suppressed because it is too large
Load Diff
|
@ -48,12 +48,11 @@
|
|||
* use multiple values with the same parser.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
typedef enum {
|
||||
ECORE_GETOPT_ACTION_STORE,
|
||||
ECORE_GETOPT_ACTION_STORE_CONST,
|
||||
ECORE_GETOPT_ACTION_STORE_TRUE,
|
||||
|
@ -66,9 +65,9 @@ extern "C" {
|
|||
ECORE_GETOPT_ACTION_VERSION,
|
||||
ECORE_GETOPT_ACTION_COPYRIGHT,
|
||||
ECORE_GETOPT_ACTION_LICENSE
|
||||
} Ecore_Getopt_Action;
|
||||
} Ecore_Getopt_Action;
|
||||
|
||||
typedef enum {
|
||||
typedef enum {
|
||||
ECORE_GETOPT_TYPE_STR,
|
||||
ECORE_GETOPT_TYPE_BOOL,
|
||||
ECORE_GETOPT_TYPE_SHORT,
|
||||
|
@ -78,23 +77,23 @@ extern "C" {
|
|||
ECORE_GETOPT_TYPE_UINT,
|
||||
ECORE_GETOPT_TYPE_ULONG,
|
||||
ECORE_GETOPT_TYPE_DOUBLE
|
||||
} Ecore_Getopt_Type;
|
||||
} Ecore_Getopt_Type;
|
||||
|
||||
typedef enum {
|
||||
typedef enum {
|
||||
ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO = 0,
|
||||
ECORE_GETOPT_DESC_ARG_REQUIREMENT_YES = 1,
|
||||
ECORE_GETOPT_DESC_ARG_REQUIREMENT_OPTIONAL = 3
|
||||
} Ecore_Getopt_Desc_Arg_Requirement;
|
||||
} Ecore_Getopt_Desc_Arg_Requirement;
|
||||
|
||||
typedef union _Ecore_Getopt_Value Ecore_Getopt_Value;
|
||||
typedef union _Ecore_Getopt_Value Ecore_Getopt_Value;
|
||||
|
||||
typedef struct _Ecore_Getopt_Desc_Store Ecore_Getopt_Desc_Store;
|
||||
typedef struct _Ecore_Getopt_Desc_Callback Ecore_Getopt_Desc_Callback;
|
||||
typedef struct _Ecore_Getopt_Desc Ecore_Getopt_Desc;
|
||||
typedef struct _Ecore_Getopt Ecore_Getopt;
|
||||
typedef struct _Ecore_Getopt_Desc_Store Ecore_Getopt_Desc_Store;
|
||||
typedef struct _Ecore_Getopt_Desc_Callback Ecore_Getopt_Desc_Callback;
|
||||
typedef struct _Ecore_Getopt_Desc Ecore_Getopt_Desc;
|
||||
typedef struct _Ecore_Getopt Ecore_Getopt;
|
||||
|
||||
union _Ecore_Getopt_Value
|
||||
{
|
||||
union _Ecore_Getopt_Value
|
||||
{
|
||||
char **strp;
|
||||
unsigned char *boolp;
|
||||
short *shortp;
|
||||
|
@ -106,10 +105,10 @@ extern "C" {
|
|||
double *doublep;
|
||||
Eina_List **listp;
|
||||
void **ptrp;
|
||||
};
|
||||
};
|
||||
|
||||
struct _Ecore_Getopt_Desc_Store
|
||||
{
|
||||
struct _Ecore_Getopt_Desc_Store
|
||||
{
|
||||
Ecore_Getopt_Type type; /**< type of data being handled */
|
||||
Ecore_Getopt_Desc_Arg_Requirement arg_req;
|
||||
union
|
||||
|
@ -124,18 +123,22 @@ extern "C" {
|
|||
unsigned long ulongv;
|
||||
double doublev;
|
||||
} def;
|
||||
};
|
||||
};
|
||||
|
||||
struct _Ecore_Getopt_Desc_Callback
|
||||
{
|
||||
Eina_Bool (*func)(const Ecore_Getopt *parser, const Ecore_Getopt_Desc *desc, const char *str, void *data, Ecore_Getopt_Value *storage);
|
||||
struct _Ecore_Getopt_Desc_Callback
|
||||
{
|
||||
Eina_Bool (*func)(const Ecore_Getopt *parser,
|
||||
const Ecore_Getopt_Desc *desc,
|
||||
const char *str,
|
||||
void *data,
|
||||
Ecore_Getopt_Value *storage);
|
||||
const void *data;
|
||||
Ecore_Getopt_Desc_Arg_Requirement arg_req;
|
||||
const char *def;
|
||||
};
|
||||
};
|
||||
|
||||
struct _Ecore_Getopt_Desc
|
||||
{
|
||||
struct _Ecore_Getopt_Desc
|
||||
{
|
||||
char shortname; /**< used with a single dash */
|
||||
const char *longname; /**< used with double dashes */
|
||||
const char *help; /**< used by --help/ecore_getopt_help() */
|
||||
|
@ -151,10 +154,10 @@ extern "C" {
|
|||
const Ecore_Getopt_Desc_Callback callback;
|
||||
const void *dummy;
|
||||
} action_param;
|
||||
};
|
||||
};
|
||||
|
||||
struct _Ecore_Getopt
|
||||
{
|
||||
struct _Ecore_Getopt
|
||||
{
|
||||
const char *prog; /**< to be used when ecore_app_args_get() fails */
|
||||
const char *usage; /**< usage example, %prog is replaced */
|
||||
const char *version; /**< if exists, --version will work */
|
||||
|
@ -163,7 +166,7 @@ extern "C" {
|
|||
const char *description; /**< long description, possible multiline */
|
||||
Eina_Bool strict : 1; /**< fail on errors */
|
||||
const Ecore_Getopt_Desc descs[]; /* NULL terminated. */
|
||||
};
|
||||
};
|
||||
|
||||
#define ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, type, arg_requirement, default_value) \
|
||||
{shortname, longname, help, metavar, ECORE_GETOPT_ACTION_STORE, \
|
||||
|
@ -192,7 +195,6 @@ extern "C" {
|
|||
#define ECORE_GETOPT_STORE_DOUBLE(shortname, longname, help) \
|
||||
ECORE_GETOPT_STORE(shortname, longname, help, ECORE_GETOPT_TYPE_DOUBLE)
|
||||
|
||||
|
||||
#define ECORE_GETOPT_STORE_METAVAR(shortname, longname, help, metavar, type) \
|
||||
ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, type, \
|
||||
ECORE_GETOPT_DESC_ARG_REQUIREMENT_YES, {})
|
||||
|
@ -216,7 +218,6 @@ extern "C" {
|
|||
#define ECORE_GETOPT_STORE_METAVAR_DOUBLE(shortname, longname, help, metavar) \
|
||||
ECORE_GETOPT_STORE_METAVAR(shortname, longname, help, metavar, ECORE_GETOPT_TYPE_DOUBLE)
|
||||
|
||||
|
||||
#define ECORE_GETOPT_STORE_DEF(shortname, longname, help, type, default_value) \
|
||||
ECORE_GETOPT_STORE_FULL(shortname, longname, help, NULL, type, \
|
||||
ECORE_GETOPT_DESC_ARG_REQUIREMENT_OPTIONAL, \
|
||||
|
@ -322,7 +323,6 @@ extern "C" {
|
|||
{shortname, longname, help, metavar, ECORE_GETOPT_ACTION_CHOICE, \
|
||||
{.choices = choices_array}}
|
||||
|
||||
|
||||
#define ECORE_GETOPT_APPEND(shortname, longname, help, sub_type) \
|
||||
{shortname, longname, help, NULL, ECORE_GETOPT_ACTION_APPEND, \
|
||||
{.append_type = sub_type}}
|
||||
|
@ -385,17 +385,33 @@ extern "C" {
|
|||
#define ECORE_GETOPT_VALUE_LIST(val) {.listp = &(val)}
|
||||
#define ECORE_GETOPT_VALUE_NONE {.ptrp = NULL}
|
||||
|
||||
EAPI void ecore_getopt_help(FILE *fp, const Ecore_Getopt *info);
|
||||
EAPI void
|
||||
ecore_getopt_help(FILE *fp,
|
||||
const Ecore_Getopt *info);
|
||||
|
||||
EAPI Eina_Bool ecore_getopt_parser_has_duplicates(const Ecore_Getopt *parser);
|
||||
EAPI int ecore_getopt_parse(const Ecore_Getopt *parser, Ecore_Getopt_Value *values, int argc, char **argv);
|
||||
EAPI Eina_Bool
|
||||
ecore_getopt_parser_has_duplicates(const Ecore_Getopt *parser);
|
||||
EAPI int
|
||||
ecore_getopt_parse(const Ecore_Getopt *parser,
|
||||
Ecore_Getopt_Value *values,
|
||||
int argc,
|
||||
char **argv);
|
||||
|
||||
EAPI Eina_List *ecore_getopt_list_free(Eina_List *list);
|
||||
|
||||
/* helper functions to be used with ECORE_GETOPT_CALLBACK_*() */
|
||||
EAPI Eina_Bool ecore_getopt_callback_geometry_parse(const Ecore_Getopt *parser, const Ecore_Getopt_Desc *desc, const char *str, void *data, Ecore_Getopt_Value *storage);
|
||||
EAPI Eina_Bool ecore_getopt_callback_size_parse(const Ecore_Getopt *parser, const Ecore_Getopt_Desc *desc, const char *str, void *data, Ecore_Getopt_Value *storage);
|
||||
EAPI Eina_List *ecore_getopt_list_free(Eina_List *list);
|
||||
|
||||
/* helper functions to be used with ECORE_GETOPT_CALLBACK_*() */
|
||||
EAPI Eina_Bool
|
||||
ecore_getopt_callback_geometry_parse(const Ecore_Getopt *parser,
|
||||
const Ecore_Getopt_Desc *desc,
|
||||
const char *str,
|
||||
void *data,
|
||||
Ecore_Getopt_Value *storage);
|
||||
EAPI Eina_Bool
|
||||
ecore_getopt_callback_size_parse(const Ecore_Getopt *parser,
|
||||
const Ecore_Getopt_Desc *desc,
|
||||
const char *str,
|
||||
void *data,
|
||||
Ecore_Getopt_Value *storage);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -73,7 +73,9 @@ struct _Ecore_Safe_Call
|
|||
|
||||
static void _ecore_main_loop_thread_safe_call(Ecore_Safe_Call *order);
|
||||
static void _thread_safe_cleanup(void *data);
|
||||
static void _thread_callback(void *data, void *buffer, unsigned int nbyte);
|
||||
static void _thread_callback(void *data,
|
||||
void *buffer,
|
||||
unsigned int nbyte);
|
||||
static Eina_List *_thread_cb = NULL;
|
||||
static Ecore_Pipe *_thread_call = NULL;
|
||||
static Eina_Lock _thread_safety;
|
||||
|
@ -189,9 +191,9 @@ ecore_init(void)
|
|||
|
||||
return _ecore_init_count;
|
||||
|
||||
shutdown_log_dom:
|
||||
shutdown_log_dom:
|
||||
eina_shutdown();
|
||||
shutdown_evil:
|
||||
shutdown_evil:
|
||||
#ifdef HAVE_EVIL
|
||||
evil_shutdown();
|
||||
#endif
|
||||
|
@ -273,20 +275,21 @@ unlock:
|
|||
static int wakeup = 42;
|
||||
|
||||
EAPI void
|
||||
ecore_main_loop_thread_safe_call_async(Ecore_Cb callback, void *data)
|
||||
ecore_main_loop_thread_safe_call_async(Ecore_Cb callback,
|
||||
void *data)
|
||||
{
|
||||
Ecore_Safe_Call *order;
|
||||
|
||||
if (!callback) return ;
|
||||
if (!callback) return;
|
||||
|
||||
if (eina_main_loop_is())
|
||||
{
|
||||
callback(data);
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
order = malloc(sizeof (Ecore_Safe_Call));
|
||||
if (!order) return ;
|
||||
if (!order) return;
|
||||
|
||||
order->cb.async = callback;
|
||||
order->data = data;
|
||||
|
@ -297,7 +300,8 @@ ecore_main_loop_thread_safe_call_async(Ecore_Cb callback, void *data)
|
|||
}
|
||||
|
||||
EAPI void *
|
||||
ecore_main_loop_thread_safe_call_sync(Ecore_Data_Cb callback, void *data)
|
||||
ecore_main_loop_thread_safe_call_sync(Ecore_Data_Cb callback,
|
||||
void *data)
|
||||
{
|
||||
Ecore_Safe_Call *order;
|
||||
void *ret;
|
||||
|
@ -414,7 +418,8 @@ ecore_thread_main_loop_end(void)
|
|||
}
|
||||
|
||||
EAPI void
|
||||
ecore_print_warning(const char *function, const char *sparam)
|
||||
ecore_print_warning(const char *function,
|
||||
const char *sparam)
|
||||
{
|
||||
WRN("***** Developer Warning ***** :\n"
|
||||
"\tThis program is calling:\n\n"
|
||||
|
@ -426,7 +431,10 @@ ecore_print_warning(const char *function, const char *sparam)
|
|||
}
|
||||
|
||||
EAPI void
|
||||
_ecore_magic_fail(const void *d, Ecore_Magic m, Ecore_Magic req_m, const char *fname)
|
||||
_ecore_magic_fail(const void *d,
|
||||
Ecore_Magic m,
|
||||
Ecore_Magic req_m,
|
||||
const char *fname)
|
||||
{
|
||||
ERR("\n"
|
||||
"*** ECORE ERROR: Ecore Magic Check Failed!!!\n"
|
||||
|
@ -455,36 +463,46 @@ _ecore_magic_string_get(Ecore_Magic m)
|
|||
case ECORE_MAGIC_NONE:
|
||||
return "None (Freed Object)";
|
||||
break;
|
||||
|
||||
case ECORE_MAGIC_EXE:
|
||||
return "Ecore_Exe (Executable)";
|
||||
break;
|
||||
|
||||
case ECORE_MAGIC_TIMER:
|
||||
return "Ecore_Timer (Timer)";
|
||||
break;
|
||||
|
||||
case ECORE_MAGIC_IDLER:
|
||||
return "Ecore_Idler (Idler)";
|
||||
break;
|
||||
|
||||
case ECORE_MAGIC_IDLE_ENTERER:
|
||||
return "Ecore_Idle_Enterer (Idler Enterer)";
|
||||
break;
|
||||
|
||||
case ECORE_MAGIC_IDLE_EXITER:
|
||||
return "Ecore_Idle_Exiter (Idler Exiter)";
|
||||
break;
|
||||
|
||||
case ECORE_MAGIC_FD_HANDLER:
|
||||
return "Ecore_Fd_Handler (Fd Handler)";
|
||||
break;
|
||||
|
||||
case ECORE_MAGIC_WIN32_HANDLER:
|
||||
return "Ecore_Win32_Handler (Win32 Handler)";
|
||||
break;
|
||||
|
||||
case ECORE_MAGIC_EVENT_HANDLER:
|
||||
return "Ecore_Event_Handler (Event Handler)";
|
||||
break;
|
||||
|
||||
case ECORE_MAGIC_EVENT:
|
||||
return "Ecore_Event (Event)";
|
||||
break;
|
||||
|
||||
default:
|
||||
return "<UNKNOWN>";
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/* fps debug calls - for debugging how much time your app actually spends */
|
||||
|
@ -710,3 +728,4 @@ _thread_callback(void *data __UNUSED__,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include "Ecore.h"
|
||||
#include "ecore_private.h"
|
||||
|
||||
|
||||
struct _Ecore_Animator
|
||||
{
|
||||
EINA_INLIST;
|
||||
|
@ -25,7 +24,6 @@ struct _Ecore_Animator
|
|||
Eina_Bool suspended : 1;
|
||||
};
|
||||
|
||||
|
||||
static Eina_Bool _ecore_animator_run(void *data);
|
||||
static Eina_Bool _ecore_animator(void *data);
|
||||
|
||||
|
@ -60,9 +58,11 @@ _begin_tick(void)
|
|||
_ecore_timer_delay(timer, d);
|
||||
}
|
||||
break;
|
||||
|
||||
case ECORE_ANIMATOR_SOURCE_CUSTOM:
|
||||
if (begin_tick_cb) begin_tick_cb((void *)begin_tick_data);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -82,9 +82,11 @@ _end_tick(void)
|
|||
timer = NULL;
|
||||
}
|
||||
break;
|
||||
|
||||
case ECORE_ANIMATOR_SOURCE_CUSTOM:
|
||||
if (end_tick_cb) end_tick_cb((void *)end_tick_data);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -109,10 +111,10 @@ _do_tick(void)
|
|||
if (animators_delete_me)
|
||||
{
|
||||
Ecore_Animator *l;
|
||||
for (l = animators; l;)
|
||||
for (l = animators; l; )
|
||||
{
|
||||
animator = l;
|
||||
l = (Ecore_Animator *) EINA_INLIST_GET(l)->next;
|
||||
l = (Ecore_Animator *)EINA_INLIST_GET(l)->next;
|
||||
if (animator->delete_me)
|
||||
{
|
||||
animators = (Ecore_Animator *)
|
||||
|
@ -134,7 +136,8 @@ _do_tick(void)
|
|||
}
|
||||
|
||||
static Ecore_Animator *
|
||||
_ecore_animator_add(Ecore_Task_Cb func, const void *data)
|
||||
_ecore_animator_add(Ecore_Task_Cb func,
|
||||
const void *data)
|
||||
{
|
||||
Ecore_Animator *animator = NULL;
|
||||
|
||||
|
@ -150,7 +153,8 @@ _ecore_animator_add(Ecore_Task_Cb func, const void *data)
|
|||
}
|
||||
|
||||
EAPI Ecore_Animator *
|
||||
ecore_animator_add(Ecore_Task_Cb func, const void *data)
|
||||
ecore_animator_add(Ecore_Task_Cb func,
|
||||
const void *data)
|
||||
{
|
||||
Ecore_Animator *animator;
|
||||
|
||||
|
@ -162,7 +166,9 @@ ecore_animator_add(Ecore_Task_Cb func, const void *data)
|
|||
}
|
||||
|
||||
EAPI Ecore_Animator *
|
||||
ecore_animator_timeline_add(double runtime, Ecore_Timeline_Cb func, const void *data)
|
||||
ecore_animator_timeline_add(double runtime,
|
||||
Ecore_Timeline_Cb func,
|
||||
const void *data)
|
||||
{
|
||||
Ecore_Animator *animator;
|
||||
|
||||
|
@ -191,7 +197,8 @@ _pos_map_cos(double in)
|
|||
}
|
||||
|
||||
static double
|
||||
_pos_map_accel_factor(double pos, double v1)
|
||||
_pos_map_accel_factor(double pos,
|
||||
double v1)
|
||||
{
|
||||
int i, fact = (int)v1;
|
||||
double p, o1 = pos, o2 = pos, v;
|
||||
|
@ -208,7 +215,9 @@ _pos_map_accel_factor(double pos, double v1)
|
|||
}
|
||||
|
||||
static double
|
||||
_pos_map_pow(double pos, double divis, int p)
|
||||
_pos_map_pow(double pos,
|
||||
double divis,
|
||||
int p)
|
||||
{
|
||||
double v = 1.0;
|
||||
int i;
|
||||
|
@ -217,7 +226,9 @@ _pos_map_pow(double pos, double divis, int p)
|
|||
}
|
||||
|
||||
static double
|
||||
_pos_map_spring(double pos, int bounces, double decfac)
|
||||
_pos_map_spring(double pos,
|
||||
int bounces,
|
||||
double decfac)
|
||||
{
|
||||
int segnum, segpos, b1, b2;
|
||||
double len, decay, decpos, p2;
|
||||
|
@ -235,45 +246,59 @@ _pos_map_spring(double pos, int bounces, double decfac)
|
|||
}
|
||||
|
||||
EAPI double
|
||||
ecore_animator_pos_map(double pos, Ecore_Pos_Map map, double v1, double v2)
|
||||
ecore_animator_pos_map(double pos,
|
||||
Ecore_Pos_Map map,
|
||||
double v1,
|
||||
double v2)
|
||||
{
|
||||
/* purely functional - locking not required */
|
||||
if (pos > 1.0) pos = 1.0;
|
||||
else if (pos < 0.0) pos = 0.0;
|
||||
else if (pos < 0.0)
|
||||
pos = 0.0;
|
||||
switch (map)
|
||||
{
|
||||
case ECORE_POS_MAP_LINEAR:
|
||||
return pos;
|
||||
|
||||
case ECORE_POS_MAP_ACCELERATE:
|
||||
pos = 1.0 - _pos_map_sin((M_PI / 2.0) + ((pos * M_PI) / 2.0));
|
||||
return pos;
|
||||
|
||||
case ECORE_POS_MAP_DECELERATE:
|
||||
pos = _pos_map_sin((pos * M_PI) / 2.0);
|
||||
return pos;
|
||||
|
||||
case ECORE_POS_MAP_SINUSOIDAL:
|
||||
pos = (1.0 - _pos_map_cos(pos * M_PI)) / 2.0;
|
||||
return pos;
|
||||
|
||||
case ECORE_POS_MAP_ACCELERATE_FACTOR:
|
||||
pos = _pos_map_accel_factor(pos, v1);
|
||||
return pos;
|
||||
|
||||
case ECORE_POS_MAP_DECELERATE_FACTOR:
|
||||
pos = 1.0 - _pos_map_accel_factor(1.0 - pos, v1);
|
||||
return pos;
|
||||
|
||||
case ECORE_POS_MAP_SINUSOIDAL_FACTOR:
|
||||
if (pos < 0.5) pos = _pos_map_accel_factor(pos * 2.0, v1) / 2.0;
|
||||
else pos = 1.0 - (_pos_map_accel_factor((1.0 - pos) * 2.0, v1) / 2.0);
|
||||
return pos;
|
||||
|
||||
case ECORE_POS_MAP_DIVISOR_INTERP:
|
||||
pos = _pos_map_pow(pos, v1, (int)v2);
|
||||
return pos;
|
||||
|
||||
case ECORE_POS_MAP_BOUNCE:
|
||||
pos = _pos_map_spring(pos, (int)v2, v1);
|
||||
if (pos < 0.0) pos = -pos;
|
||||
pos = 1.0 - pos;
|
||||
return pos;
|
||||
|
||||
case ECORE_POS_MAP_SPRING:
|
||||
pos = 1.0 - _pos_map_spring(pos, (int)v2, v1);
|
||||
return pos;
|
||||
|
||||
default:
|
||||
return pos;
|
||||
}
|
||||
|
@ -376,7 +401,8 @@ ecore_animator_source_get(void)
|
|||
}
|
||||
|
||||
EAPI void
|
||||
ecore_animator_custom_source_tick_begin_callback_set(Ecore_Cb func, const void *data)
|
||||
ecore_animator_custom_source_tick_begin_callback_set(Ecore_Cb func,
|
||||
const void *data)
|
||||
{
|
||||
_ecore_lock();
|
||||
begin_tick_cb = func;
|
||||
|
@ -387,7 +413,8 @@ ecore_animator_custom_source_tick_begin_callback_set(Ecore_Cb func, const void *
|
|||
}
|
||||
|
||||
EAPI void
|
||||
ecore_animator_custom_source_tick_end_callback_set(Ecore_Cb func, const void *data)
|
||||
ecore_animator_custom_source_tick_end_callback_set(Ecore_Cb func,
|
||||
const void *data)
|
||||
{
|
||||
_ecore_lock();
|
||||
end_tick_cb = func;
|
||||
|
@ -414,7 +441,7 @@ _ecore_animator_shutdown(void)
|
|||
Ecore_Animator *animator;
|
||||
|
||||
animator = animators;
|
||||
animators = (Ecore_Animator *) eina_inlist_remove(EINA_INLIST_GET(animators), EINA_INLIST_GET(animators));
|
||||
animators = (Ecore_Animator *)eina_inlist_remove(EINA_INLIST_GET(animators), EINA_INLIST_GET(animators));
|
||||
ECORE_MAGIC_SET(animator, ECORE_MAGIC_NONE);
|
||||
free(animator);
|
||||
}
|
||||
|
@ -432,7 +459,8 @@ _ecore_animator_run(void *data)
|
|||
{
|
||||
pos = (t - animator->start) / animator->run;
|
||||
if (pos > 1.0) pos = 1.0;
|
||||
else if (pos < 0.0) pos = 0.0;
|
||||
else if (pos < 0.0)
|
||||
pos = 0.0;
|
||||
}
|
||||
run_ret = animator->run_func(animator->run_data, pos);
|
||||
if (t >= (animator->start + animator->run)) run_ret = EINA_FALSE;
|
||||
|
@ -448,3 +476,4 @@ _ecore_animator(void *data __UNUSED__)
|
|||
_ecore_unlock();
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,8 @@ static char **app_argv = NULL;
|
|||
* for later use by ecore_app_restart() or ecore_app_args_get().
|
||||
*/
|
||||
EAPI void
|
||||
ecore_app_args_set(int argc, const char **argv)
|
||||
ecore_app_args_set(int argc,
|
||||
const char **argv)
|
||||
{
|
||||
EINA_MAIN_LOOP_CHECK_RETURN;
|
||||
|
||||
|
@ -57,7 +58,8 @@ ecore_app_args_set(int argc, const char **argv)
|
|||
* same set by ecore_app_args_set().
|
||||
*/
|
||||
EAPI void
|
||||
ecore_app_args_get(int *argc, char ***argv)
|
||||
ecore_app_args_get(int *argc,
|
||||
char ***argv)
|
||||
{
|
||||
EINA_MAIN_LOOP_CHECK_RETURN;
|
||||
|
||||
|
|
|
@ -45,7 +45,6 @@ struct _Ecore_Event
|
|||
Eina_Bool delete_me : 1;
|
||||
};
|
||||
|
||||
|
||||
static int events_num = 0;
|
||||
static Ecore_Event *events = NULL;
|
||||
static Ecore_Event *event_current = NULL;
|
||||
|
@ -67,11 +66,9 @@ static int event_id_max = ECORE_EVENT_COUNT;
|
|||
static int ecore_raw_event_type = ECORE_EVENT_NONE;
|
||||
static void *ecore_raw_event_event = NULL;
|
||||
|
||||
|
||||
static void _ecore_event_purge_deleted(void);
|
||||
static void *_ecore_event_del(Ecore_Event *event);
|
||||
|
||||
|
||||
/**
|
||||
* @addtogroup Ecore_Event_Group
|
||||
*
|
||||
|
@ -102,7 +99,9 @@ static void *_ecore_event_del(Ecore_Event *event);
|
|||
* been called, will not be.
|
||||
*/
|
||||
EAPI Ecore_Event_Handler *
|
||||
ecore_event_handler_add(int type, Ecore_Event_Handler_Cb func, const void *data)
|
||||
ecore_event_handler_add(int type,
|
||||
Ecore_Event_Handler_Cb func,
|
||||
const void *data)
|
||||
{
|
||||
Ecore_Event_Handler *eh = NULL;
|
||||
|
||||
|
@ -213,7 +212,8 @@ unlock:
|
|||
* which was previously associated with @p eh by ecore_event_handler_add().
|
||||
*/
|
||||
EAPI void *
|
||||
ecore_event_handler_data_set(Ecore_Event_Handler *eh, const void *data)
|
||||
ecore_event_handler_data_set(Ecore_Event_Handler *eh,
|
||||
const void *data)
|
||||
{
|
||||
void *old = NULL;
|
||||
|
||||
|
@ -232,7 +232,8 @@ unlock:
|
|||
}
|
||||
|
||||
static void
|
||||
_ecore_event_generic_free (void *data __UNUSED__, void *event)
|
||||
_ecore_event_generic_free(void *data __UNUSED__,
|
||||
void *event)
|
||||
{
|
||||
free (event);
|
||||
}
|
||||
|
@ -256,7 +257,10 @@ _ecore_event_generic_free (void *data __UNUSED__, void *event)
|
|||
* func_free is passed @p data as its data parameter.
|
||||
*/
|
||||
EAPI Ecore_Event *
|
||||
ecore_event_add(int type, void *ev, Ecore_End_Cb func_free, void *data)
|
||||
ecore_event_add(int type,
|
||||
void *ev,
|
||||
Ecore_End_Cb func_free,
|
||||
void *data)
|
||||
{
|
||||
Ecore_Event *event = NULL;
|
||||
|
||||
|
@ -345,7 +349,10 @@ ecore_event_type_new(void)
|
|||
* and @p data pointer to clean up.
|
||||
*/
|
||||
EAPI Ecore_Event_Filter *
|
||||
ecore_event_filter_add(Ecore_Data_Cb func_start, Ecore_Filter_Cb func_filter, Ecore_End_Cb func_end, const void *data)
|
||||
ecore_event_filter_add(Ecore_Data_Cb func_start,
|
||||
Ecore_Filter_Cb func_filter,
|
||||
Ecore_End_Cb func_end,
|
||||
const void *data)
|
||||
{
|
||||
Ecore_Event_Filter *ef = NULL;
|
||||
|
||||
|
@ -358,7 +365,7 @@ ecore_event_filter_add(Ecore_Data_Cb func_start, Ecore_Filter_Cb func_filter, Ec
|
|||
ef->func_filter = func_filter;
|
||||
ef->func_end = func_end;
|
||||
ef->data = (void *)data;
|
||||
event_filters = (Ecore_Event_Filter *) eina_inlist_append(EINA_INLIST_GET(event_filters), EINA_INLIST_GET(ef));
|
||||
event_filters = (Ecore_Event_Filter *)eina_inlist_append(EINA_INLIST_GET(event_filters), EINA_INLIST_GET(ef));
|
||||
unlock:
|
||||
_ecore_unlock();
|
||||
return ef;
|
||||
|
@ -460,7 +467,7 @@ _ecore_event_shutdown(void)
|
|||
{
|
||||
while ((eh = event_handlers[i]))
|
||||
{
|
||||
event_handlers[i] = (Ecore_Event_Handler *) eina_inlist_remove(EINA_INLIST_GET(event_handlers[i]), EINA_INLIST_GET(event_handlers[i]));
|
||||
event_handlers[i] = (Ecore_Event_Handler *)eina_inlist_remove(EINA_INLIST_GET(event_handlers[i]), EINA_INLIST_GET(event_handlers[i]));
|
||||
ECORE_MAGIC_SET(eh, ECORE_MAGIC_NONE);
|
||||
if (!eh->delete_me) free(eh);
|
||||
}
|
||||
|
@ -473,7 +480,7 @@ _ecore_event_shutdown(void)
|
|||
event_handlers_alloc_num = 0;
|
||||
while ((ef = event_filters))
|
||||
{
|
||||
event_filters = (Ecore_Event_Filter *) eina_inlist_remove(EINA_INLIST_GET(event_filters), EINA_INLIST_GET(event_filters));
|
||||
event_filters = (Ecore_Event_Filter *)eina_inlist_remove(EINA_INLIST_GET(event_filters), EINA_INLIST_GET(event_filters));
|
||||
ECORE_MAGIC_SET(ef, ECORE_MAGIC_NONE);
|
||||
free(ef);
|
||||
}
|
||||
|
@ -492,7 +499,10 @@ _ecore_event_exist(void)
|
|||
}
|
||||
|
||||
Ecore_Event *
|
||||
_ecore_event_add(int type, void *ev, Ecore_End_Cb func_free, void *data)
|
||||
_ecore_event_add(int type,
|
||||
void *ev,
|
||||
Ecore_End_Cb func_free,
|
||||
void *data)
|
||||
{
|
||||
Ecore_Event *e;
|
||||
|
||||
|
@ -523,7 +533,7 @@ _ecore_event_del(Ecore_Event *event)
|
|||
|
||||
data = event->data;
|
||||
if (event->func_free) _ecore_call_end_cb(event->func_free, event->data, event->event);
|
||||
events = (Ecore_Event *) eina_inlist_remove(EINA_INLIST_GET(events), EINA_INLIST_GET(event));
|
||||
events = (Ecore_Event *)eina_inlist_remove(EINA_INLIST_GET(events), EINA_INLIST_GET(event));
|
||||
ECORE_MAGIC_SET(event, ECORE_MAGIC_NONE);
|
||||
free(event);
|
||||
events_num--;
|
||||
|
@ -555,7 +565,6 @@ _ecore_event_purge_deleted(void)
|
|||
static inline void
|
||||
_ecore_event_filters_apply()
|
||||
{
|
||||
|
||||
if (!event_filter_current)
|
||||
{
|
||||
/* regular main loop, start from head */
|
||||
|
@ -615,10 +624,10 @@ _ecore_event_filters_apply()
|
|||
{
|
||||
int deleted_in_use = 0;
|
||||
Ecore_Event_Filter *l;
|
||||
for (l = event_filters; l;)
|
||||
for (l = event_filters; l; )
|
||||
{
|
||||
Ecore_Event_Filter *ef = l;
|
||||
l = (Ecore_Event_Filter *) EINA_INLIST_GET(l)->next;
|
||||
l = (Ecore_Event_Filter *)EINA_INLIST_GET(l)->next;
|
||||
if (ef->delete_me)
|
||||
{
|
||||
if (ef->references)
|
||||
|
@ -627,7 +636,7 @@ _ecore_event_filters_apply()
|
|||
continue;
|
||||
}
|
||||
|
||||
event_filters = (Ecore_Event_Filter *) eina_inlist_remove(EINA_INLIST_GET(event_filters), EINA_INLIST_GET(ef));
|
||||
event_filters = (Ecore_Event_Filter *)eina_inlist_remove(EINA_INLIST_GET(event_filters), EINA_INLIST_GET(ef));
|
||||
ECORE_MAGIC_SET(ef, ECORE_MAGIC_NONE);
|
||||
free(ef);
|
||||
}
|
||||
|
@ -636,6 +645,7 @@ _ecore_event_filters_apply()
|
|||
event_filters_delete_me = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_ecore_event_call(void)
|
||||
{
|
||||
|
@ -730,7 +740,7 @@ _ecore_event_call(void)
|
|||
|
||||
event_handlers_delete_list = eina_list_remove_list(event_handlers_delete_list, l);
|
||||
|
||||
event_handlers[eh->type] = (Ecore_Event_Handler *) eina_inlist_remove(EINA_INLIST_GET(event_handlers[eh->type]), EINA_INLIST_GET(eh));
|
||||
event_handlers[eh->type] = (Ecore_Event_Handler *)eina_inlist_remove(EINA_INLIST_GET(event_handlers[eh->type]), EINA_INLIST_GET(eh));
|
||||
ECORE_MAGIC_SET(eh, ECORE_MAGIC_NONE);
|
||||
free(eh);
|
||||
}
|
||||
|
@ -777,3 +787,4 @@ _ecore_event_signal_realtime_new(void)
|
|||
{
|
||||
return calloc(1, sizeof(Ecore_Event_Signal_Realtime));
|
||||
}
|
||||
|
||||
|
|
|
@ -26,8 +26,7 @@
|
|||
#include "Ecore.h"
|
||||
#include "ecore_private.h"
|
||||
|
||||
|
||||
/* FIXME: Getting respawn to work
|
||||
/* FIXME: Getting respawn to work
|
||||
*
|
||||
* There is no way that we can do anything about the internal state info of
|
||||
* an external exe. The same can be said about the state of user code. User
|
||||
|
@ -124,7 +123,6 @@ struct _Ecore_Exe
|
|||
Ecore_Exe_Cb pre_free_cb;
|
||||
};
|
||||
|
||||
|
||||
/* TODO: Something to let people build a command line and does auto escaping -
|
||||
*
|
||||
* ecore_exe_snprintf()
|
||||
|
@ -143,18 +141,26 @@ struct _ecore_exe_dead_exe
|
|||
char *cmd;
|
||||
};
|
||||
|
||||
static inline void _ecore_exe_exec_it(const char *exe_cmd, Ecore_Exe_Flags flags);
|
||||
static Eina_Bool _ecore_exe_data_generic_handler(void *data, Ecore_Fd_Handler *fd_handler, Ecore_Exe_Flags flags);
|
||||
static Eina_Bool _ecore_exe_data_error_handler(void *data, Ecore_Fd_Handler *fd_handler);
|
||||
static Eina_Bool _ecore_exe_data_read_handler(void *data, Ecore_Fd_Handler *fd_handler);
|
||||
static Eina_Bool _ecore_exe_data_write_handler(void *data, Ecore_Fd_Handler *fd_handler);
|
||||
static void _ecore_exe_flush(Ecore_Exe * exe);
|
||||
static void _ecore_exe_event_exe_data_free(void *data __UNUSED__, void *ev);
|
||||
static inline void _ecore_exe_exec_it(const char *exe_cmd,
|
||||
Ecore_Exe_Flags flags);
|
||||
static Eina_Bool _ecore_exe_data_generic_handler(void *data,
|
||||
Ecore_Fd_Handler *fd_handler,
|
||||
Ecore_Exe_Flags flags);
|
||||
static Eina_Bool _ecore_exe_data_error_handler(void *data,
|
||||
Ecore_Fd_Handler *fd_handler);
|
||||
static Eina_Bool _ecore_exe_data_read_handler(void *data,
|
||||
Ecore_Fd_Handler *fd_handler);
|
||||
static Eina_Bool _ecore_exe_data_write_handler(void *data,
|
||||
Ecore_Fd_Handler *fd_handler);
|
||||
static void _ecore_exe_flush(Ecore_Exe *exe);
|
||||
static void _ecore_exe_event_exe_data_free(void *data __UNUSED__,
|
||||
void *ev);
|
||||
static Ecore_Exe *_ecore_exe_is_it_alive(pid_t pid);
|
||||
static Eina_Bool _ecore_exe_make_sure_its_dead(void *data);
|
||||
static Eina_Bool _ecore_exe_make_sure_its_really_dead(void *data);
|
||||
static Ecore_Exe_Event_Add *_ecore_exe_event_add_new(void);
|
||||
static void _ecore_exe_event_add_free(void *data, void *ev);
|
||||
static void _ecore_exe_event_add_free(void *data,
|
||||
void *ev);
|
||||
static void _ecore_exe_dead_attach(Ecore_Exe *exe);
|
||||
|
||||
EAPI int ECORE_EXE_EVENT_ADD = 0;
|
||||
|
@ -168,20 +174,24 @@ static const char *shell = NULL;
|
|||
/* FIXME: This errno checking stuff should be put elsewhere for everybody to use.
|
||||
* For now it lives here though, just to make testing easier.
|
||||
*/
|
||||
static int _ecore_exe_check_errno(int result, const char *file, int line);
|
||||
static int _ecore_exe_check_errno(int result,
|
||||
const char *file,
|
||||
int line);
|
||||
|
||||
#define E_IF_NO_ERRNO(result, foo, ok) \
|
||||
while (((ok) = _ecore_exe_check_errno( (result) = (foo), __FILE__, __LINE__)) == -1) sleep(1); \
|
||||
while (((ok) = _ecore_exe_check_errno((result) = (foo), __FILE__, __LINE__)) == -1) sleep(1); \
|
||||
if (ok)
|
||||
|
||||
#define E_NO_ERRNO(result, foo, ok) \
|
||||
while (((ok) = _ecore_exe_check_errno( (result) = (foo), __FILE__, __LINE__)) == -1) sleep(1)
|
||||
while (((ok) = _ecore_exe_check_errno((result) = (foo), __FILE__, __LINE__)) == -1) sleep(1)
|
||||
|
||||
#define E_IF_NO_ERRNO_NOLOOP(result, foo, ok) \
|
||||
if (((ok) = _ecore_exe_check_errno( (result) = (foo), __FILE__, __LINE__)))
|
||||
if (((ok) = _ecore_exe_check_errno((result) = (foo), __FILE__, __LINE__)))
|
||||
|
||||
static int
|
||||
_ecore_exe_check_errno(int result, const char *file, int line)
|
||||
_ecore_exe_check_errno(int result,
|
||||
const char *file,
|
||||
int line)
|
||||
{
|
||||
int saved_errno = errno;
|
||||
|
||||
|
@ -253,6 +263,7 @@ _ecore_exe_check_errno(int result, const char *file, int line)
|
|||
result = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
case EMFILE:
|
||||
case ENFILE:
|
||||
case ENOLCK:
|
||||
|
@ -262,12 +273,14 @@ _ecore_exe_check_errno(int result, const char *file, int line)
|
|||
result = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
case EIO:
|
||||
{ /* I/O error. */
|
||||
ERR("*** I/O error in %s @%u.", file, line);
|
||||
result = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
case EFAULT:
|
||||
case EBADF:
|
||||
case EINVAL:
|
||||
|
@ -284,6 +297,7 @@ _ecore_exe_check_errno(int result, const char *file, int line)
|
|||
result = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{ /* Unsupported errno code, please add this one. */
|
||||
ERR("*** NAUGHTY PROGRAMMER!!!\n"
|
||||
|
@ -358,7 +372,8 @@ ecore_exe_run_priority_get(void)
|
|||
* @return A process handle to the spawned process.
|
||||
*/
|
||||
EAPI Ecore_Exe *
|
||||
ecore_exe_run(const char *exe_cmd, const void *data)
|
||||
ecore_exe_run(const char *exe_cmd,
|
||||
const void *data)
|
||||
{
|
||||
return ecore_exe_pipe_run(exe_cmd, 0, data);
|
||||
}
|
||||
|
@ -389,7 +404,9 @@ ecore_exe_run(const char *exe_cmd, const void *data)
|
|||
* @return A process handle to the spawned process.
|
||||
*/
|
||||
EAPI Ecore_Exe *
|
||||
ecore_exe_pipe_run(const char *exe_cmd, Ecore_Exe_Flags flags, const void *data)
|
||||
ecore_exe_pipe_run(const char *exe_cmd,
|
||||
Ecore_Exe_Flags flags,
|
||||
const void *data)
|
||||
{
|
||||
Ecore_Exe *exe = NULL;
|
||||
int statusPipe[2] = { -1, -1 };
|
||||
|
@ -535,7 +552,7 @@ ecore_exe_pipe_run(const char *exe_cmd, Ecore_Exe_Flags flags, const void *data)
|
|||
* waiting on a child process... even though it's just
|
||||
* the segment between the fork() and the exec) it just feels
|
||||
* wrong */
|
||||
for (;;)
|
||||
for (;; )
|
||||
{
|
||||
char buf;
|
||||
|
||||
|
@ -569,17 +586,20 @@ ecore_exe_pipe_run(const char *exe_cmd, Ecore_Exe_Flags flags, const void *data)
|
|||
exe->data = (void *)data;
|
||||
if ((exe->cmd = strdup(exe_cmd)))
|
||||
{
|
||||
if (flags & ECORE_EXE_PIPE_ERROR)
|
||||
{ /* Setup the error stuff. */
|
||||
if (flags & ECORE_EXE_PIPE_ERROR) /* Setup the error stuff. */
|
||||
{
|
||||
E_IF_NO_ERRNO(result,
|
||||
fcntl(exe->child_fd_error, F_SETFL,
|
||||
O_NONBLOCK), ok) {}
|
||||
O_NONBLOCK), ok) {
|
||||
}
|
||||
E_IF_NO_ERRNO(result,
|
||||
fcntl(exe->child_fd_error, F_SETFD,
|
||||
FD_CLOEXEC), ok) {}
|
||||
FD_CLOEXEC), ok) {
|
||||
}
|
||||
E_IF_NO_ERRNO(result,
|
||||
fcntl(exe->child_fd_error_x, F_SETFD,
|
||||
FD_CLOEXEC), ok) {}
|
||||
FD_CLOEXEC), ok) {
|
||||
}
|
||||
{
|
||||
exe->error_fd_handler =
|
||||
ecore_main_fd_handler_add(exe->child_fd_error,
|
||||
|
@ -590,17 +610,20 @@ ecore_exe_pipe_run(const char *exe_cmd, Ecore_Exe_Flags flags, const void *data)
|
|||
ok = 0;
|
||||
}
|
||||
}
|
||||
if (ok && (flags & ECORE_EXE_PIPE_READ))
|
||||
{ /* Setup the read stuff. */
|
||||
if (ok && (flags & ECORE_EXE_PIPE_READ)) /* Setup the read stuff. */
|
||||
{
|
||||
E_IF_NO_ERRNO(result,
|
||||
fcntl(exe->child_fd_read, F_SETFL,
|
||||
O_NONBLOCK), ok) {}
|
||||
O_NONBLOCK), ok) {
|
||||
}
|
||||
E_IF_NO_ERRNO(result,
|
||||
fcntl(exe->child_fd_read, F_SETFD,
|
||||
FD_CLOEXEC), ok) {}
|
||||
FD_CLOEXEC), ok) {
|
||||
}
|
||||
E_IF_NO_ERRNO(result,
|
||||
fcntl(exe->child_fd_read_x, F_SETFD,
|
||||
FD_CLOEXEC), ok) {}
|
||||
FD_CLOEXEC), ok) {
|
||||
}
|
||||
{
|
||||
exe->read_fd_handler =
|
||||
ecore_main_fd_handler_add(exe->child_fd_read,
|
||||
|
@ -611,17 +634,20 @@ ecore_exe_pipe_run(const char *exe_cmd, Ecore_Exe_Flags flags, const void *data)
|
|||
ok = 0;
|
||||
}
|
||||
}
|
||||
if (ok && (flags & ECORE_EXE_PIPE_WRITE))
|
||||
{ /* Setup the write stuff. */
|
||||
if (ok && (flags & ECORE_EXE_PIPE_WRITE)) /* Setup the write stuff. */
|
||||
{
|
||||
E_IF_NO_ERRNO(result,
|
||||
fcntl(exe->child_fd_write, F_SETFL,
|
||||
O_NONBLOCK), ok) {}
|
||||
O_NONBLOCK), ok) {
|
||||
}
|
||||
E_IF_NO_ERRNO(result,
|
||||
fcntl(exe->child_fd_write, F_SETFD,
|
||||
FD_CLOEXEC), ok) {}
|
||||
FD_CLOEXEC), ok) {
|
||||
}
|
||||
E_IF_NO_ERRNO(result,
|
||||
fcntl(exe->child_fd_write_x, F_SETFD,
|
||||
FD_CLOEXEC), ok) {}
|
||||
FD_CLOEXEC), ok) {
|
||||
}
|
||||
{
|
||||
exe->write_fd_handler =
|
||||
ecore_main_fd_handler_add(exe->child_fd_write,
|
||||
|
@ -635,7 +661,7 @@ ecore_exe_pipe_run(const char *exe_cmd, Ecore_Exe_Flags flags, const void *data)
|
|||
}
|
||||
}
|
||||
|
||||
exes = (Ecore_Exe *) eina_inlist_append(EINA_INLIST_GET(exes), EINA_INLIST_GET(exe));
|
||||
exes = (Ecore_Exe *)eina_inlist_append(EINA_INLIST_GET(exes), EINA_INLIST_GET(exe));
|
||||
n = 0;
|
||||
}
|
||||
else
|
||||
|
@ -645,8 +671,8 @@ ecore_exe_pipe_run(const char *exe_cmd, Ecore_Exe_Flags flags, const void *data)
|
|||
ok = 0;
|
||||
}
|
||||
|
||||
if (!ok)
|
||||
{ /* Something went wrong, so pull down everything. */
|
||||
if (!ok) /* Something went wrong, so pull down everything. */
|
||||
{
|
||||
if (exe->pid) ecore_exe_terminate(exe);
|
||||
IF_FN_DEL(ecore_exe_free, exe);
|
||||
}
|
||||
|
@ -680,7 +706,8 @@ ecore_exe_pipe_run(const char *exe_cmd, Ecore_Exe_Flags flags, const void *data)
|
|||
* @param func The function to call before @a exe is freed.
|
||||
*/
|
||||
EAPI void
|
||||
ecore_exe_callback_pre_free_set(Ecore_Exe *exe, Ecore_Exe_Cb func)
|
||||
ecore_exe_callback_pre_free_set(Ecore_Exe *exe,
|
||||
Ecore_Exe_Cb func)
|
||||
{
|
||||
if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
|
||||
{
|
||||
|
@ -704,7 +731,9 @@ ecore_exe_callback_pre_free_set(Ecore_Exe *exe, Ecore_Exe_Cb func)
|
|||
* @return EINA_TRUE if successful, EINA_FALSE on failure.
|
||||
*/
|
||||
EAPI Eina_Bool
|
||||
ecore_exe_send(Ecore_Exe * exe, const void *data, int size)
|
||||
ecore_exe_send(Ecore_Exe *exe,
|
||||
const void *data,
|
||||
int size)
|
||||
{
|
||||
void *buf;
|
||||
|
||||
|
@ -768,7 +797,11 @@ ecore_exe_close_stdin(Ecore_Exe *exe)
|
|||
* @param end_lines limit of lines at end of output to buffer.
|
||||
*/
|
||||
EAPI void
|
||||
ecore_exe_auto_limits_set(Ecore_Exe *exe, int start_bytes, int end_bytes, int start_lines, int end_lines)
|
||||
ecore_exe_auto_limits_set(Ecore_Exe *exe,
|
||||
int start_bytes,
|
||||
int end_bytes,
|
||||
int start_lines,
|
||||
int end_lines)
|
||||
{
|
||||
if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
|
||||
{
|
||||
|
@ -828,7 +861,8 @@ ecore_exe_auto_limits_set(Ecore_Exe *exe, int start_bytes, int end_bytes, int st
|
|||
* @param flags Is this a ECORE_EXE_PIPE_READ or ECORE_EXE_PIPE_ERROR?
|
||||
*/
|
||||
EAPI Ecore_Exe_Event_Data *
|
||||
ecore_exe_event_data_get(Ecore_Exe *exe, Ecore_Exe_Flags flags)
|
||||
ecore_exe_event_data_get(Ecore_Exe *exe,
|
||||
Ecore_Exe_Flags flags)
|
||||
{
|
||||
Ecore_Exe_Event_Data *e = NULL;
|
||||
int is_buffered = 0;
|
||||
|
@ -878,8 +912,8 @@ ecore_exe_event_data_get(Ecore_Exe *exe, Ecore_Exe_Flags flags)
|
|||
e->data = inbuf;
|
||||
e->size = inbuf_num;
|
||||
|
||||
if (is_buffered)
|
||||
{ /* Deal with line buffering. */
|
||||
if (is_buffered) /* Deal with line buffering. */
|
||||
{
|
||||
int max = 0;
|
||||
int count = 0;
|
||||
int i;
|
||||
|
@ -958,7 +992,8 @@ ecore_exe_event_data_get(Ecore_Exe *exe, Ecore_Exe_Flags flags)
|
|||
* @param tag The string tag to set on the process handle.
|
||||
*/
|
||||
EAPI void
|
||||
ecore_exe_tag_set(Ecore_Exe *exe, const char *tag)
|
||||
ecore_exe_tag_set(Ecore_Exe *exe,
|
||||
const char *tag)
|
||||
{
|
||||
if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
|
||||
{
|
||||
|
@ -1056,7 +1091,7 @@ ecore_exe_free(Ecore_Exe *exe)
|
|||
IF_FREE(exe->error_data_buf);
|
||||
IF_FREE(exe->cmd);
|
||||
|
||||
exes = (Ecore_Exe *) eina_inlist_remove(EINA_INLIST_GET(exes), EINA_INLIST_GET(exe));
|
||||
exes = (Ecore_Exe *)eina_inlist_remove(EINA_INLIST_GET(exes), EINA_INLIST_GET(exe));
|
||||
ECORE_MAGIC_SET(exe, ECORE_MAGIC_NONE);
|
||||
IF_FREE(exe->tag);
|
||||
free(exe);
|
||||
|
@ -1137,7 +1172,8 @@ ecore_exe_data_get(const Ecore_Exe *exe)
|
|||
* @since 1.1
|
||||
*/
|
||||
EAPI void *
|
||||
ecore_exe_data_set(Ecore_Exe *exe, void *data)
|
||||
ecore_exe_data_set(Ecore_Exe *exe,
|
||||
void *data)
|
||||
{
|
||||
void *ret;
|
||||
if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
|
||||
|
@ -1281,7 +1317,8 @@ ecore_exe_kill(Ecore_Exe *exe)
|
|||
* the signal will be ignored.
|
||||
*/
|
||||
EAPI void
|
||||
ecore_exe_signal(Ecore_Exe *exe, int num)
|
||||
ecore_exe_signal(Ecore_Exe *exe,
|
||||
int num)
|
||||
{
|
||||
if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
|
||||
{
|
||||
|
@ -1443,13 +1480,15 @@ _ecore_exe_doomsday_clock_get(Ecore_Exe *exe)
|
|||
}
|
||||
|
||||
void
|
||||
_ecore_exe_doomsday_clock_set(Ecore_Exe *exe, Ecore_Timer *dc)
|
||||
_ecore_exe_doomsday_clock_set(Ecore_Exe *exe,
|
||||
Ecore_Timer *dc)
|
||||
{
|
||||
exe->doomsday_clock = dc;
|
||||
}
|
||||
|
||||
static inline void
|
||||
_ecore_exe_exec_it(const char *exe_cmd, Ecore_Exe_Flags flags)
|
||||
_ecore_exe_exec_it(const char *exe_cmd,
|
||||
Ecore_Exe_Flags flags)
|
||||
{
|
||||
char use_sh = 1;
|
||||
char *buf = NULL;
|
||||
|
@ -1526,10 +1565,10 @@ _ecore_exe_exec_it(const char *exe_cmd, Ecore_Exe_Flags flags)
|
|||
errno = 0;
|
||||
execl("/bin/sh", "/bin/sh", "-c", exe_cmd, (char *)NULL);
|
||||
}
|
||||
else if (use_sh)
|
||||
{ /* We have to use a shell to run this. */
|
||||
if (!shell)
|
||||
{ /* Find users preferred shell. */
|
||||
else if (use_sh) /* We have to use a shell to run this. */
|
||||
{
|
||||
if (!shell) /* Find users preferred shell. */
|
||||
{
|
||||
shell = getenv("SHELL");
|
||||
if (!shell)
|
||||
shell = "/bin/sh";
|
||||
|
@ -1558,7 +1597,9 @@ _ecore_exe_exec_it(const char *exe_cmd, Ecore_Exe_Flags flags)
|
|||
}
|
||||
|
||||
static Eina_Bool
|
||||
_ecore_exe_data_generic_handler(void *data, Ecore_Fd_Handler *fd_handler, Ecore_Exe_Flags flags)
|
||||
_ecore_exe_data_generic_handler(void *data,
|
||||
Ecore_Fd_Handler *fd_handler,
|
||||
Ecore_Exe_Flags flags)
|
||||
{
|
||||
Ecore_Exe *exe;
|
||||
int child_fd;
|
||||
|
@ -1602,7 +1643,7 @@ _ecore_exe_data_generic_handler(void *data, Ecore_Fd_Handler *fd_handler, Ecore_
|
|||
exe->error_data_size = 0;
|
||||
}
|
||||
|
||||
for (;;)
|
||||
for (;; )
|
||||
{
|
||||
int num, lost_exe;
|
||||
char buf[READBUFSIZ];
|
||||
|
@ -1610,10 +1651,10 @@ _ecore_exe_data_generic_handler(void *data, Ecore_Fd_Handler *fd_handler, Ecore_
|
|||
lost_exe = 0;
|
||||
errno = 0;
|
||||
if ((num = read(child_fd, buf, READBUFSIZ)) < 1)
|
||||
{
|
||||
/* FIXME: SPEED/SIZE TRADE OFF - add a smaller READBUFSIZE
|
||||
* (currently 64k) to inbuf, use that instead of buf, and
|
||||
* save ourselves a memcpy(). */
|
||||
{
|
||||
lost_exe = ((errno == EIO) ||
|
||||
(errno == EBADF) ||
|
||||
(errno == EPIPE) ||
|
||||
|
@ -1621,8 +1662,8 @@ _ecore_exe_data_generic_handler(void *data, Ecore_Fd_Handler *fd_handler, Ecore_
|
|||
if ((errno != EAGAIN) && (errno != EINTR))
|
||||
perror("_ecore_exe_generic_handler() read problem ");
|
||||
}
|
||||
if (num > 0)
|
||||
{ /* data got read. */
|
||||
if (num > 0) /* data got read. */
|
||||
{
|
||||
inbuf = realloc(inbuf, inbuf_num + num);
|
||||
memcpy(inbuf + inbuf_num, buf, num);
|
||||
inbuf_num += num;
|
||||
|
@ -1686,21 +1727,24 @@ _ecore_exe_data_generic_handler(void *data, Ecore_Fd_Handler *fd_handler, Ecore_
|
|||
}
|
||||
|
||||
static Eina_Bool
|
||||
_ecore_exe_data_error_handler(void *data, Ecore_Fd_Handler *fd_handler)
|
||||
_ecore_exe_data_error_handler(void *data,
|
||||
Ecore_Fd_Handler *fd_handler)
|
||||
{
|
||||
return _ecore_exe_data_generic_handler(data, fd_handler,
|
||||
ECORE_EXE_PIPE_ERROR);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_ecore_exe_data_read_handler(void *data, Ecore_Fd_Handler *fd_handler)
|
||||
_ecore_exe_data_read_handler(void *data,
|
||||
Ecore_Fd_Handler *fd_handler)
|
||||
{
|
||||
return _ecore_exe_data_generic_handler(data, fd_handler,
|
||||
ECORE_EXE_PIPE_READ);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_ecore_exe_data_write_handler(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__)
|
||||
_ecore_exe_data_write_handler(void *data,
|
||||
Ecore_Fd_Handler *fd_handler __UNUSED__)
|
||||
{
|
||||
Ecore_Exe *exe;
|
||||
|
||||
|
@ -1755,8 +1799,8 @@ _ecore_exe_flush(Ecore_Exe *exe)
|
|||
else
|
||||
{
|
||||
exe->write_data_offset += count;
|
||||
if (exe->write_data_offset >= exe->write_data_size)
|
||||
{ /* Nothing left to write, clean up. */
|
||||
if (exe->write_data_offset >= exe->write_data_size) /* Nothing left to write, clean up. */
|
||||
{
|
||||
exe->write_data_size = 0;
|
||||
exe->write_data_offset = 0;
|
||||
IF_FREE(exe->write_data_buf);
|
||||
|
@ -1767,7 +1811,8 @@ _ecore_exe_flush(Ecore_Exe *exe)
|
|||
}
|
||||
|
||||
static void
|
||||
_ecore_exe_event_exe_data_free(void *data __UNUSED__, void *ev)
|
||||
_ecore_exe_event_exe_data_free(void *data __UNUSED__,
|
||||
void *ev)
|
||||
{
|
||||
Ecore_Exe_Event_Data *e;
|
||||
|
||||
|
@ -1785,7 +1830,8 @@ _ecore_exe_event_add_new(void)
|
|||
}
|
||||
|
||||
static void
|
||||
_ecore_exe_event_add_free(void *data __UNUSED__, void *ev)
|
||||
_ecore_exe_event_add_free(void *data __UNUSED__,
|
||||
void *ev)
|
||||
{
|
||||
Ecore_Exe_Event_Add *e;
|
||||
|
||||
|
@ -1803,7 +1849,8 @@ _ecore_exe_event_del_new(void)
|
|||
}
|
||||
|
||||
void
|
||||
_ecore_exe_event_del_free(void *data __UNUSED__, void *ev)
|
||||
_ecore_exe_event_del_free(void *data __UNUSED__,
|
||||
void *ev)
|
||||
{
|
||||
Ecore_Exe_Event_Del *e;
|
||||
|
||||
|
@ -1830,3 +1877,4 @@ _ecore_exe_dead_attach(Ecore_Exe *exe)
|
|||
exe->doomsday_clock_dead = dead;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -86,18 +86,28 @@ static Ecore_Exe *exes = NULL;
|
|||
static int _ecore_exe_win32_pipes_set(Ecore_Exe *exe);
|
||||
static void _ecore_exe_win32_pipes_close(Ecore_Exe *exe);
|
||||
|
||||
static BOOL CALLBACK _ecore_exe_enum_windows_procedure(HWND window, LPARAM data);
|
||||
static void _ecore_exe_event_add_free(void *data, void *ev);
|
||||
static void _ecore_exe_event_del_free(void *data, void *ev);
|
||||
static BOOL CALLBACK _ecore_exe_enum_windows_procedure(HWND window,
|
||||
LPARAM data);
|
||||
static void _ecore_exe_event_add_free(void *data,
|
||||
void *ev);
|
||||
static void _ecore_exe_event_del_free(void *data,
|
||||
void *ev);
|
||||
static void _ecore_exe_event_exe_data_free(void *data,
|
||||
void *ev);
|
||||
static int _ecore_exe_win32_pipe_thread_generic_cb(void *data, Ecore_Exe_Flags flags);
|
||||
static int _ecore_exe_win32_pipe_thread_generic_cb(void *data,
|
||||
Ecore_Exe_Flags flags);
|
||||
static DWORD WINAPI _ecore_exe_win32_pipe_thread_read_cb(void *data);
|
||||
static DWORD WINAPI _ecore_exe_win32_pipe_thread_error_cb(void *data);
|
||||
static Eina_Bool _ecore_exe_close_cb(void *data, Ecore_Win32_Handler *wh);
|
||||
static void _ecore_exe_pipe_read_cb(void *data, void *buf, unsigned int size);
|
||||
static int _ecore_exe_pipe_write_cb(void *data, Ecore_Win32_Handler *wh);
|
||||
static void _ecore_exe_pipe_error_cb(void *data, void *buf, unsigned int size);
|
||||
static Eina_Bool _ecore_exe_close_cb(void *data,
|
||||
Ecore_Win32_Handler *wh);
|
||||
static void _ecore_exe_pipe_read_cb(void *data,
|
||||
void *buf,
|
||||
unsigned int size);
|
||||
static int _ecore_exe_pipe_write_cb(void *data,
|
||||
Ecore_Win32_Handler *wh);
|
||||
static void _ecore_exe_pipe_error_cb(void *data,
|
||||
void *buf,
|
||||
unsigned int size);
|
||||
|
||||
EAPI int ECORE_EXE_EVENT_ADD = 0;
|
||||
EAPI int ECORE_EXE_EVENT_DEL = 0;
|
||||
|
@ -130,21 +140,27 @@ ecore_exe_run_priority_set(int pri)
|
|||
case ECORE_EXE_WIN32_PRIORITY_IDLE:
|
||||
run_pri = IDLE_PRIORITY_CLASS;
|
||||
break;
|
||||
|
||||
case ECORE_EXE_WIN32_PRIORITY_BELOW_NORMAL:
|
||||
run_pri = BELOW_NORMAL_PRIORITY_CLASS;
|
||||
break;
|
||||
|
||||
case ECORE_EXE_WIN32_PRIORITY_NORMAL:
|
||||
run_pri = NORMAL_PRIORITY_CLASS;
|
||||
break;
|
||||
|
||||
case ECORE_EXE_WIN32_PRIORITY_ABOVE_NORMAL:
|
||||
run_pri = ABOVE_NORMAL_PRIORITY_CLASS;
|
||||
break;
|
||||
|
||||
case ECORE_EXE_WIN32_PRIORITY_HIGH:
|
||||
run_pri = HIGH_PRIORITY_CLASS;
|
||||
break;
|
||||
|
||||
case ECORE_EXE_WIN32_PRIORITY_REALTIME:
|
||||
run_pri = REALTIME_PRIORITY_CLASS;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -157,16 +173,22 @@ ecore_exe_run_priority_get(void)
|
|||
{
|
||||
case IDLE_PRIORITY_CLASS:
|
||||
return ECORE_EXE_WIN32_PRIORITY_IDLE;
|
||||
|
||||
case BELOW_NORMAL_PRIORITY_CLASS:
|
||||
return ECORE_EXE_WIN32_PRIORITY_BELOW_NORMAL;
|
||||
|
||||
case NORMAL_PRIORITY_CLASS:
|
||||
return ECORE_EXE_WIN32_PRIORITY_NORMAL;
|
||||
|
||||
case ABOVE_NORMAL_PRIORITY_CLASS:
|
||||
return ECORE_EXE_WIN32_PRIORITY_ABOVE_NORMAL;
|
||||
|
||||
case HIGH_PRIORITY_CLASS:
|
||||
return ECORE_EXE_WIN32_PRIORITY_HIGH;
|
||||
|
||||
case REALTIME_PRIORITY_CLASS:
|
||||
return ECORE_EXE_WIN32_PRIORITY_REALTIME;
|
||||
|
||||
/* default should not be reached */
|
||||
default:
|
||||
return ECORE_EXE_WIN32_PRIORITY_NORMAL;
|
||||
|
@ -174,13 +196,16 @@ ecore_exe_run_priority_get(void)
|
|||
}
|
||||
|
||||
EAPI Ecore_Exe *
|
||||
ecore_exe_run(const char *exe_cmd, const void *data)
|
||||
ecore_exe_run(const char *exe_cmd,
|
||||
const void *data)
|
||||
{
|
||||
return ecore_exe_pipe_run(exe_cmd, 0, data);
|
||||
}
|
||||
|
||||
EAPI Ecore_Exe *
|
||||
ecore_exe_pipe_run(const char *exe_cmd, Ecore_Exe_Flags flags, const void *data)
|
||||
ecore_exe_pipe_run(const char *exe_cmd,
|
||||
Ecore_Exe_Flags flags,
|
||||
const void *data)
|
||||
{
|
||||
STARTUPINFO si;
|
||||
PROCESS_INFORMATION pi;
|
||||
|
@ -271,24 +296,25 @@ ecore_exe_pipe_run(const char *exe_cmd, Ecore_Exe_Flags flags, const void *data)
|
|||
|
||||
return exe;
|
||||
|
||||
delete_h_close:
|
||||
delete_h_close:
|
||||
ecore_main_win32_handler_del(exe->h_close);
|
||||
close_process2:
|
||||
close_process2:
|
||||
CloseHandle(exe->process2);
|
||||
close_thread:
|
||||
close_thread:
|
||||
CloseHandle(exe->process_thread);
|
||||
CloseHandle(exe->process);
|
||||
free_exe_cmd:
|
||||
free_exe_cmd:
|
||||
free(exe->cmd);
|
||||
close_pipes:
|
||||
close_pipes:
|
||||
_ecore_exe_win32_pipes_close(exe);
|
||||
free_exe:
|
||||
free_exe:
|
||||
free(exe);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_exe_callback_pre_free_set(Ecore_Exe *exe, Ecore_Exe_Cb func)
|
||||
ecore_exe_callback_pre_free_set(Ecore_Exe *exe,
|
||||
Ecore_Exe_Cb func)
|
||||
{
|
||||
if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
|
||||
{
|
||||
|
@ -300,7 +326,9 @@ ecore_exe_callback_pre_free_set(Ecore_Exe *exe, Ecore_Exe_Cb func)
|
|||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
ecore_exe_send(Ecore_Exe *exe, const void *data, int size)
|
||||
ecore_exe_send(Ecore_Exe *exe,
|
||||
const void *data,
|
||||
int size)
|
||||
{
|
||||
void *buf;
|
||||
|
||||
|
@ -350,12 +378,17 @@ ecore_exe_close_stdin(Ecore_Exe *exe)
|
|||
|
||||
/* Not used on Windows */
|
||||
EAPI void
|
||||
ecore_exe_auto_limits_set(Ecore_Exe *exe __UNUSED__, int start_bytes __UNUSED__, int end_bytes __UNUSED__, int start_lines __UNUSED__, int end_lines __UNUSED__)
|
||||
ecore_exe_auto_limits_set(Ecore_Exe *exe __UNUSED__,
|
||||
int start_bytes __UNUSED__,
|
||||
int end_bytes __UNUSED__,
|
||||
int start_lines __UNUSED__,
|
||||
int end_lines __UNUSED__)
|
||||
{
|
||||
}
|
||||
|
||||
EAPI Ecore_Exe_Event_Data *
|
||||
ecore_exe_event_data_get(Ecore_Exe *exe, Ecore_Exe_Flags flags)
|
||||
ecore_exe_event_data_get(Ecore_Exe *exe,
|
||||
Ecore_Exe_Flags flags)
|
||||
{
|
||||
Ecore_Exe_Event_Data *e = NULL;
|
||||
unsigned char *inbuf;
|
||||
|
@ -445,7 +478,8 @@ ecore_exe_pid_get(const Ecore_Exe *exe)
|
|||
}
|
||||
|
||||
EAPI void
|
||||
ecore_exe_tag_set(Ecore_Exe *exe, const char *tag)
|
||||
ecore_exe_tag_set(Ecore_Exe *exe,
|
||||
const char *tag)
|
||||
{
|
||||
if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
|
||||
{
|
||||
|
@ -545,7 +579,7 @@ ecore_exe_interrupt(Ecore_Exe *exe)
|
|||
CloseHandle(exe->process_thread);
|
||||
CloseHandle(exe->process);
|
||||
exe->sig = ECORE_EXE_WIN32_SIGINT;
|
||||
while (EnumWindows(_ecore_exe_enum_windows_procedure, (LPARAM)exe));
|
||||
while (EnumWindows(_ecore_exe_enum_windows_procedure, (LPARAM)exe)) ;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
|
@ -560,7 +594,7 @@ ecore_exe_quit(Ecore_Exe *exe)
|
|||
CloseHandle(exe->process_thread);
|
||||
CloseHandle(exe->process);
|
||||
exe->sig = ECORE_EXE_WIN32_SIGQUIT;
|
||||
while (EnumWindows(_ecore_exe_enum_windows_procedure, (LPARAM)exe));
|
||||
while (EnumWindows(_ecore_exe_enum_windows_procedure, (LPARAM)exe)) ;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
|
@ -575,7 +609,7 @@ ecore_exe_terminate(Ecore_Exe *exe)
|
|||
/* CloseHandle(exe->thread); */
|
||||
CloseHandle(exe->process);
|
||||
exe->sig = ECORE_EXE_WIN32_SIGTERM;
|
||||
while (EnumWindows(_ecore_exe_enum_windows_procedure, (LPARAM)exe));
|
||||
while (EnumWindows(_ecore_exe_enum_windows_procedure, (LPARAM)exe)) ;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
|
@ -590,11 +624,12 @@ ecore_exe_kill(Ecore_Exe *exe)
|
|||
CloseHandle(exe->process_thread);
|
||||
CloseHandle(exe->process);
|
||||
exe->sig = ECORE_EXE_WIN32_SIGKILL;
|
||||
while (EnumWindows(_ecore_exe_enum_windows_procedure, (LPARAM)exe));
|
||||
while (EnumWindows(_ecore_exe_enum_windows_procedure, (LPARAM)exe)) ;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_exe_signal(Ecore_Exe *exe, int num __UNUSED__)
|
||||
ecore_exe_signal(Ecore_Exe *exe,
|
||||
int num __UNUSED__)
|
||||
{
|
||||
if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
|
||||
{
|
||||
|
@ -619,7 +654,8 @@ ecore_exe_hup(Ecore_Exe *exe)
|
|||
|
||||
/* FIXME: manage error mode */
|
||||
static int
|
||||
_ecore_exe_win32_pipe_thread_generic_cb(void *data, Ecore_Exe_Flags flags)
|
||||
_ecore_exe_win32_pipe_thread_generic_cb(void *data,
|
||||
Ecore_Exe_Flags flags)
|
||||
{
|
||||
#define BUFSIZE 2048
|
||||
char buf[BUFSIZE];
|
||||
|
@ -762,7 +798,7 @@ _ecore_exe_win32_pipes_set(Ecore_Exe *exe)
|
|||
|
||||
return 1;
|
||||
|
||||
close_pipe:
|
||||
close_pipe:
|
||||
CloseHandle(child_pipe);
|
||||
CloseHandle(child_pipe_x);
|
||||
|
||||
|
@ -824,7 +860,8 @@ _ecore_exe_thread_procedure(LPVOID data __UNUSED__)
|
|||
}
|
||||
|
||||
static BOOL CALLBACK
|
||||
_ecore_exe_enum_windows_procedure(HWND window, LPARAM data)
|
||||
_ecore_exe_enum_windows_procedure(HWND window,
|
||||
LPARAM data)
|
||||
{
|
||||
Ecore_Exe *exe;
|
||||
DWORD thread_id;
|
||||
|
@ -890,7 +927,8 @@ _ecore_exe_enum_windows_procedure(HWND window, LPARAM data)
|
|||
}
|
||||
|
||||
static void
|
||||
_ecore_exe_event_add_free(void *data __UNUSED__, void *ev)
|
||||
_ecore_exe_event_add_free(void *data __UNUSED__,
|
||||
void *ev)
|
||||
{
|
||||
Ecore_Exe_Event_Add *e;
|
||||
|
||||
|
@ -899,7 +937,8 @@ _ecore_exe_event_add_free(void *data __UNUSED__, void *ev)
|
|||
}
|
||||
|
||||
static void
|
||||
_ecore_exe_event_del_free(void *data __UNUSED__, void *ev)
|
||||
_ecore_exe_event_del_free(void *data __UNUSED__,
|
||||
void *ev)
|
||||
{
|
||||
Ecore_Exe_Event_Del *e;
|
||||
|
||||
|
@ -910,7 +949,8 @@ _ecore_exe_event_del_free(void *data __UNUSED__, void *ev)
|
|||
}
|
||||
|
||||
static void
|
||||
_ecore_exe_event_exe_data_free(void *data __UNUSED__, void *ev)
|
||||
_ecore_exe_event_exe_data_free(void *data __UNUSED__,
|
||||
void *ev)
|
||||
{
|
||||
Ecore_Exe_Event_Data *e;
|
||||
|
||||
|
@ -919,7 +959,8 @@ _ecore_exe_event_exe_data_free(void *data __UNUSED__, void *ev)
|
|||
}
|
||||
|
||||
static Eina_Bool
|
||||
_ecore_exe_close_cb(void *data, Ecore_Win32_Handler *wh __UNUSED__)
|
||||
_ecore_exe_close_cb(void *data,
|
||||
Ecore_Win32_Handler *wh __UNUSED__)
|
||||
{
|
||||
Ecore_Exe_Event_Del *e;
|
||||
Ecore_Exe *exe;
|
||||
|
@ -953,7 +994,9 @@ _ecore_exe_close_cb(void *data, Ecore_Win32_Handler *wh __UNUSED__)
|
|||
}
|
||||
|
||||
static void
|
||||
_ecore_exe_pipe_read_cb(void *data, void *buf, unsigned int size)
|
||||
_ecore_exe_pipe_read_cb(void *data,
|
||||
void *buf,
|
||||
unsigned int size)
|
||||
{
|
||||
Ecore_Exe_Event_Data *e;
|
||||
|
||||
|
@ -965,7 +1008,8 @@ _ecore_exe_pipe_read_cb(void *data, void *buf, unsigned int size)
|
|||
}
|
||||
|
||||
static int
|
||||
_ecore_exe_pipe_write_cb(void *data, Ecore_Win32_Handler *wh __UNUSED__)
|
||||
_ecore_exe_pipe_write_cb(void *data,
|
||||
Ecore_Win32_Handler *wh __UNUSED__)
|
||||
{
|
||||
char buf[READBUFSIZ];
|
||||
Ecore_Exe *exe;
|
||||
|
@ -996,7 +1040,9 @@ _ecore_exe_pipe_write_cb(void *data, Ecore_Win32_Handler *wh __UNUSED__)
|
|||
}
|
||||
|
||||
static void
|
||||
_ecore_exe_pipe_error_cb(void *data, void *buf, unsigned int size)
|
||||
_ecore_exe_pipe_error_cb(void *data,
|
||||
void *buf,
|
||||
unsigned int size)
|
||||
{
|
||||
Ecore_Exe_Event_Data *e;
|
||||
|
||||
|
@ -1006,3 +1052,4 @@ _ecore_exe_pipe_error_cb(void *data, void *buf, unsigned int size)
|
|||
_ecore_exe_event_exe_data_free,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,3 +18,4 @@ void
|
|||
_ecore_exe_shutdown(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
# ifdef __cplusplus
|
||||
extern "C"
|
||||
# endif
|
||||
void *alloca (size_t);
|
||||
void *alloca(size_t);
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -47,7 +47,9 @@ static int cols = 80;
|
|||
static int helpcol = 80 / 3;
|
||||
|
||||
static void
|
||||
_ecore_getopt_help_print_replace_program(FILE *fp, const Ecore_Getopt *parser __UNUSED__, const char *text)
|
||||
_ecore_getopt_help_print_replace_program(FILE *fp,
|
||||
const Ecore_Getopt *parser __UNUSED__,
|
||||
const char *text)
|
||||
{
|
||||
do
|
||||
{
|
||||
|
@ -82,7 +84,8 @@ _ecore_getopt_help_print_replace_program(FILE *fp, const Ecore_Getopt *parser __
|
|||
}
|
||||
|
||||
static void
|
||||
_ecore_getopt_version(FILE *fp, const Ecore_Getopt *parser)
|
||||
_ecore_getopt_version(FILE *fp,
|
||||
const Ecore_Getopt *parser)
|
||||
{
|
||||
fputs(_("Version:"), fp);
|
||||
fputc(' ', fp);
|
||||
|
@ -90,7 +93,8 @@ _ecore_getopt_version(FILE *fp, const Ecore_Getopt *parser)
|
|||
}
|
||||
|
||||
static void
|
||||
_ecore_getopt_help_usage(FILE *fp, const Ecore_Getopt *parser)
|
||||
_ecore_getopt_help_usage(FILE *fp,
|
||||
const Ecore_Getopt *parser)
|
||||
{
|
||||
fputs(_("Usage:"), fp);
|
||||
fputc(' ', fp);
|
||||
|
@ -105,7 +109,12 @@ _ecore_getopt_help_usage(FILE *fp, const Ecore_Getopt *parser)
|
|||
}
|
||||
|
||||
static int
|
||||
_ecore_getopt_help_line(FILE *fp, const int base, const int total, int used, const char *text, int len)
|
||||
_ecore_getopt_help_line(FILE *fp,
|
||||
const int base,
|
||||
const int total,
|
||||
int used,
|
||||
const char *text,
|
||||
int len)
|
||||
{
|
||||
int linebreak = 0;
|
||||
do
|
||||
|
@ -186,7 +195,8 @@ _ecore_getopt_help_line(FILE *fp, const int base, const int total, int used, con
|
|||
}
|
||||
|
||||
static void
|
||||
_ecore_getopt_help_description(FILE *fp, const Ecore_Getopt *parser)
|
||||
_ecore_getopt_help_description(FILE *fp,
|
||||
const Ecore_Getopt *parser)
|
||||
{
|
||||
const char *p, *prg, *ver;
|
||||
int used, prglen, verlen;
|
||||
|
@ -242,7 +252,8 @@ _ecore_getopt_help_description(FILE *fp, const Ecore_Getopt *parser)
|
|||
}
|
||||
|
||||
static void
|
||||
_ecore_getopt_copyright(FILE *fp, const Ecore_Getopt *parser)
|
||||
_ecore_getopt_copyright(FILE *fp,
|
||||
const Ecore_Getopt *parser)
|
||||
{
|
||||
const char *txt = gettext(parser->copyright);
|
||||
fputs(_("Copyright:"), fp);
|
||||
|
@ -253,7 +264,8 @@ _ecore_getopt_copyright(FILE *fp, const Ecore_Getopt *parser)
|
|||
}
|
||||
|
||||
static void
|
||||
_ecore_getopt_license(FILE *fp, const Ecore_Getopt *parser)
|
||||
_ecore_getopt_license(FILE *fp,
|
||||
const Ecore_Getopt *parser)
|
||||
{
|
||||
const char *txt = gettext(parser->license);
|
||||
fputs(_("License:"), fp);
|
||||
|
@ -270,31 +282,44 @@ _ecore_getopt_desc_arg_requirement(const Ecore_Getopt_Desc *desc)
|
|||
{
|
||||
case ECORE_GETOPT_ACTION_STORE:
|
||||
return desc->action_param.store.arg_req;
|
||||
|
||||
case ECORE_GETOPT_ACTION_STORE_CONST:
|
||||
return ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO;
|
||||
|
||||
case ECORE_GETOPT_ACTION_STORE_TRUE:
|
||||
return ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO;
|
||||
|
||||
case ECORE_GETOPT_ACTION_STORE_FALSE:
|
||||
return ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO;
|
||||
|
||||
case ECORE_GETOPT_ACTION_CHOICE:
|
||||
return ECORE_GETOPT_DESC_ARG_REQUIREMENT_YES;
|
||||
|
||||
case ECORE_GETOPT_ACTION_APPEND:
|
||||
return ECORE_GETOPT_DESC_ARG_REQUIREMENT_YES;
|
||||
|
||||
case ECORE_GETOPT_ACTION_COUNT:
|
||||
return ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO;
|
||||
|
||||
case ECORE_GETOPT_ACTION_CALLBACK:
|
||||
return desc->action_param.callback.arg_req;
|
||||
|
||||
case ECORE_GETOPT_ACTION_HELP:
|
||||
return ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO;
|
||||
|
||||
case ECORE_GETOPT_ACTION_VERSION:
|
||||
return ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO;
|
||||
|
||||
default:
|
||||
return ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_ecore_getopt_help_desc_setup_metavar(const Ecore_Getopt_Desc *desc, char *metavar, int *metavarlen, int maxsize)
|
||||
_ecore_getopt_help_desc_setup_metavar(const Ecore_Getopt_Desc *desc,
|
||||
char *metavar,
|
||||
int *metavarlen,
|
||||
int maxsize)
|
||||
{
|
||||
if (desc->metavar)
|
||||
{
|
||||
|
@ -321,7 +346,10 @@ _ecore_getopt_help_desc_setup_metavar(const Ecore_Getopt_Desc *desc, char *metav
|
|||
}
|
||||
|
||||
static int
|
||||
_ecore_getopt_help_desc_show_arg(FILE *fp, Ecore_Getopt_Desc_Arg_Requirement requirement, const char *metavar, int metavarlen)
|
||||
_ecore_getopt_help_desc_show_arg(FILE *fp,
|
||||
Ecore_Getopt_Desc_Arg_Requirement requirement,
|
||||
const char *metavar,
|
||||
int metavarlen)
|
||||
{
|
||||
int used;
|
||||
|
||||
|
@ -353,7 +381,11 @@ _ecore_getopt_help_desc_show_arg(FILE *fp, Ecore_Getopt_Desc_Arg_Requirement req
|
|||
}
|
||||
|
||||
static int
|
||||
_ecore_getopt_help_desc_store(FILE *fp, const int base, const int total, int used, const Ecore_Getopt_Desc *desc)
|
||||
_ecore_getopt_help_desc_store(FILE *fp,
|
||||
const int base,
|
||||
const int total,
|
||||
int used,
|
||||
const Ecore_Getopt_Desc *desc)
|
||||
{
|
||||
const Ecore_Getopt_Desc_Store *store = &desc->action_param.store;
|
||||
char buf[64];
|
||||
|
@ -370,38 +402,47 @@ _ecore_getopt_help_desc_store(FILE *fp, const int base, const int total, int use
|
|||
str = "STR";
|
||||
len = sizeof("STR") - 1;
|
||||
break;
|
||||
|
||||
case ECORE_GETOPT_TYPE_BOOL:
|
||||
str = "BOOL";
|
||||
len = sizeof("BOOL") - 1;
|
||||
break;
|
||||
|
||||
case ECORE_GETOPT_TYPE_SHORT:
|
||||
str = "SHORT";
|
||||
len = sizeof("SHORT") - 1;
|
||||
break;
|
||||
|
||||
case ECORE_GETOPT_TYPE_INT:
|
||||
str = "INT";
|
||||
len = sizeof("INT") - 1;
|
||||
break;
|
||||
|
||||
case ECORE_GETOPT_TYPE_LONG:
|
||||
str = "LONG";
|
||||
len = sizeof("LONG") - 1;
|
||||
break;
|
||||
|
||||
case ECORE_GETOPT_TYPE_USHORT:
|
||||
str = "USHORT";
|
||||
len = sizeof("USHORT") - 1;
|
||||
break;
|
||||
|
||||
case ECORE_GETOPT_TYPE_UINT:
|
||||
str = "UINT";
|
||||
len = sizeof("UINT") - 1;
|
||||
break;
|
||||
|
||||
case ECORE_GETOPT_TYPE_ULONG:
|
||||
str = "ULONG";
|
||||
len = sizeof("ULONG") - 1;
|
||||
break;
|
||||
|
||||
case ECORE_GETOPT_TYPE_DOUBLE:
|
||||
str = "DOUBLE";
|
||||
len = sizeof("DOUBLE") - 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
str = "???";
|
||||
len = sizeof("???") - 1;
|
||||
|
@ -423,52 +464,61 @@ _ecore_getopt_help_desc_store(FILE *fp, const int base, const int total, int use
|
|||
str = store->def.strv;
|
||||
len = str ? strlen(str) : 0;
|
||||
break;
|
||||
|
||||
case ECORE_GETOPT_TYPE_BOOL:
|
||||
str = store->def.boolv ? "true" : "false";
|
||||
len = strlen(str);
|
||||
break;
|
||||
|
||||
case ECORE_GETOPT_TYPE_SHORT:
|
||||
str = buf;
|
||||
len = snprintf(buf, sizeof(buf), "%hd", store->def.shortv);
|
||||
if (len > sizeof(buf) - 1)
|
||||
len = sizeof(buf) - 1;
|
||||
break;
|
||||
|
||||
case ECORE_GETOPT_TYPE_INT:
|
||||
str = buf;
|
||||
len = snprintf(buf, sizeof(buf), "%d", store->def.intv);
|
||||
if (len > sizeof(buf) - 1)
|
||||
len = sizeof(buf) - 1;
|
||||
break;
|
||||
|
||||
case ECORE_GETOPT_TYPE_LONG:
|
||||
str = buf;
|
||||
len = snprintf(buf, sizeof(buf), "%ld", store->def.longv);
|
||||
if (len > sizeof(buf) - 1)
|
||||
len = sizeof(buf) - 1;
|
||||
break;
|
||||
|
||||
case ECORE_GETOPT_TYPE_USHORT:
|
||||
str = buf;
|
||||
len = snprintf(buf, sizeof(buf), "%hu", store->def.ushortv);
|
||||
if (len > sizeof(buf) - 1)
|
||||
len = sizeof(buf) - 1;
|
||||
break;
|
||||
|
||||
case ECORE_GETOPT_TYPE_UINT:
|
||||
str = buf;
|
||||
len = snprintf(buf, sizeof(buf), "%u", store->def.uintv);
|
||||
if (len > sizeof(buf) - 1)
|
||||
len = sizeof(buf) - 1;
|
||||
break;
|
||||
|
||||
case ECORE_GETOPT_TYPE_ULONG:
|
||||
str = buf;
|
||||
len = snprintf(buf, sizeof(buf), "%lu", store->def.ulongv);
|
||||
if (len > sizeof(buf) - 1)
|
||||
len = sizeof(buf) - 1;
|
||||
break;
|
||||
|
||||
case ECORE_GETOPT_TYPE_DOUBLE:
|
||||
str = buf;
|
||||
len = snprintf(buf, sizeof(buf), "%f", store->def.doublev);
|
||||
if (len > sizeof(buf) - 1)
|
||||
len = sizeof(buf) - 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
str = "???";
|
||||
len = sizeof("???") - 1;
|
||||
|
@ -478,12 +528,16 @@ _ecore_getopt_help_desc_store(FILE *fp, const int base, const int total, int use
|
|||
(fp, base, total, used, _("Default: "), strlen(_("Default: ")));
|
||||
used = _ecore_getopt_help_line(fp, base, total, used, str, len);
|
||||
|
||||
end:
|
||||
end:
|
||||
return _ecore_getopt_help_line(fp, base, total, used, ".", 1);
|
||||
}
|
||||
|
||||
static int
|
||||
_ecore_getopt_help_desc_choices(FILE *fp, const int base, const int total, int used, const Ecore_Getopt_Desc *desc)
|
||||
_ecore_getopt_help_desc_choices(FILE *fp,
|
||||
const int base,
|
||||
const int total,
|
||||
int used,
|
||||
const Ecore_Getopt_Desc *desc)
|
||||
{
|
||||
const char *const *itr;
|
||||
const char sep[] = ", ";
|
||||
|
@ -512,7 +566,8 @@ _ecore_getopt_help_desc_choices(FILE *fp, const int base, const int total, int u
|
|||
}
|
||||
|
||||
static void
|
||||
_ecore_getopt_help_desc(FILE *fp, const Ecore_Getopt_Desc *desc)
|
||||
_ecore_getopt_help_desc(FILE *fp,
|
||||
const Ecore_Getopt_Desc *desc)
|
||||
{
|
||||
Ecore_Getopt_Desc_Arg_Requirement arg_req;
|
||||
char metavar[32] = "ARG";
|
||||
|
@ -573,14 +628,16 @@ _ecore_getopt_help_desc(FILE *fp, const Ecore_Getopt_Desc *desc)
|
|||
case ECORE_GETOPT_ACTION_STORE:
|
||||
_ecore_getopt_help_desc_store(fp, helpcol, cols, used, desc);
|
||||
break;
|
||||
|
||||
case ECORE_GETOPT_ACTION_CHOICE:
|
||||
_ecore_getopt_help_desc_choices(fp, helpcol, cols, used, desc);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
end:
|
||||
end:
|
||||
fputc('\n', fp);
|
||||
}
|
||||
|
||||
|
@ -591,7 +648,8 @@ _ecore_getopt_desc_is_sentinel(const Ecore_Getopt_Desc *desc)
|
|||
}
|
||||
|
||||
static void
|
||||
_ecore_getopt_help_options(FILE *fp, const Ecore_Getopt *parser)
|
||||
_ecore_getopt_help_options(FILE *fp,
|
||||
const Ecore_Getopt *parser)
|
||||
{
|
||||
const Ecore_Getopt_Desc *desc;
|
||||
|
||||
|
@ -609,7 +667,8 @@ _ecore_getopt_help_options(FILE *fp, const Ecore_Getopt *parser)
|
|||
* Message will be print to stderr.
|
||||
*/
|
||||
void
|
||||
ecore_getopt_help(FILE *fp, const Ecore_Getopt *parser)
|
||||
ecore_getopt_help(FILE *fp,
|
||||
const Ecore_Getopt *parser)
|
||||
{
|
||||
const char *var;
|
||||
|
||||
|
@ -640,7 +699,8 @@ ecore_getopt_help(FILE *fp, const Ecore_Getopt *parser)
|
|||
}
|
||||
|
||||
static const Ecore_Getopt_Desc *
|
||||
_ecore_getopt_parse_find_long(const Ecore_Getopt *parser, const char *name)
|
||||
_ecore_getopt_parse_find_long(const Ecore_Getopt *parser,
|
||||
const char *name)
|
||||
{
|
||||
const Ecore_Getopt_Desc *desc = parser->descs;
|
||||
const char *p = strchr(name, '=');
|
||||
|
@ -671,7 +731,8 @@ _ecore_getopt_parse_find_long(const Ecore_Getopt *parser, const char *name)
|
|||
}
|
||||
|
||||
static const Ecore_Getopt_Desc *
|
||||
_ecore_getopt_parse_find_short(const Ecore_Getopt *parser, char name)
|
||||
_ecore_getopt_parse_find_short(const Ecore_Getopt *parser,
|
||||
char name)
|
||||
{
|
||||
const Ecore_Getopt_Desc *desc = parser->descs;
|
||||
for (; !_ecore_getopt_desc_is_sentinel(desc); desc++)
|
||||
|
@ -681,12 +742,14 @@ _ecore_getopt_parse_find_short(const Ecore_Getopt *parser, char name)
|
|||
}
|
||||
|
||||
static int
|
||||
_ecore_getopt_parse_find_nonargs_base(const Ecore_Getopt *parser, int argc, char **argv)
|
||||
_ecore_getopt_parse_find_nonargs_base(const Ecore_Getopt *parser,
|
||||
int argc,
|
||||
char **argv)
|
||||
{
|
||||
char **nonargs;
|
||||
int src, dst, used, base;
|
||||
|
||||
nonargs = alloca(sizeof(char*) * argc);
|
||||
nonargs = alloca(sizeof(char *) * argc);
|
||||
src = 1;
|
||||
dst = 1;
|
||||
used = 0;
|
||||
|
@ -748,7 +811,7 @@ _ecore_getopt_parse_find_nonargs_base(const Ecore_Getopt *parser, int argc, char
|
|||
dst++;
|
||||
continue;
|
||||
|
||||
found_nonarg:
|
||||
found_nonarg:
|
||||
nonargs[used] = arg;
|
||||
used++;
|
||||
src++;
|
||||
|
@ -769,7 +832,9 @@ _ecore_getopt_parse_find_nonargs_base(const Ecore_Getopt *parser, int argc, char
|
|||
}
|
||||
|
||||
static void
|
||||
_ecore_getopt_desc_print_error(const Ecore_Getopt_Desc *desc, const char *fmt, ...)
|
||||
_ecore_getopt_desc_print_error(const Ecore_Getopt_Desc *desc,
|
||||
const char *fmt,
|
||||
...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
|
@ -798,7 +863,8 @@ _ecore_getopt_desc_print_error(const Ecore_Getopt_Desc *desc, const char *fmt, .
|
|||
}
|
||||
|
||||
static Eina_Bool
|
||||
_ecore_getopt_parse_bool(const char *str, Eina_Bool *v)
|
||||
_ecore_getopt_parse_bool(const char *str,
|
||||
Eina_Bool *v)
|
||||
{
|
||||
if ((strcmp(str, "0") == 0) ||
|
||||
(strcasecmp(str, "f") == 0) ||
|
||||
|
@ -825,7 +891,8 @@ _ecore_getopt_parse_bool(const char *str, Eina_Bool *v)
|
|||
}
|
||||
|
||||
static Eina_Bool
|
||||
_ecore_getopt_parse_long(const char *str, long int *v)
|
||||
_ecore_getopt_parse_long(const char *str,
|
||||
long int *v)
|
||||
{
|
||||
char *endptr = NULL;
|
||||
*v = strtol(str, &endptr, 0);
|
||||
|
@ -833,7 +900,8 @@ _ecore_getopt_parse_long(const char *str, long int *v)
|
|||
}
|
||||
|
||||
static Eina_Bool
|
||||
_ecore_getopt_parse_double(const char *str, double *v)
|
||||
_ecore_getopt_parse_double(const char *str,
|
||||
double *v)
|
||||
{
|
||||
char *endptr = NULL;
|
||||
*v = strtod(str, &endptr);
|
||||
|
@ -841,7 +909,10 @@ _ecore_getopt_parse_double(const char *str, double *v)
|
|||
}
|
||||
|
||||
static Eina_Bool
|
||||
_ecore_getopt_parse_store(const Ecore_Getopt *parser __UNUSED__, const Ecore_Getopt_Desc *desc, Ecore_Getopt_Value *value, const char *arg_val)
|
||||
_ecore_getopt_parse_store(const Ecore_Getopt *parser __UNUSED__,
|
||||
const Ecore_Getopt_Desc *desc,
|
||||
Ecore_Getopt_Value *value,
|
||||
const char *arg_val)
|
||||
{
|
||||
const Ecore_Getopt_Desc_Store *store = &desc->action_param.store;
|
||||
long int v;
|
||||
|
@ -858,9 +929,11 @@ _ecore_getopt_parse_store(const Ecore_Getopt *parser __UNUSED__, const Ecore_Get
|
|||
{
|
||||
case ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO:
|
||||
goto use_optional;
|
||||
|
||||
case ECORE_GETOPT_DESC_ARG_REQUIREMENT_OPTIONAL:
|
||||
if (!arg_val)
|
||||
goto use_optional;
|
||||
|
||||
case ECORE_GETOPT_DESC_ARG_REQUIREMENT_YES:
|
||||
break;
|
||||
}
|
||||
|
@ -870,6 +943,7 @@ _ecore_getopt_parse_store(const Ecore_Getopt *parser __UNUSED__, const Ecore_Get
|
|||
case ECORE_GETOPT_TYPE_STR:
|
||||
*value->strp = (char *)arg_val;
|
||||
return EINA_TRUE;
|
||||
|
||||
case ECORE_GETOPT_TYPE_BOOL:
|
||||
if (_ecore_getopt_parse_bool(arg_val, &b))
|
||||
{
|
||||
|
@ -882,36 +956,43 @@ _ecore_getopt_parse_store(const Ecore_Getopt *parser __UNUSED__, const Ecore_Get
|
|||
(desc, _("unknown boolean value %s.\n"), arg_val);
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
case ECORE_GETOPT_TYPE_SHORT:
|
||||
if (!_ecore_getopt_parse_long(arg_val, &v))
|
||||
goto error;
|
||||
*value->shortp = v;
|
||||
return EINA_TRUE;
|
||||
|
||||
case ECORE_GETOPT_TYPE_INT:
|
||||
if (!_ecore_getopt_parse_long(arg_val, &v))
|
||||
goto error;
|
||||
*value->intp = v;
|
||||
return EINA_TRUE;
|
||||
|
||||
case ECORE_GETOPT_TYPE_LONG:
|
||||
if (!_ecore_getopt_parse_long(arg_val, &v))
|
||||
goto error;
|
||||
*value->longp = v;
|
||||
return EINA_TRUE;
|
||||
|
||||
case ECORE_GETOPT_TYPE_USHORT:
|
||||
if (!_ecore_getopt_parse_long(arg_val, &v))
|
||||
goto error;
|
||||
*value->ushortp = v;
|
||||
return EINA_TRUE;
|
||||
|
||||
case ECORE_GETOPT_TYPE_UINT:
|
||||
if (!_ecore_getopt_parse_long(arg_val, &v))
|
||||
goto error;
|
||||
*value->uintp = v;
|
||||
return EINA_TRUE;
|
||||
|
||||
case ECORE_GETOPT_TYPE_ULONG:
|
||||
if (!_ecore_getopt_parse_long(arg_val, &v))
|
||||
goto error;
|
||||
*value->ulongp = v;
|
||||
return EINA_TRUE;
|
||||
|
||||
case ECORE_GETOPT_TYPE_DOUBLE:
|
||||
if (!_ecore_getopt_parse_double(arg_val, &d))
|
||||
goto error;
|
||||
|
@ -921,38 +1002,46 @@ _ecore_getopt_parse_store(const Ecore_Getopt *parser __UNUSED__, const Ecore_Get
|
|||
|
||||
return EINA_TRUE;
|
||||
|
||||
error:
|
||||
error:
|
||||
_ecore_getopt_desc_print_error
|
||||
(desc, _("invalid number format %s\n"), arg_val);
|
||||
return EINA_FALSE;
|
||||
|
||||
use_optional:
|
||||
use_optional:
|
||||
switch (store->type)
|
||||
{
|
||||
case ECORE_GETOPT_TYPE_STR:
|
||||
*value->strp = (char *)store->def.strv;
|
||||
break;
|
||||
|
||||
case ECORE_GETOPT_TYPE_BOOL:
|
||||
*value->boolp = store->def.boolv;
|
||||
break;
|
||||
|
||||
case ECORE_GETOPT_TYPE_SHORT:
|
||||
*value->shortp = store->def.shortv;
|
||||
break;
|
||||
|
||||
case ECORE_GETOPT_TYPE_INT:
|
||||
*value->intp = store->def.intv;
|
||||
break;
|
||||
|
||||
case ECORE_GETOPT_TYPE_LONG:
|
||||
*value->longp = store->def.longv;
|
||||
break;
|
||||
|
||||
case ECORE_GETOPT_TYPE_USHORT:
|
||||
*value->ushortp = store->def.ushortv;
|
||||
break;
|
||||
|
||||
case ECORE_GETOPT_TYPE_UINT:
|
||||
*value->uintp = store->def.uintv;
|
||||
break;
|
||||
|
||||
case ECORE_GETOPT_TYPE_ULONG:
|
||||
*value->ulongp = store->def.ulongv;
|
||||
break;
|
||||
|
||||
case ECORE_GETOPT_TYPE_DOUBLE:
|
||||
*value->doublep = store->def.doublev;
|
||||
break;
|
||||
|
@ -962,7 +1051,10 @@ _ecore_getopt_parse_store(const Ecore_Getopt *parser __UNUSED__, const Ecore_Get
|
|||
}
|
||||
|
||||
static Eina_Bool
|
||||
_ecore_getopt_parse_store_const(const Ecore_Getopt *parser __UNUSED__, const Ecore_Getopt_Desc *desc, Ecore_Getopt_Value *val, const char *arg_val __UNUSED__)
|
||||
_ecore_getopt_parse_store_const(const Ecore_Getopt *parser __UNUSED__,
|
||||
const Ecore_Getopt_Desc *desc,
|
||||
Ecore_Getopt_Value *val,
|
||||
const char *arg_val __UNUSED__)
|
||||
{
|
||||
if (!val->ptrp)
|
||||
{
|
||||
|
@ -975,7 +1067,10 @@ _ecore_getopt_parse_store_const(const Ecore_Getopt *parser __UNUSED__, const Eco
|
|||
}
|
||||
|
||||
static Eina_Bool
|
||||
_ecore_getopt_parse_store_true(const Ecore_Getopt *parser __UNUSED__, const Ecore_Getopt_Desc *desc, Ecore_Getopt_Value *val, const char *arg_val __UNUSED__)
|
||||
_ecore_getopt_parse_store_true(const Ecore_Getopt *parser __UNUSED__,
|
||||
const Ecore_Getopt_Desc *desc,
|
||||
Ecore_Getopt_Value *val,
|
||||
const char *arg_val __UNUSED__)
|
||||
{
|
||||
if (!val->boolp)
|
||||
{
|
||||
|
@ -987,7 +1082,10 @@ _ecore_getopt_parse_store_true(const Ecore_Getopt *parser __UNUSED__, const Ecor
|
|||
}
|
||||
|
||||
static Eina_Bool
|
||||
_ecore_getopt_parse_store_false(const Ecore_Getopt *parser __UNUSED__, const Ecore_Getopt_Desc *desc, Ecore_Getopt_Value *val, const char *arg_val __UNUSED__)
|
||||
_ecore_getopt_parse_store_false(const Ecore_Getopt *parser __UNUSED__,
|
||||
const Ecore_Getopt_Desc *desc,
|
||||
Ecore_Getopt_Value *val,
|
||||
const char *arg_val __UNUSED__)
|
||||
{
|
||||
if (!val->boolp)
|
||||
{
|
||||
|
@ -999,9 +1097,12 @@ _ecore_getopt_parse_store_false(const Ecore_Getopt *parser __UNUSED__, const Eco
|
|||
}
|
||||
|
||||
static Eina_Bool
|
||||
_ecore_getopt_parse_choice(const Ecore_Getopt *parser __UNUSED__, const Ecore_Getopt_Desc *desc, Ecore_Getopt_Value *val, const char *arg_val)
|
||||
_ecore_getopt_parse_choice(const Ecore_Getopt *parser __UNUSED__,
|
||||
const Ecore_Getopt_Desc *desc,
|
||||
Ecore_Getopt_Value *val,
|
||||
const char *arg_val)
|
||||
{
|
||||
const char * const *pchoice;
|
||||
const char *const *pchoice;
|
||||
|
||||
if (!val->strp)
|
||||
{
|
||||
|
@ -1033,7 +1134,10 @@ _ecore_getopt_parse_choice(const Ecore_Getopt *parser __UNUSED__, const Ecore_Ge
|
|||
}
|
||||
|
||||
static Eina_Bool
|
||||
_ecore_getopt_parse_append(const Ecore_Getopt *parser __UNUSED__, const Ecore_Getopt_Desc *desc, Ecore_Getopt_Value *val, const char *arg_val)
|
||||
_ecore_getopt_parse_append(const Ecore_Getopt *parser __UNUSED__,
|
||||
const Ecore_Getopt_Desc *desc,
|
||||
Ecore_Getopt_Value *val,
|
||||
const char *arg_val)
|
||||
{
|
||||
void *data;
|
||||
long int v;
|
||||
|
@ -1058,6 +1162,7 @@ _ecore_getopt_parse_append(const Ecore_Getopt *parser __UNUSED__, const Ecore_Ge
|
|||
case ECORE_GETOPT_TYPE_STR:
|
||||
data = strdup(arg_val);
|
||||
break;
|
||||
|
||||
case ECORE_GETOPT_TYPE_BOOL:
|
||||
{
|
||||
if (_ecore_getopt_parse_bool(arg_val, &b))
|
||||
|
@ -1073,6 +1178,7 @@ _ecore_getopt_parse_append(const Ecore_Getopt *parser __UNUSED__, const Ecore_Ge
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ECORE_GETOPT_TYPE_SHORT:
|
||||
{
|
||||
if (!_ecore_getopt_parse_long(arg_val, &v))
|
||||
|
@ -1082,6 +1188,7 @@ _ecore_getopt_parse_append(const Ecore_Getopt *parser __UNUSED__, const Ecore_Ge
|
|||
*(short *)data = (short)v;
|
||||
}
|
||||
break;
|
||||
|
||||
case ECORE_GETOPT_TYPE_INT:
|
||||
{
|
||||
if (!_ecore_getopt_parse_long(arg_val, &v))
|
||||
|
@ -1091,6 +1198,7 @@ _ecore_getopt_parse_append(const Ecore_Getopt *parser __UNUSED__, const Ecore_Ge
|
|||
*(int *)data = (int)v;
|
||||
}
|
||||
break;
|
||||
|
||||
case ECORE_GETOPT_TYPE_LONG:
|
||||
{
|
||||
if (!_ecore_getopt_parse_long(arg_val, &v))
|
||||
|
@ -1100,6 +1208,7 @@ _ecore_getopt_parse_append(const Ecore_Getopt *parser __UNUSED__, const Ecore_Ge
|
|||
*(long *)data = v;
|
||||
}
|
||||
break;
|
||||
|
||||
case ECORE_GETOPT_TYPE_USHORT:
|
||||
{
|
||||
if (!_ecore_getopt_parse_long(arg_val, &v))
|
||||
|
@ -1109,6 +1218,7 @@ _ecore_getopt_parse_append(const Ecore_Getopt *parser __UNUSED__, const Ecore_Ge
|
|||
*(unsigned short *)data = (unsigned short)v;
|
||||
}
|
||||
break;
|
||||
|
||||
case ECORE_GETOPT_TYPE_UINT:
|
||||
{
|
||||
if (!_ecore_getopt_parse_long(arg_val, &v))
|
||||
|
@ -1118,6 +1228,7 @@ _ecore_getopt_parse_append(const Ecore_Getopt *parser __UNUSED__, const Ecore_Ge
|
|||
*(unsigned int *)data = (unsigned int)v;
|
||||
}
|
||||
break;
|
||||
|
||||
case ECORE_GETOPT_TYPE_ULONG:
|
||||
{
|
||||
if (!_ecore_getopt_parse_long(arg_val, &v))
|
||||
|
@ -1127,6 +1238,7 @@ _ecore_getopt_parse_append(const Ecore_Getopt *parser __UNUSED__, const Ecore_Ge
|
|||
*(unsigned long *)data = v;
|
||||
}
|
||||
break;
|
||||
|
||||
case ECORE_GETOPT_TYPE_DOUBLE:
|
||||
{
|
||||
if (!_ecore_getopt_parse_double(arg_val, &d))
|
||||
|
@ -1136,6 +1248,7 @@ _ecore_getopt_parse_append(const Ecore_Getopt *parser __UNUSED__, const Ecore_Ge
|
|||
*(double *)data = d;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
_ecore_getopt_desc_print_error(desc, _("could not parse value.\n"));
|
||||
|
@ -1146,14 +1259,17 @@ _ecore_getopt_parse_append(const Ecore_Getopt *parser __UNUSED__, const Ecore_Ge
|
|||
*val->listp = eina_list_append(*val->listp, data);
|
||||
return EINA_TRUE;
|
||||
|
||||
error:
|
||||
error:
|
||||
_ecore_getopt_desc_print_error
|
||||
(desc, _("invalid number format %s\n"), arg_val);
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_ecore_getopt_parse_count(const Ecore_Getopt *parser __UNUSED__, const Ecore_Getopt_Desc *desc, Ecore_Getopt_Value *val, const char *arg_val __UNUSED__)
|
||||
_ecore_getopt_parse_count(const Ecore_Getopt *parser __UNUSED__,
|
||||
const Ecore_Getopt_Desc *desc,
|
||||
Ecore_Getopt_Value *val,
|
||||
const char *arg_val __UNUSED__)
|
||||
{
|
||||
if (!val->intp)
|
||||
{
|
||||
|
@ -1166,7 +1282,10 @@ _ecore_getopt_parse_count(const Ecore_Getopt *parser __UNUSED__, const Ecore_Get
|
|||
}
|
||||
|
||||
static Eina_Bool
|
||||
_ecore_getopt_parse_callback(const Ecore_Getopt *parser, const Ecore_Getopt_Desc *desc, Ecore_Getopt_Value *val, const char *arg_val)
|
||||
_ecore_getopt_parse_callback(const Ecore_Getopt *parser,
|
||||
const Ecore_Getopt_Desc *desc,
|
||||
Ecore_Getopt_Value *val,
|
||||
const char *arg_val)
|
||||
{
|
||||
const Ecore_Getopt_Desc_Callback *cb = &desc->action_param.callback;
|
||||
|
||||
|
@ -1175,10 +1294,12 @@ _ecore_getopt_parse_callback(const Ecore_Getopt *parser, const Ecore_Getopt_Desc
|
|||
case ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO:
|
||||
arg_val = cb->def;
|
||||
break;
|
||||
|
||||
case ECORE_GETOPT_DESC_ARG_REQUIREMENT_OPTIONAL:
|
||||
if (!arg_val)
|
||||
arg_val = cb->def;
|
||||
break;
|
||||
|
||||
case ECORE_GETOPT_DESC_ARG_REQUIREMENT_YES:
|
||||
break;
|
||||
}
|
||||
|
@ -1208,7 +1329,10 @@ _ecore_getopt_parse_callback(const Ecore_Getopt *parser, const Ecore_Getopt_Desc
|
|||
}
|
||||
|
||||
static Eina_Bool
|
||||
_ecore_getopt_parse_help(const Ecore_Getopt *parser, const Ecore_Getopt_Desc *desc __UNUSED__, Ecore_Getopt_Value *val, const char *arg_val __UNUSED__)
|
||||
_ecore_getopt_parse_help(const Ecore_Getopt *parser,
|
||||
const Ecore_Getopt_Desc *desc __UNUSED__,
|
||||
Ecore_Getopt_Value *val,
|
||||
const char *arg_val __UNUSED__)
|
||||
{
|
||||
if (val->boolp)
|
||||
(*val->boolp) = EINA_TRUE;
|
||||
|
@ -1217,7 +1341,10 @@ _ecore_getopt_parse_help(const Ecore_Getopt *parser, const Ecore_Getopt_Desc *de
|
|||
}
|
||||
|
||||
static Eina_Bool
|
||||
_ecore_getopt_parse_version(const Ecore_Getopt *parser, const Ecore_Getopt_Desc *desc, Ecore_Getopt_Value *val, const char *arg_val __UNUSED__)
|
||||
_ecore_getopt_parse_version(const Ecore_Getopt *parser,
|
||||
const Ecore_Getopt_Desc *desc,
|
||||
Ecore_Getopt_Value *val,
|
||||
const char *arg_val __UNUSED__)
|
||||
{
|
||||
if (val->boolp)
|
||||
(*val->boolp) = EINA_TRUE;
|
||||
|
@ -1231,7 +1358,10 @@ _ecore_getopt_parse_version(const Ecore_Getopt *parser, const Ecore_Getopt_Desc
|
|||
}
|
||||
|
||||
static Eina_Bool
|
||||
_ecore_getopt_parse_copyright(const Ecore_Getopt *parser, const Ecore_Getopt_Desc *desc, Ecore_Getopt_Value *val, const char *arg_val __UNUSED__)
|
||||
_ecore_getopt_parse_copyright(const Ecore_Getopt *parser,
|
||||
const Ecore_Getopt_Desc *desc,
|
||||
Ecore_Getopt_Value *val,
|
||||
const char *arg_val __UNUSED__)
|
||||
{
|
||||
if (val->boolp)
|
||||
(*val->boolp) = EINA_TRUE;
|
||||
|
@ -1245,7 +1375,10 @@ _ecore_getopt_parse_copyright(const Ecore_Getopt *parser, const Ecore_Getopt_Des
|
|||
}
|
||||
|
||||
static Eina_Bool
|
||||
_ecore_getopt_parse_license(const Ecore_Getopt *parser, const Ecore_Getopt_Desc *desc, Ecore_Getopt_Value *val, const char *arg_val __UNUSED__)
|
||||
_ecore_getopt_parse_license(const Ecore_Getopt *parser,
|
||||
const Ecore_Getopt_Desc *desc,
|
||||
Ecore_Getopt_Value *val,
|
||||
const char *arg_val __UNUSED__)
|
||||
{
|
||||
if (val->boolp)
|
||||
(*val->boolp) = EINA_TRUE;
|
||||
|
@ -1259,41 +1392,62 @@ _ecore_getopt_parse_license(const Ecore_Getopt *parser, const Ecore_Getopt_Desc
|
|||
}
|
||||
|
||||
static Eina_Bool
|
||||
_ecore_getopt_desc_handle(const Ecore_Getopt *parser, const Ecore_Getopt_Desc *desc, Ecore_Getopt_Value *value, const char *arg_val)
|
||||
_ecore_getopt_desc_handle(const Ecore_Getopt *parser,
|
||||
const Ecore_Getopt_Desc *desc,
|
||||
Ecore_Getopt_Value *value,
|
||||
const char *arg_val)
|
||||
{
|
||||
switch (desc->action)
|
||||
{
|
||||
case ECORE_GETOPT_ACTION_STORE:
|
||||
return _ecore_getopt_parse_store(parser, desc, value, arg_val);
|
||||
|
||||
case ECORE_GETOPT_ACTION_STORE_CONST:
|
||||
return _ecore_getopt_parse_store_const(parser, desc, value, arg_val);
|
||||
|
||||
case ECORE_GETOPT_ACTION_STORE_TRUE:
|
||||
return _ecore_getopt_parse_store_true(parser, desc, value, arg_val);
|
||||
|
||||
case ECORE_GETOPT_ACTION_STORE_FALSE:
|
||||
return _ecore_getopt_parse_store_false(parser, desc, value, arg_val);
|
||||
|
||||
case ECORE_GETOPT_ACTION_CHOICE:
|
||||
return _ecore_getopt_parse_choice(parser, desc, value, arg_val);
|
||||
|
||||
case ECORE_GETOPT_ACTION_APPEND:
|
||||
return _ecore_getopt_parse_append(parser, desc, value, arg_val);
|
||||
|
||||
case ECORE_GETOPT_ACTION_COUNT:
|
||||
return _ecore_getopt_parse_count(parser, desc, value, arg_val);
|
||||
|
||||
case ECORE_GETOPT_ACTION_CALLBACK:
|
||||
return _ecore_getopt_parse_callback(parser, desc, value, arg_val);
|
||||
|
||||
case ECORE_GETOPT_ACTION_HELP:
|
||||
return _ecore_getopt_parse_help(parser, desc, value, arg_val);
|
||||
|
||||
case ECORE_GETOPT_ACTION_VERSION:
|
||||
return _ecore_getopt_parse_version(parser, desc, value, arg_val);
|
||||
|
||||
case ECORE_GETOPT_ACTION_COPYRIGHT:
|
||||
return _ecore_getopt_parse_copyright(parser, desc, value, arg_val);
|
||||
|
||||
case ECORE_GETOPT_ACTION_LICENSE:
|
||||
return _ecore_getopt_parse_license(parser, desc, value, arg_val);
|
||||
|
||||
default:
|
||||
return EINA_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_ecore_getopt_parse_arg_long(const Ecore_Getopt *parser, Ecore_Getopt_Value *values, int argc __UNUSED__, char **argv, int *idx, int *nonargs, const char *arg)
|
||||
_ecore_getopt_parse_arg_long(const Ecore_Getopt *parser,
|
||||
Ecore_Getopt_Value *values,
|
||||
int argc __UNUSED__,
|
||||
char **argv,
|
||||
int *idx,
|
||||
int *nonargs,
|
||||
const char *arg)
|
||||
{
|
||||
const Ecore_Getopt_Desc *desc;
|
||||
Ecore_Getopt_Desc_Arg_Requirement arg_req;
|
||||
|
@ -1357,7 +1511,13 @@ _ecore_getopt_parse_arg_long(const Ecore_Getopt *parser, Ecore_Getopt_Value *val
|
|||
}
|
||||
|
||||
static Eina_Bool
|
||||
_ecore_getopt_parse_arg_short(const Ecore_Getopt *parser, Ecore_Getopt_Value *values, int argc __UNUSED__, char **argv, int *idx, int *nonargs, const char *arg)
|
||||
_ecore_getopt_parse_arg_short(const Ecore_Getopt *parser,
|
||||
Ecore_Getopt_Value *values,
|
||||
int argc __UNUSED__,
|
||||
char **argv,
|
||||
int *idx,
|
||||
int *nonargs,
|
||||
const char *arg)
|
||||
{
|
||||
int run = 1;
|
||||
while (run && (arg[0] != '\0'))
|
||||
|
@ -1436,7 +1596,12 @@ _ecore_getopt_parse_arg_short(const Ecore_Getopt *parser, Ecore_Getopt_Value *va
|
|||
}
|
||||
|
||||
static Eina_Bool
|
||||
_ecore_getopt_parse_arg(const Ecore_Getopt *parser, Ecore_Getopt_Value *values, int argc, char **argv, int *idx, int *nonargs)
|
||||
_ecore_getopt_parse_arg(const Ecore_Getopt *parser,
|
||||
Ecore_Getopt_Value *values,
|
||||
int argc,
|
||||
char **argv,
|
||||
int *idx,
|
||||
int *nonargs)
|
||||
{
|
||||
char *arg = argv[*idx];
|
||||
|
||||
|
@ -1463,7 +1628,8 @@ _ecore_getopt_parse_arg(const Ecore_Getopt *parser, Ecore_Getopt_Value *values,
|
|||
}
|
||||
|
||||
static const Ecore_Getopt_Desc *
|
||||
_ecore_getopt_parse_find_short_other(const Ecore_Getopt *parser, const Ecore_Getopt_Desc *orig)
|
||||
_ecore_getopt_parse_find_short_other(const Ecore_Getopt *parser,
|
||||
const Ecore_Getopt_Desc *orig)
|
||||
{
|
||||
const Ecore_Getopt_Desc *desc = parser->descs;
|
||||
const char c = orig->shortname;
|
||||
|
@ -1481,7 +1647,8 @@ _ecore_getopt_parse_find_short_other(const Ecore_Getopt *parser, const Ecore_Get
|
|||
}
|
||||
|
||||
static const Ecore_Getopt_Desc *
|
||||
_ecore_getopt_parse_find_long_other(const Ecore_Getopt *parser, const Ecore_Getopt_Desc *orig)
|
||||
_ecore_getopt_parse_find_long_other(const Ecore_Getopt *parser,
|
||||
const Ecore_Getopt_Desc *orig)
|
||||
{
|
||||
const Ecore_Getopt_Desc *desc = parser->descs;
|
||||
const char *name = orig->longname;
|
||||
|
@ -1605,7 +1772,10 @@ _ecore_getopt_find_help(const Ecore_Getopt *parser)
|
|||
* @return index of first non-option parameter or -1 on error.
|
||||
*/
|
||||
int
|
||||
ecore_getopt_parse(const Ecore_Getopt *parser, Ecore_Getopt_Value *values, int argc, char **argv)
|
||||
ecore_getopt_parse(const Ecore_Getopt *parser,
|
||||
Ecore_Getopt_Value *values,
|
||||
int argc,
|
||||
char **argv)
|
||||
{
|
||||
int i, nonargs;
|
||||
|
||||
|
@ -1648,7 +1818,7 @@ ecore_getopt_parse(const Ecore_Getopt *parser, Ecore_Getopt_Value *values, int a
|
|||
|
||||
return nonargs;
|
||||
|
||||
error:
|
||||
error:
|
||||
{
|
||||
const Ecore_Getopt_Desc *help;
|
||||
fputs(_("ERROR: invalid options found."), stderr);
|
||||
|
@ -1690,7 +1860,11 @@ ecore_getopt_list_free(Eina_List *list)
|
|||
* @c callback_data value is ignored, you can safely use @c NULL.
|
||||
*/
|
||||
Eina_Bool
|
||||
ecore_getopt_callback_geometry_parse(const Ecore_Getopt *parser __UNUSED__, const Ecore_Getopt_Desc *desc __UNUSED__, const char *str, void *data __UNUSED__, Ecore_Getopt_Value *storage)
|
||||
ecore_getopt_callback_geometry_parse(const Ecore_Getopt *parser __UNUSED__,
|
||||
const Ecore_Getopt_Desc *desc __UNUSED__,
|
||||
const char *str,
|
||||
void *data __UNUSED__,
|
||||
Ecore_Getopt_Value *storage)
|
||||
{
|
||||
Eina_Rectangle *v = (Eina_Rectangle *)storage->ptrp;
|
||||
|
||||
|
@ -1713,7 +1887,11 @@ ecore_getopt_callback_geometry_parse(const Ecore_Getopt *parser __UNUSED__, cons
|
|||
* @c callback_data value is ignored, you can safely use @c NULL.
|
||||
*/
|
||||
Eina_Bool
|
||||
ecore_getopt_callback_size_parse(const Ecore_Getopt *parser __UNUSED__, const Ecore_Getopt_Desc *desc __UNUSED__, const char *str, void *data __UNUSED__, Ecore_Getopt_Value *storage)
|
||||
ecore_getopt_callback_size_parse(const Ecore_Getopt *parser __UNUSED__,
|
||||
const Ecore_Getopt_Desc *desc __UNUSED__,
|
||||
const char *str,
|
||||
void *data __UNUSED__,
|
||||
Ecore_Getopt_Value *storage)
|
||||
{
|
||||
Eina_Rectangle *v = (Eina_Rectangle *)storage->ptrp;
|
||||
|
||||
|
@ -1727,3 +1905,4 @@ ecore_getopt_callback_size_parse(const Ecore_Getopt *parser __UNUSED__, const Ec
|
|||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,9 @@ _ecore_glib_fds_resize(size_t size)
|
|||
}
|
||||
|
||||
static int
|
||||
_ecore_glib_context_query(GMainContext *ctx, int priority, int *p_timer)
|
||||
_ecore_glib_context_query(GMainContext *ctx,
|
||||
int priority,
|
||||
int *p_timer)
|
||||
{
|
||||
int reqfds;
|
||||
|
||||
|
@ -70,7 +72,11 @@ _ecore_glib_context_query(GMainContext *ctx, int priority, int *p_timer)
|
|||
}
|
||||
|
||||
static int
|
||||
_ecore_glib_context_poll_from(const GPollFD *pfds, int count, fd_set *rfds, fd_set *wfds, fd_set *efds)
|
||||
_ecore_glib_context_poll_from(const GPollFD *pfds,
|
||||
int count,
|
||||
fd_set *rfds,
|
||||
fd_set *wfds,
|
||||
fd_set *efds)
|
||||
{
|
||||
const GPollFD *itr = pfds, *itr_end = pfds + count;
|
||||
int glib_fds = -1;
|
||||
|
@ -92,7 +98,12 @@ _ecore_glib_context_poll_from(const GPollFD *pfds, int count, fd_set *rfds, fd_s
|
|||
}
|
||||
|
||||
static int
|
||||
_ecore_glib_context_poll_to(GPollFD *pfds, int count, const fd_set *rfds, const fd_set *wfds, const fd_set *efds, int ready)
|
||||
_ecore_glib_context_poll_to(GPollFD *pfds,
|
||||
int count,
|
||||
const fd_set *rfds,
|
||||
const fd_set *wfds,
|
||||
const fd_set *efds,
|
||||
int ready)
|
||||
{
|
||||
GPollFD *itr = pfds, *itr_end = pfds + count;
|
||||
|
||||
|
@ -119,7 +130,12 @@ _ecore_glib_context_poll_to(GPollFD *pfds, int count, const fd_set *rfds, const
|
|||
}
|
||||
|
||||
static int
|
||||
_ecore_glib_select__locked(GMainContext *ctx, int ecore_fds, fd_set *rfds, fd_set *wfds, fd_set *efds, struct timeval *ecore_timeout)
|
||||
_ecore_glib_select__locked(GMainContext *ctx,
|
||||
int ecore_fds,
|
||||
fd_set *rfds,
|
||||
fd_set *wfds,
|
||||
fd_set *efds,
|
||||
struct timeval *ecore_timeout)
|
||||
{
|
||||
int priority, maxfds, glib_fds, reqfds, reqtimeout, ret;
|
||||
struct timeval *timeout, glib_timeout;
|
||||
|
@ -155,13 +171,17 @@ _ecore_glib_select__locked(GMainContext *ctx, int ecore_fds, fd_set *rfds, fd_se
|
|||
|
||||
return ret;
|
||||
|
||||
error:
|
||||
error:
|
||||
return _ecore_glib_select_original
|
||||
(ecore_fds, rfds, wfds, efds, ecore_timeout);
|
||||
}
|
||||
|
||||
static int
|
||||
_ecore_glib_select(int ecore_fds, fd_set *rfds, fd_set *wfds, fd_set *efds, struct timeval *ecore_timeout)
|
||||
_ecore_glib_select(int ecore_fds,
|
||||
fd_set *rfds,
|
||||
fd_set *wfds,
|
||||
fd_set *efds,
|
||||
struct timeval *ecore_timeout)
|
||||
{
|
||||
GStaticMutex lock = G_STATIC_MUTEX_INIT;
|
||||
GMutex *mutex = g_static_mutex_get_mutex(&lock);
|
||||
|
@ -187,6 +207,7 @@ _ecore_glib_select(int ecore_fds, fd_set *rfds, fd_set *wfds, fd_set *efds, stru
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include "Ecore.h"
|
||||
#include "ecore_private.h"
|
||||
|
||||
|
||||
struct _Ecore_Idle_Enterer
|
||||
{
|
||||
EINA_INLIST;
|
||||
|
@ -18,7 +17,6 @@ struct _Ecore_Idle_Enterer
|
|||
Eina_Bool delete_me : 1;
|
||||
};
|
||||
|
||||
|
||||
static Ecore_Idle_Enterer *idle_enterers = NULL;
|
||||
static Ecore_Idle_Enterer *idle_enterer_current = NULL;
|
||||
static int idle_enterers_delete_me = 0;
|
||||
|
@ -43,7 +41,8 @@ _ecore_idle_enterer_del(Ecore_Idle_Enterer *idle_enterer);
|
|||
* (or ECORE_CALLBACK_CANCEL) deletes the idle enterer.
|
||||
*/
|
||||
EAPI Ecore_Idle_Enterer *
|
||||
ecore_idle_enterer_add(Ecore_Task_Cb func, const void *data)
|
||||
ecore_idle_enterer_add(Ecore_Task_Cb func,
|
||||
const void *data)
|
||||
{
|
||||
Ecore_Idle_Enterer *ie = NULL;
|
||||
|
||||
|
@ -55,7 +54,7 @@ ecore_idle_enterer_add(Ecore_Task_Cb func, const void *data)
|
|||
ECORE_MAGIC_SET(ie, ECORE_MAGIC_IDLE_ENTERER);
|
||||
ie->func = func;
|
||||
ie->data = (void *)data;
|
||||
idle_enterers = (Ecore_Idle_Enterer *) eina_inlist_append(EINA_INLIST_GET(idle_enterers), EINA_INLIST_GET(ie));
|
||||
idle_enterers = (Ecore_Idle_Enterer *)eina_inlist_append(EINA_INLIST_GET(idle_enterers), EINA_INLIST_GET(ie));
|
||||
unlock:
|
||||
_ecore_unlock();
|
||||
return ie;
|
||||
|
@ -72,7 +71,8 @@ unlock:
|
|||
* (or ECORE_CALLBACK_CANCEL) deletes the idle enterer.
|
||||
*/
|
||||
EAPI Ecore_Idle_Enterer *
|
||||
ecore_idle_enterer_before_add(Ecore_Task_Cb func, const void *data)
|
||||
ecore_idle_enterer_before_add(Ecore_Task_Cb func,
|
||||
const void *data)
|
||||
{
|
||||
Ecore_Idle_Enterer *ie = NULL;
|
||||
|
||||
|
@ -84,7 +84,7 @@ ecore_idle_enterer_before_add(Ecore_Task_Cb func, const void *data)
|
|||
ECORE_MAGIC_SET(ie, ECORE_MAGIC_IDLE_ENTERER);
|
||||
ie->func = func;
|
||||
ie->data = (void *)data;
|
||||
idle_enterers = (Ecore_Idle_Enterer *) eina_inlist_prepend(EINA_INLIST_GET(idle_enterers), EINA_INLIST_GET(ie));
|
||||
idle_enterers = (Ecore_Idle_Enterer *)eina_inlist_prepend(EINA_INLIST_GET(idle_enterers), EINA_INLIST_GET(ie));
|
||||
unlock:
|
||||
_ecore_unlock();
|
||||
return ie;
|
||||
|
@ -126,14 +126,13 @@ _ecore_idle_enterer_del(Ecore_Idle_Enterer *idle_enterer)
|
|||
return idle_enterer->data;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_ecore_idle_enterer_shutdown(void)
|
||||
{
|
||||
Ecore_Idle_Enterer *ie;
|
||||
while ((ie = idle_enterers))
|
||||
{
|
||||
idle_enterers = (Ecore_Idle_Enterer *) eina_inlist_remove(EINA_INLIST_GET(idle_enterers), EINA_INLIST_GET(idle_enterers));
|
||||
idle_enterers = (Ecore_Idle_Enterer *)eina_inlist_remove(EINA_INLIST_GET(idle_enterers), EINA_INLIST_GET(idle_enterers));
|
||||
ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE);
|
||||
free(ie);
|
||||
}
|
||||
|
@ -177,10 +176,10 @@ _ecore_idle_enterer_call(void)
|
|||
Ecore_Idle_Enterer *l;
|
||||
int deleted_idler_enterers_in_use = 0;
|
||||
|
||||
for (l = idle_enterers; l;)
|
||||
for (l = idle_enterers; l; )
|
||||
{
|
||||
Ecore_Idle_Enterer *ie = l;
|
||||
l = (Ecore_Idle_Enterer *) EINA_INLIST_GET(l)->next;
|
||||
l = (Ecore_Idle_Enterer *)EINA_INLIST_GET(l)->next;
|
||||
if (ie->delete_me)
|
||||
{
|
||||
if (ie->references)
|
||||
|
@ -189,7 +188,7 @@ _ecore_idle_enterer_call(void)
|
|||
continue;
|
||||
}
|
||||
|
||||
idle_enterers = (Ecore_Idle_Enterer *) eina_inlist_remove(EINA_INLIST_GET(idle_enterers), EINA_INLIST_GET(ie));
|
||||
idle_enterers = (Ecore_Idle_Enterer *)eina_inlist_remove(EINA_INLIST_GET(idle_enterers), EINA_INLIST_GET(ie));
|
||||
ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE);
|
||||
free(ie);
|
||||
}
|
||||
|
@ -205,3 +204,4 @@ _ecore_idle_enterer_exist(void)
|
|||
if (idle_enterers) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include "Ecore.h"
|
||||
#include "ecore_private.h"
|
||||
|
||||
|
||||
struct _Ecore_Idle_Exiter
|
||||
{
|
||||
EINA_INLIST;
|
||||
|
@ -18,7 +17,6 @@ struct _Ecore_Idle_Exiter
|
|||
Eina_Bool delete_me : 1;
|
||||
};
|
||||
|
||||
|
||||
static Ecore_Idle_Exiter *idle_exiters = NULL;
|
||||
static Ecore_Idle_Exiter *idle_exiter_current = NULL;
|
||||
static int idle_exiters_delete_me = 0;
|
||||
|
@ -42,7 +40,8 @@ _ecore_idle_exiter_del(Ecore_Idle_Exiter *idle_exiter);
|
|||
* (or ECORE_CALLBACK_CANCEL) deletes the idle exiter.
|
||||
*/
|
||||
EAPI Ecore_Idle_Exiter *
|
||||
ecore_idle_exiter_add(Ecore_Task_Cb func, const void *data)
|
||||
ecore_idle_exiter_add(Ecore_Task_Cb func,
|
||||
const void *data)
|
||||
{
|
||||
Ecore_Idle_Exiter *ie = NULL;
|
||||
|
||||
|
@ -53,7 +52,7 @@ ecore_idle_exiter_add(Ecore_Task_Cb func, const void *data)
|
|||
ECORE_MAGIC_SET(ie, ECORE_MAGIC_IDLE_EXITER);
|
||||
ie->func = func;
|
||||
ie->data = (void *)data;
|
||||
idle_exiters = (Ecore_Idle_Exiter *) eina_inlist_append(EINA_INLIST_GET(idle_exiters), EINA_INLIST_GET(ie));
|
||||
idle_exiters = (Ecore_Idle_Exiter *)eina_inlist_append(EINA_INLIST_GET(idle_exiters), EINA_INLIST_GET(ie));
|
||||
unlock:
|
||||
_ecore_unlock();
|
||||
return ie;
|
||||
|
@ -101,7 +100,7 @@ _ecore_idle_exiter_shutdown(void)
|
|||
Ecore_Idle_Exiter *ie;
|
||||
while ((ie = idle_exiters))
|
||||
{
|
||||
idle_exiters = (Ecore_Idle_Exiter *) eina_inlist_remove(EINA_INLIST_GET(idle_exiters), EINA_INLIST_GET(idle_exiters));
|
||||
idle_exiters = (Ecore_Idle_Exiter *)eina_inlist_remove(EINA_INLIST_GET(idle_exiters), EINA_INLIST_GET(idle_exiters));
|
||||
ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE);
|
||||
free(ie);
|
||||
}
|
||||
|
@ -145,11 +144,11 @@ _ecore_idle_exiter_call(void)
|
|||
Ecore_Idle_Exiter *l;
|
||||
int deleted_idler_exiters_in_use = 0;
|
||||
|
||||
for (l = idle_exiters; l;)
|
||||
for (l = idle_exiters; l; )
|
||||
{
|
||||
Ecore_Idle_Exiter *ie = l;
|
||||
|
||||
l = (Ecore_Idle_Exiter *) EINA_INLIST_GET(l)->next;
|
||||
l = (Ecore_Idle_Exiter *)EINA_INLIST_GET(l)->next;
|
||||
if (ie->delete_me)
|
||||
{
|
||||
if (ie->references)
|
||||
|
@ -158,7 +157,7 @@ _ecore_idle_exiter_call(void)
|
|||
continue;
|
||||
}
|
||||
|
||||
idle_exiters = (Ecore_Idle_Exiter *) eina_inlist_remove(EINA_INLIST_GET(idle_exiters), EINA_INLIST_GET(ie));
|
||||
idle_exiters = (Ecore_Idle_Exiter *)eina_inlist_remove(EINA_INLIST_GET(idle_exiters), EINA_INLIST_GET(ie));
|
||||
ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE);
|
||||
free(ie);
|
||||
}
|
||||
|
@ -174,3 +173,4 @@ _ecore_idle_exiter_exist(void)
|
|||
if (idle_exiters) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include "Ecore.h"
|
||||
#include "ecore_private.h"
|
||||
|
||||
|
||||
struct _Ecore_Idler
|
||||
{
|
||||
EINA_INLIST;
|
||||
|
@ -18,7 +17,6 @@ struct _Ecore_Idler
|
|||
Eina_Bool delete_me : 1;
|
||||
};
|
||||
|
||||
|
||||
static Ecore_Idler *idlers = NULL;
|
||||
static Ecore_Idler *idler_current = NULL;
|
||||
static int idlers_delete_me = 0;
|
||||
|
@ -27,7 +25,8 @@ static void *
|
|||
_ecore_idler_del(Ecore_Idler *idler);
|
||||
|
||||
EAPI Ecore_Idler *
|
||||
ecore_idler_add(Ecore_Task_Cb func, const void *data)
|
||||
ecore_idler_add(Ecore_Task_Cb func,
|
||||
const void *data)
|
||||
{
|
||||
Ecore_Idler *ie = NULL;
|
||||
|
||||
|
@ -38,7 +37,7 @@ ecore_idler_add(Ecore_Task_Cb func, const void *data)
|
|||
ECORE_MAGIC_SET(ie, ECORE_MAGIC_IDLER);
|
||||
ie->func = func;
|
||||
ie->data = (void *)data;
|
||||
idlers = (Ecore_Idler *) eina_inlist_append(EINA_INLIST_GET(idlers), EINA_INLIST_GET(ie));
|
||||
idlers = (Ecore_Idler *)eina_inlist_append(EINA_INLIST_GET(idlers), EINA_INLIST_GET(ie));
|
||||
unlock:
|
||||
_ecore_unlock();
|
||||
return ie;
|
||||
|
@ -79,14 +78,13 @@ _ecore_idler_del(Ecore_Idler *idler)
|
|||
return idler->data;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_ecore_idler_shutdown(void)
|
||||
{
|
||||
Ecore_Idler *ie;
|
||||
while ((ie = idlers))
|
||||
{
|
||||
idlers = (Ecore_Idler *) eina_inlist_remove(EINA_INLIST_GET(idlers), EINA_INLIST_GET(idlers));
|
||||
idlers = (Ecore_Idler *)eina_inlist_remove(EINA_INLIST_GET(idlers), EINA_INLIST_GET(idlers));
|
||||
ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE);
|
||||
free(ie);
|
||||
}
|
||||
|
@ -127,10 +125,10 @@ _ecore_idler_all_call(void)
|
|||
{
|
||||
Ecore_Idler *l;
|
||||
int deleted_idlers_in_use = 0;
|
||||
for (l = idlers; l;)
|
||||
for (l = idlers; l; )
|
||||
{
|
||||
Ecore_Idler *ie = l;
|
||||
l = (Ecore_Idler *) EINA_INLIST_GET(l)->next;
|
||||
l = (Ecore_Idler *)EINA_INLIST_GET(l)->next;
|
||||
if (ie->delete_me)
|
||||
{
|
||||
if (ie->references)
|
||||
|
@ -139,7 +137,7 @@ _ecore_idler_all_call(void)
|
|||
continue;
|
||||
}
|
||||
|
||||
idlers = (Ecore_Idler *) eina_inlist_remove(EINA_INLIST_GET(idlers), EINA_INLIST_GET(ie));
|
||||
idlers = (Ecore_Idler *)eina_inlist_remove(EINA_INLIST_GET(idlers), EINA_INLIST_GET(ie));
|
||||
ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE);
|
||||
free(ie);
|
||||
}
|
||||
|
@ -157,3 +155,4 @@ _ecore_idler_exist(void)
|
|||
if (idlers) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,11 +7,14 @@
|
|||
#include "Ecore.h"
|
||||
#include "ecore_private.h"
|
||||
|
||||
static Eina_Bool _ecore_job_event_handler(void *data, int type, void *ev);
|
||||
static void _ecore_job_event_free(void *data, void *ev);
|
||||
static Eina_Bool _ecore_job_event_handler(void *data,
|
||||
int type,
|
||||
void *ev);
|
||||
static void _ecore_job_event_free(void *data,
|
||||
void *ev);
|
||||
|
||||
static int ecore_event_job_type = 0;
|
||||
static Ecore_Event_Handler* _ecore_job_handler = NULL;
|
||||
static Ecore_Event_Handler *_ecore_job_handler = NULL;
|
||||
|
||||
struct _Ecore_Job
|
||||
{
|
||||
|
@ -51,7 +54,8 @@ _ecore_job_shutdown(void)
|
|||
* @note Once the job has been executed, the job handle is invalid.
|
||||
*/
|
||||
EAPI Ecore_Job *
|
||||
ecore_job_add(Ecore_Cb func, const void *data)
|
||||
ecore_job_add(Ecore_Cb func,
|
||||
const void *data)
|
||||
{
|
||||
Ecore_Job *job;
|
||||
|
||||
|
@ -98,7 +102,9 @@ ecore_job_del(Ecore_Job *job)
|
|||
*/
|
||||
|
||||
static Eina_Bool
|
||||
_ecore_job_event_handler(void *data __UNUSED__, int type __UNUSED__, void *ev)
|
||||
_ecore_job_event_handler(void *data __UNUSED__,
|
||||
int type __UNUSED__,
|
||||
void *ev)
|
||||
{
|
||||
Ecore_Job *job;
|
||||
|
||||
|
@ -108,7 +114,9 @@ _ecore_job_event_handler(void *data __UNUSED__, int type __UNUSED__, void *ev)
|
|||
}
|
||||
|
||||
static void
|
||||
_ecore_job_event_free(void *data __UNUSED__, void *ev)
|
||||
_ecore_job_event_free(void *data __UNUSED__,
|
||||
void *ev)
|
||||
{
|
||||
free(ev);
|
||||
}
|
||||
|
||||
|
|
|
@ -79,7 +79,8 @@ typedef union epoll_data {
|
|||
uint64_t u64;
|
||||
} epoll_data_t;
|
||||
|
||||
struct epoll_event {
|
||||
struct epoll_event
|
||||
{
|
||||
uint32_t events;
|
||||
epoll_data_t data;
|
||||
};
|
||||
|
@ -91,14 +92,18 @@ epoll_create(int size __UNUSED__)
|
|||
}
|
||||
|
||||
static inline int
|
||||
epoll_wait(int epfd __UNUSED__, struct epoll_event *events __UNUSED__,
|
||||
int maxevents __UNUSED__, int timeout __UNUSED__)
|
||||
epoll_wait(int epfd __UNUSED__,
|
||||
struct epoll_event *events __UNUSED__,
|
||||
int maxevents __UNUSED__,
|
||||
int timeout __UNUSED__)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
static inline int
|
||||
epoll_ctl(int epfd __UNUSED__, int op __UNUSED__, int fd __UNUSED__,
|
||||
epoll_ctl(int epfd __UNUSED__,
|
||||
int op __UNUSED__,
|
||||
int fd __UNUSED__,
|
||||
struct epoll_event *event __UNUSED__)
|
||||
{
|
||||
return -1;
|
||||
|
@ -117,17 +122,21 @@ epoll_ctl(int epfd __UNUSED__, int op __UNUSED__, int fd __UNUSED__,
|
|||
#define TFD_NONBLOCK 0 /* bogus value */
|
||||
#endif
|
||||
static inline int
|
||||
timerfd_create(int clockid __UNUSED__, int flags __UNUSED__)
|
||||
timerfd_create(int clockid __UNUSED__,
|
||||
int flags __UNUSED__)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
static inline int
|
||||
timerfd_settime(int fd __UNUSED__, int flags __UNUSED__,
|
||||
timerfd_settime(int fd __UNUSED__,
|
||||
int flags __UNUSED__,
|
||||
const struct itimerspec *new_value __UNUSED__,
|
||||
struct itimerspec *old_value __UNUSED__)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif /* HAVE_SYS_TIMERFD_H */
|
||||
|
||||
#ifdef USE_G_MAIN_LOOP
|
||||
|
@ -172,7 +181,6 @@ struct _Ecore_Win32_Handler
|
|||
};
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef USE_G_MAIN_LOOP
|
||||
static int _ecore_main_select(double timeout);
|
||||
#endif
|
||||
|
@ -190,8 +198,11 @@ static void _ecore_main_loop_iterate_internal(int once_only);
|
|||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
static int _ecore_main_win32_select(int nfds, fd_set *readfds, fd_set *writefds,
|
||||
fd_set *exceptfds, struct timeval *timeout);
|
||||
static int _ecore_main_win32_select(int nfds,
|
||||
fd_set *readfds,
|
||||
fd_set *writefds,
|
||||
fd_set *exceptfds,
|
||||
struct timeval *timeout);
|
||||
static void _ecore_main_win32_handlers_cleanup(void);
|
||||
#endif
|
||||
|
||||
|
@ -238,7 +249,7 @@ static GPollFD ecore_epoll_fd;
|
|||
static GPollFD ecore_timer_fd;
|
||||
static GSource *ecore_glib_source;
|
||||
static guint ecore_glib_source_id;
|
||||
static GMainLoop* ecore_main_loop;
|
||||
static GMainLoop *ecore_main_loop;
|
||||
static gboolean ecore_idling;
|
||||
static gboolean _ecore_glib_idle_enterer_called;
|
||||
static gboolean ecore_fds_ready;
|
||||
|
@ -291,7 +302,10 @@ _ecore_get_epoll_fd(void)
|
|||
}
|
||||
|
||||
static inline int
|
||||
_ecore_epoll_add(int efd, int fd, int events, void *ptr)
|
||||
_ecore_epoll_add(int efd,
|
||||
int fd,
|
||||
int events,
|
||||
void *ptr)
|
||||
{
|
||||
struct epoll_event ev;
|
||||
|
||||
|
@ -322,6 +336,7 @@ _gfd_events_from_fdh(Ecore_Fd_Handler *fdh)
|
|||
if (fdh->flags & ECORE_FD_ERROR) events |= G_IO_ERR;
|
||||
return events;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static inline int
|
||||
|
@ -412,7 +427,8 @@ _ecore_main_fdh_poll_modify(Ecore_Fd_Handler *fdh)
|
|||
return r;
|
||||
}
|
||||
|
||||
static inline int _ecore_main_fdh_epoll_mark_active(void)
|
||||
static inline int
|
||||
_ecore_main_fdh_epoll_mark_active(void)
|
||||
{
|
||||
struct epoll_event ev[32];
|
||||
int i, ret;
|
||||
|
@ -459,7 +475,8 @@ static inline int _ecore_main_fdh_epoll_mark_active(void)
|
|||
|
||||
#ifdef USE_G_MAIN_LOOP
|
||||
|
||||
static inline int _ecore_main_fdh_glib_mark_active(void)
|
||||
static inline int
|
||||
_ecore_main_fdh_glib_mark_active(void)
|
||||
{
|
||||
Ecore_Fd_Handler *fdh;
|
||||
int ret = 0;
|
||||
|
@ -479,7 +496,7 @@ static inline int _ecore_main_fdh_glib_mark_active(void)
|
|||
|
||||
_ecore_try_add_to_call_list(fdh);
|
||||
|
||||
if (fdh->gfd.revents & (G_IO_IN|G_IO_OUT|G_IO_ERR)) ret++;
|
||||
if (fdh->gfd.revents & (G_IO_IN | G_IO_OUT | G_IO_ERR)) ret++;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -487,7 +504,8 @@ static inline int _ecore_main_fdh_glib_mark_active(void)
|
|||
|
||||
/* like we are about to enter main_loop_select in _ecore_main_select */
|
||||
static gboolean
|
||||
_ecore_main_gsource_prepare(GSource *source __UNUSED__, gint *next_time)
|
||||
_ecore_main_gsource_prepare(GSource *source __UNUSED__,
|
||||
gint *next_time)
|
||||
{
|
||||
gboolean ready = FALSE;
|
||||
|
||||
|
@ -527,7 +545,7 @@ _ecore_main_gsource_prepare(GSource *source __UNUSED__, gint *next_time)
|
|||
ts.it_interval.tv_sec = 0;
|
||||
ts.it_interval.tv_nsec = 0;
|
||||
ts.it_value.tv_sec = t;
|
||||
ts.it_value.tv_nsec = fmod(t*NS_PER_SEC, NS_PER_SEC);
|
||||
ts.it_value.tv_nsec = fmod(t * NS_PER_SEC, NS_PER_SEC);
|
||||
|
||||
/* timerfd cannot sleep for 0 time */
|
||||
if (ts.it_value.tv_sec || ts.it_value.tv_nsec)
|
||||
|
@ -542,7 +560,7 @@ _ecore_main_gsource_prepare(GSource *source __UNUSED__, gint *next_time)
|
|||
else
|
||||
INF("sleeping for %ld s %06ldus",
|
||||
ts.it_value.tv_sec,
|
||||
ts.it_value.tv_nsec/1000);
|
||||
ts.it_value.tv_nsec / 1000);
|
||||
}
|
||||
}
|
||||
if (r == -1)
|
||||
|
@ -628,7 +646,9 @@ _ecore_main_gsource_check(GSource *source __UNUSED__)
|
|||
|
||||
/* like we just came out of main_loop_select in _ecore_main_select */
|
||||
static gboolean
|
||||
_ecore_main_gsource_dispatch(GSource *source __UNUSED__, GSourceFunc callback __UNUSED__, gpointer user_data __UNUSED__)
|
||||
_ecore_main_gsource_dispatch(GSource *source __UNUSED__,
|
||||
GSourceFunc callback __UNUSED__,
|
||||
gpointer user_data __UNUSED__)
|
||||
{
|
||||
gboolean events_ready, timers_ready, idlers_ready;
|
||||
double next_time;
|
||||
|
@ -951,8 +971,12 @@ ecore_main_loop_select_func_get(void)
|
|||
* @ingroup Ecore_FD_Handler_Group
|
||||
*/
|
||||
EAPI Ecore_Fd_Handler *
|
||||
ecore_main_fd_handler_add(int fd, Ecore_Fd_Handler_Flags flags, Ecore_Fd_Cb func, const void *data,
|
||||
Ecore_Fd_Cb buf_func, const void *buf_data)
|
||||
ecore_main_fd_handler_add(int fd,
|
||||
Ecore_Fd_Handler_Flags flags,
|
||||
Ecore_Fd_Cb func,
|
||||
const void *data,
|
||||
Ecore_Fd_Cb buf_func,
|
||||
const void *buf_data)
|
||||
{
|
||||
Ecore_Fd_Handler *fdh = NULL;
|
||||
|
||||
|
@ -994,7 +1018,9 @@ unlock:
|
|||
|
||||
#ifdef _WIN32
|
||||
EAPI Ecore_Win32_Handler *
|
||||
ecore_main_win32_handler_add(void *h, Ecore_Win32_Handle_Cb func, const void *data)
|
||||
ecore_main_win32_handler_add(void *h,
|
||||
Ecore_Win32_Handle_Cb func,
|
||||
const void *data)
|
||||
{
|
||||
Ecore_Win32_Handler *wh;
|
||||
|
||||
|
@ -1012,15 +1038,17 @@ ecore_main_win32_handler_add(void *h, Ecore_Win32_Handle_Cb func, const void *da
|
|||
EINA_INLIST_GET(wh));
|
||||
return wh;
|
||||
}
|
||||
|
||||
#else
|
||||
EAPI Ecore_Win32_Handler *
|
||||
ecore_main_win32_handler_add(void *h __UNUSED__, Ecore_Win32_Handle_Cb func __UNUSED__,
|
||||
ecore_main_win32_handler_add(void *h __UNUSED__,
|
||||
Ecore_Win32_Handle_Cb func __UNUSED__,
|
||||
const void *data __UNUSED__)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Marks an FD handler for deletion.
|
||||
|
@ -1069,12 +1097,14 @@ ecore_main_win32_handler_del(Ecore_Win32_Handler *win32_handler)
|
|||
win32_handlers_delete_me = EINA_TRUE;
|
||||
return win32_handler->data;
|
||||
}
|
||||
|
||||
#else
|
||||
EAPI void *
|
||||
ecore_main_win32_handler_del(Ecore_Win32_Handler *win32_handler __UNUSED__)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -1096,7 +1126,9 @@ ecore_main_win32_handler_del(Ecore_Win32_Handler *win32_handler __UNUSED__)
|
|||
* @ingroup Ecore_FD_Handler_Group
|
||||
*/
|
||||
EAPI void
|
||||
ecore_main_fd_handler_prepare_callback_set(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Prep_Cb func, const void *data)
|
||||
ecore_main_fd_handler_prepare_callback_set(Ecore_Fd_Handler *fd_handler,
|
||||
Ecore_Fd_Prep_Cb func,
|
||||
const void *data)
|
||||
{
|
||||
_ecore_lock();
|
||||
|
||||
|
@ -1151,7 +1183,8 @@ unlock:
|
|||
* @ingroup Ecore_FD_Handler_Group
|
||||
*/
|
||||
EAPI Eina_Bool
|
||||
ecore_main_fd_handler_active_get(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Handler_Flags flags)
|
||||
ecore_main_fd_handler_active_get(Ecore_Fd_Handler *fd_handler,
|
||||
Ecore_Fd_Handler_Flags flags)
|
||||
{
|
||||
int ret = EINA_FALSE;
|
||||
|
||||
|
@ -1178,7 +1211,8 @@ unlock:
|
|||
* @ingroup Ecore_FD_Handler_Group
|
||||
*/
|
||||
EAPI void
|
||||
ecore_main_fd_handler_active_set(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Handler_Flags flags)
|
||||
ecore_main_fd_handler_active_set(Ecore_Fd_Handler *fd_handler,
|
||||
Ecore_Fd_Handler_Flags flags)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
@ -1219,7 +1253,7 @@ _ecore_main_shutdown(void)
|
|||
Ecore_Fd_Handler *fdh;
|
||||
|
||||
fdh = fd_handlers;
|
||||
fd_handlers = (Ecore_Fd_Handler *) eina_inlist_remove(EINA_INLIST_GET(fd_handlers),
|
||||
fd_handlers = (Ecore_Fd_Handler *)eina_inlist_remove(EINA_INLIST_GET(fd_handlers),
|
||||
EINA_INLIST_GET(fdh));
|
||||
ECORE_MAGIC_SET(fdh, ECORE_MAGIC_NONE);
|
||||
free(fdh);
|
||||
|
@ -1242,7 +1276,7 @@ _ecore_main_shutdown(void)
|
|||
Ecore_Win32_Handler *wh;
|
||||
|
||||
wh = win32_handlers;
|
||||
win32_handlers = (Ecore_Win32_Handler *) eina_inlist_remove(EINA_INLIST_GET(win32_handlers),
|
||||
win32_handlers = (Ecore_Win32_Handler *)eina_inlist_remove(EINA_INLIST_GET(win32_handlers),
|
||||
EINA_INLIST_GET(wh));
|
||||
ECORE_MAGIC_SET(wh, ECORE_MAGIC_NONE);
|
||||
free(wh);
|
||||
|
@ -1362,7 +1396,8 @@ _ecore_main_select(double timeout)
|
|||
{
|
||||
#ifndef _WIN32
|
||||
if (errno == EINTR) return -1;
|
||||
else if (errno == EBADF) _ecore_main_fd_handlers_bads_rem();
|
||||
else if (errno == EBADF)
|
||||
_ecore_main_fd_handlers_bads_rem();
|
||||
#endif
|
||||
}
|
||||
if (ret > 0)
|
||||
|
@ -1396,6 +1431,7 @@ _ecore_main_select(double timeout)
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
|
@ -1410,7 +1446,7 @@ _ecore_main_fd_handlers_bads_rem(void)
|
|||
ERR("Removing bad fds");
|
||||
for (l = EINA_INLIST_GET(fd_handlers); l; )
|
||||
{
|
||||
fdh = (Ecore_Fd_Handler *) l;
|
||||
fdh = (Ecore_Fd_Handler *)l;
|
||||
l = l->next;
|
||||
errno = 0;
|
||||
|
||||
|
@ -1456,6 +1492,7 @@ _ecore_main_fd_handlers_bads_rem(void)
|
|||
}
|
||||
_ecore_main_fd_handlers_cleanup();
|
||||
}
|
||||
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
@ -1519,6 +1556,7 @@ _ecore_main_win32_handlers_cleanup(void)
|
|||
}
|
||||
if (!deleted_in_use) win32_handlers_delete_me = EINA_FALSE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void
|
||||
|
@ -1549,7 +1587,6 @@ _ecore_main_fd_handlers_call(void)
|
|||
fdh->delete_me = EINA_TRUE;
|
||||
fd_handlers_to_delete = eina_list_append(fd_handlers_to_delete, fdh);
|
||||
}
|
||||
|
||||
}
|
||||
fdh->references--;
|
||||
_ecore_fd_valid();
|
||||
|
@ -1634,7 +1671,7 @@ _ecore_main_loop_spin_no_timers(void)
|
|||
{
|
||||
/* if we have idlers we HAVE to spin and handle everything
|
||||
* in a polling way - spin in a tight polling loop */
|
||||
for (;;)
|
||||
for (;; )
|
||||
{
|
||||
int action = _ecore_main_loop_spin_core();
|
||||
if (action != SPIN_MORE) return action;
|
||||
|
@ -1651,7 +1688,7 @@ _ecore_main_loop_spin_timers(void)
|
|||
{
|
||||
/* if we have idlers we HAVE to spin and handle everything
|
||||
* in a polling way - spin in a tight polling loop */
|
||||
for (;;)
|
||||
for (;; )
|
||||
{
|
||||
int action = _ecore_main_loop_spin_core();
|
||||
if (action != SPIN_MORE) return action;
|
||||
|
@ -1782,7 +1819,6 @@ start_loop: /***************************************************************/
|
|||
}
|
||||
_ecore_fps_marker_2();
|
||||
|
||||
|
||||
/* actually wake up and deal with input, events etc. */
|
||||
process_all: /***********************************************************/
|
||||
|
||||
|
@ -1809,12 +1845,16 @@ process_all: /***********************************************************/
|
|||
done: /*******************************************************************/
|
||||
in_main_loop--;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
static int
|
||||
_ecore_main_win32_select(int nfds __UNUSED__, fd_set *readfds, fd_set *writefds,
|
||||
fd_set *exceptfds, struct timeval *tv)
|
||||
_ecore_main_win32_select(int nfds __UNUSED__,
|
||||
fd_set *readfds,
|
||||
fd_set *writefds,
|
||||
fd_set *exceptfds,
|
||||
struct timeval *tv)
|
||||
{
|
||||
HANDLE objects[MAXIMUM_WAIT_OBJECTS];
|
||||
int sockets[MAXIMUM_WAIT_OBJECTS];
|
||||
|
@ -1972,4 +2012,5 @@ _ecore_main_win32_select(int nfds __UNUSED__, fd_set *readfds, fd_set *writefds,
|
|||
|
||||
return res;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -86,9 +86,8 @@ struct _Ecore_Pipe
|
|||
Eina_Bool delete_me : 1;
|
||||
};
|
||||
|
||||
|
||||
static Eina_Bool _ecore_pipe_read(void *data, Ecore_Fd_Handler *fd_handler);
|
||||
|
||||
static Eina_Bool _ecore_pipe_read(void *data,
|
||||
Ecore_Fd_Handler *fd_handler);
|
||||
|
||||
/**
|
||||
* @addtogroup Ecore_Pipe_Group
|
||||
|
@ -108,7 +107,8 @@ static Eina_Bool _ecore_pipe_read(void *data, Ecore_Fd_Handler *fd_handler);
|
|||
* @c NULL otherwise.
|
||||
*/
|
||||
EAPI Ecore_Pipe *
|
||||
ecore_pipe_add(Ecore_Pipe_Cb handler, const void *data)
|
||||
ecore_pipe_add(Ecore_Pipe_Cb handler,
|
||||
const void *data)
|
||||
{
|
||||
Ecore_Pipe *p;
|
||||
int fds[2];
|
||||
|
@ -250,7 +250,9 @@ ecore_pipe_thaw(Ecore_Pipe *p)
|
|||
* Negative value for @p wait means infite wait.
|
||||
*/
|
||||
EAPI int
|
||||
ecore_pipe_wait(Ecore_Pipe *p, int message_count, double wait)
|
||||
ecore_pipe_wait(Ecore_Pipe *p,
|
||||
int message_count,
|
||||
double wait)
|
||||
{
|
||||
struct timeval tv, *t;
|
||||
fd_set rset;
|
||||
|
@ -356,7 +358,9 @@ ecore_pipe_write_close(Ecore_Pipe *p)
|
|||
* @return Returns EINA_TRUE on a successful write, EINA_FALSE on an error
|
||||
*/
|
||||
EAPI Eina_Bool
|
||||
ecore_pipe_write(Ecore_Pipe *p, const void *buffer, unsigned int nbytes)
|
||||
ecore_pipe_write(Ecore_Pipe *p,
|
||||
const void *buffer,
|
||||
unsigned int nbytes)
|
||||
{
|
||||
ssize_t ret;
|
||||
size_t already_written = 0;
|
||||
|
@ -459,7 +463,8 @@ _ecore_pipe_unhandle(Ecore_Pipe *p)
|
|||
}
|
||||
|
||||
static Eina_Bool
|
||||
_ecore_pipe_read(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__)
|
||||
_ecore_pipe_read(void *data,
|
||||
Ecore_Fd_Handler *fd_handler __UNUSED__)
|
||||
{
|
||||
Ecore_Pipe *p = (Ecore_Pipe *)data;
|
||||
int i;
|
||||
|
@ -664,3 +669,4 @@ _ecore_pipe_read(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__)
|
|||
_ecore_pipe_unhandle(p);
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include "Ecore.h"
|
||||
#include "ecore_private.h"
|
||||
|
||||
|
||||
struct _Ecore_Poller
|
||||
{
|
||||
EINA_INLIST;
|
||||
|
@ -18,7 +17,6 @@ struct _Ecore_Poller
|
|||
void *data;
|
||||
};
|
||||
|
||||
|
||||
static Ecore_Timer *timer = NULL;
|
||||
static int min_interval = -1;
|
||||
static int interval_incr = 0;
|
||||
|
@ -31,13 +29,13 @@ static double poll_cur_interval = 0.0;
|
|||
static double last_tick = 0.0;
|
||||
static Ecore_Poller *pollers[16] =
|
||||
{
|
||||
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
||||
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
|
||||
};
|
||||
static unsigned short poller_counters[16] =
|
||||
{
|
||||
0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
static void _ecore_poller_next_tick_eval(void);
|
||||
|
@ -154,13 +152,13 @@ _ecore_poller_cb_timer(void *data __UNUSED__)
|
|||
/* FIXME: walk all pollers and remove deleted ones */
|
||||
for (i = 0; i < 15; i++)
|
||||
{
|
||||
for (l = pollers[i]; l;)
|
||||
for (l = pollers[i]; l; )
|
||||
{
|
||||
poller = l;
|
||||
l = (Ecore_Poller *) EINA_INLIST_GET(l)->next;
|
||||
l = (Ecore_Poller *)EINA_INLIST_GET(l)->next;
|
||||
if (poller->delete_me)
|
||||
{
|
||||
pollers[i] = (Ecore_Poller *) eina_inlist_remove(EINA_INLIST_GET(pollers[i]), EINA_INLIST_GET(poller));
|
||||
pollers[i] = (Ecore_Poller *)eina_inlist_remove(EINA_INLIST_GET(pollers[i]), EINA_INLIST_GET(poller));
|
||||
free(poller);
|
||||
poller_delete_count--;
|
||||
changes++;
|
||||
|
@ -196,7 +194,6 @@ _ecore_poller_cb_timer(void *data __UNUSED__)
|
|||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Sets the time between ticks (in seconds) for the given ticker clock.
|
||||
* @param type The ticker type to adjust
|
||||
|
@ -206,7 +203,8 @@ _ecore_poller_cb_timer(void *data __UNUSED__)
|
|||
* by @p type to the time period defined by @p poll_time.
|
||||
*/
|
||||
EAPI void
|
||||
ecore_poller_poll_interval_set(Ecore_Poller_Type type __UNUSED__, double poll_time)
|
||||
ecore_poller_poll_interval_set(Ecore_Poller_Type type __UNUSED__,
|
||||
double poll_time)
|
||||
{
|
||||
poll_interval = poll_time;
|
||||
_ecore_poller_next_tick_eval();
|
||||
|
@ -272,7 +270,10 @@ ecore_poller_poll_interval_get(Ecore_Poller_Type type __UNUSED__)
|
|||
* invalid.
|
||||
*/
|
||||
EAPI Ecore_Poller *
|
||||
ecore_poller_add(Ecore_Poller_Type type __UNUSED__, int interval, Ecore_Task_Cb func, const void *data)
|
||||
ecore_poller_add(Ecore_Poller_Type type __UNUSED__,
|
||||
int interval,
|
||||
Ecore_Task_Cb func,
|
||||
const void *data)
|
||||
{
|
||||
Ecore_Poller *poller;
|
||||
int ibit;
|
||||
|
@ -297,7 +298,7 @@ ecore_poller_add(Ecore_Poller_Type type __UNUSED__, int interval, Ecore_Task_Cb
|
|||
poller->ibit = ibit;
|
||||
poller->func = func;
|
||||
poller->data = (void *)data;
|
||||
pollers[poller->ibit] = (Ecore_Poller *) eina_inlist_prepend(EINA_INLIST_GET(pollers[poller->ibit]), EINA_INLIST_GET(poller));
|
||||
pollers[poller->ibit] = (Ecore_Poller *)eina_inlist_prepend(EINA_INLIST_GET(pollers[poller->ibit]), EINA_INLIST_GET(poller));
|
||||
if (poller_walking)
|
||||
just_added_poller++;
|
||||
else
|
||||
|
@ -316,7 +317,8 @@ ecore_poller_add(Ecore_Poller_Type type __UNUSED__, int interval, Ecore_Task_Cb
|
|||
* a poll rate without deleting and re-creating a poller.
|
||||
*/
|
||||
EAPI Eina_Bool
|
||||
ecore_poller_poller_interval_set(Ecore_Poller *poller, int interval)
|
||||
ecore_poller_poller_interval_set(Ecore_Poller *poller,
|
||||
int interval)
|
||||
{
|
||||
int ibit;
|
||||
|
||||
|
@ -340,9 +342,9 @@ ecore_poller_poller_interval_set(Ecore_Poller *poller, int interval)
|
|||
/* if interval specified is the same as interval set, return true without wasting time */
|
||||
if (poller->ibit == ibit)
|
||||
return EINA_TRUE;
|
||||
pollers[poller->ibit] = (Ecore_Poller *) eina_inlist_remove(EINA_INLIST_GET(pollers[poller->ibit]), EINA_INLIST_GET(poller));
|
||||
pollers[poller->ibit] = (Ecore_Poller *)eina_inlist_remove(EINA_INLIST_GET(pollers[poller->ibit]), EINA_INLIST_GET(poller));
|
||||
poller->ibit = ibit;
|
||||
pollers[poller->ibit] = (Ecore_Poller *) eina_inlist_prepend(EINA_INLIST_GET(pollers[poller->ibit]), EINA_INLIST_GET(poller));
|
||||
pollers[poller->ibit] = (Ecore_Poller *)eina_inlist_prepend(EINA_INLIST_GET(pollers[poller->ibit]), EINA_INLIST_GET(poller));
|
||||
if (poller_walking)
|
||||
just_added_poller++;
|
||||
else
|
||||
|
@ -410,7 +412,7 @@ ecore_poller_del(Ecore_Poller *poller)
|
|||
}
|
||||
/* not in loop so safe - delete immediately */
|
||||
data = poller->data;
|
||||
pollers[poller->ibit] = (Ecore_Poller *) eina_inlist_remove(EINA_INLIST_GET(pollers[poller->ibit]), EINA_INLIST_GET(poller));
|
||||
pollers[poller->ibit] = (Ecore_Poller *)eina_inlist_remove(EINA_INLIST_GET(pollers[poller->ibit]), EINA_INLIST_GET(poller));
|
||||
free(poller);
|
||||
_ecore_poller_next_tick_eval();
|
||||
return data;
|
||||
|
@ -430,8 +432,9 @@ _ecore_poller_shutdown(void)
|
|||
{
|
||||
while ((poller = pollers[i]))
|
||||
{
|
||||
pollers[i] = (Ecore_Poller *) eina_inlist_remove(EINA_INLIST_GET(pollers[i]), EINA_INLIST_GET(pollers[i]));
|
||||
pollers[i] = (Ecore_Poller *)eina_inlist_remove(EINA_INLIST_GET(pollers[i]), EINA_INLIST_GET(pollers[i]));
|
||||
free(poller);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include <assert.h>
|
||||
|
||||
extern int _ecore_log_dom ;
|
||||
extern int _ecore_log_dom;
|
||||
#ifdef _ECORE_DEFAULT_LOG_DOM
|
||||
# undef _ECORE_DEFAULT_LOG_DOM
|
||||
#endif
|
||||
|
@ -79,7 +79,6 @@ extern int _ecore_log_dom ;
|
|||
#define ECORE_MAGIC_WIN32_HANDLER 0xf7e8f1a3
|
||||
#define ECORE_MAGIC_JOB 0x76543210
|
||||
|
||||
|
||||
#define ECORE_MAGIC Ecore_Magic __magic
|
||||
|
||||
#define ECORE_MAGIC_SET(d, m) (d)->__magic = (m)
|
||||
|
@ -96,7 +95,9 @@ extern int _ecore_log_dom ;
|
|||
#undef IF_FN_DEL
|
||||
#define IF_FN_DEL(_fn, ptr) if (ptr) { _fn(ptr); ptr = NULL; }
|
||||
|
||||
EAPI void ecore_print_warning(const char *function, const char *sparam);
|
||||
EAPI void
|
||||
ecore_print_warning(const char *function,
|
||||
const char *sparam);
|
||||
|
||||
/* convenience macros for checking pointer parameters for non-NULL */
|
||||
#undef CHECK_PARAM_POINTER_RETURN
|
||||
|
@ -117,13 +118,19 @@ EAPI void ecore_print_warning(const char *function, const char *sparam);
|
|||
|
||||
typedef unsigned int Ecore_Magic;
|
||||
|
||||
EAPI void _ecore_magic_fail(const void *d, Ecore_Magic m, Ecore_Magic req_m, const char *fname);
|
||||
EAPI void _ecore_magic_fail(const void *d,
|
||||
Ecore_Magic m,
|
||||
Ecore_Magic req_m,
|
||||
const char *fname);
|
||||
|
||||
void _ecore_time_init(void);
|
||||
|
||||
Ecore_Timer *_ecore_timer_loop_add(double in, Ecore_Task_Cb func, const void *data);
|
||||
Ecore_Timer *_ecore_timer_loop_add(double in,
|
||||
Ecore_Task_Cb func,
|
||||
const void *data);
|
||||
void *_ecore_timer_del(Ecore_Timer *timer);
|
||||
void _ecore_timer_delay(Ecore_Timer *timer, double add);
|
||||
void _ecore_timer_delay(Ecore_Timer *timer,
|
||||
double add);
|
||||
void _ecore_timer_shutdown(void);
|
||||
void _ecore_timer_cleanup(void);
|
||||
void _ecore_timer_enable_new(void);
|
||||
|
@ -147,12 +154,16 @@ int _ecore_idle_exiter_exist(void);
|
|||
|
||||
void _ecore_event_shutdown(void);
|
||||
int _ecore_event_exist(void);
|
||||
Ecore_Event *_ecore_event_add(int type, void *ev, Ecore_End_Cb func_free, void *data);
|
||||
Ecore_Event *_ecore_event_add(int type,
|
||||
void *ev,
|
||||
Ecore_End_Cb func_free,
|
||||
void *data);
|
||||
void _ecore_event_call(void);
|
||||
void *_ecore_event_handler_del(Ecore_Event_Handler *event_handler);
|
||||
|
||||
Ecore_Timer *_ecore_exe_doomsday_clock_get(Ecore_Exe *exe);
|
||||
void _ecore_exe_doomsday_clock_set(Ecore_Exe *exe, Ecore_Timer *dc);
|
||||
void _ecore_exe_doomsday_clock_set(Ecore_Exe *exe,
|
||||
Ecore_Timer *dc);
|
||||
|
||||
EAPI void *_ecore_event_signal_user_new(void);
|
||||
void *_ecore_event_signal_hup_new(void);
|
||||
|
@ -166,10 +177,15 @@ void _ecore_main_shutdown(void);
|
|||
|
||||
#if defined (_WIN32) || defined (__lv2ppu__)
|
||||
static inline void _ecore_signal_shutdown(void) { }
|
||||
|
||||
static inline void _ecore_signal_init(void) { }
|
||||
|
||||
static inline void _ecore_signal_received_process(void) { }
|
||||
|
||||
static inline int _ecore_signal_count_get(void) { return 0; }
|
||||
|
||||
static inline void _ecore_signal_call(void) { }
|
||||
|
||||
#else
|
||||
void _ecore_signal_shutdown(void);
|
||||
void _ecore_signal_init(void);
|
||||
|
@ -183,7 +199,8 @@ void _ecore_exe_shutdown(void);
|
|||
#ifndef _WIN32
|
||||
Ecore_Exe *_ecore_exe_find(pid_t pid);
|
||||
void *_ecore_exe_event_del_new(void);
|
||||
void _ecore_exe_event_del_free(void *data, void *ev);
|
||||
void _ecore_exe_event_del_free(void *data,
|
||||
void *ev);
|
||||
#endif
|
||||
|
||||
void _ecore_animator_shutdown(void);
|
||||
|
@ -238,7 +255,8 @@ _ecore_unlock(void)
|
|||
* Callback wrappers all assume that ecore _ecore_lock has been called
|
||||
*/
|
||||
static inline Eina_Bool
|
||||
_ecore_call_task_cb(Ecore_Task_Cb func, void *data)
|
||||
_ecore_call_task_cb(Ecore_Task_Cb func,
|
||||
void *data)
|
||||
{
|
||||
Eina_Bool r;
|
||||
|
||||
|
@ -250,7 +268,8 @@ _ecore_call_task_cb(Ecore_Task_Cb func, void *data)
|
|||
}
|
||||
|
||||
static inline void *
|
||||
_ecore_call_data_cb(Ecore_Data_Cb func, void *data)
|
||||
_ecore_call_data_cb(Ecore_Data_Cb func,
|
||||
void *data)
|
||||
{
|
||||
void *r;
|
||||
|
||||
|
@ -262,7 +281,9 @@ _ecore_call_data_cb(Ecore_Data_Cb func, void *data)
|
|||
}
|
||||
|
||||
static inline void
|
||||
_ecore_call_end_cb(Ecore_End_Cb func, void *user_data, void *func_data)
|
||||
_ecore_call_end_cb(Ecore_End_Cb func,
|
||||
void *user_data,
|
||||
void *func_data)
|
||||
{
|
||||
_ecore_unlock();
|
||||
func(user_data, func_data);
|
||||
|
@ -270,8 +291,11 @@ _ecore_call_end_cb(Ecore_End_Cb func, void *user_data, void *func_data)
|
|||
}
|
||||
|
||||
static inline Eina_Bool
|
||||
_ecore_call_filter_cb(Ecore_Filter_Cb func, void *data,
|
||||
void *loop_data, int type, void *event)
|
||||
_ecore_call_filter_cb(Ecore_Filter_Cb func,
|
||||
void *data,
|
||||
void *loop_data,
|
||||
int type,
|
||||
void *event)
|
||||
{
|
||||
Eina_Bool r;
|
||||
|
||||
|
@ -283,7 +307,10 @@ _ecore_call_filter_cb(Ecore_Filter_Cb func, void *data,
|
|||
}
|
||||
|
||||
static inline Eina_Bool
|
||||
_ecore_call_handler_cb(Ecore_Event_Handler_Cb func, void *data, int type, void *event)
|
||||
_ecore_call_handler_cb(Ecore_Event_Handler_Cb func,
|
||||
void *data,
|
||||
int type,
|
||||
void *event)
|
||||
{
|
||||
Eina_Bool r;
|
||||
|
||||
|
@ -295,7 +322,9 @@ _ecore_call_handler_cb(Ecore_Event_Handler_Cb func, void *data, int type, void *
|
|||
}
|
||||
|
||||
static inline void
|
||||
_ecore_call_prep_cb(Ecore_Fd_Prep_Cb func, void *data, Ecore_Fd_Handler *fd_handler)
|
||||
_ecore_call_prep_cb(Ecore_Fd_Prep_Cb func,
|
||||
void *data,
|
||||
Ecore_Fd_Handler *fd_handler)
|
||||
{
|
||||
_ecore_unlock();
|
||||
func(data, fd_handler);
|
||||
|
@ -303,7 +332,9 @@ _ecore_call_prep_cb(Ecore_Fd_Prep_Cb func, void *data, Ecore_Fd_Handler *fd_hand
|
|||
}
|
||||
|
||||
static inline Eina_Bool
|
||||
_ecore_call_fd_cb(Ecore_Fd_Cb func, void *data, Ecore_Fd_Handler *fd_handler)
|
||||
_ecore_call_fd_cb(Ecore_Fd_Cb func,
|
||||
void *data,
|
||||
Ecore_Fd_Handler *fd_handler)
|
||||
{
|
||||
Eina_Bool r;
|
||||
|
||||
|
|
|
@ -18,17 +18,36 @@
|
|||
|
||||
typedef void (*Signal_Handler)(int sig, siginfo_t *si, void *foo);
|
||||
|
||||
static void _ecore_signal_callback_set(int sig, Signal_Handler func);
|
||||
static void _ecore_signal_callback_ignore(int sig, siginfo_t *si, void *foo);
|
||||
static void _ecore_signal_callback_sigchld(int sig, siginfo_t *si, void *foo);
|
||||
static void _ecore_signal_callback_sigusr1(int sig, siginfo_t *si, void *foo);
|
||||
static void _ecore_signal_callback_sigusr2(int sig, siginfo_t *si, void *foo);
|
||||
static void _ecore_signal_callback_sighup(int sig, siginfo_t *si, void *foo);
|
||||
static void _ecore_signal_callback_sigquit(int sig, siginfo_t *si, void *foo);
|
||||
static void _ecore_signal_callback_sigint(int sig, siginfo_t *si, void *foo);
|
||||
static void _ecore_signal_callback_sigterm(int sig, siginfo_t *si, void *foo);
|
||||
static void _ecore_signal_callback_set(int sig,
|
||||
Signal_Handler func);
|
||||
static void _ecore_signal_callback_ignore(int sig,
|
||||
siginfo_t *si,
|
||||
void *foo);
|
||||
static void _ecore_signal_callback_sigchld(int sig,
|
||||
siginfo_t *si,
|
||||
void *foo);
|
||||
static void _ecore_signal_callback_sigusr1(int sig,
|
||||
siginfo_t *si,
|
||||
void *foo);
|
||||
static void _ecore_signal_callback_sigusr2(int sig,
|
||||
siginfo_t *si,
|
||||
void *foo);
|
||||
static void _ecore_signal_callback_sighup(int sig,
|
||||
siginfo_t *si,
|
||||
void *foo);
|
||||
static void _ecore_signal_callback_sigquit(int sig,
|
||||
siginfo_t *si,
|
||||
void *foo);
|
||||
static void _ecore_signal_callback_sigint(int sig,
|
||||
siginfo_t *si,
|
||||
void *foo);
|
||||
static void _ecore_signal_callback_sigterm(int sig,
|
||||
siginfo_t *si,
|
||||
void *foo);
|
||||
#ifdef SIGPWR
|
||||
static void _ecore_signal_callback_sigpwr(int sig, siginfo_t *si, void *foo);
|
||||
static void _ecore_signal_callback_sigpwr(int sig,
|
||||
siginfo_t *si,
|
||||
void *foo);
|
||||
#endif
|
||||
|
||||
static Eina_Bool _ecore_signal_exe_exit_delay(void *data);
|
||||
|
@ -62,17 +81,17 @@ static volatile siginfo_t sigpwr_info[MAXSIGQ];
|
|||
void
|
||||
_ecore_signal_shutdown(void)
|
||||
{
|
||||
_ecore_signal_callback_set(SIGPIPE, (Signal_Handler) SIG_DFL);
|
||||
_ecore_signal_callback_set(SIGALRM, (Signal_Handler) SIG_DFL);
|
||||
_ecore_signal_callback_set(SIGCHLD, (Signal_Handler) SIG_DFL);
|
||||
_ecore_signal_callback_set(SIGUSR1, (Signal_Handler) SIG_DFL);
|
||||
_ecore_signal_callback_set(SIGUSR2, (Signal_Handler) SIG_DFL);
|
||||
_ecore_signal_callback_set(SIGHUP, (Signal_Handler) SIG_DFL);
|
||||
_ecore_signal_callback_set(SIGQUIT, (Signal_Handler) SIG_DFL);
|
||||
_ecore_signal_callback_set(SIGINT, (Signal_Handler) SIG_DFL);
|
||||
_ecore_signal_callback_set(SIGTERM, (Signal_Handler) SIG_DFL);
|
||||
_ecore_signal_callback_set(SIGPIPE, (Signal_Handler)SIG_DFL);
|
||||
_ecore_signal_callback_set(SIGALRM, (Signal_Handler)SIG_DFL);
|
||||
_ecore_signal_callback_set(SIGCHLD, (Signal_Handler)SIG_DFL);
|
||||
_ecore_signal_callback_set(SIGUSR1, (Signal_Handler)SIG_DFL);
|
||||
_ecore_signal_callback_set(SIGUSR2, (Signal_Handler)SIG_DFL);
|
||||
_ecore_signal_callback_set(SIGHUP, (Signal_Handler)SIG_DFL);
|
||||
_ecore_signal_callback_set(SIGQUIT, (Signal_Handler)SIG_DFL);
|
||||
_ecore_signal_callback_set(SIGINT, (Signal_Handler)SIG_DFL);
|
||||
_ecore_signal_callback_set(SIGTERM, (Signal_Handler)SIG_DFL);
|
||||
#ifdef SIGPWR
|
||||
_ecore_signal_callback_set(SIGPWR, (Signal_Handler) SIG_DFL);
|
||||
_ecore_signal_callback_set(SIGPWR, (Signal_Handler)SIG_DFL);
|
||||
sigpwr_count = 0;
|
||||
#endif
|
||||
sigchld_count = 0;
|
||||
|
@ -83,7 +102,6 @@ _ecore_signal_shutdown(void)
|
|||
sigint_count = 0;
|
||||
sigterm_count = 0;
|
||||
sig_count = 0;
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -364,7 +382,8 @@ _ecore_signal_call(void)
|
|||
}
|
||||
|
||||
static void
|
||||
_ecore_signal_callback_set(int sig, Signal_Handler func)
|
||||
_ecore_signal_callback_set(int sig,
|
||||
Signal_Handler func)
|
||||
{
|
||||
struct sigaction sa;
|
||||
|
||||
|
@ -375,12 +394,16 @@ _ecore_signal_callback_set(int sig, Signal_Handler func)
|
|||
}
|
||||
|
||||
static void
|
||||
_ecore_signal_callback_ignore(int sig __UNUSED__, siginfo_t *si __UNUSED__, void *foo __UNUSED__)
|
||||
_ecore_signal_callback_ignore(int sig __UNUSED__,
|
||||
siginfo_t *si __UNUSED__,
|
||||
void *foo __UNUSED__)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
_ecore_signal_callback_sigchld(int sig __UNUSED__, siginfo_t *si, void *foo __UNUSED__)
|
||||
_ecore_signal_callback_sigchld(int sig __UNUSED__,
|
||||
siginfo_t *si,
|
||||
void *foo __UNUSED__)
|
||||
{
|
||||
volatile sig_atomic_t n;
|
||||
n = sigchld_count;
|
||||
|
@ -397,7 +420,9 @@ _ecore_signal_callback_sigchld(int sig __UNUSED__, siginfo_t *si, void *foo __UN
|
|||
}
|
||||
|
||||
static void
|
||||
_ecore_signal_callback_sigusr1(int sig __UNUSED__, siginfo_t *si, void *foo __UNUSED__)
|
||||
_ecore_signal_callback_sigusr1(int sig __UNUSED__,
|
||||
siginfo_t *si,
|
||||
void *foo __UNUSED__)
|
||||
{
|
||||
volatile sig_atomic_t n;
|
||||
n = sigusr1_count;
|
||||
|
@ -413,7 +438,9 @@ _ecore_signal_callback_sigusr1(int sig __UNUSED__, siginfo_t *si, void *foo __UN
|
|||
}
|
||||
|
||||
static void
|
||||
_ecore_signal_callback_sigusr2(int sig __UNUSED__, siginfo_t *si, void *foo __UNUSED__)
|
||||
_ecore_signal_callback_sigusr2(int sig __UNUSED__,
|
||||
siginfo_t *si,
|
||||
void *foo __UNUSED__)
|
||||
{
|
||||
volatile sig_atomic_t n;
|
||||
n = sigusr2_count;
|
||||
|
@ -429,7 +456,9 @@ _ecore_signal_callback_sigusr2(int sig __UNUSED__, siginfo_t *si, void *foo __UN
|
|||
}
|
||||
|
||||
static void
|
||||
_ecore_signal_callback_sighup(int sig __UNUSED__, siginfo_t *si, void *foo __UNUSED__)
|
||||
_ecore_signal_callback_sighup(int sig __UNUSED__,
|
||||
siginfo_t *si,
|
||||
void *foo __UNUSED__)
|
||||
{
|
||||
volatile sig_atomic_t n;
|
||||
n = sighup_count;
|
||||
|
@ -445,7 +474,9 @@ _ecore_signal_callback_sighup(int sig __UNUSED__, siginfo_t *si, void *foo __UNU
|
|||
}
|
||||
|
||||
static void
|
||||
_ecore_signal_callback_sigquit(int sig __UNUSED__, siginfo_t *si, void *foo __UNUSED__)
|
||||
_ecore_signal_callback_sigquit(int sig __UNUSED__,
|
||||
siginfo_t *si,
|
||||
void *foo __UNUSED__)
|
||||
{
|
||||
volatile sig_atomic_t n;
|
||||
n = sigquit_count;
|
||||
|
@ -461,7 +492,9 @@ _ecore_signal_callback_sigquit(int sig __UNUSED__, siginfo_t *si, void *foo __UN
|
|||
}
|
||||
|
||||
static void
|
||||
_ecore_signal_callback_sigint(int sig __UNUSED__, siginfo_t *si, void *foo __UNUSED__)
|
||||
_ecore_signal_callback_sigint(int sig __UNUSED__,
|
||||
siginfo_t *si,
|
||||
void *foo __UNUSED__)
|
||||
{
|
||||
volatile sig_atomic_t n;
|
||||
n = sigint_count;
|
||||
|
@ -477,7 +510,9 @@ _ecore_signal_callback_sigint(int sig __UNUSED__, siginfo_t *si, void *foo __UNU
|
|||
}
|
||||
|
||||
static void
|
||||
_ecore_signal_callback_sigterm(int sig __UNUSED__, siginfo_t *si, void *foo __UNUSED__)
|
||||
_ecore_signal_callback_sigterm(int sig __UNUSED__,
|
||||
siginfo_t *si,
|
||||
void *foo __UNUSED__)
|
||||
{
|
||||
volatile sig_atomic_t n;
|
||||
n = sigterm_count;
|
||||
|
@ -494,7 +529,9 @@ _ecore_signal_callback_sigterm(int sig __UNUSED__, siginfo_t *si, void *foo __UN
|
|||
|
||||
#ifdef SIGPWR
|
||||
static void
|
||||
_ecore_signal_callback_sigpwr(int sig __UNUSED__, siginfo_t *si, void *foo __UNUSED__)
|
||||
_ecore_signal_callback_sigpwr(int sig __UNUSED__,
|
||||
siginfo_t *si,
|
||||
void *foo __UNUSED__)
|
||||
{
|
||||
volatile sig_atomic_t n;
|
||||
n = sigpwr_count;
|
||||
|
@ -508,6 +545,7 @@ _ecore_signal_callback_sigpwr(int sig __UNUSED__, siginfo_t *si, void *foo __UNU
|
|||
sigpwr_count++;
|
||||
sig_count++;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static Eina_Bool
|
||||
|
@ -524,3 +562,4 @@ _ecore_signal_exe_exit_delay(void *data)
|
|||
}
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
# define PH(x) pthread_t x
|
||||
# define PHE(x, y) pthread_equal(x, y)
|
||||
# define PHS() pthread_self()
|
||||
# define PHC(x, f, d) pthread_create(&(x), NULL, (void*) f, d)
|
||||
# define PHJ(x, p) pthread_join(x, (void**)(&(p)))
|
||||
# define PHC(x, f, d) pthread_create(&(x), NULL, (void *)f, d)
|
||||
# define PHJ(x, p) pthread_join(x, (void **)(&(p)))
|
||||
# define PHA(x) pthread_cancel(x)
|
||||
|
||||
# define CD(x) pthread_cond_t x
|
||||
|
@ -62,11 +62,14 @@ typedef struct
|
|||
void *val;
|
||||
} win32_thread;
|
||||
|
||||
# define PH(x) win32_thread *x
|
||||
# define PH(x) win32_thread * x
|
||||
# define PHE(x, y) ((x) == (y))
|
||||
# define PHS() (HANDLE)GetCurrentThreadId()
|
||||
|
||||
int _ecore_thread_win32_create(win32_thread **x, LPTHREAD_START_ROUTINE f, void *d)
|
||||
int
|
||||
_ecore_thread_win32_create(win32_thread **x,
|
||||
LPTHREAD_START_ROUTINE f,
|
||||
void *d)
|
||||
{
|
||||
win32_thread *t;
|
||||
t = (win32_thread *)calloc(1, sizeof(win32_thread));
|
||||
|
@ -84,9 +87,12 @@ int _ecore_thread_win32_create(win32_thread **x, LPTHREAD_START_ROUTINE f, void
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
# define PHC(x, f, d) _ecore_thread_win32_create(&(x), (LPTHREAD_START_ROUTINE)f, d)
|
||||
|
||||
int _ecore_thread_win32_join(win32_thread *x, void **res)
|
||||
int
|
||||
_ecore_thread_win32_join(win32_thread *x,
|
||||
void **res)
|
||||
{
|
||||
if (!PHE(x, PHS()))
|
||||
{
|
||||
|
@ -99,7 +105,7 @@ int _ecore_thread_win32_join(win32_thread *x, void **res)
|
|||
return 0;
|
||||
}
|
||||
|
||||
# define PHJ(x, p) _ecore_thread_win32_join(x, (void**)(&(p)))
|
||||
# define PHJ(x, p) _ecore_thread_win32_join(x, (void **)(&(p)))
|
||||
# define PHA(x) TerminateThread(x->thread, 0)
|
||||
|
||||
# define LK(x) HANDLE x
|
||||
|
@ -115,7 +121,7 @@ typedef struct
|
|||
CRITICAL_SECTION threads_count_lock;
|
||||
} win32_cond;
|
||||
|
||||
# define CD(x) win32_cond *x
|
||||
# define CD(x) win32_cond * x
|
||||
|
||||
# define CDI(x) \
|
||||
do { \
|
||||
|
@ -141,14 +147,17 @@ typedef struct
|
|||
} while (0)
|
||||
|
||||
# define CDB(x) \
|
||||
do { \
|
||||
do { \
|
||||
EnterCriticalSection(&x->threads_count_lock); \
|
||||
if (x->threads_count > 0) \
|
||||
ReleaseSemaphore(x->semaphore, x->threads_count, NULL); \
|
||||
LeaveCriticalSection (&x->threads_count_lock); \
|
||||
} while (0)
|
||||
|
||||
int _ecore_thread_win32_cond_timedwait(win32_cond *c, HANDLE *external_mutex, struct timeval *t)
|
||||
int
|
||||
_ecore_thread_win32_cond_timedwait(win32_cond *c,
|
||||
HANDLE *external_mutex,
|
||||
struct timeval *t)
|
||||
{
|
||||
DWORD res;
|
||||
DWORD val = t->tv_sec * 1000 + (t->tv_usec / 1000);
|
||||
|
@ -163,6 +172,7 @@ int _ecore_thread_win32_cond_timedwait(win32_cond *c, HANDLE *external_mutex, st
|
|||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
# define CDW(x, y, t) _ecore_thread_win32_cond_timedwait(x, y, t)
|
||||
|
||||
typedef struct
|
||||
|
@ -176,7 +186,7 @@ typedef struct
|
|||
CD(cond_write);
|
||||
} win32_rwl;
|
||||
|
||||
# define LRWK(x) win32_rwl *x
|
||||
# define LRWK(x) win32_rwl * x
|
||||
# define LRWKI(x) \
|
||||
do { \
|
||||
x = (win32_rwl *)calloc(1, sizeof(win32_rwl)); \
|
||||
|
@ -315,10 +325,12 @@ struct _Ecore_Thread_Data
|
|||
struct _Ecore_Pthread_Worker
|
||||
{
|
||||
union {
|
||||
struct {
|
||||
struct
|
||||
{
|
||||
Ecore_Thread_Cb func_blocking;
|
||||
} short_run;
|
||||
struct {
|
||||
struct
|
||||
{
|
||||
Ecore_Thread_Cb func_heavy;
|
||||
Ecore_Thread_Notify_Cb func_notify;
|
||||
Ecore_Pipe *notify;
|
||||
|
@ -361,16 +373,17 @@ struct _Ecore_Pthread_Data
|
|||
};
|
||||
#endif
|
||||
|
||||
|
||||
static int _ecore_thread_count_max = 0;
|
||||
static int ECORE_THREAD_PIPE_DEL = 0;
|
||||
static Eina_Array *_ecore_thread_pipe = NULL;
|
||||
|
||||
#ifdef EFL_HAVE_THREADS
|
||||
|
||||
static void _ecore_thread_handler(void *data __UNUSED__, void *buffer, unsigned int nbyte);
|
||||
static void _ecore_thread_handler(void *data __UNUSED__,
|
||||
void *buffer,
|
||||
unsigned int nbyte);
|
||||
|
||||
static Ecore_Pipe*
|
||||
static Ecore_Pipe *
|
||||
_ecore_thread_pipe_get(void)
|
||||
{
|
||||
if (eina_array_count_get(_ecore_thread_pipe) > 0)
|
||||
|
@ -400,7 +413,7 @@ static int _ecore_thread_worker_count = 0;
|
|||
static void *_ecore_thread_worker(Ecore_Pthread_Data *pth);
|
||||
static Ecore_Pthread_Worker *_ecore_thread_worker_new(void);
|
||||
|
||||
static PH(get_main_loop_thread)(void)
|
||||
static PH(get_main_loop_thread) (void)
|
||||
{
|
||||
static PH(main_loop_thread);
|
||||
static pid_t main_loop_pid;
|
||||
|
@ -422,7 +435,7 @@ _ecore_thread_worker_free(Ecore_Pthread_Worker *worker)
|
|||
if (_ecore_thread_worker_count > (_ecore_thread_count_max + 1) * 16)
|
||||
{
|
||||
free(worker);
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
eina_trash_push(&_ecore_thread_worker_trash, worker);
|
||||
|
@ -438,7 +451,8 @@ _ecore_thread_data_free(void *data)
|
|||
}
|
||||
|
||||
static void
|
||||
_ecore_thread_pipe_free(void *data __UNUSED__, void *event)
|
||||
_ecore_thread_pipe_free(void *data __UNUSED__,
|
||||
void *event)
|
||||
{
|
||||
Ecore_Pipe *p = event;
|
||||
|
||||
|
@ -450,26 +464,29 @@ _ecore_thread_pipe_free(void *data __UNUSED__, void *event)
|
|||
}
|
||||
|
||||
static Eina_Bool
|
||||
_ecore_thread_pipe_del(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
|
||||
_ecore_thread_pipe_del(void *data __UNUSED__,
|
||||
int type __UNUSED__,
|
||||
void *event __UNUSED__)
|
||||
{
|
||||
/* This is a hack to delay pipe destruction until we are out of its internal loop. */
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
}
|
||||
|
||||
static void
|
||||
_ecore_thread_end(Ecore_Pthread_Data *pth, Ecore_Thread *work)
|
||||
_ecore_thread_end(Ecore_Pthread_Data *pth,
|
||||
Ecore_Thread *work)
|
||||
{
|
||||
Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *) work;
|
||||
Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *)work;
|
||||
Ecore_Pipe *p;
|
||||
|
||||
if (!worker->feedback_run || (worker->feedback_run && !worker->no_queue))
|
||||
_ecore_thread_count--;
|
||||
|
||||
if (PHJ(pth->thread, p) != 0)
|
||||
return ;
|
||||
return;
|
||||
|
||||
if (eina_list_count(_ecore_pending_job_threads) > 0
|
||||
&& (unsigned int) _ecore_thread_count < eina_list_count(_ecore_pending_job_threads)
|
||||
&& (unsigned int)_ecore_thread_count < eina_list_count(_ecore_pending_job_threads)
|
||||
&& _ecore_thread_count < _ecore_thread_count_max)
|
||||
{
|
||||
/* One more thread should be created. */
|
||||
|
@ -483,12 +500,12 @@ _ecore_thread_end(Ecore_Pthread_Data *pth, Ecore_Thread *work)
|
|||
if (PHC(pth->thread, _ecore_thread_worker, pth) == 0)
|
||||
{
|
||||
_ecore_thread_count++;
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
eina_threads_shutdown();
|
||||
|
||||
end:
|
||||
end:
|
||||
if (pth->death_job) _ecore_thread_worker_free(pth->death_job);
|
||||
}
|
||||
|
||||
|
@ -504,12 +521,12 @@ _ecore_thread_kill(Ecore_Pthread_Worker *work)
|
|||
if (work->cancel)
|
||||
{
|
||||
if (work->func_cancel)
|
||||
work->func_cancel((void *) work->data, (Ecore_Thread *) work);
|
||||
work->func_cancel((void *)work->data, (Ecore_Thread *)work);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (work->func_end)
|
||||
work->func_end((void *) work->data, (Ecore_Thread *) work);
|
||||
work->func_end((void *)work->data, (Ecore_Thread *)work);
|
||||
}
|
||||
|
||||
if (work->feedback_run)
|
||||
|
@ -529,11 +546,13 @@ _ecore_thread_kill(Ecore_Pthread_Worker *work)
|
|||
}
|
||||
|
||||
static void
|
||||
_ecore_thread_handler(void *data __UNUSED__, void *buffer, unsigned int nbyte)
|
||||
_ecore_thread_handler(void *data __UNUSED__,
|
||||
void *buffer,
|
||||
unsigned int nbyte)
|
||||
{
|
||||
Ecore_Pthread_Worker *work;
|
||||
|
||||
if (nbyte != sizeof (Ecore_Pthread_Worker *)) return ;
|
||||
if (nbyte != sizeof (Ecore_Pthread_Worker *)) return;
|
||||
|
||||
work = *(Ecore_Pthread_Worker **)buffer;
|
||||
|
||||
|
@ -542,7 +561,7 @@ _ecore_thread_handler(void *data __UNUSED__, void *buffer, unsigned int nbyte)
|
|||
if (work->u.feedback_run.send != work->u.feedback_run.received)
|
||||
{
|
||||
work->kill = EINA_TRUE;
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -550,18 +569,20 @@ _ecore_thread_handler(void *data __UNUSED__, void *buffer, unsigned int nbyte)
|
|||
}
|
||||
|
||||
static void
|
||||
_ecore_notify_handler(void *data, void *buffer, unsigned int nbyte)
|
||||
_ecore_notify_handler(void *data,
|
||||
void *buffer,
|
||||
unsigned int nbyte)
|
||||
{
|
||||
Ecore_Pthread_Worker *work = data;
|
||||
void *user_data;
|
||||
|
||||
if (nbyte != sizeof (Ecore_Pthread_Worker *)) return ;
|
||||
if (nbyte != sizeof (Ecore_Pthread_Worker *)) return;
|
||||
|
||||
user_data = *(void **)buffer;
|
||||
work->u.feedback_run.received++;
|
||||
|
||||
if (work->u.feedback_run.func_notify)
|
||||
work->u.feedback_run.func_notify((void *) work->data, (Ecore_Thread *) work, user_data);
|
||||
work->u.feedback_run.func_notify((void *)work->data, (Ecore_Thread *)work, user_data);
|
||||
|
||||
/* Force reading all notify event before killing the thread */
|
||||
if (work->kill && work->u.feedback_run.send == work->u.feedback_run.received)
|
||||
|
@ -592,7 +613,7 @@ _ecore_short_job(Ecore_Pipe *end_pipe)
|
|||
LKU(_ecore_pending_job_threads_mutex);
|
||||
|
||||
if (!work->cancel)
|
||||
work->u.short_run.func_blocking((void *) work->data, (Ecore_Thread*) work);
|
||||
work->u.short_run.func_blocking((void *)work->data, (Ecore_Thread *)work);
|
||||
|
||||
if (work->reschedule)
|
||||
{
|
||||
|
@ -610,7 +631,8 @@ _ecore_short_job(Ecore_Pipe *end_pipe)
|
|||
}
|
||||
|
||||
static void
|
||||
_ecore_feedback_job(Ecore_Pipe *end_pipe, PH(thread))
|
||||
_ecore_feedback_job(Ecore_Pipe *end_pipe,
|
||||
PH(thread))
|
||||
{
|
||||
Ecore_Pthread_Worker *work;
|
||||
|
||||
|
@ -632,7 +654,7 @@ _ecore_feedback_job(Ecore_Pipe *end_pipe, PH(thread))
|
|||
|
||||
work->self = thread;
|
||||
if (!work->cancel)
|
||||
work->u.feedback_run.func_heavy((void *) work->data, (Ecore_Thread *) work);
|
||||
work->u.feedback_run.func_heavy((void *)work->data, (Ecore_Thread *)work);
|
||||
|
||||
if (work->reschedule)
|
||||
{
|
||||
|
@ -673,7 +695,7 @@ _ecore_direct_worker(Ecore_Pthread_Worker *work)
|
|||
pth->thread = PHS();
|
||||
|
||||
work->self = pth->thread;
|
||||
work->u.feedback_run.func_heavy((void *) work->data, (Ecore_Thread *) work);
|
||||
work->u.feedback_run.func_heavy((void *)work->data, (Ecore_Thread *)work);
|
||||
|
||||
ecore_pipe_write(pth->p, &work, sizeof (Ecore_Pthread_Worker *));
|
||||
|
||||
|
@ -686,7 +708,7 @@ _ecore_direct_worker(Ecore_Pthread_Worker *work)
|
|||
|
||||
work->data = pth;
|
||||
work->u.short_run.func_blocking = NULL;
|
||||
work->func_end = (void *) _ecore_thread_end;
|
||||
work->func_end = (void *)_ecore_thread_end;
|
||||
work->func_cancel = NULL;
|
||||
work->cancel = EINA_FALSE;
|
||||
work->feedback_run = EINA_FALSE;
|
||||
|
@ -712,7 +734,7 @@ _ecore_thread_worker(Ecore_Pthread_Data *pth)
|
|||
|
||||
eina_sched_prio_drop();
|
||||
|
||||
restart:
|
||||
restart:
|
||||
if (_ecore_pending_job_threads) _ecore_short_job(pth->p);
|
||||
if (_ecore_pending_job_threads_feedback) _ecore_feedback_job(pth->p, pth->thread);
|
||||
|
||||
|
@ -746,7 +768,7 @@ _ecore_thread_worker(Ecore_Pthread_Data *pth)
|
|||
|
||||
work->data = pth;
|
||||
work->u.short_run.func_blocking = NULL;
|
||||
work->func_end = (void *) _ecore_thread_end;
|
||||
work->func_end = (void *)_ecore_thread_end;
|
||||
work->func_cancel = NULL;
|
||||
work->cancel = EINA_FALSE;
|
||||
work->feedback_run = EINA_FALSE;
|
||||
|
@ -816,14 +838,14 @@ _ecore_thread_shutdown(void)
|
|||
EINA_LIST_FREE(_ecore_pending_job_threads, work)
|
||||
{
|
||||
if (work->func_cancel)
|
||||
work->func_cancel((void *)work->data, (Ecore_Thread *) work);
|
||||
work->func_cancel((void *)work->data, (Ecore_Thread *)work);
|
||||
free(work);
|
||||
}
|
||||
|
||||
EINA_LIST_FREE(_ecore_pending_job_threads_feedback, work)
|
||||
{
|
||||
if (work->func_cancel)
|
||||
work->func_cancel((void *)work->data, (Ecore_Thread *) work);
|
||||
work->func_cancel((void *)work->data, (Ecore_Thread *)work);
|
||||
free(work);
|
||||
}
|
||||
|
||||
|
@ -891,7 +913,7 @@ ecore_thread_run(Ecore_Thread_Cb func_blocking,
|
|||
if (!work)
|
||||
{
|
||||
if (func_cancel)
|
||||
func_cancel((void *) data, NULL);
|
||||
func_cancel((void *)data, NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -915,7 +937,7 @@ ecore_thread_run(Ecore_Thread_Cb func_blocking,
|
|||
if (_ecore_thread_count == _ecore_thread_count_max)
|
||||
{
|
||||
LKU(_ecore_pending_job_threads_mutex);
|
||||
return (Ecore_Thread *) work;
|
||||
return (Ecore_Thread *)work;
|
||||
}
|
||||
|
||||
LKU(_ecore_pending_job_threads_mutex);
|
||||
|
@ -933,12 +955,12 @@ ecore_thread_run(Ecore_Thread_Cb func_blocking,
|
|||
if (PHC(pth->thread, _ecore_thread_worker, pth) == 0)
|
||||
{
|
||||
_ecore_thread_count++;
|
||||
return (Ecore_Thread *) work;
|
||||
return (Ecore_Thread *)work;
|
||||
}
|
||||
|
||||
eina_threads_shutdown();
|
||||
|
||||
on_error:
|
||||
on_error:
|
||||
if (pth)
|
||||
{
|
||||
if (pth->p) eina_array_push(_ecore_thread_pipe, pth->p);
|
||||
|
@ -953,11 +975,11 @@ ecore_thread_run(Ecore_Thread_Cb func_blocking,
|
|||
LKU(_ecore_pending_job_threads_mutex);
|
||||
|
||||
if (work->func_cancel)
|
||||
work->func_cancel((void *) work->data, (Ecore_Thread *) work);
|
||||
work->func_cancel((void *)work->data, (Ecore_Thread *)work);
|
||||
free(work);
|
||||
work = NULL;
|
||||
}
|
||||
return (Ecore_Thread *) work;
|
||||
return (Ecore_Thread *)work;
|
||||
#else
|
||||
/*
|
||||
If no thread and as we don't want to break app that rely on this
|
||||
|
@ -970,10 +992,9 @@ ecore_thread_run(Ecore_Thread_Cb func_blocking,
|
|||
*/
|
||||
work->reschedule = EINA_FALSE;
|
||||
|
||||
func_blocking((void *)data, (Ecore_Thread *) work);
|
||||
if (work->cancel == EINA_FALSE) func_end((void *)data, (Ecore_Thread *) work);
|
||||
else func_cancel((void *)data, (Ecore_Thread *) work);
|
||||
|
||||
func_blocking((void *)data, (Ecore_Thread *)work);
|
||||
if (work->cancel == EINA_FALSE) func_end((void *)data, (Ecore_Thread *)work);
|
||||
else func_cancel((void *)data, (Ecore_Thread *)work);
|
||||
} while (work->reschedule == EINA_TRUE);
|
||||
|
||||
free(work);
|
||||
|
@ -1010,14 +1031,14 @@ ecore_thread_cancel(Ecore_Thread *thread)
|
|||
if (!work->feedback_run)
|
||||
EINA_LIST_FOREACH(_ecore_pending_job_threads, l, work)
|
||||
{
|
||||
if ((void *) work == (void *) thread)
|
||||
if ((void *)work == (void *)thread)
|
||||
{
|
||||
_ecore_pending_job_threads = eina_list_remove_list(_ecore_pending_job_threads, l);
|
||||
|
||||
LKU(_ecore_pending_job_threads_mutex);
|
||||
|
||||
if (work->func_cancel)
|
||||
work->func_cancel((void *) work->data, (Ecore_Thread *) work);
|
||||
work->func_cancel((void *)work->data, (Ecore_Thread *)work);
|
||||
free(work);
|
||||
|
||||
return EINA_TRUE;
|
||||
|
@ -1026,14 +1047,14 @@ ecore_thread_cancel(Ecore_Thread *thread)
|
|||
else
|
||||
EINA_LIST_FOREACH(_ecore_pending_job_threads_feedback, l, work)
|
||||
{
|
||||
if ((void *) work == (void *) thread)
|
||||
if ((void *)work == (void *)thread)
|
||||
{
|
||||
_ecore_pending_job_threads_feedback = eina_list_remove_list(_ecore_pending_job_threads_feedback, l);
|
||||
|
||||
LKU(_ecore_pending_job_threads_mutex);
|
||||
|
||||
if (work->func_cancel)
|
||||
work->func_cancel((void *) work->data, (Ecore_Thread *) work);
|
||||
work->func_cancel((void *)work->data, (Ecore_Thread *)work);
|
||||
free(work);
|
||||
|
||||
return EINA_TRUE;
|
||||
|
@ -1044,7 +1065,7 @@ ecore_thread_cancel(Ecore_Thread *thread)
|
|||
LKU(_ecore_pending_job_threads_mutex);
|
||||
|
||||
/* Delay the destruction */
|
||||
on_exit:
|
||||
on_exit:
|
||||
((Ecore_Pthread_Worker *)thread)->cancel = EINA_TRUE;
|
||||
return EINA_FALSE;
|
||||
#else
|
||||
|
@ -1055,20 +1076,20 @@ ecore_thread_cancel(Ecore_Thread *thread)
|
|||
EAPI Eina_Bool
|
||||
ecore_thread_check(Ecore_Thread *thread)
|
||||
{
|
||||
Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *) thread;
|
||||
Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *)thread;
|
||||
|
||||
if (!worker) return EINA_TRUE;
|
||||
return worker->cancel;
|
||||
}
|
||||
|
||||
EAPI Ecore_Thread *ecore_thread_feedback_run(Ecore_Thread_Cb func_heavy,
|
||||
EAPI Ecore_Thread *
|
||||
ecore_thread_feedback_run(Ecore_Thread_Cb func_heavy,
|
||||
Ecore_Thread_Notify_Cb func_notify,
|
||||
Ecore_Thread_Cb func_end,
|
||||
Ecore_Thread_Cb func_cancel,
|
||||
const void *data,
|
||||
Eina_Bool try_no_queue)
|
||||
{
|
||||
|
||||
#ifdef EFL_HAVE_THREADS
|
||||
Ecore_Pthread_Worker *worker;
|
||||
Ecore_Pthread_Data *pth = NULL;
|
||||
|
@ -1109,7 +1130,7 @@ EAPI Ecore_Thread *ecore_thread_feedback_run(Ecore_Thread_Cb func_heavy,
|
|||
eina_threads_init();
|
||||
|
||||
if (PHC(t, _ecore_direct_worker, worker) == 0)
|
||||
return (Ecore_Thread *) worker;
|
||||
return (Ecore_Thread *)worker;
|
||||
|
||||
eina_threads_shutdown();
|
||||
}
|
||||
|
@ -1122,7 +1143,7 @@ EAPI Ecore_Thread *ecore_thread_feedback_run(Ecore_Thread_Cb func_heavy,
|
|||
if (_ecore_thread_count == _ecore_thread_count_max)
|
||||
{
|
||||
LKU(_ecore_pending_job_threads_mutex);
|
||||
return (Ecore_Thread *) worker;
|
||||
return (Ecore_Thread *)worker;
|
||||
}
|
||||
|
||||
LKU(_ecore_pending_job_threads_mutex);
|
||||
|
@ -1140,12 +1161,12 @@ EAPI Ecore_Thread *ecore_thread_feedback_run(Ecore_Thread_Cb func_heavy,
|
|||
if (PHC(pth->thread, _ecore_thread_worker, pth) == 0)
|
||||
{
|
||||
_ecore_thread_count++;
|
||||
return (Ecore_Thread *) worker;
|
||||
return (Ecore_Thread *)worker;
|
||||
}
|
||||
|
||||
eina_threads_shutdown();
|
||||
|
||||
on_error:
|
||||
on_error:
|
||||
if (pth)
|
||||
{
|
||||
if (pth->p) eina_array_push(_ecore_thread_pipe, pth->p);
|
||||
|
@ -1160,7 +1181,7 @@ EAPI Ecore_Thread *ecore_thread_feedback_run(Ecore_Thread_Cb func_heavy,
|
|||
worker);
|
||||
LKU(_ecore_pending_job_threads_mutex);
|
||||
|
||||
if (func_cancel) func_cancel((void *) data, NULL);
|
||||
if (func_cancel) func_cancel((void *)data, NULL);
|
||||
|
||||
if (worker)
|
||||
{
|
||||
|
@ -1170,11 +1191,11 @@ EAPI Ecore_Thread *ecore_thread_feedback_run(Ecore_Thread_Cb func_heavy,
|
|||
}
|
||||
}
|
||||
|
||||
return (Ecore_Thread *) worker;
|
||||
return (Ecore_Thread *)worker;
|
||||
#else
|
||||
Ecore_Pthread_Worker worker;
|
||||
|
||||
(void) try_no_queue;
|
||||
(void)try_no_queue;
|
||||
|
||||
/*
|
||||
If no thread and as we don't want to break app that rely on this
|
||||
|
@ -1195,10 +1216,10 @@ EAPI Ecore_Thread *ecore_thread_feedback_run(Ecore_Thread_Cb func_heavy,
|
|||
do {
|
||||
worker.reschedule = EINA_FALSE;
|
||||
|
||||
func_heavy((void *)data, (Ecore_Thread *) &worker);
|
||||
func_heavy((void *)data, (Ecore_Thread *)&worker);
|
||||
|
||||
if (worker.cancel) func_cancel((void *)data, (Ecore_Thread *) &worker);
|
||||
else func_end((void *)data, (Ecore_Thread *) &worker);
|
||||
if (worker.cancel) func_cancel((void *)data, (Ecore_Thread *)&worker);
|
||||
else func_end((void *)data, (Ecore_Thread *)&worker);
|
||||
} while (worker.reschedule == EINA_TRUE);
|
||||
|
||||
return NULL;
|
||||
|
@ -1206,9 +1227,10 @@ EAPI Ecore_Thread *ecore_thread_feedback_run(Ecore_Thread_Cb func_heavy,
|
|||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
ecore_thread_feedback(Ecore_Thread *thread, const void *data)
|
||||
ecore_thread_feedback(Ecore_Thread *thread,
|
||||
const void *data)
|
||||
{
|
||||
Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *) thread;
|
||||
Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *)thread;
|
||||
|
||||
if (!worker) return EINA_FALSE;
|
||||
if (!worker->feedback_run) return EINA_FALSE;
|
||||
|
@ -1221,7 +1243,7 @@ ecore_thread_feedback(Ecore_Thread *thread, const void *data)
|
|||
|
||||
return EINA_TRUE;
|
||||
#else
|
||||
worker->u.feedback_run.func_notify((void*) worker->data, thread, (void*) data);
|
||||
worker->u.feedback_run.func_notify((void *)worker->data, thread, (void *)data);
|
||||
|
||||
return EINA_TRUE;
|
||||
#endif
|
||||
|
@ -1230,7 +1252,7 @@ ecore_thread_feedback(Ecore_Thread *thread, const void *data)
|
|||
EAPI Eina_Bool
|
||||
ecore_thread_reschedule(Ecore_Thread *thread)
|
||||
{
|
||||
Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *) thread;
|
||||
Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *)thread;
|
||||
|
||||
if (!worker) return EINA_FALSE;
|
||||
|
||||
|
@ -1331,9 +1353,13 @@ ecore_thread_available_get(void)
|
|||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
ecore_thread_local_data_add(Ecore_Thread *thread, const char *key, void *value, Eina_Free_Cb cb, Eina_Bool direct)
|
||||
ecore_thread_local_data_add(Ecore_Thread *thread,
|
||||
const char *key,
|
||||
void *value,
|
||||
Eina_Free_Cb cb,
|
||||
Eina_Bool direct)
|
||||
{
|
||||
Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *) thread;
|
||||
Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *)thread;
|
||||
Ecore_Thread_Data *d;
|
||||
Eina_Bool ret;
|
||||
|
||||
|
@ -1366,9 +1392,12 @@ ecore_thread_local_data_add(Ecore_Thread *thread, const char *key, void *value,
|
|||
}
|
||||
|
||||
EAPI void *
|
||||
ecore_thread_local_data_set(Ecore_Thread *thread, const char *key, void *value, Eina_Free_Cb cb)
|
||||
ecore_thread_local_data_set(Ecore_Thread *thread,
|
||||
const char *key,
|
||||
void *value,
|
||||
Eina_Free_Cb cb)
|
||||
{
|
||||
Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *) thread;
|
||||
Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *)thread;
|
||||
Ecore_Thread_Data *d, *r;
|
||||
void *ret;
|
||||
if ((!thread) || (!key) || (!value))
|
||||
|
@ -1398,11 +1427,11 @@ ecore_thread_local_data_set(Ecore_Thread *thread, const char *key, void *value,
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
EAPI void *
|
||||
ecore_thread_local_data_find(Ecore_Thread *thread, const char *key)
|
||||
ecore_thread_local_data_find(Ecore_Thread *thread,
|
||||
const char *key)
|
||||
{
|
||||
Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *) thread;
|
||||
Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *)thread;
|
||||
Ecore_Thread_Data *d;
|
||||
|
||||
if ((!thread) || (!key))
|
||||
|
@ -1423,9 +1452,10 @@ ecore_thread_local_data_find(Ecore_Thread *thread, const char *key)
|
|||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
ecore_thread_local_data_del(Ecore_Thread *thread, const char *key)
|
||||
ecore_thread_local_data_del(Ecore_Thread *thread,
|
||||
const char *key)
|
||||
{
|
||||
Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *) thread;
|
||||
Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *)thread;
|
||||
if ((!thread) || (!key))
|
||||
return EINA_FALSE;
|
||||
#ifdef EFL_HAVE_THREADS
|
||||
|
@ -1440,7 +1470,10 @@ ecore_thread_local_data_del(Ecore_Thread *thread, const char *key)
|
|||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
ecore_thread_global_data_add(const char *key, void *value, Eina_Free_Cb cb, Eina_Bool direct)
|
||||
ecore_thread_global_data_add(const char *key,
|
||||
void *value,
|
||||
Eina_Free_Cb cb,
|
||||
Eina_Bool direct)
|
||||
{
|
||||
Eina_Bool ret;
|
||||
Ecore_Thread_Data *d;
|
||||
|
@ -1475,7 +1508,9 @@ ecore_thread_global_data_add(const char *key, void *value, Eina_Free_Cb cb, Eina
|
|||
}
|
||||
|
||||
EAPI void *
|
||||
ecore_thread_global_data_set(const char *key, void *value, Eina_Free_Cb cb)
|
||||
ecore_thread_global_data_set(const char *key,
|
||||
void *value,
|
||||
Eina_Free_Cb cb)
|
||||
{
|
||||
Ecore_Thread_Data *d, *r;
|
||||
void *ret;
|
||||
|
@ -1510,7 +1545,6 @@ ecore_thread_global_data_set(const char *key, void *value, Eina_Free_Cb cb)
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
EAPI void *
|
||||
ecore_thread_global_data_find(const char *key)
|
||||
{
|
||||
|
@ -1552,7 +1586,8 @@ ecore_thread_global_data_del(const char *key)
|
|||
}
|
||||
|
||||
EAPI void *
|
||||
ecore_thread_global_data_wait(const char *key, double seconds)
|
||||
ecore_thread_global_data_wait(const char *key,
|
||||
double seconds)
|
||||
{
|
||||
double tm = 0;
|
||||
Ecore_Thread_Data *ret = NULL;
|
||||
|
@ -1593,3 +1628,4 @@ ecore_thread_global_data_wait(const char *key, double seconds)
|
|||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -96,3 +96,4 @@ _ecore_throttle(void)
|
|||
if (throttle_val <= 0) return;
|
||||
usleep(throttle_val);
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ ecore_time_get(void)
|
|||
#elif defined(HAVE_EVIL)
|
||||
return evil_time_get();
|
||||
#elif defined(__APPLE__) && defined(__MACH__)
|
||||
return _ecore_time_clock_conversion * (double) mach_absolute_time();
|
||||
return _ecore_time_clock_conversion * (double)mach_absolute_time();
|
||||
#else
|
||||
return ecore_time_unix_get();
|
||||
#endif
|
||||
|
@ -127,7 +127,6 @@ ecore_loop_time_get(void)
|
|||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/********************** Internal methods ********************************/
|
||||
|
||||
/* TODO: Documentation says "All implementations support the system-wide
|
||||
|
@ -166,7 +165,7 @@ _ecore_time_init(void)
|
|||
kern_return_t err = mach_timebase_info(&info);
|
||||
if (err == 0)
|
||||
{
|
||||
_ecore_time_clock_conversion = 1e-9 * (double) info.numer / (double) info.denom;
|
||||
_ecore_time_clock_conversion = 1e-9 * (double)info.numer / (double)info.denom;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -182,3 +181,4 @@ _ecore_time_init(void)
|
|||
|
||||
_ecore_time_loop_time = ecore_time_get();
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
# include <string.h>
|
||||
# include <execinfo.h>
|
||||
# define ECORE_TIMER_DEBUG_BT_NUM 64
|
||||
typedef void (*Ecore_Timer_Bt_Func) ();
|
||||
typedef void (*Ecore_Timer_Bt_Func)();
|
||||
#endif
|
||||
|
||||
struct _Ecore_Timer
|
||||
|
@ -36,9 +36,13 @@ struct _Ecore_Timer
|
|||
unsigned char frozen : 1;
|
||||
};
|
||||
|
||||
|
||||
static void _ecore_timer_set(Ecore_Timer *timer, double at, double in, Ecore_Task_Cb func, void *data);
|
||||
static int _ecore_timer_cmp(const void *d1, const void *d2);
|
||||
static void _ecore_timer_set(Ecore_Timer *timer,
|
||||
double at,
|
||||
double in,
|
||||
Ecore_Task_Cb func,
|
||||
void *data);
|
||||
static int _ecore_timer_cmp(const void *d1,
|
||||
const void *d2);
|
||||
|
||||
static int timers_added = 0;
|
||||
static int timers_delete_me = 0;
|
||||
|
@ -48,7 +52,6 @@ static Ecore_Timer *suspended = NULL;
|
|||
static double last_check = 0.0;
|
||||
static double precision = 10.0 / 1000000.0;
|
||||
|
||||
|
||||
/**
|
||||
* @addtogroup Ecore_Time_Group
|
||||
*
|
||||
|
@ -125,7 +128,9 @@ unlock:
|
|||
* invalid.
|
||||
*/
|
||||
EAPI Ecore_Timer *
|
||||
ecore_timer_add(double in, Ecore_Task_Cb func, const void *data)
|
||||
ecore_timer_add(double in,
|
||||
Ecore_Task_Cb func,
|
||||
const void *data)
|
||||
{
|
||||
double now;
|
||||
Ecore_Timer *timer = NULL;
|
||||
|
@ -139,7 +144,7 @@ ecore_timer_add(double in, Ecore_Task_Cb func, const void *data)
|
|||
now = ecore_time_get();
|
||||
|
||||
#ifdef WANT_ECORE_TIMER_DUMP
|
||||
timer->timer_bt_num = backtrace((void**) (timer->timer_bt),
|
||||
timer->timer_bt_num = backtrace((void **)(timer->timer_bt),
|
||||
ECORE_TIMER_DEBUG_BT_NUM);
|
||||
#endif
|
||||
|
||||
|
@ -162,7 +167,9 @@ unlock:
|
|||
* ecore_timer_add() for more details.
|
||||
*/
|
||||
EAPI Ecore_Timer *
|
||||
ecore_timer_loop_add(double in, Ecore_Task_Cb func, const void *data)
|
||||
ecore_timer_loop_add(double in,
|
||||
Ecore_Task_Cb func,
|
||||
const void *data)
|
||||
{
|
||||
Ecore_Timer *timer;
|
||||
|
||||
|
@ -211,7 +218,8 @@ unlock:
|
|||
* @param in The interval in seconds.
|
||||
*/
|
||||
EAPI void
|
||||
ecore_timer_interval_set(Ecore_Timer *timer, double in)
|
||||
ecore_timer_interval_set(Ecore_Timer *timer,
|
||||
double in)
|
||||
{
|
||||
_ecore_lock();
|
||||
|
||||
|
@ -261,7 +269,8 @@ unlock:
|
|||
* @param add The dalay to add to the next iteration.
|
||||
*/
|
||||
EAPI void
|
||||
ecore_timer_delay(Ecore_Timer *timer, double add)
|
||||
ecore_timer_delay(Ecore_Timer *timer,
|
||||
double add)
|
||||
{
|
||||
if (!ECORE_MAGIC_CHECK(timer, ECORE_MAGIC_TIMER))
|
||||
{
|
||||
|
@ -339,8 +348,8 @@ ecore_timer_freeze(Ecore_Timer *timer)
|
|||
if (timer->frozen)
|
||||
goto unlock;
|
||||
|
||||
timers = (Ecore_Timer *) eina_inlist_remove(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer));
|
||||
suspended = (Ecore_Timer *) eina_inlist_prepend(EINA_INLIST_GET(suspended), EINA_INLIST_GET(timer));
|
||||
timers = (Ecore_Timer *)eina_inlist_remove(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer));
|
||||
suspended = (Ecore_Timer *)eina_inlist_prepend(EINA_INLIST_GET(suspended), EINA_INLIST_GET(timer));
|
||||
|
||||
now = ecore_time_get();
|
||||
|
||||
|
@ -382,7 +391,7 @@ ecore_timer_thaw(Ecore_Timer *timer)
|
|||
if (!timer->frozen)
|
||||
goto unlock;
|
||||
|
||||
suspended = (Ecore_Timer *) eina_inlist_remove(EINA_INLIST_GET(suspended), EINA_INLIST_GET(timer));
|
||||
suspended = (Ecore_Timer *)eina_inlist_remove(EINA_INLIST_GET(suspended), EINA_INLIST_GET(timer));
|
||||
now = ecore_time_get();
|
||||
|
||||
_ecore_timer_set(timer, timer->pending + now, timer->in, timer->func, timer->data);
|
||||
|
@ -415,11 +424,11 @@ ecore_timer_dump(void)
|
|||
if (!tm->frozen && !tm->delete_me)
|
||||
living_timer++;
|
||||
|
||||
strings = backtrace_symbols((void**) tm->timer_bt, tm->timer_bt_num);
|
||||
strings = backtrace_symbols((void **)tm->timer_bt, tm->timer_bt_num);
|
||||
if (tm->timer_bt_num <= 0 || strings == NULL)
|
||||
{
|
||||
unknow_timer++;
|
||||
continue ;
|
||||
continue;
|
||||
}
|
||||
|
||||
eina_strbuf_append_printf(result, "*** timer: %f ***\n", tm->in);
|
||||
|
@ -450,7 +459,9 @@ ecore_timer_dump(void)
|
|||
*/
|
||||
|
||||
Ecore_Timer *
|
||||
_ecore_timer_loop_add(double in, Ecore_Task_Cb func, const void *data)
|
||||
_ecore_timer_loop_add(double in,
|
||||
Ecore_Task_Cb func,
|
||||
const void *data)
|
||||
{
|
||||
double now;
|
||||
Ecore_Timer *timer = NULL;
|
||||
|
@ -463,7 +474,7 @@ _ecore_timer_loop_add(double in, Ecore_Task_Cb func, const void *data)
|
|||
now = ecore_loop_time_get();
|
||||
|
||||
#ifdef WANT_ECORE_TIMER_DUMP
|
||||
timer->timer_bt_num = backtrace((void**) (timer->timer_bt),
|
||||
timer->timer_bt_num = backtrace((void **)(timer->timer_bt),
|
||||
ECORE_TIMER_DEBUG_BT_NUM);
|
||||
#endif
|
||||
_ecore_timer_set(timer, now + in, in, func, (void *)data);
|
||||
|
@ -471,7 +482,8 @@ _ecore_timer_loop_add(double in, Ecore_Task_Cb func, const void *data)
|
|||
}
|
||||
|
||||
EAPI void
|
||||
_ecore_timer_delay(Ecore_Timer *timer, double add)
|
||||
_ecore_timer_delay(Ecore_Timer *timer,
|
||||
double add)
|
||||
{
|
||||
if (timer->frozen)
|
||||
{
|
||||
|
@ -479,12 +491,11 @@ _ecore_timer_delay(Ecore_Timer *timer, double add)
|
|||
}
|
||||
else
|
||||
{
|
||||
timers = (Ecore_Timer *) eina_inlist_remove(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer));
|
||||
timers = (Ecore_Timer *)eina_inlist_remove(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer));
|
||||
_ecore_timer_set(timer, timer->at + add, timer->in, timer->func, timer->data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
_ecore_timer_del(Ecore_Timer *timer)
|
||||
{
|
||||
|
@ -492,7 +503,7 @@ _ecore_timer_del(Ecore_Timer *timer)
|
|||
{
|
||||
void *data = timer->data;
|
||||
|
||||
suspended = (Ecore_Timer *) eina_inlist_remove(EINA_INLIST_GET(suspended), EINA_INLIST_GET(timer));
|
||||
suspended = (Ecore_Timer *)eina_inlist_remove(EINA_INLIST_GET(suspended), EINA_INLIST_GET(timer));
|
||||
|
||||
if (timer->delete_me)
|
||||
timers_delete_me--;
|
||||
|
@ -514,14 +525,14 @@ _ecore_timer_shutdown(void)
|
|||
|
||||
while ((timer = timers))
|
||||
{
|
||||
timers = (Ecore_Timer *) eina_inlist_remove(EINA_INLIST_GET(timers), EINA_INLIST_GET(timers));
|
||||
timers = (Ecore_Timer *)eina_inlist_remove(EINA_INLIST_GET(timers), EINA_INLIST_GET(timers));
|
||||
ECORE_MAGIC_SET(timer, ECORE_MAGIC_NONE);
|
||||
free(timer);
|
||||
}
|
||||
|
||||
while ((timer = suspended))
|
||||
{
|
||||
suspended = (Ecore_Timer *) eina_inlist_remove(EINA_INLIST_GET(suspended), EINA_INLIST_GET(suspended));
|
||||
suspended = (Ecore_Timer *)eina_inlist_remove(EINA_INLIST_GET(suspended), EINA_INLIST_GET(suspended));
|
||||
ECORE_MAGIC_SET(timer, ECORE_MAGIC_NONE);
|
||||
free(timer);
|
||||
}
|
||||
|
@ -536,11 +547,11 @@ _ecore_timer_cleanup(void)
|
|||
int in_use = 0, todo = timers_delete_me, done = 0;
|
||||
|
||||
if (!timers_delete_me) return;
|
||||
for (l = timers; l;)
|
||||
for (l = timers; l; )
|
||||
{
|
||||
Ecore_Timer *timer = l;
|
||||
|
||||
l = (Ecore_Timer *) EINA_INLIST_GET(l)->next;
|
||||
l = (Ecore_Timer *)EINA_INLIST_GET(l)->next;
|
||||
if (timer->delete_me)
|
||||
{
|
||||
if (timer->references)
|
||||
|
@ -548,7 +559,7 @@ _ecore_timer_cleanup(void)
|
|||
in_use++;
|
||||
continue;
|
||||
}
|
||||
timers = (Ecore_Timer *) eina_inlist_remove(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer));
|
||||
timers = (Ecore_Timer *)eina_inlist_remove(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer));
|
||||
ECORE_MAGIC_SET(timer, ECORE_MAGIC_NONE);
|
||||
free(timer);
|
||||
timers_delete_me--;
|
||||
|
@ -556,11 +567,11 @@ _ecore_timer_cleanup(void)
|
|||
if (timers_delete_me == 0) return;
|
||||
}
|
||||
}
|
||||
for (l = suspended; l;)
|
||||
for (l = suspended; l; )
|
||||
{
|
||||
Ecore_Timer *timer = l;
|
||||
|
||||
l = (Ecore_Timer *) EINA_INLIST_GET(l)->next;
|
||||
l = (Ecore_Timer *)EINA_INLIST_GET(l)->next;
|
||||
if (timer->delete_me)
|
||||
{
|
||||
if (timer->references)
|
||||
|
@ -568,7 +579,7 @@ _ecore_timer_cleanup(void)
|
|||
in_use++;
|
||||
continue;
|
||||
}
|
||||
suspended = (Ecore_Timer *) eina_inlist_remove(EINA_INLIST_GET(suspended), EINA_INLIST_GET(timer));
|
||||
suspended = (Ecore_Timer *)eina_inlist_remove(EINA_INLIST_GET(suspended), EINA_INLIST_GET(timer));
|
||||
ECORE_MAGIC_SET(timer, ECORE_MAGIC_NONE);
|
||||
free(timer);
|
||||
timers_delete_me--;
|
||||
|
@ -614,7 +625,7 @@ _ecore_timer_first_get(void)
|
|||
Ecore_Timer *timer = timers;
|
||||
|
||||
while ((timer) && ((timer->delete_me) || (timer->just_added)))
|
||||
timer = (Ecore_Timer *) EINA_INLIST_GET(timer)->next;
|
||||
timer = (Ecore_Timer *)EINA_INLIST_GET(timer)->next;
|
||||
|
||||
return timer;
|
||||
}
|
||||
|
@ -622,7 +633,7 @@ _ecore_timer_first_get(void)
|
|||
static inline Ecore_Timer *
|
||||
_ecore_timer_after_get(Ecore_Timer *base)
|
||||
{
|
||||
Ecore_Timer *timer = (Ecore_Timer *) EINA_INLIST_GET(base)->next;
|
||||
Ecore_Timer *timer = (Ecore_Timer *)EINA_INLIST_GET(base)->next;
|
||||
Ecore_Timer *valid_timer = NULL;
|
||||
double maxtime = base->at + precision;
|
||||
|
||||
|
@ -630,7 +641,7 @@ _ecore_timer_after_get(Ecore_Timer *base)
|
|||
{
|
||||
if (!((timer->delete_me) || (timer->just_added)))
|
||||
valid_timer = timer;
|
||||
timer = (Ecore_Timer *) EINA_INLIST_GET(timer)->next;
|
||||
timer = (Ecore_Timer *)EINA_INLIST_GET(timer)->next;
|
||||
}
|
||||
|
||||
return valid_timer;
|
||||
|
@ -656,11 +667,12 @@ _ecore_timer_next_get(void)
|
|||
}
|
||||
|
||||
static inline void
|
||||
_ecore_timer_reschedule(Ecore_Timer *timer, double when)
|
||||
_ecore_timer_reschedule(Ecore_Timer *timer,
|
||||
double when)
|
||||
{
|
||||
if ((timer->delete_me) || (timer->frozen)) return;
|
||||
|
||||
timers = (Ecore_Timer *) eina_inlist_remove(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer));
|
||||
timers = (Ecore_Timer *)eina_inlist_remove(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer));
|
||||
|
||||
/* if the timer would have gone off more than 15 seconds ago,
|
||||
* assume that the system hung and set the timer to go off
|
||||
|
@ -682,7 +694,7 @@ void
|
|||
_ecore_timer_expired_timers_call(double when)
|
||||
{
|
||||
/* call the first expired timer until no expired timers exist */
|
||||
while (_ecore_timer_expired_call(when));
|
||||
while (_ecore_timer_expired_call(when)) ;
|
||||
}
|
||||
|
||||
/* assume that we hold the ecore lock when entering this function */
|
||||
|
@ -723,7 +735,7 @@ _ecore_timer_expired_call(double when)
|
|||
|
||||
if ((timer->just_added) || (timer->delete_me))
|
||||
{
|
||||
timer_current = (Ecore_Timer*)EINA_INLIST_GET(timer_current)->next;
|
||||
timer_current = (Ecore_Timer *)EINA_INLIST_GET(timer_current)->next;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -743,7 +755,11 @@ _ecore_timer_expired_call(double when)
|
|||
}
|
||||
|
||||
static void
|
||||
_ecore_timer_set(Ecore_Timer *timer, double at, double in, Ecore_Task_Cb func, void *data)
|
||||
_ecore_timer_set(Ecore_Timer *timer,
|
||||
double at,
|
||||
double in,
|
||||
Ecore_Task_Cb func,
|
||||
void *data)
|
||||
{
|
||||
Ecore_Timer *t2;
|
||||
|
||||
|
@ -761,19 +777,21 @@ _ecore_timer_set(Ecore_Timer *timer, double at, double in, Ecore_Task_Cb func, v
|
|||
{
|
||||
if (timer->at > t2->at)
|
||||
{
|
||||
timers = (Ecore_Timer *) eina_inlist_append_relative(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer), EINA_INLIST_GET(t2));
|
||||
timers = (Ecore_Timer *)eina_inlist_append_relative(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer), EINA_INLIST_GET(t2));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
timers = (Ecore_Timer *) eina_inlist_prepend(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer));
|
||||
timers = (Ecore_Timer *)eina_inlist_prepend(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer));
|
||||
}
|
||||
|
||||
static int
|
||||
_ecore_timer_cmp(const void *d1, const void *d2)
|
||||
_ecore_timer_cmp(const void *d1,
|
||||
const void *d2)
|
||||
{
|
||||
const Ecore_Timer *t1 = d1;
|
||||
const Ecore_Timer *t2 = d2;
|
||||
|
||||
return (int) ((t1->in - t2->in) * 100);
|
||||
return (int)((t1->in - t2->in) * 100);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue