q66 pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=c9119b0c8801ca5e5bb15e1c65172e4f98040521

commit c9119b0c8801ca5e5bb15e1c65172e4f98040521
Author: Daniel Kolesa <[email protected]>
Date:   Wed Jul 9 16:45:41 2014 +0100

    eolian: refactoring step three
    
    Move from all instances of Eolian_Event and Eolian_Implement to 
Eolian_Event* and Eolian_Implement*.
---
 src/bin/eolian/eo_generator.c         |  8 ++--
 src/bin/eolian/impl_generator.c       |  4 +-
 src/bin/eolian_cxx/convert.cc         |  2 +-
 src/bin/eolian_cxx/eolian_wrappers.hh |  4 +-
 src/lib/eolian/Eolian.h               | 14 +++----
 src/lib/eolian/eo_parser.c            |  4 +-
 src/lib/eolian/eolian_database.c      | 78 +++++++++++++++++------------------
 src/lib/eolian/eolian_database.h      | 10 ++---
 8 files changed, 60 insertions(+), 64 deletions(-)

diff --git a/src/bin/eolian/eo_generator.c b/src/bin/eolian/eo_generator.c
index c84b6f5..2dd7156 100644
--- a/src/bin/eolian/eo_generator.c
+++ b/src/bin/eolian/eo_generator.c
@@ -266,7 +266,7 @@ eo_header_generate(const Eolian_Class *class, Eina_Strbuf 
*buf)
    Eina_Strbuf *str_extrn_ev = eina_strbuf_new();
    Eina_Strbuf *tmpbuf = eina_strbuf_new();
 
-   Eolian_Event event;
+   Eolian_Event *event;
    EINA_LIST_FOREACH(eolian_class_events_list_get(class), itr, event)
      {
         const char *evname = NULL;
@@ -517,7 +517,7 @@ eo_source_beginning_generate(const Eolian_Class *class, 
Eina_Strbuf *buf)
    Eina_Strbuf *tmpbuf = eina_strbuf_new();
    Eina_Strbuf *str_ev = eina_strbuf_new();
 
-   Eolian_Event event;
+   Eolian_Event *event;
    EINA_LIST_FOREACH(eolian_class_events_list_get(class), itr, event)
      {
         const char *evname;
@@ -617,7 +617,7 @@ eo_source_end_generate(const Eolian_Class *class, 
Eina_Strbuf *buf)
    eina_strbuf_reset(tmpbuf);
 
    //Implements - TODO one generate func def for all
-   Eolian_Implement impl_desc;
+   Eolian_Implement *impl_desc;
    EINA_LIST_FOREACH(eolian_class_implements_list_get(class), itr, impl_desc)
      {
         _eolian_class_vars impl_env;
@@ -722,7 +722,7 @@ eo_source_end_generate(const Eolian_Class *class, 
Eina_Strbuf *buf)
         free(desc);
      }
 
-   Eolian_Event event;
+   Eolian_Event *event;
    EINA_LIST_FOREACH(eolian_class_events_list_get(class), itr, event)
      {
         const char *evname;
diff --git a/src/bin/eolian/impl_generator.c b/src/bin/eolian/impl_generator.c
index d6534b8..0aeb45e 100644
--- a/src/bin/eolian/impl_generator.c
+++ b/src/bin/eolian/impl_generator.c
@@ -112,7 +112,7 @@ _type_exists(const char* type_name, Eina_Strbuf *buffer)
 }
 
 static Eina_Bool
-_prototype_generate(Eolian_Function foo, Eolian_Function_Type ftype, 
Eina_Strbuf *data_type_buf, Eolian_Implement impl_desc, Eina_Strbuf *buffer)
+_prototype_generate(Eolian_Function foo, Eolian_Function_Type ftype, 
Eina_Strbuf *data_type_buf, Eolian_Implement *impl_desc, Eina_Strbuf *buffer)
 {
    Eina_Bool var_as_ret = EINA_FALSE, ret_const = EINA_FALSE;
    Eina_Strbuf *params = NULL, *short_params = NULL, *super_invok = NULL;
@@ -264,7 +264,7 @@ impl_source_generate(const Eolian_Class *class, Eina_Strbuf 
*buffer)
 
    if (eolian_class_implements_list_get(class))
      {
-        Eolian_Implement impl_desc;
+        Eolian_Implement *impl_desc;
         EINA_LIST_FOREACH(eolian_class_implements_list_get(class), itr_funcs, 
impl_desc)
           {
              Eolian_Class *impl_class = NULL;
diff --git a/src/bin/eolian_cxx/convert.cc b/src/bin/eolian_cxx/convert.cc
index 1a5917d..066dc77 100644
--- a/src/bin/eolian_cxx/convert.cc
+++ b/src/bin/eolian_cxx/convert.cc
@@ -198,7 +198,7 @@ convert_eolian_implements(efl::eolian::eo_class& cls, 
Eolian_Class const *& klas
 
    EINA_LIST_FOREACH(eolian_class_implements_list_get(klass), it, impl_desc_)
      {
-        Eolian_Implement impl_desc = static_cast<Eolian_Implement>(impl_desc_);
+        Eolian_Implement *impl_desc = 
static_cast<Eolian_Implement*>(impl_desc_);
         Eolian_Class *impl_class;
         Eolian_Function impl_func;
         Eolian_Function_Type impl_type;
diff --git a/src/bin/eolian_cxx/eolian_wrappers.hh 
b/src/bin/eolian_cxx/eolian_wrappers.hh
index cb979d0..92e9c5e 100644
--- a/src/bin/eolian_cxx/eolian_wrappers.hh
+++ b/src/bin/eolian_cxx/eolian_wrappers.hh
@@ -308,7 +308,7 @@ parameter_type(Eolian_Function_Parameter const& parameter, 
setter_t func_type)
 }
 
 inline efl::eolian::eo_event
-event_create(Eolian_Class const *& klass, const Eolian_Event event_)
+event_create(Eolian_Class const *& klass, const Eolian_Event *event_)
 {
    efl::eolian::eo_event event;
    const char *name, *type, *comment;
@@ -332,7 +332,7 @@ event_list(Eolian_Class const *& klass)
    unsigned int length = eina_list_count(list);
    for (unsigned int i = 0; i < length; ++i)
      {
-        Eolian_Event e = static_cast<Eolian_Event>(eina_list_nth(list, i));
+        Eolian_Event *e = static_cast<Eolian_Event*>(eina_list_nth(list, i));
         events.push_back(event_create(klass, e));
      }
    return events;
diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h
index 17c5ed8..efa321f 100644
--- a/src/lib/eolian/Eolian.h
+++ b/src/lib/eolian/Eolian.h
@@ -66,13 +66,13 @@ typedef struct _Eolian_Function_Parameter* 
Eolian_Function_Parameter;
  *
  * @ingroup Eolian
  */
-typedef struct _Eolian_Implement* Eolian_Implement;
+typedef struct _Eolian_Implement Eolian_Implement;
 
 /* Event information
  *
  * @ingroup Eolian
  */
-typedef struct _Eolian_Event* Eolian_Event;
+typedef struct _Eolian_Event Eolian_Event;
 
 #define EOLIAN_LEGACY "legacy"
 #define EOLIAN_LEGACY_GET "legacy_get"
@@ -638,7 +638,7 @@ EAPI Eina_Bool 
eolian_function_object_is_const(Eolian_Function function_id);
  *
  * @ingroup Eolian
  */
-EAPI Eina_Stringshare * eolian_implement_full_name_get(const Eolian_Implement 
impl);
+EAPI Eina_Stringshare * eolian_implement_full_name_get(const Eolian_Implement 
*impl);
 
 /*
  * @brief Get information about an overriding function (implement).
@@ -651,14 +651,14 @@ EAPI Eina_Stringshare * 
eolian_implement_full_name_get(const Eolian_Implement im
  *
  * @ingroup Eolian
  */
-EAPI Eina_Bool eolian_implement_information_get(const Eolian_Implement impl,
+EAPI Eina_Bool eolian_implement_information_get(const Eolian_Implement *impl,
       Eolian_Class **klass, Eolian_Function *function, Eolian_Function_Type 
*type);
 
 /*
  * @brief Get the list of overriding functions defined in a class.
  *
  * @param[in] klass the class.
- * @return a list of Eolian_Implement handles
+ * @return a list of Eolian_Implement* handles
  *
  * @ingroup Eolian
  */
@@ -668,7 +668,7 @@ EAPI const Eina_List 
*eolian_class_implements_list_get(const Eolian_Class *klass
  * @brief Get the list of events defined in a class.
  *
  * @param[in] klass the class.
- * @return a list of Eolian_Event handles
+ * @return a list of Eolian_Event* handles
  *
  * @ingroup Eolian
  */
@@ -684,7 +684,7 @@ EAPI const Eina_List *eolian_class_events_list_get(const 
Eolian_Class *klass);
  *
  * @ingroup Eolian
  */
-EAPI Eina_Bool eolian_class_event_information_get(Eolian_Event event, const 
char **event_name, const char **event_type, const char **event_desc);
+EAPI Eina_Bool eolian_class_event_information_get(const Eolian_Event *event, 
const char **event_name, const char **event_type, const char **event_desc);
 
 /*
  * @brief Indicates if the class constructor has to invoke
diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c
index 3e9ed9a..8bbfe00 100644
--- a/src/lib/eolian/eo_parser.c
+++ b/src/lib/eolian/eo_parser.c
@@ -1376,13 +1376,13 @@ _db_fill_class(Eo_Class_Def *kls, const char *filename)
              database_function_set_as_virtual_pure(foo_id, ftype);
              continue;
           }
-        Eolian_Implement impl_desc = database_implement_new(impl_name);
+        Eolian_Implement *impl_desc = database_implement_new(impl_name);
         database_class_implement_add(class, impl_desc);
      }
 
    EINA_LIST_FOREACH(kls->events, l, event)
      {
-        Eolian_Event ev = database_event_new(event->name, event->type, 
event->comment);
+        Eolian_Event *ev = database_event_new(event->name, event->type, 
event->comment);
         database_class_event_add(class, ev);
      }
 
diff --git a/src/lib/eolian/eolian_database.c b/src/lib/eolian/eolian_database.c
index 7fcb6d3..bf185aa 100644
--- a/src/lib/eolian/eolian_database.c
+++ b/src/lib/eolian/eolian_database.c
@@ -36,8 +36,8 @@ typedef struct _Eolian_Class
    Eina_List *properties; /* List prop_name -> _Eolian_Function */
    Eina_List *methods; /* List meth_name -> _Eolian_Function */
    Eina_List *constructors; /* List constructor_name -> _Eolian_Function */
-   Eina_List *implements; /* List implements name -> _Eolian_Implement */
-   Eina_List *events; /* List event_name -> _Eolian_Event */
+   Eina_List *implements; /* List implements name -> Eolian_Implement */
+   Eina_List *events; /* List event_name -> Eolian_Event */
    Eina_Bool class_ctor_enable:1;
    Eina_Bool class_dtor_enable:1;
 } Eolian_Class;
@@ -106,17 +106,17 @@ typedef struct
    Eina_Bool is_own    :1;
 } _Eolian_Type;
 
-typedef struct
+typedef struct _Eolian_Implement
 {
    Eina_Stringshare *full_name;
-} _Eolian_Implement;
+} Eolian_Implement;
 
-typedef struct
+typedef struct _Eolian_Event
 {
    Eina_Stringshare *name;
    Eina_Stringshare *type;
    Eina_Stringshare *comment;
-} _Eolian_Event;
+} Eolian_Event;
 
 static void
 _param_del(_Eolian_Function_Parameter *pdesc)
@@ -157,7 +157,7 @@ _class_del(Eolian_Class *class)
    EINA_LIST_FREE(inherits, inherit_name)
       eina_stringshare_del(inherit_name);
 
-   _Eolian_Implement *impl;
+   Eolian_Implement *impl;
    Eina_List *implements = class->implements;
    EINA_LIST_FREE(implements, impl)
      {
@@ -166,7 +166,7 @@ _class_del(Eolian_Class *class)
      }
 
    _Eolian_Function *fid;
-   Eolian_Event ev;
+   Eolian_Event *ev;
    EINA_LIST_FREE(class->constructors, fid) _fid_del(fid);
    EINA_LIST_FREE(class->methods, fid) _fid_del(fid);
    EINA_LIST_FREE(class->properties, fid) _fid_del(fid);
@@ -566,17 +566,17 @@ Eina_Bool database_class_function_add(Eolian_Class *cl, 
Eolian_Function foo_id)
    return EINA_TRUE;
 }
 
-Eolian_Implement
+Eolian_Implement *
 database_implement_new(const char *impl_name)
 {
-   _Eolian_Implement *impl_desc = calloc(1, sizeof(_Eolian_Implement));
+   Eolian_Implement *impl_desc = calloc(1, sizeof(Eolian_Implement));
    EINA_SAFETY_ON_NULL_RETURN_VAL(impl_desc, NULL);
    impl_desc->full_name = eina_stringshare_add(impl_name);
-   return (Eolian_Implement) impl_desc;
+   return impl_desc;
 }
 
 Eina_Bool
-database_class_implement_add(Eolian_Class *cl, Eolian_Implement impl_desc)
+database_class_implement_add(Eolian_Class *cl, Eolian_Implement *impl_desc)
 {
    EINA_SAFETY_ON_NULL_RETURN_VAL(impl_desc, EINA_FALSE);
    EINA_SAFETY_ON_NULL_RETURN_VAL(cl, EINA_FALSE);
@@ -585,24 +585,22 @@ database_class_implement_add(Eolian_Class *cl, 
Eolian_Implement impl_desc)
 }
 
 EAPI Eina_Stringshare *
-eolian_implement_full_name_get(const Eolian_Implement impl)
+eolian_implement_full_name_get(const Eolian_Implement *impl)
 {
-   _Eolian_Implement *_impl = (_Eolian_Implement *)impl;
-   EINA_SAFETY_ON_NULL_RETURN_VAL(_impl, NULL);
-   return _impl->full_name;
+   EINA_SAFETY_ON_NULL_RETURN_VAL(impl, NULL);
+   return impl->full_name;
 }
 
 EAPI Eina_Bool
-eolian_implement_information_get(const Eolian_Implement impl, Eolian_Class 
**class_out, Eolian_Function *func_out, Eolian_Function_Type *type_out)
+eolian_implement_information_get(const Eolian_Implement *impl, Eolian_Class 
**class_out, Eolian_Function *func_out, Eolian_Function_Type *type_out)
 {
-   _Eolian_Implement *_impl = (_Eolian_Implement *)impl;
-   EINA_SAFETY_ON_NULL_RETURN_VAL(_impl, EINA_FALSE);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(impl, EINA_FALSE);
    Eolian_Class *class;
-   if (!database_class_name_validate(_impl->full_name, &class) || !class) 
return EINA_FALSE;
+   if (!database_class_name_validate(impl->full_name, &class) || !class) 
return EINA_FALSE;
    const char *class_name = class->full_name;
    if (class_out) *class_out = class;
 
-   char *func_name = strdup(_impl->full_name + strlen(class_name) + 1);
+   char *func_name = strdup(impl->full_name + strlen(class_name) + 1);
    char *colon = strchr(func_name, '.');
    Eolian_Function_Type type = EOLIAN_UNRESOLVED;
    if (colon)
@@ -1049,29 +1047,28 @@ eolian_function_object_is_const(Eolian_Function foo_id)
    return fid->obj_is_const;
 }
 
-Eolian_Event
+Eolian_Event *
 database_event_new(const char *event_name, const char *event_type, const char 
*event_comment)
 {
    if (!event_name) return NULL;
-   _Eolian_Event *event_desc = calloc(1, sizeof(_Eolian_Event));
+   Eolian_Event *event_desc = calloc(1, sizeof(Eolian_Event));
    if (!event_desc) return NULL;
    event_desc->name = eina_stringshare_add(event_name);
    if (event_type) event_desc->type = eina_stringshare_add(event_type);
    event_desc->comment = eina_stringshare_add(event_comment);
-   return (Eolian_Event) event_desc;
+   return event_desc;
 }
 
 void
-database_event_free(Eolian_Event event)
+database_event_free(Eolian_Event *event)
 {
-   _Eolian_Event *event_desc = (_Eolian_Event *)event;
-   eina_stringshare_del(event_desc->name);
-   eina_stringshare_del(event_desc->comment);
-   free(event_desc);
+   eina_stringshare_del(event->name);
+   eina_stringshare_del(event->comment);
+   free(event);
 }
 
 Eina_Bool
-database_class_event_add(Eolian_Class *cl, Eolian_Event event_desc)
+database_class_event_add(Eolian_Class *cl, Eolian_Event *event_desc)
 {
    EINA_SAFETY_ON_FALSE_RETURN_VAL(event_desc && cl, EINA_FALSE);
    cl->events = eina_list_append(cl->events, event_desc);
@@ -1086,13 +1083,12 @@ eolian_class_events_list_get(const Eolian_Class *cl)
 }
 
 EAPI Eina_Bool
-eolian_class_event_information_get(Eolian_Event event, const char 
**event_name, const char **event_type, const char **event_comment)
+eolian_class_event_information_get(const Eolian_Event *event, const char 
**event_name, const char **event_type, const char **event_comment)
 {
-   _Eolian_Event *_event_desc = (_Eolian_Event *) event;
-   EINA_SAFETY_ON_NULL_RETURN_VAL(_event_desc, EINA_FALSE);
-   if (event_name) *event_name = _event_desc->name;
-   if (event_type) *event_type = _event_desc->type;
-   if (event_comment) *event_comment = _event_desc->comment;
+   EINA_SAFETY_ON_NULL_RETURN_VAL(event, EINA_FALSE);
+   if (event_name) *event_name = event->name;
+   if (event_type) *event_type = event->type;
+   if (event_comment) *event_comment = event->comment;
    return EINA_TRUE;
 }
 
@@ -1424,7 +1420,7 @@ database_type_print(Eolian_Type type)
 }
 
 static void
-_implements_print(Eolian_Implement impl, int nb_spaces)
+_implements_print(Eolian_Implement *impl, int nb_spaces)
 {
    Eolian_Class *class;
    Eolian_Function func;
@@ -1449,7 +1445,7 @@ _implements_print(Eolian_Implement impl, int nb_spaces)
 }
 
 static void
-_event_print(Eolian_Event ev, int nb_spaces)
+_event_print(Eolian_Event *ev, int nb_spaces)
 {
    const char *name, *comment, *type;
 
@@ -1619,7 +1615,7 @@ _class_print(const Eolian_Class *cl)
      }
    // Implement
    printf("  implements:\n");
-   Eolian_Implement impl;
+   Eolian_Implement *impl;
    EINA_LIST_FOREACH(cl->implements, itr, impl)
      {
         _implements_print(impl, 4);
@@ -1627,7 +1623,7 @@ _class_print(const Eolian_Class *cl)
    printf("\n");
    // Implement
    printf("  events:\n");
-   Eolian_Event ev;
+   Eolian_Event *ev;
    EINA_LIST_FOREACH(cl->events, itr, ev)
      {
         _event_print(ev, 4);
@@ -1730,7 +1726,7 @@ eolian_eo_file_parse(const char *filepath)
    const Eina_List *itr;
    Eolian_Class *class = eolian_class_find_by_file(filepath);
    const char *inherit_name;
-   Eolian_Implement impl;
+   Eolian_Implement *impl;
    if (!class)
      {
         if (!eo_parser_database_fill(filepath, EINA_FALSE)) return EINA_FALSE;
diff --git a/src/lib/eolian/eolian_database.h b/src/lib/eolian/eolian_database.h
index f54a567..0403f20 100644
--- a/src/lib/eolian/eolian_database.h
+++ b/src/lib/eolian/eolian_database.h
@@ -118,11 +118,11 @@ database_function_scope_set(Eolian_Function function_id, 
Eolian_Function_Scope s
 
 /* Need to add API for callbacks and implements */
 
-Eolian_Implement
+Eolian_Implement *
 database_implement_new(const char *impl_name);
 
 Eina_Bool
-database_class_implement_add(Eolian_Class *class, Eolian_Implement impl_id);
+database_class_implement_add(Eolian_Class *class, Eolian_Implement *impl_id);
 
 Eina_Bool
 database_class_ctor_enable_set(Eolian_Class *class, Eina_Bool enable);
@@ -130,14 +130,14 @@ database_class_ctor_enable_set(Eolian_Class *class, 
Eina_Bool enable);
 Eina_Bool
 database_class_dtor_enable_set(Eolian_Class *class, Eina_Bool enable);
 
-Eolian_Event
+Eolian_Event *
 database_event_new(const char *event_name, const char *event_type, const char 
*event_desc);
 
 void
-database_event_free(Eolian_Event event);
+database_event_free(Eolian_Event *event);
 
 Eina_Bool
-database_class_event_add(Eolian_Class *class, Eolian_Event event_desc);
+database_class_event_add(Eolian_Class *class, Eolian_Event *event_desc);
 
 void
 database_type_print(Eolian_Type type);

-- 


Reply via email to