Eo: Made constructor/destructor regular ops.
authortasn <tasn>
Sun, 10 Jun 2012 14:04:53 +0000 (14:04 +0000)
committertasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sun, 10 Jun 2012 14:04:53 +0000 (14:04 +0000)
This lets us remove some unneeded code and makes everything nicer.

git-svn-id: http://svn.enlightenment.org/svn/e/trunk/PROTO/eobj@71899 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

37 files changed:
CMakeLists.txt
examples/access/inherit.c
examples/access/simple.c
examples/composite_objects/comp.c
examples/composite_objects/simple.c
examples/constructors/mixin.c
examples/constructors/simple.c
examples/constructors/simple2.c
examples/constructors/simple3.c
examples/constructors/simple4.c
examples/constructors/simple5.c
examples/constructors/simple6.c
examples/evas/elw_box.c
examples/evas/elw_boxedbutton.c
examples/evas/elw_button.c
examples/evas/elw_win.c
examples/evas/evas_obj.c
examples/function_overrides/inherit.c
examples/function_overrides/inherit2.c
examples/function_overrides/inherit3.c
examples/function_overrides/main.c
examples/function_overrides/simple.c
examples/interface/interface.c
examples/interface/interface2.c
examples/interface/simple.c
examples/mixin/mixin.c
examples/mixin/mixin2.c
examples/mixin/mixin3.c
examples/mixin/simple.c
examples/signals/simple.c
lib/Eo.h
lib/eo.c
lib/eo_base_class.c
lib/eo_private.h
tests/class_simple.c
tests/eo_test_class_errors.c
tests/eo_test_general.c

index f4e1f2e..0f579e8 100644 (file)
@@ -39,7 +39,7 @@ configure_file (
 include(EFLCheck)
 
 add_subdirectory(lib)
-add_subdirectory(examples/evas)
+#add_subdirectory(examples/evas)
 add_subdirectory(examples/mixin)
 add_subdirectory(examples/signals)
 add_subdirectory(examples/access)
index 91a8869..2bf8abe 100644 (file)
@@ -40,8 +40,6 @@ static const Eo_Class_Description class_desc = {
      EO_CLASS_DESCRIPTION_OPS(&INHERIT_BASE_ID, op_desc, INHERIT_SUB_ID_LAST),
      NULL,
      0,
-     NULL,
-     NULL,
      _class_constructor,
      NULL
 };
index 1399214..12cb082 100644 (file)
@@ -57,8 +57,6 @@ static const Eo_Class_Description class_desc = {
      EO_CLASS_DESCRIPTION_OPS(&SIMPLE_BASE_ID, op_desc, SIMPLE_SUB_ID_LAST),
      event_desc,
      sizeof(Private_Data),
-     NULL,
-     NULL,
      _class_constructor,
      NULL
 };
index f8ed9f2..4774974 100644 (file)
@@ -19,9 +19,9 @@ _a_get(const Eo *obj, const void *class_data EINA_UNUSED, va_list *list)
 }
 
 static void
-_constructor(Eo *obj, void *class_data EINA_UNUSED)
+_constructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
 {
-   eo_constructor_super(obj);
+   eo_do_super(obj, eo_constructor());
 
    Eo *simple = eo_add(SIMPLE_CLASS, obj);
    eo_composite_object_attach(obj, simple);
@@ -39,6 +39,7 @@ static void
 _class_constructor(Eo_Class *klass)
 {
    const Eo_Op_Func_Description func_desc[] = {
+        EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
         EO_OP_FUNC_CONST(SIMPLE_ID(SIMPLE_SUB_ID_A_GET), _a_get),
         EO_OP_FUNC_SENTINEL
    };
@@ -52,8 +53,6 @@ static const Eo_Class_Description class_desc = {
      EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
      NULL,
      0,
-     _constructor,
-     NULL,
      _class_constructor,
      NULL
 };
index d7e5e25..dbb40df 100644 (file)
@@ -60,8 +60,6 @@ static const Eo_Class_Description class_desc = {
      EO_CLASS_DESCRIPTION_OPS(&SIMPLE_BASE_ID, op_desc, SIMPLE_SUB_ID_LAST),
      event_desc,
      sizeof(Simple_Public_Data),
-     NULL,
-     NULL,
      _class_constructor,
      NULL
 };
index b8d9cf6..a572f3f 100644 (file)
@@ -20,17 +20,17 @@ _add_and_print_set(const Eo *obj, const void *class_data EINA_UNUSED, va_list *l
 extern int my_init_count;
 
 static void
-_constructor(Eo *obj, void *class_data EINA_UNUSED)
+_constructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
 {
-   eo_constructor_super(obj);
+   eo_do_super(obj, eo_constructor());
 
    my_init_count++;
 }
 
 static void
-_destructor(Eo *obj, void *class_data EINA_UNUSED)
+_destructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
 {
-   eo_destructor_super(obj);
+   eo_do_super(obj, eo_destructor());
 
    my_init_count--;
 }
@@ -39,6 +39,8 @@ static void
 _class_constructor(Eo_Class *klass)
 {
    const Eo_Op_Func_Description func_desc[] = {
+        EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
+        EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DESTRUCTOR), _destructor),
         EO_OP_FUNC_CONST(MIXIN_ID(MIXIN_SUB_ID_ADD_AND_SET), _add_and_print_set),
         EO_OP_FUNC_SENTINEL
    };
@@ -57,8 +59,6 @@ static const Eo_Class_Description class_desc = {
      EO_CLASS_DESCRIPTION_OPS(&MIXIN_BASE_ID, op_desc, MIXIN_SUB_ID_LAST),
      NULL,
      0,
-     _constructor,
-     _destructor,
      _class_constructor,
      NULL
 };
index 7918b8c..c1dddb4 100644 (file)
@@ -42,17 +42,17 @@ _GET_SET_FUNC(b)
 extern int my_init_count;
 
 static void
-_constructor(Eo *obj, void *class_data EINA_UNUSED)
+_constructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
 {
-   eo_constructor_super(obj);
+   eo_do_super(obj, eo_constructor());
 
    my_init_count++;
 }
 
 static void
-_destructor(Eo *obj, void *class_data EINA_UNUSED)
+_destructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
 {
-   eo_destructor_super(obj);
+   eo_do_super(obj, eo_destructor());
 
    my_init_count--;
 }
@@ -61,6 +61,8 @@ static void
 _class_constructor(Eo_Class *klass)
 {
    const Eo_Op_Func_Description func_desc[] = {
+        EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
+        EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DESTRUCTOR), _destructor),
         EO_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_A_SET), _a_set),
         EO_OP_FUNC_CONST(SIMPLE_ID(SIMPLE_SUB_ID_A_GET), _a_get),
         EO_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_B_SET), _b_set),
@@ -93,8 +95,6 @@ static const Eo_Class_Description class_desc = {
      EO_CLASS_DESCRIPTION_OPS(&SIMPLE_BASE_ID, op_desc, SIMPLE_SUB_ID_LAST),
      NULL,
      sizeof(Private_Data),
-     _constructor,
-     _destructor,
      _class_constructor,
      _class_destructor
 };
index 2980dca..9effd91 100644 (file)
@@ -7,22 +7,31 @@
 #define MY_CLASS SIMPLE2_CLASS
 
 static void
-_constructor(Eo *obj, void *class_data EINA_UNUSED)
+_constructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
 {
-   eo_constructor_super(obj);
+   eo_do_super(obj, eo_constructor());
 
    eo_error_set(obj);
 }
 
+static void
+_class_constructor(Eo_Class *klass)
+{
+   const Eo_Op_Func_Description func_desc[] = {
+        EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
+        EO_OP_FUNC_SENTINEL
+   };
+
+   eo_class_funcs_set(klass, func_desc);
+}
+
 static const Eo_Class_Description class_desc = {
      "Simple2",
      EO_CLASS_TYPE_REGULAR,
      EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
      NULL,
      0,
-     _constructor,
-     NULL,
-     NULL,
+     _class_constructor,
      NULL
 };
 
index a09ec46..7ecc874 100644 (file)
@@ -7,20 +7,29 @@
 #define MY_CLASS SIMPLE3_CLASS
 
 static void
-_constructor(Eo *obj, void *class_data EINA_UNUSED)
+_constructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
 {
    (void) obj;
 }
 
+static void
+_class_constructor(Eo_Class *klass)
+{
+   const Eo_Op_Func_Description func_desc[] = {
+        EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
+        EO_OP_FUNC_SENTINEL
+   };
+
+   eo_class_funcs_set(klass, func_desc);
+}
+
 static const Eo_Class_Description class_desc = {
      "Simple3",
      EO_CLASS_TYPE_REGULAR,
      EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
      NULL,
      0,
-     _constructor,
-     NULL,
-     NULL,
+     _class_constructor,
      NULL
 };
 
index 43099d3..0c7eb62 100644 (file)
@@ -12,8 +12,6 @@ static const Eo_Class_Description class_desc = {
      NULL,
      0,
      NULL,
-     NULL,
-     NULL,
      NULL
 };
 
index e8438c0..098a168 100644 (file)
@@ -7,20 +7,29 @@
 #define MY_CLASS SIMPLE5_CLASS
 
 static void
-_destructor(Eo *obj, void *class_data EINA_UNUSED)
+_destructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
 {
    (void) obj;
 }
 
+static void
+_class_constructor(Eo_Class *klass)
+{
+   const Eo_Op_Func_Description func_desc[] = {
+        EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DESTRUCTOR), _destructor),
+        EO_OP_FUNC_SENTINEL
+   };
+
+   eo_class_funcs_set(klass, func_desc);
+}
+
 static const Eo_Class_Description class_desc = {
      "Simple5",
      EO_CLASS_TYPE_REGULAR,
      EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
      NULL,
      0,
-     NULL,
-     _destructor,
-     NULL,
+     _class_constructor,
      NULL
 };
 
index b5c143a..743f3ef 100644 (file)
@@ -7,22 +7,31 @@
 #define MY_CLASS SIMPLE6_CLASS
 
 static void
-_destructor(Eo *obj, void *class_data EINA_UNUSED)
+_destructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
 {
-   eo_constructor_super(obj);
+   eo_do_super(obj, eo_constructor());
 
    eo_error_set(obj);
 }
 
+static void
+_class_constructor(Eo_Class *klass)
+{
+   const Eo_Op_Func_Description func_desc[] = {
+        EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DESTRUCTOR), _destructor),
+        EO_OP_FUNC_SENTINEL
+   };
+
+   eo_class_funcs_set(klass, func_desc);
+}
+
 static const Eo_Class_Description class_desc = {
      "Simple6",
      EO_CLASS_TYPE_REGULAR,
      EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
      NULL,
      0,
-     NULL,
-     _destructor,
-     NULL,
+     _class_constructor,
      NULL
 };
 
index 508db15..e447ddf 100644 (file)
@@ -28,7 +28,7 @@ _pack_end(Eo *obj EINA_UNUSED, void *class_data, va_list *list)
 static void
 _constructor(Eo *obj, void *class_data)
 {
-   eo_constructor_super(obj);
+   eo_do_super(obj, eo_constructor());
 
    Widget_Data *wd = class_data;
 
index 21c465a..8bdc308 100644 (file)
@@ -16,9 +16,9 @@ typedef struct
 #define MY_CLASS ELW_BOXEDBUTTON_CLASS
 
 static void
-_constructor(Eo *obj, void *class_data EINA_UNUSED)
+_constructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
 {
-   eo_constructor_super(obj);
+   eo_do_super(obj, eo_constructor());
 
    Eo *bt = eo_add(ELW_BUTTON_CLASS, obj);
    eo_composite_object_attach(obj, bt);
index 52e6d5f..3eecb98 100644 (file)
@@ -50,7 +50,7 @@ _btn_clicked(void *data, Evas_Object *evas_obj, void *event_info)
 static void
 _constructor(Eo *obj, void *class_data)
 {
-   eo_constructor_super(obj);
+   eo_do_super(obj, eo_constructor());
 
    Widget_Data *wd = class_data;
 
@@ -64,9 +64,9 @@ _constructor(Eo *obj, void *class_data)
 }
 
 static void
-_destructor(Eo *obj, void *class_data EINA_UNUSED)
+_destructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
 {
-   eo_destructor_super(obj);
+   eo_do_super(obj, eo_destructor());
 
    //Widget_Data *wd = class_data;
    /* FIXME: Commented out because it's automatically done because our tree
index aad69f5..2558b00 100644 (file)
@@ -25,7 +25,7 @@ my_win_del(void *data, Evas_Object *obj, void *event_info)
 static void
 _constructor(Eo *obj, void *class_data)
 {
-   eo_constructor_super(obj);
+   eo_do_super(obj, eo_constructor());
 
    Widget_Data *wd = class_data;
 
index 1177fd6..753f773 100644 (file)
@@ -78,9 +78,9 @@ _child_add(Eo *obj, void *class_data, va_list *list)
 }
 
 static void
-_constructor(Eo *obj, void *class_data EINA_UNUSED)
+_constructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
 {
-   eo_constructor_super(obj);
+   eo_do_super(obj, eo_constructor());
 
    /* Add type check. */
    Eo *parent = eo_parent_get(obj);
@@ -91,7 +91,7 @@ _constructor(Eo *obj, void *class_data EINA_UNUSED)
 static void
 _destructor(Eo *obj, void *class_data)
 {
-   eo_destructor_super(obj);
+   eo_do_super(obj, eo_destructor());
 
    Widget_Data *wd = class_data;
 
index a8cde28..c9d256a 100644 (file)
@@ -12,8 +12,6 @@ static const Eo_Class_Description class_desc = {
      NULL,
      0,
      NULL,
-     NULL,
-     NULL,
      NULL
 };
 
index 2d8ed17..a334457 100644 (file)
@@ -72,8 +72,6 @@ static const Eo_Class_Description class_desc = {
      EO_CLASS_DESCRIPTION_OPS(&INHERIT2_BASE_ID, op_desc, INHERIT2_SUB_ID_LAST),
      NULL,
      0,
-     NULL,
-     NULL,
      _class_constructor,
      NULL
 };
index 43be75f..185962e 100644 (file)
@@ -34,8 +34,6 @@ static const Eo_Class_Description class_desc = {
      EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
      NULL,
      0,
-     NULL,
-     NULL,
      _class_constructor,
      NULL
 };
index 4eb770d..7e9d2e1 100644 (file)
@@ -47,8 +47,8 @@ main(int argc, char *argv[])
 
    fail_if(eo_class_do(SIMPLE_CLASS, simple_a_print()));
 
-   eo_constructor_super(obj);
-   eo_destructor_super(obj);
+   eo_do_super(obj, eo_constructor());
+   eo_do_super(obj, eo_destructor());
 
    eo_unref(obj);
 
index d3742a5..328736e 100644 (file)
@@ -70,8 +70,6 @@ static const Eo_Class_Description class_desc = {
      EO_CLASS_DESCRIPTION_OPS(&SIMPLE_BASE_ID, op_desc, SIMPLE_SUB_ID_LAST),
      NULL,
      sizeof(Simple_Public_Data),
-     NULL,
-     NULL,
      _class_constructor,
      NULL
 };
index d03a30c..8015e63 100644 (file)
@@ -20,8 +20,6 @@ static const Eo_Class_Description class_desc = {
      NULL,
      0,
      NULL,
-     NULL,
-     NULL,
      NULL
 };
 
index 9abf7f0..0f60bbc 100644 (file)
@@ -21,8 +21,6 @@ static const Eo_Class_Description class_desc = {
      NULL,
      0,
      NULL,
-     NULL,
-     NULL,
      NULL
 };
 
index 216bc5a..b72ed76 100644 (file)
@@ -90,8 +90,6 @@ static const Eo_Class_Description class_desc = {
      EO_CLASS_DESCRIPTION_OPS(&SIMPLE_BASE_ID, op_desc, SIMPLE_SUB_ID_LAST),
      NULL,
      sizeof(Private_Data),
-     NULL,
-     NULL,
      _class_constructor,
      NULL
 };
index f1b112c..e643d2a 100644 (file)
@@ -20,21 +20,23 @@ _ab_sum_get(const Eo *obj, const void *class_data EINA_UNUSED, va_list *list)
 }
 
 static void
-_constructor(Eo *obj, void *class_data EINA_UNUSED)
+_constructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
 {
-   eo_constructor_super(obj);
+   eo_do_super(obj, eo_constructor());
 }
 
 static void
-_destructor(Eo *obj, void *class_data EINA_UNUSED)
+_destructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
 {
-   eo_destructor_super(obj);
+   eo_do_super(obj, eo_destructor());
 }
 
 static void
 _class_constructor(Eo_Class *klass)
 {
    const Eo_Op_Func_Description func_desc[] = {
+        EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
+        EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DESTRUCTOR), _destructor),
         EO_OP_FUNC_CONST(MIXIN_ID(MIXIN_SUB_ID_AB_SUM_GET), _ab_sum_get),
         EO_OP_FUNC_SENTINEL
    };
@@ -54,8 +56,6 @@ static const Eo_Class_Description class_desc = {
      EO_CLASS_DESCRIPTION_OPS(&MIXIN_BASE_ID, op_desc, MIXIN_SUB_ID_LAST),
      NULL,
      0,
-     _constructor,
-     _destructor,
      _class_constructor,
      NULL
 };
index 2244ffd..f47c438 100644 (file)
@@ -29,21 +29,23 @@ _ab_sum_get(const Eo *obj, const void *class_data, va_list *list)
 }
 
 static void
-_constructor(Eo *obj, void *class_data EINA_UNUSED)
+_constructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
 {
-   eo_constructor_super(obj);
+   eo_do_super(obj, eo_constructor());
 }
 
 static void
-_destructor(Eo *obj, void *class_data EINA_UNUSED)
+_destructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
 {
-   eo_destructor_super(obj);
+   eo_do_super(obj, eo_destructor());
 }
 
 static void
 _class_constructor(Eo_Class *klass)
 {
    const Eo_Op_Func_Description func_desc[] = {
+        EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
+        EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DESTRUCTOR), _destructor),
         EO_OP_FUNC_CONST(MIXIN_ID(MIXIN_SUB_ID_AB_SUM_GET), _ab_sum_get),
         EO_OP_FUNC_SENTINEL
    };
@@ -57,8 +59,6 @@ static const Eo_Class_Description class_desc = {
      EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
      NULL,
      sizeof(Mixin2_Public_Data),
-     _constructor,
-     _destructor,
      _class_constructor,
      NULL
 };
index c1821f9..46a3d7c 100644 (file)
@@ -29,21 +29,23 @@ _ab_sum_get(const Eo *obj, const void *class_data EINA_UNUSED, va_list *list)
 }
 
 static void
-_constructor(Eo *obj, void *class_data EINA_UNUSED)
+_constructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
 {
-   eo_constructor_super(obj);
+   eo_do_super(obj, eo_constructor());
 }
 
 static void
-_destructor(Eo *obj, void *class_data EINA_UNUSED)
+_destructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
 {
-   eo_destructor_super(obj);
+   eo_do_super(obj, eo_destructor());
 }
 
 static void
 _class_constructor(Eo_Class *klass)
 {
    const Eo_Op_Func_Description func_desc[] = {
+        EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
+        EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DESTRUCTOR), _destructor),
         EO_OP_FUNC_CONST(MIXIN_ID(MIXIN_SUB_ID_AB_SUM_GET), _ab_sum_get),
         EO_OP_FUNC_SENTINEL
    };
@@ -57,8 +59,6 @@ static const Eo_Class_Description class_desc = {
      EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
      NULL,
      sizeof(Mixin3_Public_Data),
-     _constructor,
-     _destructor,
      _class_constructor,
      NULL
 };
index 347e3b5..c0c3b79 100644 (file)
@@ -67,8 +67,6 @@ static const Eo_Class_Description class_desc = {
      EO_CLASS_DESCRIPTION_OPS(&SIMPLE_BASE_ID, op_desc, SIMPLE_SUB_ID_LAST),
      NULL,
      sizeof(Private_Data),
-     NULL,
-     NULL,
      _class_constructor,
      NULL
 };
index ad68e33..6bbd3bd 100644 (file)
@@ -63,9 +63,9 @@ _cb_deled(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_inf
 }
 
 static void
-_constructor(Eo *obj, void *class_data EINA_UNUSED)
+_constructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
 {
-   eo_constructor_super(obj);
+   eo_do_super(obj, eo_constructor());
 
    eo_do(obj, eo_event_callback_add(EO_EV_CALLBACK_ADD, _cb_added, NULL));
    eo_do(obj, eo_event_callback_add(EO_EV_CALLBACK_DEL, _cb_deled, NULL));
@@ -77,6 +77,7 @@ static void
 _class_constructor(Eo_Class *klass)
 {
    const Eo_Op_Func_Description func_desc[] = {
+        EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
         EO_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_A_SET), _a_set),
         EO_OP_FUNC_SENTINEL
    };
@@ -100,8 +101,6 @@ static const Eo_Class_Description class_desc = {
      EO_CLASS_DESCRIPTION_OPS(&SIMPLE_BASE_ID, op_desc, SIMPLE_SUB_ID_LAST),
      event_desc,
      sizeof(Private_Data),
-     _constructor,
-     NULL,
      _class_constructor,
      NULL
 };
index e0d8d82..04e9a0c 100644 (file)
--- a/lib/Eo.h
+++ b/lib/Eo.h
@@ -252,6 +252,7 @@ class_get_func_name(void) \
         return _my_class; \
      } \
    eina_lock_release(&_eo_class_creation_lock); \
+   (void) parent_class; \
    _my_class = eo_class_new(class_desc, id, parent_class, __VA_ARGS__); \
    eina_lock_release(&_my_lock); \
    \
@@ -369,8 +370,6 @@ struct _Eo_Class_Description
    } ops; /**< The ops description, should be filled using #EO_CLASS_DESCRIPTION_OPS */
    const Eo_Event_Description **events; /**< The event descriptions for this class. */
    size_t data_size; /**< The size of data (private + protected + public) this class needs per object. */
-   void (*constructor)(Eo *obj, void *class_data); /**< The constructor of the object. */
-   void (*destructor)(Eo *obj, void *class_data); /**< The destructor of the object. */
    void (*class_constructor)(Eo_Class *klass); /**< The constructor of the class. */
    void (*class_destructor)(Eo_Class *klass); /**< The destructor of the class. */
 };
@@ -620,22 +619,6 @@ EAPI Eina_Bool eo_class_do_super_internal(const Eo_Class *klass, Eo_Op op, ...);
 EAPI const Eo_Class *eo_class_get(const Eo *obj);
 
 /**
- * @brief Calls the super constructor of the object passed.
- * @param obj the object to work on.
- *
- * @see eo_destructor_super()
- */
-EAPI void eo_constructor_super(Eo *obj);
-
-/**
- * @brief Calls the super destructor of the object passed.
- * @param obj the object to work on.
- *
- * @see eo_constructor_super()
- */
-EAPI void eo_destructor_super(Eo *obj);
-
-/**
  * @def eo_error_set
  * @brief Notify eo that there was an error when constructing, destructing or calling a function of the object.
  * @param obj the object to work on.
@@ -853,7 +836,7 @@ EAPI void eo_manual_free(Eo *obj);
  * @brief Use #EO_BASE_CLASS
  * @internal
  * */
-EAPI const Eo_Class *eo_base_class_get(void) EINA_CONST;
+EAPI const Eo_Class *eo_base_class_get(void);
 
 /**
  * @typedef eo_base_data_free_func
@@ -874,6 +857,8 @@ typedef void (*eo_base_data_free_func)(void *);
 #define EO_BASE_BASE_ID EO_CLASS_ID_TO_BASE_ID(EO_BASE_CLASS_ID)
 
 enum {
+     EO_BASE_SUB_ID_CONSTRUCTOR,
+     EO_BASE_SUB_ID_DESTRUCTOR,
      EO_BASE_SUB_ID_DATA_SET,
      EO_BASE_SUB_ID_DATA_GET,
      EO_BASE_SUB_ID_DATA_DEL,
@@ -972,6 +957,26 @@ enum {
    } while (0)
 
 /**
+ * @def eo_constructor
+ * @brief Call the object's constructor.
+ *
+ * Should not be used with #eo_do. Only use it with #eo_do_super.
+ *
+ * @see #eo_destructor
+ */
+#define eo_constructor() EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR)
+
+/**
+ * @def eo_destructor
+ * @brief Call the object's destructor.
+ *
+ * Should not be used with #eo_do. Only use it with #eo_do_super.
+ *
+ * @see #eo_constructor
+ */
+#define eo_destructor() EO_BASE_ID(EO_BASE_SUB_ID_DESTRUCTOR)
+
+/**
  * @addtogroup Eo_Events Eo's Event Handling
  * @{
  */
index 63735f4..a3f5125 100644 (file)
--- a/lib/eo.c
+++ b/lib/eo.c
@@ -16,8 +16,7 @@ static Eo_Class **_eo_classes;
 static Eo_Class_Id _eo_classes_last_id;
 static Eina_Bool _eo_init_count = 0;
 
-static void _eo_constructor(Eo *obj, const Eo_Class *klass);
-static void _eo_destructor(Eo *obj, const Eo_Class *klass);
+static void _eo_condtor_reset(Eo *obj);
 static inline Eina_Bool _eo_error_get(const Eo *obj);
 static inline void _eo_error_unset(Eo *obj);
 static inline void *_eo_data_get(const Eo *obj, const Eo_Class *klass);
@@ -45,9 +44,11 @@ struct _Eo {
 
      Eo_Kls_Itr mro_itr;
 
+     Eina_Bool construct_error:1;
+     Eina_Bool condtor_done:1;
+
      Eina_Bool composite:1;
      Eina_Bool del:1;
-     Eina_Bool construct_error:1;
      Eina_Bool manual_free:1;
 };
 
@@ -279,7 +280,7 @@ _eo_kls_itr_init(const Eo_Class *obj_klass, Eo_Kls_Itr *cur, Eo_Op op, Eo_Kls_It
    prev_state->kls_itr = cur->kls_itr;
 
    /* If we are in a constructor/destructor or we changed an op - init. */
-   if ((op == EO_NOOP) || (cur->op != op))
+   if ((cur->op == EO_NOOP) || (cur->op != op))
      {
         cur->op = op;
         cur->kls_itr = obj_klass->mro;
@@ -317,17 +318,10 @@ _eo_kls_itr_next(Eo_Kls_Itr *cur, Eo_Op op)
    const Eo_Class **kls_itr = cur->kls_itr;
    if (*kls_itr)
      {
-        if (op != EO_NOOP)
-          {
-             const op_type_funcs *fsrc = _dich_func_get(*kls_itr, op);
+        const op_type_funcs *fsrc = _dich_func_get(*kls_itr, op);
 
-             while (*kls_itr && (*(kls_itr++) != fsrc->src))
-                ;
-          }
-        else
-          {
-             kls_itr++;
-          }
+        while (*kls_itr && (*(kls_itr++) != fsrc->src))
+           ;
 
         cur->kls_itr = kls_itr;
         return *kls_itr;
@@ -338,13 +332,6 @@ _eo_kls_itr_next(Eo_Kls_Itr *cur, Eo_Op op)
      }
 }
 
-static inline Eina_Bool
-_eo_kls_itr_reached_end(const Eo_Kls_Itr *cur)
-{
-   const Eo_Class **kls_itr = cur->kls_itr;
-   return !(*kls_itr && *(kls_itr + 1));
-}
-
 static inline const op_type_funcs *
 _eo_kls_itr_func_get(const Eo_Class *klass, Eo_Kls_Itr *mro_itr, Eo_Op op, Eo_Kls_Itr *prev_state)
 {
@@ -883,8 +870,6 @@ eo_class_new(const Eo_Class_Description *desc, Eo_Class_Id id, const Eo_Class *p
    /* Check restrictions on Interface types. */
    if (desc->type == EO_CLASS_TYPE_INTERFACE)
      {
-        EINA_SAFETY_ON_FALSE_RETURN_VAL(!desc->constructor, NULL);
-        EINA_SAFETY_ON_FALSE_RETURN_VAL(!desc->destructor, NULL);
         EINA_SAFETY_ON_FALSE_RETURN_VAL(!desc->class_constructor, NULL);
         EINA_SAFETY_ON_FALSE_RETURN_VAL(!desc->class_destructor, NULL);
         EINA_SAFETY_ON_FALSE_RETURN_VAL(!desc->data_size, NULL);
@@ -1135,9 +1120,10 @@ eo_add(const Eo_Class *klass, Eo *parent)
 
    _eo_kls_itr_init(klass, &obj->mro_itr, EO_NOOP, &prev_state);
    _eo_error_unset(obj);
+   _eo_condtor_reset(obj);
 
    _eo_ref(obj);
-   _eo_constructor(obj, klass);
+   eo_do(obj, eo_constructor());
 
    if (EINA_UNLIKELY(_eo_error_get(obj)))
      {
@@ -1145,7 +1131,7 @@ eo_add(const Eo_Class *klass, Eo *parent)
         goto fail;
      }
 
-   if (EINA_UNLIKELY(!_eo_kls_itr_reached_end(&obj->mro_itr)))
+   if (!obj->condtor_done)
      {
         const Eo_Class *cur_klass = _eo_kls_itr_get(&obj->mro_itr);
         ERR("Object of class '%s' - Not all of the object constructors have been executed, last destructor was of class: '%s'", klass->desc->name, cur_klass->desc->name);
@@ -1252,13 +1238,15 @@ _eo_del_internal(Eo *obj)
 
    _eo_kls_itr_init(klass, &obj->mro_itr, EO_NOOP, &prev_state);
    _eo_error_unset(obj);
-   _eo_destructor(obj, klass);
+   _eo_condtor_reset(obj);
+
+   eo_do(obj, eo_destructor());
    if (_eo_error_get(obj))
      {
         ERR("Object of class '%s' - One of the object destructors have failed.", klass->desc->name);
      }
 
-   if (!_eo_kls_itr_reached_end(&obj->mro_itr))
+   if (!obj->condtor_done)
      {
         const Eo_Class *cur_klass = _eo_kls_itr_get(&obj->mro_itr);
         ERR("Object of class '%s' - Not all of the object destructors have been executed, last destructor was of class: '%s'", klass->desc->name, cur_klass->desc->name);
@@ -1370,6 +1358,18 @@ _eo_error_unset(Eo *obj)
    obj->construct_error = EINA_FALSE;
 }
 
+void
+_eo_condtor_done(Eo *obj)
+{
+   obj->condtor_done = EINA_TRUE;
+}
+
+static void
+_eo_condtor_reset(Eo *obj)
+{
+   obj->condtor_done = EINA_FALSE;
+}
+
 /**
  * @internal
  * @brief Check if there was an error when constructing, destructing or calling a function of the object.
@@ -1382,58 +1382,6 @@ _eo_error_get(const Eo *obj)
    return obj->construct_error;
 }
 
-static inline void
-_eo_constructor_default(Eo *obj)
-{
-   eo_constructor_super(obj);
-}
-
-static inline void
-_eo_destructor_default(Eo *obj)
-{
-   eo_destructor_super(obj);
-}
-
-static void
-_eo_constructor(Eo *obj, const Eo_Class *klass)
-{
-   if (!klass)
-      return;
-
-   if (klass->desc->constructor)
-      klass->desc->constructor(obj, _eo_data_get(obj, klass));
-   else
-      _eo_constructor_default(obj);
-}
-
-static void
-_eo_destructor(Eo *obj, const Eo_Class *klass)
-{
-   if (!klass)
-      return;
-
-   if (klass->desc->destructor)
-      klass->desc->destructor(obj, _eo_data_get(obj, klass));
-   else
-      _eo_destructor_default(obj);
-}
-
-EAPI void
-eo_constructor_super(Eo *obj)
-{
-   EO_MAGIC_RETURN(obj, EO_EINA_MAGIC);
-
-   _eo_constructor(obj, _eo_kls_itr_next(&obj->mro_itr, EO_NOOP));
-}
-
-EAPI void
-eo_destructor_super(Eo *obj)
-{
-   EO_MAGIC_RETURN(obj, EO_EINA_MAGIC);
-
-   _eo_destructor(obj, _eo_kls_itr_next(&obj->mro_itr, EO_NOOP));
-}
-
 static inline void *
 _eo_data_get(const Eo *obj, const Eo_Class *klass)
 {
index a90d37a..ffb8858 100644 (file)
@@ -484,19 +484,23 @@ EAPI const Eo_Event_Description _EO_EV_DEL =
    EO_EVENT_DESCRIPTION("del", "Obj is being deleted.");
 
 static void
-_constructor(Eo *obj, void *class_data EINA_UNUSED)
+_constructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
 {
    DBG("%p - %s.", obj, eo_class_name_get(MY_CLASS));
+
+   _eo_condtor_done(obj);
 }
 
 static void
-_destructor(Eo *obj, void *class_data)
+_destructor(Eo *obj, void *class_data, va_list *list EINA_UNUSED)
 {
    DBG("%p - %s.", obj, eo_class_name_get(MY_CLASS));
 
    _eo_generic_data_del_all(class_data);
    _wref_destruct(class_data);
    _eo_callback_remove_all(class_data);
+
+   _eo_condtor_done(obj);
 }
 
 static void
@@ -505,6 +509,8 @@ _class_constructor(Eo_Class *klass)
    event_freeze_count = 0;
 
    const Eo_Op_Func_Description func_desc[] = {
+        EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
+        EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DESTRUCTOR), _destructor),
         EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DATA_SET), _data_set),
         EO_OP_FUNC_CONST(EO_BASE_ID(EO_BASE_SUB_ID_DATA_GET), _data_get),
         EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DATA_DEL), _data_del),
@@ -528,6 +534,8 @@ _class_constructor(Eo_Class *klass)
 }
 
 static const Eo_Op_Description op_desc[] = {
+     EO_OP_DESCRIPTION(EO_BASE_SUB_ID_CONSTRUCTOR, "Constructor"),
+     EO_OP_DESCRIPTION(EO_BASE_SUB_ID_DESTRUCTOR, "Destructor"),
      EO_OP_DESCRIPTION(EO_BASE_SUB_ID_DATA_SET, "Set data for key."),
      EO_OP_DESCRIPTION_CONST(EO_BASE_SUB_ID_DATA_GET, "Get data for key."),
      EO_OP_DESCRIPTION(EO_BASE_SUB_ID_DATA_DEL, "Del key."),
@@ -560,8 +568,6 @@ static const Eo_Class_Description class_desc = {
      EO_CLASS_DESCRIPTION_OPS(NULL, op_desc, EO_BASE_SUB_ID_LAST),
      event_desc,
      sizeof(Private_Data),
-     _constructor,
-     _destructor,
      _class_constructor,
      NULL
 };
index 631ce01..7759a2a 100644 (file)
@@ -54,5 +54,7 @@ extern int _eo_log_dom;
 #endif
 #define DBG(...) EINA_LOG_DOM_DBG(_eo_log_dom, __VA_ARGS__)
 
+void _eo_condtor_done(Eo *obj);
+
 #endif
 
index 58d6d29..866a336 100644 (file)
@@ -58,8 +58,6 @@ static const Eo_Class_Description class_desc = {
      EO_CLASS_DESCRIPTION_OPS(&SIMPLE_BASE_ID, op_desc, SIMPLE_SUB_ID_LAST),
      NULL,
      sizeof(Simple_Public_Data),
-     NULL,
-     NULL,
      _class_constructor,
      NULL
 };
index fcafc4f..4f50336 100644 (file)
@@ -40,8 +40,6 @@ START_TEST(eo_incomplete_desc)
         NULL,
         0,
         NULL,
-        NULL,
-        NULL,
         NULL
    };
 
@@ -108,8 +106,6 @@ START_TEST(eo_inherit_errors)
         NULL,
         0,
         NULL,
-        NULL,
-        NULL,
         NULL
    };
 
@@ -120,8 +116,6 @@ START_TEST(eo_inherit_errors)
         NULL,
         0,
         NULL,
-        NULL,
-        NULL,
         NULL
    };
 
@@ -132,8 +126,6 @@ START_TEST(eo_inherit_errors)
         NULL,
         0,
         NULL,
-        NULL,
-        NULL,
         NULL
    };
 
@@ -173,8 +165,6 @@ START_TEST(eo_inconsistent_mro)
         NULL,
         0,
         NULL,
-        NULL,
-        NULL,
         NULL
    };
 
@@ -185,8 +175,6 @@ START_TEST(eo_inconsistent_mro)
         NULL,
         0,
         NULL,
-        NULL,
-        NULL,
         NULL
    };
 
@@ -197,8 +185,6 @@ START_TEST(eo_inconsistent_mro)
         NULL,
         0,
         NULL,
-        NULL,
-        NULL,
         NULL
    };
 
@@ -209,8 +195,6 @@ START_TEST(eo_inconsistent_mro)
         NULL,
         0,
         NULL,
-        NULL,
-        NULL,
         NULL
    };
 
@@ -236,7 +220,6 @@ START_TEST(eo_inconsistent_mro)
 }
 END_TEST
 
-static void _stub_constructor(Eo *obj EINA_UNUSED, void *data EINA_UNUSED) {}
 static void _stub_class_constructor(Eo_Class *klass EINA_UNUSED) {}
 
 START_TEST(eo_bad_interface)
@@ -252,8 +235,6 @@ START_TEST(eo_bad_interface)
         NULL,
         10,
         NULL,
-        NULL,
-        NULL,
         NULL
    };
 
@@ -261,18 +242,6 @@ START_TEST(eo_bad_interface)
    fail_if(klass);
 
    class_desc.data_size = 0;
-   class_desc.constructor = _stub_constructor;
-
-   klass = eo_class_new(&class_desc, 0, NULL, NULL);
-   fail_if(klass);
-
-   class_desc.constructor = NULL;
-   class_desc.destructor = _stub_constructor;
-
-   klass = eo_class_new(&class_desc, 0, NULL, NULL);
-   fail_if(klass);
-
-   class_desc.destructor = NULL;
    class_desc.class_constructor = _stub_class_constructor;
 
    klass = eo_class_new(&class_desc, 0, NULL, NULL);
@@ -343,8 +312,6 @@ START_TEST(eo_op_types)
         EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
         NULL,
         0,
-        NULL,
-        NULL,
         _const_ops_class_constructor,
         NULL
    };
index c37bf3d..bba143c 100644 (file)
@@ -31,8 +31,6 @@ START_TEST(eo_data_fetch)
         NULL,
         10,
         NULL,
-        NULL,
-        NULL,
         NULL
    };
 
@@ -96,8 +94,6 @@ START_TEST(eo_static_classes)
         NULL,
         0,
         NULL,
-        NULL,
-        NULL,
         NULL
    };
 
@@ -114,18 +110,36 @@ START_TEST(eo_static_classes)
 }
 END_TEST
 
+static Eina_Bool _man_should_con = EINA_TRUE;
+static Eina_Bool _man_should_des = EINA_TRUE;
+
 static void
-_man_con(Eo *obj, void *data EINA_UNUSED)
+_man_con(Eo *obj, void *data EINA_UNUSED, va_list *list EINA_UNUSED)
 {
-   eo_manual_free_set(obj, EINA_TRUE);
-   eo_constructor_super(obj);
+   if (_man_should_con)
+      eo_manual_free_set(obj, EINA_TRUE);
+   eo_do_super(obj, eo_constructor());
+}
+
+static void
+_man_des(Eo *obj, void *data EINA_UNUSED, va_list *list EINA_UNUSED)
+{
+   eo_do_super(obj, eo_destructor());
+   if (_man_should_des)
+      eo_manual_free_set(obj, EINA_FALSE);
 }
 
+
 static void
-_man_des(Eo *obj, void *data EINA_UNUSED)
+_man_class_constructor(Eo_Class *klass)
 {
-   eo_destructor_super(obj);
-   eo_manual_free_set(obj, EINA_FALSE);
+   const Eo_Op_Func_Description func_desc[] = {
+        EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _man_con),
+        EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DESTRUCTOR), _man_des),
+        EO_OP_FUNC_SENTINEL
+   };
+
+   eo_class_funcs_set(klass, func_desc);
 }
 
 START_TEST(eo_man_free)
@@ -139,9 +153,7 @@ START_TEST(eo_man_free)
         EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
         NULL,
         10,
-        _man_con,
-        _man_des,
-        NULL,
+        _man_class_constructor,
         NULL
    };
 
@@ -157,7 +169,7 @@ START_TEST(eo_man_free)
    eo_manual_free(obj);
    eo_unref(obj);
 
-   class_desc.destructor = NULL;
+   _man_should_des = EINA_FALSE;
    klass = eo_class_new(&class_desc, 0, EO_BASE_CLASS, NULL);
    fail_if(!klass);
 
@@ -172,7 +184,7 @@ START_TEST(eo_man_free)
    eo_unref(obj);
    eo_manual_free(obj);
 
-   class_desc.constructor = NULL;
+   _man_should_con = EINA_FALSE;
    klass = eo_class_new(&class_desc, 0, EO_BASE_CLASS, NULL);
    fail_if(!klass);
 
@@ -360,8 +372,6 @@ START_TEST(eo_op_errors)
         EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
         NULL,
         0,
-        NULL,
-        NULL,
         _op_errors_class_constructor,
         NULL
    };
@@ -525,9 +535,6 @@ START_TEST(eo_magic_checks)
 
         eo_error_set((Eo *) buf);
 
-        eo_constructor_super((Eo *) buf);
-        eo_destructor_super((Eo *) buf);
-
         fail_if(eo_data_get((Eo *) buf, SIMPLE_CLASS));
 
         eo_composite_object_attach((Eo *) buf, obj);