Sorry guys. There was a bug in our access control config that let me push branches with bad names. That added to the fact I didn't pay attention caused the creation of this branch.
This branch is now deleted from the repo and I fixed the config. On 01/05/14 14:22, Tom Hacohen wrote: > tasn pushed a commit to branch eo-events-hash. > > http://git.enlightenment.org/core/efl.git/commit/?id=85a9d69b8c89d218e683e96761f96974909b29a2 > > commit 85a9d69b8c89d218e683e96761f96974909b29a2 > Author: Tom Hacohen <[email protected]> > Date: Thu May 1 14:13:08 2014 +0100 > > Eo: implemented a function to get event description from name. > > It's called: eo_event_global_event_from_name_get(). > > It's useful for dynamic method calling from bindings, and is needed for > better legacy (smart) callbacks support. > > @feature > --- > src/lib/eo/Eo.h | 9 +++++++++ > src/lib/eo/eo.c | 25 +++++++++++++++++++++++++ > src/lib/eo/eo_base_class.c | 14 ++++++++++++++ > 3 files changed, 48 insertions(+) > > diff --git a/src/lib/eo/Eo.h b/src/lib/eo/Eo.h > index 13179b8..be19528 100644 > --- a/src/lib/eo/Eo.h > +++ b/src/lib/eo/Eo.h > @@ -1258,6 +1258,15 @@ EAPI void eo_event_global_thaw(void); > EAPI int eo_event_global_freeze_get(void); > > /** > + * @brief return an event structure from its name. > + * > + * @param[in] name The name of the events. > + * > + * @return the event structure with that name. > + */ > +EAPI const Eo_Event_Description *eo_event_from_name_get(const char *name); > + > +/** > * @def eo_event_callback_add(obj, desc, cb, data) > * Add a callback for an event. > * @param[in] desc The description of the event to listen to. > diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c > index b22a15a..cea1a39 100644 > --- a/src/lib/eo/eo.c > +++ b/src/lib/eo/eo.c > @@ -15,6 +15,8 @@ > EAPI Eina_Spinlock _eo_class_creation_lock; > int _eo_log_dom = -1; > > +Eina_Hash *_eo_events_hash = NULL; > + > static _Eo_Class **_eo_classes; > static Eo_Id _eo_classes_last_id; > static Eina_Bool _eo_init_count = 0; > @@ -1418,6 +1420,24 @@ eo_class_new(const Eo_Class_Description *desc, const > Eo_Class *parent_id, ...) > _eo_classes = tmp; > _eo_classes[klass->header.id - 1] = klass; > } > + > + /* Add events to the events hash. */ > + if (klass->desc->events) > + { > + const Eo_Event_Description **event_itr; > + for (event_itr = klass->desc->events ; *event_itr ; event_itr++) > + { > + const Eo_Event_Description *event = *event_itr; > + > + if (eina_hash_find(_eo_events_hash, event->name)) > + { > + ERR("Event named '%s' was already found. This may cause > issues.", event->name); > + } > + > + eina_hash_direct_add(_eo_events_hash, event->name, event); > + } > + } > + > eina_spinlock_release(&_eo_class_creation_lock); > > _eo_class_constructor(klass); > @@ -1776,6 +1796,8 @@ eo_init(void) > } > } > > + _eo_events_hash = eina_hash_string_superfast_new(NULL); > + > return EINA_TRUE; > } > > @@ -1792,6 +1814,9 @@ eo_shutdown(void) > EINA_LOG_STATE_START, > EINA_LOG_STATE_SHUTDOWN); > > + eina_hash_free(_eo_events_hash); > + _eo_events_hash = NULL; > + > for (i = 0 ; i < _eo_classes_last_id ; i++, cls_itr++) > { > if (*cls_itr) > diff --git a/src/lib/eo/eo_base_class.c b/src/lib/eo/eo_base_class.c > index 21d7d2d..2644fb6 100644 > --- a/src/lib/eo/eo_base_class.c > +++ b/src/lib/eo/eo_base_class.c > @@ -8,6 +8,7 @@ > #include "eo_ptr_indirection.h" > #include "eo_private.h" > > +extern Eina_Hash *_eo_events_hash; > static int event_freeze_count = 0; > > typedef struct _Eo_Callback_Description Eo_Callback_Description; > @@ -702,6 +703,7 @@ end: > > return ret; > } > + > EAPI EO_FUNC_BODYV(eo_event_callback_call, Eina_Bool, > EINA_FALSE, > EO_FUNC_CALL(desc, event_info), > @@ -811,6 +813,17 @@ _ev_global_freeze_get(const Eo_Class *klass EINA_UNUSED, > void *class_data EINA_U > } > EAPI EO_FUNC_BODY(eo_event_global_freeze_get, int, 0); > > +static const Eo_Event_Description * > +_ev_from_name_get(const Eo_Class *klass EINA_UNUSED, const char *name) > +{ > + return eina_hash_find(_eo_events_hash, name); > +} > + > +EAPI EO_FUNC_BODYV(eo_event_from_name_get, > + const Eo_Event_Description *, NULL, > + EO_FUNC_CALL(name), > + const char *name); > + > /* Eo_Dbg */ > EAPI void > eo_dbg_info_free(Eo_Dbg_Info *info) > @@ -977,6 +990,7 @@ static Eo_Op_Description op_descs [] = { > EO_OP_CLASS_FUNC(eo_event_global_freeze, _ev_global_freeze, "Freezes > events globally."), > EO_OP_CLASS_FUNC(eo_event_global_thaw, _ev_global_thaw, "Thaws > events globally."), > EO_OP_CLASS_FUNC(eo_event_global_freeze_get, _ev_global_freeze_get, > "Get global event freeze counter."), > + EO_OP_CLASS_FUNC(eo_event_from_name_get, _ev_from_name_get, > "Translate an event string to an event struct."), > EO_OP_FUNC(eo_dbg_info_get, _dbg_info_get, "Get debug info list for > obj."), > EO_OP_SENTINEL > }; > ------------------------------------------------------------------------------ "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE Instantly run your Selenium tests across 300+ browser/OS combos. Get unparalleled scalability from the best Selenium testing platform available. Simple to use. Nothing to install. Get started now for free." http://p.sf.net/sfu/SauceLabs _______________________________________________ enlightenment-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
