From 816a4ad71d0beed7a5631b3224426168da8de23c Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Tue, 1 May 2012 07:40:14 +0000 Subject: [PATCH] Eobj: Rename to Eo. Blame cedric. SVN revision: 70566 --- legacy/eobj/CMakeLists.txt | 8 +- legacy/eobj/doc/Doxyfile.in | 36 +- legacy/eobj/{eobj.pc.in => eo.pc.in} | 6 +- legacy/eobj/examples/access/CMakeLists.txt | 6 +- legacy/eobj/examples/access/inherit.c | 32 +- legacy/eobj/examples/access/inherit.h | 6 +- legacy/eobj/examples/access/main.c | 14 +- legacy/eobj/examples/access/simple.c | 38 +- legacy/eobj/examples/access/simple.h | 10 +- .../examples/composite_objects/CMakeLists.txt | 6 +- legacy/eobj/examples/composite_objects/comp.c | 44 +- legacy/eobj/examples/composite_objects/comp.h | 4 +- legacy/eobj/examples/composite_objects/main.c | 42 +- .../eobj/examples/composite_objects/simple.c | 46 +- .../eobj/examples/composite_objects/simple.h | 12 +- .../eobj/examples/constructors/CMakeLists.txt | 6 +- legacy/eobj/examples/constructors/main.c | 30 +- legacy/eobj/examples/constructors/mixin.c | 40 +- legacy/eobj/examples/constructors/mixin.h | 8 +- legacy/eobj/examples/constructors/simple.c | 54 +- legacy/eobj/examples/constructors/simple.h | 14 +- legacy/eobj/examples/constructors/simple2.c | 16 +- legacy/eobj/examples/constructors/simple2.h | 4 +- legacy/eobj/examples/constructors/simple3.c | 12 +- legacy/eobj/examples/constructors/simple3.h | 4 +- legacy/eobj/examples/constructors/simple4.c | 10 +- legacy/eobj/examples/constructors/simple4.h | 4 +- legacy/eobj/examples/constructors/simple5.c | 12 +- legacy/eobj/examples/constructors/simple5.h | 4 +- legacy/eobj/examples/constructors/simple6.c | 16 +- legacy/eobj/examples/constructors/simple6.h | 4 +- legacy/eobj/examples/evas/CMakeLists.txt | 6 +- legacy/eobj/examples/evas/elw_box.c | 46 +- legacy/eobj/examples/evas/elw_box.h | 8 +- legacy/eobj/examples/evas/elw_boxedbutton.c | 26 +- legacy/eobj/examples/evas/elw_boxedbutton.h | 4 +- legacy/eobj/examples/evas/elw_button.c | 62 +- legacy/eobj/examples/evas/elw_button.h | 10 +- legacy/eobj/examples/evas/elw_win.c | 20 +- legacy/eobj/examples/evas/elw_win.h | 4 +- legacy/eobj/examples/evas/evas_obj.c | 92 +- legacy/eobj/examples/evas/evas_obj.h | 26 +- legacy/eobj/examples/evas/test.c | 36 +- .../function_overrides/CMakeLists.txt | 6 +- .../examples/function_overrides/inherit.c | 10 +- .../examples/function_overrides/inherit.h | 4 +- .../examples/function_overrides/inherit2.c | 50 +- .../examples/function_overrides/inherit2.h | 6 +- .../examples/function_overrides/inherit3.c | 26 +- .../examples/function_overrides/inherit3.h | 4 +- .../eobj/examples/function_overrides/main.c | 40 +- .../eobj/examples/function_overrides/simple.c | 40 +- .../eobj/examples/function_overrides/simple.h | 10 +- legacy/eobj/examples/mixin/CMakeLists.txt | 6 +- legacy/eobj/examples/mixin/main.c | 20 +- legacy/eobj/examples/mixin/mixin.c | 42 +- legacy/eobj/examples/mixin/mixin.h | 8 +- legacy/eobj/examples/mixin/mixin2.c | 36 +- legacy/eobj/examples/mixin/mixin2.h | 4 +- legacy/eobj/examples/mixin/mixin3.c | 36 +- legacy/eobj/examples/mixin/mixin3.h | 4 +- legacy/eobj/examples/mixin/simple.c | 44 +- legacy/eobj/examples/mixin/simple.h | 14 +- legacy/eobj/examples/signals/CMakeLists.txt | 6 +- legacy/eobj/examples/signals/main.c | 40 +- legacy/eobj/examples/signals/simple.c | 64 +- legacy/eobj/examples/signals/simple.h | 10 +- legacy/eobj/lib/CMakeLists.txt | 24 +- legacy/eobj/lib/Eo.h | 969 ++++++++++++++++++ legacy/eobj/lib/Eobj.h | 969 ------------------ legacy/eobj/lib/{eobj.c => eo.c} | 696 ++++++------- legacy/eobj/lib/eo_base_class.c | 226 ++++ legacy/eobj/lib/eo_private.h | 32 + legacy/eobj/lib/eobj_base_class.c | 226 ---- legacy/eobj/lib/eobj_private.h | 32 - legacy/eobj/tests/CMakeLists.txt | 22 +- legacy/eobj/tests/class_simple.c | 40 +- legacy/eobj/tests/class_simple.h | 10 +- .../eobj/tests/{eobj_suite.c => eo_suite.c} | 24 +- legacy/eobj/tests/eo_suite.h | 11 + legacy/eobj/tests/eo_test_class_errors.c | 362 +++++++ legacy/eobj/tests/eo_test_general.c | 327 ++++++ legacy/eobj/tests/eo_test_init.c | 22 + legacy/eobj/tests/eobj_suite.h | 11 - legacy/eobj/tests/eobj_test_class_errors.c | 362 ------- legacy/eobj/tests/eobj_test_general.c | 327 ------ legacy/eobj/tests/eobj_test_init.c | 22 - 87 files changed, 3067 insertions(+), 3065 deletions(-) rename legacy/eobj/{eobj.pc.in => eo.pc.in} (79%) create mode 100644 legacy/eobj/lib/Eo.h delete mode 100644 legacy/eobj/lib/Eobj.h rename legacy/eobj/lib/{eobj.c => eo.c} (58%) create mode 100644 legacy/eobj/lib/eo_base_class.c create mode 100644 legacy/eobj/lib/eo_private.h delete mode 100644 legacy/eobj/lib/eobj_base_class.c delete mode 100644 legacy/eobj/lib/eobj_private.h rename legacy/eobj/tests/{eobj_suite.c => eo_suite.c} (77%) create mode 100644 legacy/eobj/tests/eo_suite.h create mode 100644 legacy/eobj/tests/eo_test_class_errors.c create mode 100644 legacy/eobj/tests/eo_test_general.c create mode 100644 legacy/eobj/tests/eo_test_init.c delete mode 100644 legacy/eobj/tests/eobj_suite.h delete mode 100644 legacy/eobj/tests/eobj_test_class_errors.c delete mode 100644 legacy/eobj/tests/eobj_test_general.c delete mode 100644 legacy/eobj/tests/eobj_test_init.c diff --git a/legacy/eobj/CMakeLists.txt b/legacy/eobj/CMakeLists.txt index 2de716961a..41f1d9a739 100644 --- a/legacy/eobj/CMakeLists.txt +++ b/legacy/eobj/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 2.6) -project(eobj) +project(eo) set(VMAJ 0) set(VMIN 1) set(VMIC 0) @@ -53,10 +53,10 @@ add_subdirectory(doc) # PKGCONFIG file. CONFIGURE_FILE( - "${PROJECT_SOURCE_DIR}/eobj.pc.in" - "${PROJECT_BINARY_DIR}/eobj.pc" + "${PROJECT_SOURCE_DIR}/eo.pc.in" + "${PROJECT_BINARY_DIR}/eo.pc" @ONLY ) -INSTALL(FILES "${PROJECT_BINARY_DIR}/eobj.pc" +INSTALL(FILES "${PROJECT_BINARY_DIR}/eo.pc" DESTINATION "lib/pkgconfig") diff --git a/legacy/eobj/doc/Doxyfile.in b/legacy/eobj/doc/Doxyfile.in index 958a757052..b898de3360 100644 --- a/legacy/eobj/doc/Doxyfile.in +++ b/legacy/eobj/doc/Doxyfile.in @@ -25,7 +25,7 @@ DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. -PROJECT_NAME = Eobj +PROJECT_NAME = Eo # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or @@ -793,12 +793,12 @@ COLS_IN_ALPHA_INDEX = 2 # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. -IGNORE_PREFIX = eobj_ \ - _eobj_ \ - Eobj_ \ - _Eobj_ \ - EOBJ_ \ - _EOBJ_ +IGNORE_PREFIX = eo_ \ + _eo_ \ + Eo_ \ + _Eo_ \ + EO_ \ + _EO_ #--------------------------------------------------------------------------- # configuration options related to the HTML output @@ -912,13 +912,13 @@ DOCSET_FEEDNAME = "Doxygen generated docs" # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen # will append .docset to the name. -DOCSET_BUNDLE_ID = org.enlightenment.Eobj +DOCSET_BUNDLE_ID = org.enlightenment.Eo # When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify # the documentation publisher. This should be a reverse domain-name style # string, e.g. com.mycompany.MyDocSet.documentation. -DOCSET_PUBLISHER_ID = org.enlightenment.Eobj +DOCSET_PUBLISHER_ID = org.enlightenment.Eo # The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. @@ -985,7 +985,7 @@ QCH_FILE = # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#namespace -QHP_NAMESPACE = org.enlightenment.Eobj +QHP_NAMESPACE = org.enlightenment.Eo # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating # Qt Help Project output. For more information please see @@ -1036,7 +1036,7 @@ GENERATE_ECLIPSEHELP = NO # the directory name containing the HTML and XML files should also have # this name. -ECLIPSE_DOC_ID = org.enlightenment.Eobj +ECLIPSE_DOC_ID = org.enlightenment.Eo # The DISABLE_INDEX tag can be used to turn on/off the condensed index at # top of each HTML page. The value NO (the default) enables the index and @@ -1418,14 +1418,16 @@ INCLUDE_FILE_PATTERNS = # undefined via #undef or recursively expanded use the := operator # instead of the = operator. -PREDEFINED = EOBJ_MAGIC_DEBUG \ +PREDEFINED = EINA_MAGIC_DEBUG \ __UNUSED__= \ - EOBJ_ARG_NONNULL()= \ - EOBJ_MALLOC= \ - EOBJ_WARN_UNUSED_RESULT= \ + EINA_ARG_NONNULL()= \ + EINA_MALLOC= \ + EINA_WARN_UNUSED_RESULT= \ EAPI= \ - EOBJ_PURE= \ - EOBJ_CONST= + EINA_PURE= \ + EINA_TRUE= \ + EINA_FALSE= \ + EINA_CONST= # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. diff --git a/legacy/eobj/eobj.pc.in b/legacy/eobj/eo.pc.in similarity index 79% rename from legacy/eobj/eobj.pc.in rename to legacy/eobj/eo.pc.in index 61f1697103..7a90ce3926 100644 --- a/legacy/eobj/eobj.pc.in +++ b/legacy/eobj/eo.pc.in @@ -3,11 +3,11 @@ exec_prefix=${prefix} libdir=${exec_prefix}/lib includedir=${prefix}/include -Name: Eobj +Name: Eo Description: EFL's generic object system library. Version: @PACKAGE_VERSION@ -Libs: -L${libdir} -leobj +Libs: -L${libdir} -leo Libs.private: -Cflags: -I${includedir}/eobj-@VMAJ@ +Cflags: -I${includedir}/eo-@VMAJ@ ~ diff --git a/legacy/eobj/examples/access/CMakeLists.txt b/legacy/eobj/examples/access/CMakeLists.txt index dcfbc1e576..a6ab154e0e 100644 --- a/legacy/eobj/examples/access/CMakeLists.txt +++ b/legacy/eobj/examples/access/CMakeLists.txt @@ -12,13 +12,13 @@ include_directories( add_executable(access ${ACCESS_CC_SOURCES}) -get_target_property(eobj_LIB_FILE eobj LOCATION) +get_target_property(eo_LIB_FILE eo LOCATION) target_link_libraries(access ${EINA_LIBRARIES} ${EINA_LDFLAGS_OTHER} - ${eobj_LIB_FILE} + ${eo_LIB_FILE} ) -add_dependencies(access eobj) +add_dependencies(access eo) add_test(Example_access access) diff --git a/legacy/eobj/examples/access/inherit.c b/legacy/eobj/examples/access/inherit.c index b2fc51a7f4..f84b095277 100644 --- a/legacy/eobj/examples/access/inherit.c +++ b/legacy/eobj/examples/access/inherit.c @@ -1,4 +1,4 @@ -#include "Eobj.h" +#include "Eo.h" #include "simple.h" #include "simple_protected.h" @@ -6,38 +6,38 @@ #include "config.h" -EAPI Eobj_Op INHERIT_BASE_ID = 0; +EAPI Eo_Op INHERIT_BASE_ID = 0; #define MY_CLASS INHERIT_CLASS static void -_prot_print(const Eobj *obj, const void *class_data EINA_UNUSED, va_list *list) +_prot_print(const Eo *obj, const void *class_data EINA_UNUSED, va_list *list) { - Simple_Protected_Data *pd = eobj_data_get(obj, SIMPLE_CLASS); + Simple_Protected_Data *pd = eo_data_get(obj, SIMPLE_CLASS); (void) list; printf("%s %d\n", __func__, pd->protected_x1); } static void -_class_constructor(Eobj_Class *klass) +_class_constructor(Eo_Class *klass) { - const Eobj_Op_Func_Description func_desc[] = { - EOBJ_OP_FUNC_CONST(INHERIT_ID(INHERIT_SUB_ID_PROT_PRINT), _prot_print), - EOBJ_OP_FUNC_SENTINEL + const Eo_Op_Func_Description func_desc[] = { + EO_OP_FUNC_CONST(INHERIT_ID(INHERIT_SUB_ID_PROT_PRINT), _prot_print), + EO_OP_FUNC_SENTINEL }; - eobj_class_funcs_set(klass, func_desc); + eo_class_funcs_set(klass, func_desc); } -static const Eobj_Op_Description op_desc[] = { - EOBJ_OP_DESCRIPTION_CONST(INHERIT_SUB_ID_PROT_PRINT, "", "Print protected var x1."), - EOBJ_OP_DESCRIPTION_SENTINEL +static const Eo_Op_Description op_desc[] = { + EO_OP_DESCRIPTION_CONST(INHERIT_SUB_ID_PROT_PRINT, "", "Print protected var x1."), + EO_OP_DESCRIPTION_SENTINEL }; -static const Eobj_Class_Description class_desc = { +static const Eo_Class_Description class_desc = { "Inherit", - EOBJ_CLASS_TYPE_REGULAR, - EOBJ_CLASS_DESCRIPTION_OPS(&INHERIT_BASE_ID, op_desc, INHERIT_SUB_ID_LAST), + EO_CLASS_TYPE_REGULAR, + EO_CLASS_DESCRIPTION_OPS(&INHERIT_BASE_ID, op_desc, INHERIT_SUB_ID_LAST), NULL, 0, NULL, @@ -46,4 +46,4 @@ static const Eobj_Class_Description class_desc = { NULL }; -EOBJ_DEFINE_CLASS(inherit_class_get, &class_desc, SIMPLE_CLASS, NULL) +EO_DEFINE_CLASS(inherit_class_get, &class_desc, SIMPLE_CLASS, NULL) diff --git a/legacy/eobj/examples/access/inherit.h b/legacy/eobj/examples/access/inherit.h index 51beb8897c..dda9a0769c 100644 --- a/legacy/eobj/examples/access/inherit.h +++ b/legacy/eobj/examples/access/inherit.h @@ -1,9 +1,9 @@ #ifndef INHERIT_H #define INHERIT_H -#include "Eobj.h" +#include "Eo.h" -extern EAPI Eobj_Op INHERIT_BASE_ID; +extern EAPI Eo_Op INHERIT_BASE_ID; enum { INHERIT_SUB_ID_PROT_PRINT, @@ -15,6 +15,6 @@ enum { #define inherit_prot_print() INHERIT_ID(INHERIT_SUB_ID_PROT_PRINT) #define INHERIT_CLASS inherit_class_get() -const Eobj_Class *inherit_class_get(void) EINA_CONST; +const Eo_Class *inherit_class_get(void) EINA_CONST; #endif diff --git a/legacy/eobj/examples/access/main.c b/legacy/eobj/examples/access/main.c index b019a04e18..0cd352ec5f 100644 --- a/legacy/eobj/examples/access/main.c +++ b/legacy/eobj/examples/access/main.c @@ -1,4 +1,4 @@ -#include "Eobj.h" +#include "Eo.h" #include "simple.h" #include "inherit.h" @@ -7,17 +7,17 @@ main(int argc, char *argv[]) { (void) argc; (void) argv; - eobj_init(); + eo_init(); - Eobj *obj = eobj_add(INHERIT_CLASS, NULL); + Eo *obj = eo_add(INHERIT_CLASS, NULL); - eobj_do(obj, simple_a_set(1), inherit_prot_print()); + eo_do(obj, simple_a_set(1), inherit_prot_print()); - Simple_Public_Data *pd = eobj_data_get(obj, SIMPLE_CLASS); + Simple_Public_Data *pd = eo_data_get(obj, SIMPLE_CLASS); printf("Pub: %d\n", pd->public_x2); - eobj_unref(obj); - eobj_shutdown(); + eo_unref(obj); + eo_shutdown(); return 0; } diff --git a/legacy/eobj/examples/access/simple.c b/legacy/eobj/examples/access/simple.c index 9189ecf7fb..58943441a9 100644 --- a/legacy/eobj/examples/access/simple.c +++ b/legacy/eobj/examples/access/simple.c @@ -1,8 +1,8 @@ -#include "Eobj.h" +#include "Eo.h" #include "simple.h" #include "simple_protected.h" -EAPI Eobj_Op SIMPLE_BASE_ID = 0; +EAPI Eo_Op SIMPLE_BASE_ID = 0; typedef struct { @@ -10,13 +10,13 @@ typedef struct int a; } Private_Data; -EAPI const Eobj_Event_Description _SIG_A_CHANGED = - EOBJ_EVENT_DESCRIPTION("a,changed", "i", "Called when a has changed."); +EAPI const Eo_Event_Description _SIG_A_CHANGED = + EO_EVENT_DESCRIPTION("a,changed", "i", "Called when a has changed."); #define MY_CLASS SIMPLE_CLASS static void -_a_set(Eobj *obj, void *class_data, va_list *list) +_a_set(Eo *obj, void *class_data, va_list *list) { Private_Data *pd = class_data; int a; @@ -27,34 +27,34 @@ _a_set(Eobj *obj, void *class_data, va_list *list) pd->protected.protected_x1 = a + 1; pd->protected.public.public_x2 = a + 2; - eobj_event_callback_call(obj, SIG_A_CHANGED, &pd->a); + eo_event_callback_call(obj, SIG_A_CHANGED, &pd->a); } static void -_class_constructor(Eobj_Class *klass) +_class_constructor(Eo_Class *klass) { - const Eobj_Op_Func_Description func_desc[] = { - EOBJ_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_A_SET), _a_set), - EOBJ_OP_FUNC_SENTINEL + const Eo_Op_Func_Description func_desc[] = { + EO_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_A_SET), _a_set), + EO_OP_FUNC_SENTINEL }; - eobj_class_funcs_set(klass, func_desc); + eo_class_funcs_set(klass, func_desc); } -static const Eobj_Op_Description op_desc[] = { - EOBJ_OP_DESCRIPTION(SIMPLE_SUB_ID_A_SET, "i", "Set property A"), - EOBJ_OP_DESCRIPTION_SENTINEL +static const Eo_Op_Description op_desc[] = { + EO_OP_DESCRIPTION(SIMPLE_SUB_ID_A_SET, "i", "Set property A"), + EO_OP_DESCRIPTION_SENTINEL }; -static const Eobj_Event_Description *event_desc[] = { +static const Eo_Event_Description *event_desc[] = { SIG_A_CHANGED, NULL }; -static const Eobj_Class_Description class_desc = { +static const Eo_Class_Description class_desc = { "Simple", - EOBJ_CLASS_TYPE_REGULAR, - EOBJ_CLASS_DESCRIPTION_OPS(&SIMPLE_BASE_ID, op_desc, SIMPLE_SUB_ID_LAST), + EO_CLASS_TYPE_REGULAR, + EO_CLASS_DESCRIPTION_OPS(&SIMPLE_BASE_ID, op_desc, SIMPLE_SUB_ID_LAST), event_desc, sizeof(Private_Data), NULL, @@ -63,5 +63,5 @@ static const Eobj_Class_Description class_desc = { NULL }; -EOBJ_DEFINE_CLASS(simple_class_get, &class_desc, EOBJ_BASE_CLASS, NULL) +EO_DEFINE_CLASS(simple_class_get, &class_desc, EO_BASE_CLASS, NULL) diff --git a/legacy/eobj/examples/access/simple.h b/legacy/eobj/examples/access/simple.h index c9f773b7ea..5853369052 100644 --- a/legacy/eobj/examples/access/simple.h +++ b/legacy/eobj/examples/access/simple.h @@ -1,9 +1,9 @@ #ifndef SIMPLE_H #define SIMPLE_H -#include "Eobj.h" +#include "Eo.h" -extern EAPI Eobj_Op SIMPLE_BASE_ID; +extern EAPI Eo_Op SIMPLE_BASE_ID; enum { SIMPLE_SUB_ID_A_SET, @@ -17,12 +17,12 @@ typedef struct #define SIMPLE_ID(sub_id) (SIMPLE_BASE_ID + sub_id) -#define simple_a_set(a) SIMPLE_ID(SIMPLE_SUB_ID_A_SET), EOBJ_TYPECHECK(int, a) +#define simple_a_set(a) SIMPLE_ID(SIMPLE_SUB_ID_A_SET), EO_TYPECHECK(int, a) -extern const Eobj_Event_Description _SIG_A_CHANGED; +extern const Eo_Event_Description _SIG_A_CHANGED; #define SIG_A_CHANGED (&(_SIG_A_CHANGED)) #define SIMPLE_CLASS simple_class_get() -const Eobj_Class *simple_class_get(void) EINA_CONST; +const Eo_Class *simple_class_get(void) EINA_CONST; #endif diff --git a/legacy/eobj/examples/composite_objects/CMakeLists.txt b/legacy/eobj/examples/composite_objects/CMakeLists.txt index cb79964222..a2c677e456 100644 --- a/legacy/eobj/examples/composite_objects/CMakeLists.txt +++ b/legacy/eobj/examples/composite_objects/CMakeLists.txt @@ -12,13 +12,13 @@ include_directories( add_executable(composite_objects ${COMPOSITE_OBJECTS_CC_SOURCES}) -get_target_property(eobj_LIB_FILE eobj LOCATION) +get_target_property(eo_LIB_FILE eo LOCATION) target_link_libraries(composite_objects ${EINA_LIBRARIES} ${EINA_LDFLAGS_OTHER} - ${eobj_LIB_FILE} + ${eo_LIB_FILE} ) -add_dependencies(composite_objects eobj) +add_dependencies(composite_objects eo) add_test(Example_composite_objects composite_objects) diff --git a/legacy/eobj/examples/composite_objects/comp.c b/legacy/eobj/examples/composite_objects/comp.c index 5303d4c8fb..60ad206ec1 100644 --- a/legacy/eobj/examples/composite_objects/comp.c +++ b/legacy/eobj/examples/composite_objects/comp.c @@ -1,4 +1,4 @@ -#include "Eobj.h" +#include "Eo.h" #include "simple.h" #include "comp.h" @@ -6,50 +6,50 @@ #include "../eunit_tests.h" -EAPI Eobj_Op COMP_BASE_ID = 0; +EAPI Eo_Op COMP_BASE_ID = 0; #define MY_CLASS COMP_CLASS static void -_a_get(const Eobj *obj, const void *class_data EINA_UNUSED, va_list *list) +_a_get(const Eo *obj, const void *class_data EINA_UNUSED, va_list *list) { int *a; a = va_arg(*list, int *); - eobj_query_super(obj, simple_a_get(a)); + eo_query_super(obj, simple_a_get(a)); } static void -_constructor(Eobj *obj, void *class_data EINA_UNUSED) +_constructor(Eo *obj, void *class_data EINA_UNUSED) { - eobj_constructor_super(obj); + eo_constructor_super(obj); - Eobj *simple = eobj_add(SIMPLE_CLASS, obj); - eobj_composite_object_attach(obj, simple); - eobj_event_callback_forwarder_add(simple, SIG_A_CHANGED, obj); + Eo *simple = eo_add(SIMPLE_CLASS, obj); + eo_composite_object_attach(obj, simple); + eo_event_callback_forwarder_add(simple, SIG_A_CHANGED, obj); - fail_if(eobj_composite_is(obj)); - fail_if(!eobj_composite_is(simple)); + fail_if(eo_composite_is(obj)); + fail_if(!eo_composite_is(simple)); - eobj_do(obj, eobj_base_data_set("simple-obj", simple, NULL)); + eo_do(obj, eo_base_data_set("simple-obj", simple, NULL)); - eobj_unref(simple); + eo_unref(simple); } static void -_class_constructor(Eobj_Class *klass) +_class_constructor(Eo_Class *klass) { - const Eobj_Op_Func_Description func_desc[] = { - EOBJ_OP_FUNC_CONST(SIMPLE_ID(SIMPLE_SUB_ID_A_GET), _a_get), - EOBJ_OP_FUNC_SENTINEL + const Eo_Op_Func_Description func_desc[] = { + EO_OP_FUNC_CONST(SIMPLE_ID(SIMPLE_SUB_ID_A_GET), _a_get), + EO_OP_FUNC_SENTINEL }; - eobj_class_funcs_set(klass, func_desc); + eo_class_funcs_set(klass, func_desc); } -static const Eobj_Class_Description class_desc = { +static const Eo_Class_Description class_desc = { "Comp", - EOBJ_CLASS_TYPE_REGULAR, - EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), + EO_CLASS_TYPE_REGULAR, + EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), NULL, 0, _constructor, @@ -58,6 +58,6 @@ static const Eobj_Class_Description class_desc = { NULL }; -EOBJ_DEFINE_CLASS(comp_class_get, &class_desc, EOBJ_BASE_CLASS, +EO_DEFINE_CLASS(comp_class_get, &class_desc, EO_BASE_CLASS, SIMPLE_CLASS, NULL); diff --git a/legacy/eobj/examples/composite_objects/comp.h b/legacy/eobj/examples/composite_objects/comp.h index e97a0a7302..3e15e3e62a 100644 --- a/legacy/eobj/examples/composite_objects/comp.h +++ b/legacy/eobj/examples/composite_objects/comp.h @@ -1,9 +1,9 @@ #ifndef COMP_H #define COMP_H -#include "Eobj.h" +#include "Eo.h" #define COMP_CLASS comp_class_get() -const Eobj_Class *comp_class_get(void) EINA_CONST; +const Eo_Class *comp_class_get(void) EINA_CONST; #endif diff --git a/legacy/eobj/examples/composite_objects/main.c b/legacy/eobj/examples/composite_objects/main.c index 0635d2e9b0..31bd5c599d 100644 --- a/legacy/eobj/examples/composite_objects/main.c +++ b/legacy/eobj/examples/composite_objects/main.c @@ -1,4 +1,4 @@ -#include "Eobj.h" +#include "Eo.h" #include "simple.h" #include "comp.h" @@ -7,7 +7,7 @@ static int cb_called = EINA_FALSE; static Eina_Bool -_a_changed_cb(void *data, Eobj *obj, const Eobj_Event_Description *desc, void *event_info) +_a_changed_cb(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info) { (void) desc; (void) obj; @@ -16,7 +16,7 @@ _a_changed_cb(void *data, Eobj *obj, const Eobj_Event_Description *desc, void *e cb_called = EINA_TRUE; - return EOBJ_CALLBACK_CONTINUE; + return EO_CALLBACK_CONTINUE; } int @@ -24,38 +24,38 @@ main(int argc, char *argv[]) { (void) argc; (void) argv; - eobj_init(); + eo_init(); - Eobj *obj = eobj_add(COMP_CLASS, NULL); - eobj_event_callback_add(obj, SIG_A_CHANGED, _a_changed_cb, NULL); + Eo *obj = eo_add(COMP_CLASS, NULL); + eo_event_callback_add(obj, SIG_A_CHANGED, _a_changed_cb, NULL); int a; - eobj_do(obj, simple_a_set(1)); + eo_do(obj, simple_a_set(1)); fail_if(!cb_called); - eobj_do(obj, simple_a_get(&a)); + eo_do(obj, simple_a_get(&a)); fail_if(a != 1); /* disable the callback forwarder, and fail if it's still called. */ - Eobj *simple; - eobj_do(obj, eobj_base_data_get("simple-obj", (void **) &simple)); - eobj_ref(simple); - eobj_event_callback_forwarder_del(simple, SIG_A_CHANGED, obj); + Eo *simple; + eo_do(obj, eo_base_data_get("simple-obj", (void **) &simple)); + eo_ref(simple); + eo_event_callback_forwarder_del(simple, SIG_A_CHANGED, obj); cb_called = EINA_FALSE; - eobj_do(obj, simple_a_set(2)); + eo_do(obj, simple_a_set(2)); fail_if(cb_called); - fail_if(!eobj_composite_is(simple)); - eobj_composite_object_detach(obj, simple); - fail_if(eobj_composite_is(simple)); - eobj_composite_object_attach(obj, simple); - fail_if(!eobj_composite_is(simple)); + fail_if(!eo_composite_is(simple)); + eo_composite_object_detach(obj, simple); + fail_if(eo_composite_is(simple)); + eo_composite_object_attach(obj, simple); + fail_if(!eo_composite_is(simple)); - eobj_unref(simple); - eobj_unref(obj); + eo_unref(simple); + eo_unref(obj); - eobj_shutdown(); + eo_shutdown(); return 0; } diff --git a/legacy/eobj/examples/composite_objects/simple.c b/legacy/eobj/examples/composite_objects/simple.c index 5687eb0b2f..e8fada1325 100644 --- a/legacy/eobj/examples/composite_objects/simple.c +++ b/legacy/eobj/examples/composite_objects/simple.c @@ -1,29 +1,29 @@ -#include "Eobj.h" +#include "Eo.h" #include "simple.h" #include "config.h" -EAPI Eobj_Op SIMPLE_BASE_ID = 0; +EAPI Eo_Op SIMPLE_BASE_ID = 0; -EAPI const Eobj_Event_Description _SIG_A_CHANGED = - EOBJ_EVENT_DESCRIPTION("a,changed", "i", "Called when a has changed."); +EAPI const Eo_Event_Description _SIG_A_CHANGED = + EO_EVENT_DESCRIPTION("a,changed", "i", "Called when a has changed."); #define MY_CLASS SIMPLE_CLASS static void -_a_set(Eobj *obj, void *class_data, va_list *list) +_a_set(Eo *obj, void *class_data, va_list *list) { Simple_Public_Data *pd = class_data; int a; a = va_arg(*list, int); - printf("%s %d\n", eobj_class_name_get(MY_CLASS), a); + printf("%s %d\n", eo_class_name_get(MY_CLASS), a); pd->a = a; - eobj_event_callback_call(obj, SIG_A_CHANGED, &pd->a); + eo_event_callback_call(obj, SIG_A_CHANGED, &pd->a); } static void -_a_get(const Eobj *obj EINA_UNUSED, const void *class_data, va_list *list) +_a_get(const Eo *obj EINA_UNUSED, const void *class_data, va_list *list) { const Simple_Public_Data *pd = class_data; int *a; @@ -32,32 +32,32 @@ _a_get(const Eobj *obj EINA_UNUSED, const void *class_data, va_list *list) } static void -_class_constructor(Eobj_Class *klass) +_class_constructor(Eo_Class *klass) { - const Eobj_Op_Func_Description func_desc[] = { - EOBJ_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_A_SET), _a_set), - EOBJ_OP_FUNC_CONST(SIMPLE_ID(SIMPLE_SUB_ID_A_GET), _a_get), - EOBJ_OP_FUNC_SENTINEL + const Eo_Op_Func_Description func_desc[] = { + 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_SENTINEL }; - eobj_class_funcs_set(klass, func_desc); + eo_class_funcs_set(klass, func_desc); } -static const Eobj_Op_Description op_desc[] = { - EOBJ_OP_DESCRIPTION(SIMPLE_SUB_ID_A_SET, "i", "Set property A"), - EOBJ_OP_DESCRIPTION_CONST(SIMPLE_SUB_ID_A_GET, "i", "Get property A"), - EOBJ_OP_DESCRIPTION_SENTINEL +static const Eo_Op_Description op_desc[] = { + EO_OP_DESCRIPTION(SIMPLE_SUB_ID_A_SET, "i", "Set property A"), + EO_OP_DESCRIPTION_CONST(SIMPLE_SUB_ID_A_GET, "i", "Get property A"), + EO_OP_DESCRIPTION_SENTINEL }; -static const Eobj_Event_Description *event_desc[] = { +static const Eo_Event_Description *event_desc[] = { SIG_A_CHANGED, NULL }; -static const Eobj_Class_Description class_desc = { +static const Eo_Class_Description class_desc = { "Simple", - EOBJ_CLASS_TYPE_REGULAR, - EOBJ_CLASS_DESCRIPTION_OPS(&SIMPLE_BASE_ID, op_desc, SIMPLE_SUB_ID_LAST), + EO_CLASS_TYPE_REGULAR, + EO_CLASS_DESCRIPTION_OPS(&SIMPLE_BASE_ID, op_desc, SIMPLE_SUB_ID_LAST), event_desc, sizeof(Simple_Public_Data), NULL, @@ -66,5 +66,5 @@ static const Eobj_Class_Description class_desc = { NULL }; -EOBJ_DEFINE_CLASS(simple_class_get, &class_desc, EOBJ_BASE_CLASS, NULL); +EO_DEFINE_CLASS(simple_class_get, &class_desc, EO_BASE_CLASS, NULL); diff --git a/legacy/eobj/examples/composite_objects/simple.h b/legacy/eobj/examples/composite_objects/simple.h index 336b8cceae..3fc75a958c 100644 --- a/legacy/eobj/examples/composite_objects/simple.h +++ b/legacy/eobj/examples/composite_objects/simple.h @@ -1,9 +1,9 @@ #ifndef SIMPLE_H #define SIMPLE_H -#include "Eobj.h" +#include "Eo.h" -extern EAPI Eobj_Op SIMPLE_BASE_ID; +extern EAPI Eo_Op SIMPLE_BASE_ID; enum { SIMPLE_SUB_ID_A_SET, @@ -18,13 +18,13 @@ typedef struct #define SIMPLE_ID(sub_id) (SIMPLE_BASE_ID + sub_id) -#define simple_a_set(a) SIMPLE_ID(SIMPLE_SUB_ID_A_SET), EOBJ_TYPECHECK(int, a) -#define simple_a_get(a) SIMPLE_ID(SIMPLE_SUB_ID_A_GET), EOBJ_TYPECHECK(int *, a) +#define simple_a_set(a) SIMPLE_ID(SIMPLE_SUB_ID_A_SET), EO_TYPECHECK(int, a) +#define simple_a_get(a) SIMPLE_ID(SIMPLE_SUB_ID_A_GET), EO_TYPECHECK(int *, a) -extern const Eobj_Event_Description _SIG_A_CHANGED; +extern const Eo_Event_Description _SIG_A_CHANGED; #define SIG_A_CHANGED (&(_SIG_A_CHANGED)) #define SIMPLE_CLASS simple_class_get() -const Eobj_Class *simple_class_get(void) EINA_CONST; +const Eo_Class *simple_class_get(void) EINA_CONST; #endif diff --git a/legacy/eobj/examples/constructors/CMakeLists.txt b/legacy/eobj/examples/constructors/CMakeLists.txt index 6daf946e2f..7752453c79 100644 --- a/legacy/eobj/examples/constructors/CMakeLists.txt +++ b/legacy/eobj/examples/constructors/CMakeLists.txt @@ -17,13 +17,13 @@ include_directories( add_executable(constructors ${CONSTRUCTORS_CC_SOURCES}) -get_target_property(eobj_LIB_FILE eobj LOCATION) +get_target_property(eo_LIB_FILE eo LOCATION) target_link_libraries(constructors ${EINA_LIBRARIES} ${EINA_LDFLAGS_OTHER} - ${eobj_LIB_FILE} + ${eo_LIB_FILE} ) -add_dependencies(constructors eobj) +add_dependencies(constructors eo) add_test(Example_constructors constructors) diff --git a/legacy/eobj/examples/constructors/main.c b/legacy/eobj/examples/constructors/main.c index a7ef68965c..c2906d9df9 100644 --- a/legacy/eobj/examples/constructors/main.c +++ b/legacy/eobj/examples/constructors/main.c @@ -1,4 +1,4 @@ -#include "Eobj.h" +#include "Eo.h" #include "simple.h" #include "simple2.h" #include "simple3.h" @@ -17,43 +17,43 @@ main(int argc, char *argv[]) int ret = 0; (void) argc; (void) argv; - eobj_init(); + eo_init(); - Eobj *obj = eobj_add(SIMPLE_CLASS, NULL); + Eo *obj = eo_add(SIMPLE_CLASS, NULL); fail_if(my_init_count != 2); - eobj_do(obj, simple_a_set(1), simple_b_set(2)); + eo_do(obj, simple_a_set(1), simple_b_set(2)); int a, b; - eobj_do(obj, simple_a_get(&a), simple_b_get(&b), mixin_add_and_print(5)); + eo_do(obj, simple_a_get(&a), simple_b_get(&b), mixin_add_and_print(5)); - eobj_unref(obj); + eo_unref(obj); fail_if(my_init_count != 0); - obj = eobj_add(SIMPLE2_CLASS, NULL); + obj = eo_add(SIMPLE2_CLASS, NULL); fail_if(obj); - obj = eobj_add(SIMPLE3_CLASS, NULL); + obj = eo_add(SIMPLE3_CLASS, NULL); fail_if(obj); my_init_count = 0; - obj = eobj_add(SIMPLE4_CLASS, NULL); + obj = eo_add(SIMPLE4_CLASS, NULL); fail_if(my_init_count != 2); - eobj_unref(obj); + eo_unref(obj); fail_if(my_init_count != 0); - obj = eobj_add(SIMPLE5_CLASS, NULL); - eobj_unref(obj); + obj = eo_add(SIMPLE5_CLASS, NULL); + eo_unref(obj); - obj = eobj_add(SIMPLE6_CLASS, NULL); - eobj_unref(obj); + obj = eo_add(SIMPLE6_CLASS, NULL); + eo_unref(obj); - eobj_shutdown(); + eo_shutdown(); return ret; } diff --git a/legacy/eobj/examples/constructors/mixin.c b/legacy/eobj/examples/constructors/mixin.c index 635fc34880..eac643dca0 100644 --- a/legacy/eobj/examples/constructors/mixin.c +++ b/legacy/eobj/examples/constructors/mixin.c @@ -1,18 +1,18 @@ -#include "Eobj.h" +#include "Eo.h" #include "mixin.h" #include "simple.h" #include "config.h" -EAPI Eobj_Op MIXIN_BASE_ID = 0; +EAPI Eo_Op MIXIN_BASE_ID = 0; #define MY_CLASS MIXIN_CLASS static void -_add_and_print_set(const Eobj *obj, const void *class_data EINA_UNUSED, va_list *list) +_add_and_print_set(const Eo *obj, const void *class_data EINA_UNUSED, va_list *list) { int a, b, x; - eobj_query(obj, simple_a_get(&a), simple_b_get(&b)); + eo_query(obj, simple_a_get(&a), simple_b_get(&b)); x = va_arg(*list, const int); printf("%s %d\n", __func__, a + b + x); } @@ -20,41 +20,41 @@ _add_and_print_set(const Eobj *obj, const void *class_data EINA_UNUSED, va_list extern int my_init_count; static void -_constructor(Eobj *obj, void *class_data EINA_UNUSED) +_constructor(Eo *obj, void *class_data EINA_UNUSED) { - eobj_constructor_super(obj); + eo_constructor_super(obj); my_init_count++; } static void -_destructor(Eobj *obj, void *class_data EINA_UNUSED) +_destructor(Eo *obj, void *class_data EINA_UNUSED) { - eobj_destructor_super(obj); + eo_destructor_super(obj); my_init_count--; } static void -_class_constructor(Eobj_Class *klass) +_class_constructor(Eo_Class *klass) { - const Eobj_Op_Func_Description func_desc[] = { - EOBJ_OP_FUNC_CONST(MIXIN_ID(MIXIN_SUB_ID_ADD_AND_SET), _add_and_print_set), - EOBJ_OP_FUNC_SENTINEL + const Eo_Op_Func_Description func_desc[] = { + EO_OP_FUNC_CONST(MIXIN_ID(MIXIN_SUB_ID_ADD_AND_SET), _add_and_print_set), + EO_OP_FUNC_SENTINEL }; - eobj_class_funcs_set(klass, func_desc); + eo_class_funcs_set(klass, func_desc); } -static const Eobj_Op_Description op_desc[] = { - EOBJ_OP_DESCRIPTION_CONST(MIXIN_SUB_ID_ADD_AND_SET, "i", "Add A + B + param and print it"), - EOBJ_OP_DESCRIPTION_SENTINEL +static const Eo_Op_Description op_desc[] = { + EO_OP_DESCRIPTION_CONST(MIXIN_SUB_ID_ADD_AND_SET, "i", "Add A + B + param and print it"), + EO_OP_DESCRIPTION_SENTINEL }; -static const Eobj_Class_Description class_desc = { +static const Eo_Class_Description class_desc = { "Mixin", - EOBJ_CLASS_TYPE_MIXIN, - EOBJ_CLASS_DESCRIPTION_OPS(&MIXIN_BASE_ID, op_desc, MIXIN_SUB_ID_LAST), + EO_CLASS_TYPE_MIXIN, + EO_CLASS_DESCRIPTION_OPS(&MIXIN_BASE_ID, op_desc, MIXIN_SUB_ID_LAST), NULL, 0, _constructor, @@ -63,5 +63,5 @@ static const Eobj_Class_Description class_desc = { NULL }; -EOBJ_DEFINE_CLASS(mixin_class_get, &class_desc, NULL, NULL); +EO_DEFINE_CLASS(mixin_class_get, &class_desc, NULL, NULL); diff --git a/legacy/eobj/examples/constructors/mixin.h b/legacy/eobj/examples/constructors/mixin.h index ef6017b82f..860a51304f 100644 --- a/legacy/eobj/examples/constructors/mixin.h +++ b/legacy/eobj/examples/constructors/mixin.h @@ -1,9 +1,9 @@ #ifndef MIXIN_H #define MIXIN_H -#include "Eobj.h" +#include "Eo.h" -extern EAPI Eobj_Op MIXIN_BASE_ID; +extern EAPI Eo_Op MIXIN_BASE_ID; enum { MIXIN_SUB_ID_ADD_AND_SET, @@ -12,9 +12,9 @@ enum { #define MIXIN_ID(sub_id) (MIXIN_BASE_ID + sub_id) -#define mixin_add_and_print(x) MIXIN_ID(MIXIN_SUB_ID_ADD_AND_SET), EOBJ_TYPECHECK(int, x) +#define mixin_add_and_print(x) MIXIN_ID(MIXIN_SUB_ID_ADD_AND_SET), EO_TYPECHECK(int, x) #define MIXIN_CLASS mixin_class_get() -const Eobj_Class *mixin_class_get(void) EINA_CONST; +const Eo_Class *mixin_class_get(void) EINA_CONST; #endif diff --git a/legacy/eobj/examples/constructors/simple.c b/legacy/eobj/examples/constructors/simple.c index 3f050c4996..15716b8a90 100644 --- a/legacy/eobj/examples/constructors/simple.c +++ b/legacy/eobj/examples/constructors/simple.c @@ -1,10 +1,10 @@ -#include "Eobj.h" +#include "Eo.h" #include "mixin.h" #include "simple.h" #include "config.h" -EAPI Eobj_Op SIMPLE_BASE_ID = 0; +EAPI Eo_Op SIMPLE_BASE_ID = 0; typedef struct { @@ -18,7 +18,7 @@ static char *class_var = NULL; #define _GET_SET_FUNC(name) \ static void \ -_##name##_get(const Eobj *obj EINA_UNUSED, const void *class_data, va_list *list) \ +_##name##_get(const Eo *obj EINA_UNUSED, const void *class_data, va_list *list) \ { \ const Private_Data *pd = class_data; \ int *name; \ @@ -27,7 +27,7 @@ _##name##_get(const Eobj *obj EINA_UNUSED, const void *class_data, va_list *list printf("%s %d\n", __func__, pd->name); \ } \ static void \ -_##name##_set(Eobj *obj EINA_UNUSED, void *class_data, va_list *list) \ +_##name##_set(Eo *obj EINA_UNUSED, void *class_data, va_list *list) \ { \ Private_Data *pd = class_data; \ int name; \ @@ -42,55 +42,55 @@ _GET_SET_FUNC(b) extern int my_init_count; static void -_constructor(Eobj *obj, void *class_data EINA_UNUSED) +_constructor(Eo *obj, void *class_data EINA_UNUSED) { - eobj_constructor_super(obj); + eo_constructor_super(obj); my_init_count++; } static void -_destructor(Eobj *obj, void *class_data EINA_UNUSED) +_destructor(Eo *obj, void *class_data EINA_UNUSED) { - eobj_destructor_super(obj); + eo_destructor_super(obj); my_init_count--; } static void -_class_constructor(Eobj_Class *klass) +_class_constructor(Eo_Class *klass) { - const Eobj_Op_Func_Description func_desc[] = { - EOBJ_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_A_SET), _a_set), - EOBJ_OP_FUNC_CONST(SIMPLE_ID(SIMPLE_SUB_ID_A_GET), _a_get), - EOBJ_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_B_SET), _b_set), - EOBJ_OP_FUNC_CONST(SIMPLE_ID(SIMPLE_SUB_ID_B_GET), _b_get), - EOBJ_OP_FUNC_SENTINEL + const Eo_Op_Func_Description func_desc[] = { + 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), + EO_OP_FUNC_CONST(SIMPLE_ID(SIMPLE_SUB_ID_B_GET), _b_get), + EO_OP_FUNC_SENTINEL }; - eobj_class_funcs_set(klass, func_desc); + eo_class_funcs_set(klass, func_desc); class_var = malloc(10); } static void -_class_destructor(Eobj_Class *klass EINA_UNUSED) +_class_destructor(Eo_Class *klass EINA_UNUSED) { free(class_var); } -static const Eobj_Op_Description op_desc[] = { - EOBJ_OP_DESCRIPTION(SIMPLE_SUB_ID_A_SET, "i", "Set property A"), - EOBJ_OP_DESCRIPTION_CONST(SIMPLE_SUB_ID_A_GET, "i", "Get property A"), - EOBJ_OP_DESCRIPTION(SIMPLE_SUB_ID_B_SET, "i", "Set property B"), - EOBJ_OP_DESCRIPTION_CONST(SIMPLE_SUB_ID_B_GET, "i", "Get property B"), - EOBJ_OP_DESCRIPTION_SENTINEL +static const Eo_Op_Description op_desc[] = { + EO_OP_DESCRIPTION(SIMPLE_SUB_ID_A_SET, "i", "Set property A"), + EO_OP_DESCRIPTION_CONST(SIMPLE_SUB_ID_A_GET, "i", "Get property A"), + EO_OP_DESCRIPTION(SIMPLE_SUB_ID_B_SET, "i", "Set property B"), + EO_OP_DESCRIPTION_CONST(SIMPLE_SUB_ID_B_GET, "i", "Get property B"), + EO_OP_DESCRIPTION_SENTINEL }; -static const Eobj_Class_Description class_desc = { +static const Eo_Class_Description class_desc = { "Simple", - EOBJ_CLASS_TYPE_REGULAR, - EOBJ_CLASS_DESCRIPTION_OPS(&SIMPLE_BASE_ID, op_desc, SIMPLE_SUB_ID_LAST), + EO_CLASS_TYPE_REGULAR, + EO_CLASS_DESCRIPTION_OPS(&SIMPLE_BASE_ID, op_desc, SIMPLE_SUB_ID_LAST), NULL, sizeof(Private_Data), _constructor, @@ -99,6 +99,6 @@ static const Eobj_Class_Description class_desc = { _class_destructor }; -EOBJ_DEFINE_CLASS(simple_class_get, &class_desc, EOBJ_BASE_CLASS, +EO_DEFINE_CLASS(simple_class_get, &class_desc, EO_BASE_CLASS, MIXIN_CLASS, NULL); diff --git a/legacy/eobj/examples/constructors/simple.h b/legacy/eobj/examples/constructors/simple.h index 005d12c2c2..0f2d217ee8 100644 --- a/legacy/eobj/examples/constructors/simple.h +++ b/legacy/eobj/examples/constructors/simple.h @@ -1,9 +1,9 @@ #ifndef SIMPLE_H #define SIMPLE_H -#include "Eobj.h" +#include "Eo.h" -extern EAPI Eobj_Op SIMPLE_BASE_ID; +extern EAPI Eo_Op SIMPLE_BASE_ID; enum { SIMPLE_SUB_ID_A_SET, @@ -15,12 +15,12 @@ enum { #define SIMPLE_ID(sub_id) (SIMPLE_BASE_ID + sub_id) -#define simple_a_set(a) SIMPLE_ID(SIMPLE_SUB_ID_A_SET), EOBJ_TYPECHECK(int, a) -#define simple_a_get(a) SIMPLE_ID(SIMPLE_SUB_ID_A_GET), EOBJ_TYPECHECK(int *, a) -#define simple_b_set(b) SIMPLE_ID(SIMPLE_SUB_ID_B_SET), EOBJ_TYPECHECK(int, b) -#define simple_b_get(b) SIMPLE_ID(SIMPLE_SUB_ID_B_GET), EOBJ_TYPECHECK(int *, b) +#define simple_a_set(a) SIMPLE_ID(SIMPLE_SUB_ID_A_SET), EO_TYPECHECK(int, a) +#define simple_a_get(a) SIMPLE_ID(SIMPLE_SUB_ID_A_GET), EO_TYPECHECK(int *, a) +#define simple_b_set(b) SIMPLE_ID(SIMPLE_SUB_ID_B_SET), EO_TYPECHECK(int, b) +#define simple_b_get(b) SIMPLE_ID(SIMPLE_SUB_ID_B_GET), EO_TYPECHECK(int *, b) #define SIMPLE_CLASS simple_class_get() -const Eobj_Class *simple_class_get(void) EINA_CONST; +const Eo_Class *simple_class_get(void) EINA_CONST; #endif diff --git a/legacy/eobj/examples/constructors/simple2.c b/legacy/eobj/examples/constructors/simple2.c index 535f8045cb..365ce81bf7 100644 --- a/legacy/eobj/examples/constructors/simple2.c +++ b/legacy/eobj/examples/constructors/simple2.c @@ -1,4 +1,4 @@ -#include "Eobj.h" +#include "Eo.h" #include "mixin.h" #include "simple2.h" @@ -7,17 +7,17 @@ #define MY_CLASS SIMPLE2_CLASS static void -_constructor(Eobj *obj, void *class_data EINA_UNUSED) +_constructor(Eo *obj, void *class_data EINA_UNUSED) { - eobj_constructor_super(obj); + eo_constructor_super(obj); - eobj_constructor_error_set(obj); + eo_constructor_error_set(obj); } -static const Eobj_Class_Description class_desc = { +static const Eo_Class_Description class_desc = { "Simple2", - EOBJ_CLASS_TYPE_REGULAR, - EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), + EO_CLASS_TYPE_REGULAR, + EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), NULL, 0, _constructor, @@ -26,5 +26,5 @@ static const Eobj_Class_Description class_desc = { NULL }; -EOBJ_DEFINE_CLASS(simple2_class_get, &class_desc, EOBJ_BASE_CLASS, NULL); +EO_DEFINE_CLASS(simple2_class_get, &class_desc, EO_BASE_CLASS, NULL); diff --git a/legacy/eobj/examples/constructors/simple2.h b/legacy/eobj/examples/constructors/simple2.h index 2c376c05a8..d557d7e7b0 100644 --- a/legacy/eobj/examples/constructors/simple2.h +++ b/legacy/eobj/examples/constructors/simple2.h @@ -1,9 +1,9 @@ #ifndef SIMPLE2_H #define SIMPLE2_H -#include "Eobj.h" +#include "Eo.h" #define SIMPLE2_CLASS simple2_class_get() -const Eobj_Class *simple2_class_get(void) EINA_CONST; +const Eo_Class *simple2_class_get(void) EINA_CONST; #endif diff --git a/legacy/eobj/examples/constructors/simple3.c b/legacy/eobj/examples/constructors/simple3.c index 44dba64a81..a09ec461f4 100644 --- a/legacy/eobj/examples/constructors/simple3.c +++ b/legacy/eobj/examples/constructors/simple3.c @@ -1,4 +1,4 @@ -#include "Eobj.h" +#include "Eo.h" #include "mixin.h" #include "simple3.h" @@ -7,15 +7,15 @@ #define MY_CLASS SIMPLE3_CLASS static void -_constructor(Eobj *obj, void *class_data EINA_UNUSED) +_constructor(Eo *obj, void *class_data EINA_UNUSED) { (void) obj; } -static const Eobj_Class_Description class_desc = { +static const Eo_Class_Description class_desc = { "Simple3", - EOBJ_CLASS_TYPE_REGULAR, - EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), + EO_CLASS_TYPE_REGULAR, + EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), NULL, 0, _constructor, @@ -24,5 +24,5 @@ static const Eobj_Class_Description class_desc = { NULL }; -EOBJ_DEFINE_CLASS(simple3_class_get, &class_desc, EOBJ_BASE_CLASS, NULL); +EO_DEFINE_CLASS(simple3_class_get, &class_desc, EO_BASE_CLASS, NULL); diff --git a/legacy/eobj/examples/constructors/simple3.h b/legacy/eobj/examples/constructors/simple3.h index b3281c0e68..a8b1b7178d 100644 --- a/legacy/eobj/examples/constructors/simple3.h +++ b/legacy/eobj/examples/constructors/simple3.h @@ -1,9 +1,9 @@ #ifndef SIMPLE3_H #define SIMPLE3_H -#include "Eobj.h" +#include "Eo.h" #define SIMPLE3_CLASS simple3_class_get() -const Eobj_Class *simple3_class_get(void) EINA_CONST; +const Eo_Class *simple3_class_get(void) EINA_CONST; #endif diff --git a/legacy/eobj/examples/constructors/simple4.c b/legacy/eobj/examples/constructors/simple4.c index ac7f666e81..43099d34f5 100644 --- a/legacy/eobj/examples/constructors/simple4.c +++ b/legacy/eobj/examples/constructors/simple4.c @@ -1,14 +1,14 @@ -#include "Eobj.h" +#include "Eo.h" #include "mixin.h" #include "simple.h" #include "simple4.h" #define MY_CLASS SIMPLE4_CLASS -static const Eobj_Class_Description class_desc = { +static const Eo_Class_Description class_desc = { "Simple4", - EOBJ_CLASS_TYPE_REGULAR, - EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), + EO_CLASS_TYPE_REGULAR, + EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), NULL, 0, NULL, @@ -17,5 +17,5 @@ static const Eobj_Class_Description class_desc = { NULL }; -EOBJ_DEFINE_CLASS(simple4_class_get, &class_desc, SIMPLE_CLASS, MIXIN_CLASS, NULL); +EO_DEFINE_CLASS(simple4_class_get, &class_desc, SIMPLE_CLASS, MIXIN_CLASS, NULL); diff --git a/legacy/eobj/examples/constructors/simple4.h b/legacy/eobj/examples/constructors/simple4.h index 695c748fb3..a3b7387205 100644 --- a/legacy/eobj/examples/constructors/simple4.h +++ b/legacy/eobj/examples/constructors/simple4.h @@ -1,9 +1,9 @@ #ifndef SIMPLE4_H #define SIMPLE4_H -#include "Eobj.h" +#include "Eo.h" #define SIMPLE4_CLASS simple4_class_get() -const Eobj_Class *simple4_class_get(void) EINA_CONST; +const Eo_Class *simple4_class_get(void) EINA_CONST; #endif diff --git a/legacy/eobj/examples/constructors/simple5.c b/legacy/eobj/examples/constructors/simple5.c index 2c7cc78ab1..e8438c0fa1 100644 --- a/legacy/eobj/examples/constructors/simple5.c +++ b/legacy/eobj/examples/constructors/simple5.c @@ -1,4 +1,4 @@ -#include "Eobj.h" +#include "Eo.h" #include "mixin.h" #include "simple5.h" @@ -7,15 +7,15 @@ #define MY_CLASS SIMPLE5_CLASS static void -_destructor(Eobj *obj, void *class_data EINA_UNUSED) +_destructor(Eo *obj, void *class_data EINA_UNUSED) { (void) obj; } -static const Eobj_Class_Description class_desc = { +static const Eo_Class_Description class_desc = { "Simple5", - EOBJ_CLASS_TYPE_REGULAR, - EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), + EO_CLASS_TYPE_REGULAR, + EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), NULL, 0, NULL, @@ -24,5 +24,5 @@ static const Eobj_Class_Description class_desc = { NULL }; -EOBJ_DEFINE_CLASS(simple5_class_get, &class_desc, EOBJ_BASE_CLASS, NULL); +EO_DEFINE_CLASS(simple5_class_get, &class_desc, EO_BASE_CLASS, NULL); diff --git a/legacy/eobj/examples/constructors/simple5.h b/legacy/eobj/examples/constructors/simple5.h index 97135086f5..0157af8e07 100644 --- a/legacy/eobj/examples/constructors/simple5.h +++ b/legacy/eobj/examples/constructors/simple5.h @@ -1,9 +1,9 @@ #ifndef SIMPLE5_H #define SIMPLE5_H -#include "Eobj.h" +#include "Eo.h" #define SIMPLE5_CLASS simple5_class_get() -const Eobj_Class *simple5_class_get(void) EINA_CONST; +const Eo_Class *simple5_class_get(void) EINA_CONST; #endif diff --git a/legacy/eobj/examples/constructors/simple6.c b/legacy/eobj/examples/constructors/simple6.c index e3210c6ca3..105e950526 100644 --- a/legacy/eobj/examples/constructors/simple6.c +++ b/legacy/eobj/examples/constructors/simple6.c @@ -1,4 +1,4 @@ -#include "Eobj.h" +#include "Eo.h" #include "mixin.h" #include "simple6.h" @@ -7,17 +7,17 @@ #define MY_CLASS SIMPLE6_CLASS static void -_destructor(Eobj *obj, void *class_data EINA_UNUSED) +_destructor(Eo *obj, void *class_data EINA_UNUSED) { - eobj_constructor_super(obj); + eo_constructor_super(obj); - eobj_constructor_error_set(obj); + eo_constructor_error_set(obj); } -static const Eobj_Class_Description class_desc = { +static const Eo_Class_Description class_desc = { "Simple6", - EOBJ_CLASS_TYPE_REGULAR, - EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), + EO_CLASS_TYPE_REGULAR, + EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), NULL, 0, NULL, @@ -26,5 +26,5 @@ static const Eobj_Class_Description class_desc = { NULL }; -EOBJ_DEFINE_CLASS(simple6_class_get, &class_desc, EOBJ_BASE_CLASS, NULL); +EO_DEFINE_CLASS(simple6_class_get, &class_desc, EO_BASE_CLASS, NULL); diff --git a/legacy/eobj/examples/constructors/simple6.h b/legacy/eobj/examples/constructors/simple6.h index 52797b536c..0915aea69e 100644 --- a/legacy/eobj/examples/constructors/simple6.h +++ b/legacy/eobj/examples/constructors/simple6.h @@ -1,9 +1,9 @@ #ifndef SIMPLE6_H #define SIMPLE6_H -#include "Eobj.h" +#include "Eo.h" #define SIMPLE6_CLASS simple6_class_get() -const Eobj_Class *simple6_class_get(void) EINA_CONST; +const Eo_Class *simple6_class_get(void) EINA_CONST; #endif diff --git a/legacy/eobj/examples/evas/CMakeLists.txt b/legacy/eobj/examples/evas/CMakeLists.txt index 445e056248..0fe04c0906 100644 --- a/legacy/eobj/examples/evas/CMakeLists.txt +++ b/legacy/eobj/examples/evas/CMakeLists.txt @@ -15,13 +15,13 @@ include_directories( ) add_executable(evas ${EVAS_CC_SOURCES}) -get_target_property(eobj_LIB_FILE eobj LOCATION) +get_target_property(eo_LIB_FILE eo LOCATION) target_link_libraries(evas ${EINA_LIBRARIES} ${EINA_LDFLAGS_OTHER} ${EVAS_LIBRARIES} ${ELEMENTARY_LIBRARIES} - ${eobj_LIB_FILE} + ${eo_LIB_FILE} ) -add_dependencies(evas eobj) +add_dependencies(evas eo) diff --git a/legacy/eobj/examples/evas/elw_box.c b/legacy/eobj/examples/evas/elw_box.c index 7c7414181c..a4302daf1d 100644 --- a/legacy/eobj/examples/evas/elw_box.c +++ b/legacy/eobj/examples/evas/elw_box.c @@ -1,12 +1,12 @@ #include -#include "Eobj.h" +#include "Eo.h" #include "evas_obj.h" #include "elw_box.h" #include "config.h" -EAPI Eobj_Op ELW_BOX_BASE_ID = 0; +EAPI Eo_Op ELW_BOX_BASE_ID = 0; typedef struct { @@ -16,50 +16,50 @@ typedef struct #define MY_CLASS ELW_BOX_CLASS static void -_pack_end(Eobj *obj EINA_UNUSED, void *class_data, va_list *list) +_pack_end(Eo *obj EINA_UNUSED, void *class_data, va_list *list) { Widget_Data *wd = class_data; - Eobj *child_obj; - child_obj = va_arg(*list, Eobj *); + Eo *child_obj; + child_obj = va_arg(*list, Eo *); /* FIXME: Ref and the later uref child_obj here... */ - elm_box_pack_end(wd->bx, eobj_evas_object_get(child_obj)); + elm_box_pack_end(wd->bx, eo_evas_object_get(child_obj)); } static void -_constructor(Eobj *obj, void *class_data) +_constructor(Eo *obj, void *class_data) { - eobj_constructor_super(obj); + eo_constructor_super(obj); Widget_Data *wd = class_data; - /* FIXME: An hack, because our tree is not yet only Eobj */ - wd->bx = elm_box_add(eobj_evas_object_get(eobj_parent_get(obj))); + /* FIXME: An hack, because our tree is not yet only Eo */ + wd->bx = elm_box_add(eo_evas_object_get(eo_parent_get(obj))); evas_object_size_hint_align_set(wd->bx, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_size_hint_weight_set(wd->bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - eobj_evas_object_set(obj, wd->bx); + eo_evas_object_set(obj, wd->bx); } static void -_class_constructor(Eobj_Class *klass) +_class_constructor(Eo_Class *klass) { - const Eobj_Op_Func_Description func_desc[] = { - EOBJ_OP_FUNC(ELW_BOX_ID(ELW_BOX_SUB_ID_PACK_END), _pack_end), - EOBJ_OP_FUNC_SENTINEL + const Eo_Op_Func_Description func_desc[] = { + EO_OP_FUNC(ELW_BOX_ID(ELW_BOX_SUB_ID_PACK_END), _pack_end), + EO_OP_FUNC_SENTINEL }; - eobj_class_funcs_set(klass, func_desc); + eo_class_funcs_set(klass, func_desc); } -static const Eobj_Op_Description op_desc[] = { - EOBJ_OP_DESCRIPTION(ELW_BOX_SUB_ID_PACK_END, "o", "Pack obj at the end of box."), - EOBJ_OP_DESCRIPTION_SENTINEL +static const Eo_Op_Description op_desc[] = { + EO_OP_DESCRIPTION(ELW_BOX_SUB_ID_PACK_END, "o", "Pack obj at the end of box."), + EO_OP_DESCRIPTION_SENTINEL }; -static const Eobj_Class_Description class_desc = { +static const Eo_Class_Description class_desc = { "Elw Box", - EOBJ_CLASS_TYPE_REGULAR, - EOBJ_CLASS_DESCRIPTION_OPS(&ELW_BOX_BASE_ID, op_desc, ELW_BOX_SUB_ID_LAST), + EO_CLASS_TYPE_REGULAR, + EO_CLASS_DESCRIPTION_OPS(&ELW_BOX_BASE_ID, op_desc, ELW_BOX_SUB_ID_LAST), NULL, sizeof(Widget_Data), _constructor, @@ -68,5 +68,5 @@ static const Eobj_Class_Description class_desc = { NULL }; -EOBJ_DEFINE_CLASS(elw_box_class_get, &class_desc, EVAS_OBJ_CLASS, NULL) +EO_DEFINE_CLASS(elw_box_class_get, &class_desc, EVAS_OBJ_CLASS, NULL) diff --git a/legacy/eobj/examples/evas/elw_box.h b/legacy/eobj/examples/evas/elw_box.h index 89777e8edc..23cd731a35 100644 --- a/legacy/eobj/examples/evas/elw_box.h +++ b/legacy/eobj/examples/evas/elw_box.h @@ -1,9 +1,9 @@ #ifndef ELW_BOX_H #define ELW_BOX_H -#include "Eobj.h" +#include "Eo.h" -extern EAPI Eobj_Op ELW_BOX_BASE_ID; +extern EAPI Eo_Op ELW_BOX_BASE_ID; enum { ELW_BOX_SUB_ID_PACK_END, @@ -17,9 +17,9 @@ enum { * @brief Pack object to the end of the box * @param[in] obj object to pack into box */ -#define elw_box_pack_end(obj) ELW_BOX_ID(ELW_BOX_SUB_ID_PACK_END), EOBJ_TYPECHECK(Eobj *, obj) +#define elw_box_pack_end(obj) ELW_BOX_ID(ELW_BOX_SUB_ID_PACK_END), EO_TYPECHECK(Eo *, obj) #define ELW_BOX_CLASS elw_box_class_get() -const Eobj_Class *elw_box_class_get(void) EINA_CONST; +const Eo_Class *elw_box_class_get(void) EINA_CONST; #endif diff --git a/legacy/eobj/examples/evas/elw_boxedbutton.c b/legacy/eobj/examples/evas/elw_boxedbutton.c index ff14824201..4846697352 100644 --- a/legacy/eobj/examples/evas/elw_boxedbutton.c +++ b/legacy/eobj/examples/evas/elw_boxedbutton.c @@ -1,6 +1,6 @@ #include -#include "Eobj.h" +#include "Eo.h" #include "evas_obj.h" #include "elw_box.h" #include "elw_button.h" @@ -16,23 +16,23 @@ typedef struct #define MY_CLASS ELW_BOXEDBUTTON_CLASS static void -_constructor(Eobj *obj, void *class_data EINA_UNUSED) +_constructor(Eo *obj, void *class_data EINA_UNUSED) { - eobj_constructor_super(obj); + eo_constructor_super(obj); - Eobj *bt = eobj_add(ELW_BUTTON_CLASS, obj); - eobj_composite_object_attach(obj, bt); - eobj_event_callback_forwarder_add(bt, SIG_CLICKED, obj); - eobj_do(bt, evas_obj_visibility_set(EINA_TRUE)); + Eo *bt = eo_add(ELW_BUTTON_CLASS, obj); + eo_composite_object_attach(obj, bt); + eo_event_callback_forwarder_add(bt, SIG_CLICKED, obj); + eo_do(bt, evas_obj_visibility_set(EINA_TRUE)); - eobj_do(obj, elw_box_pack_end(bt)); - eobj_unref(bt); + eo_do(obj, elw_box_pack_end(bt)); + eo_unref(bt); } -static const Eobj_Class_Description class_desc = { +static const Eo_Class_Description class_desc = { "Elw BoxedButton", - EOBJ_CLASS_TYPE_REGULAR, - EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), + EO_CLASS_TYPE_REGULAR, + EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), NULL, sizeof(Widget_Data), _constructor, @@ -41,5 +41,5 @@ static const Eobj_Class_Description class_desc = { NULL }; -EOBJ_DEFINE_CLASS(elw_boxedbutton_class_get, &class_desc, ELW_BOX_CLASS, ELW_BUTTON_CLASS, NULL) +EO_DEFINE_CLASS(elw_boxedbutton_class_get, &class_desc, ELW_BOX_CLASS, ELW_BUTTON_CLASS, NULL) diff --git a/legacy/eobj/examples/evas/elw_boxedbutton.h b/legacy/eobj/examples/evas/elw_boxedbutton.h index 4a1c9fdcdc..e9ee82ae1e 100644 --- a/legacy/eobj/examples/evas/elw_boxedbutton.h +++ b/legacy/eobj/examples/evas/elw_boxedbutton.h @@ -1,9 +1,9 @@ #ifndef ELW_BOXEDBUTTON_H #define ELW_BOXEDBUTTON_H -#include "Eobj.h" +#include "Eo.h" #define ELW_BOXEDBUTTON_CLASS elw_boxedbutton_class_get() -const Eobj_Class *elw_boxedbutton_class_get(void) EINA_CONST; +const Eo_Class *elw_boxedbutton_class_get(void) EINA_CONST; #endif diff --git a/legacy/eobj/examples/evas/elw_button.c b/legacy/eobj/examples/evas/elw_button.c index 788246d6ee..42911c8022 100644 --- a/legacy/eobj/examples/evas/elw_button.c +++ b/legacy/eobj/examples/evas/elw_button.c @@ -1,15 +1,15 @@ #include -#include "Eobj.h" +#include "Eo.h" #include "evas_obj.h" #include "elw_button.h" #include "config.h" -EAPI Eobj_Op ELW_BUTTON_BASE_ID = 0; +EAPI Eo_Op ELW_BUTTON_BASE_ID = 0; -EAPI const Eobj_Event_Description _SIG_CLICKED = - EOBJ_EVENT_DESCRIPTION("clicked", "", "Called when there was a click."); +EAPI const Eo_Event_Description _SIG_CLICKED = + EO_EVENT_DESCRIPTION("clicked", "", "Called when there was a click."); typedef struct { @@ -19,18 +19,18 @@ typedef struct #define MY_CLASS ELW_BUTTON_CLASS static void -_position_set(Eobj *obj, void *class_data EINA_UNUSED, va_list *list) +_position_set(Eo *obj, void *class_data EINA_UNUSED, va_list *list) { (void) obj; Evas_Coord x, y; x = va_arg(*list, Evas_Coord); y = va_arg(*list, Evas_Coord); printf("But set position %d,%d\n", x, y); - eobj_do_super(obj, evas_obj_position_set(x, y)); + eo_do_super(obj, evas_obj_position_set(x, y)); } static void -_text_set(Eobj *obj EINA_UNUSED, void *class_data, va_list *list) +_text_set(Eo *obj EINA_UNUSED, void *class_data, va_list *list) { Widget_Data *wd = class_data; const char *text; @@ -43,63 +43,63 @@ _btn_clicked(void *data, Evas_Object *evas_obj, void *event_info) { (void) evas_obj; (void) event_info; - Eobj *obj = data; - eobj_event_callback_call(obj, SIG_CLICKED, NULL); + Eo *obj = data; + eo_event_callback_call(obj, SIG_CLICKED, NULL); } static void -_constructor(Eobj *obj, void *class_data) +_constructor(Eo *obj, void *class_data) { - eobj_constructor_super(obj); + eo_constructor_super(obj); Widget_Data *wd = class_data; - /* FIXME: An hack, because our tree is not yet only Eobj */ - wd->bt = elm_button_add(eobj_evas_object_get(eobj_parent_get(obj))); + /* FIXME: An hack, because our tree is not yet only Eo */ + wd->bt = elm_button_add(eo_evas_object_get(eo_parent_get(obj))); evas_object_size_hint_align_set(wd->bt, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_size_hint_weight_set(wd->bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_smart_callback_add(wd->bt, "clicked", _btn_clicked, obj); - eobj_evas_object_set(obj, wd->bt); + eo_evas_object_set(obj, wd->bt); } static void -_destructor(Eobj *obj, void *class_data EINA_UNUSED) +_destructor(Eo *obj, void *class_data EINA_UNUSED) { - eobj_destructor_super(obj); + eo_destructor_super(obj); //Widget_Data *wd = class_data; /* FIXME: Commented out because it's automatically done because our tree - * is not made of only eobj */ + * is not made of only eo */ //evas_object_del(wd->bt); } static void -_class_constructor(Eobj_Class *klass) +_class_constructor(Eo_Class *klass) { - const Eobj_Op_Func_Description func_desc[] = { - EOBJ_OP_FUNC(ELW_BUTTON_ID(ELW_BUTTON_SUB_ID_TEXT_SET), _text_set), - EOBJ_OP_FUNC(EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_POSITION_SET), _position_set), - EOBJ_OP_FUNC_SENTINEL + const Eo_Op_Func_Description func_desc[] = { + EO_OP_FUNC(ELW_BUTTON_ID(ELW_BUTTON_SUB_ID_TEXT_SET), _text_set), + EO_OP_FUNC(EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_POSITION_SET), _position_set), + EO_OP_FUNC_SENTINEL }; - eobj_class_funcs_set(klass, func_desc); + eo_class_funcs_set(klass, func_desc); } -static const Eobj_Op_Description op_desc[] = { - EOBJ_OP_DESCRIPTION(ELW_BUTTON_SUB_ID_TEXT_SET, "s", "Text of a text supporting evas object."), // FIXME: This ID sholudn't really be defined here... - EOBJ_OP_DESCRIPTION_SENTINEL +static const Eo_Op_Description op_desc[] = { + EO_OP_DESCRIPTION(ELW_BUTTON_SUB_ID_TEXT_SET, "s", "Text of a text supporting evas object."), // FIXME: This ID sholudn't really be defined here... + EO_OP_DESCRIPTION_SENTINEL }; -static const Eobj_Event_Description *event_desc[] = { +static const Eo_Event_Description *event_desc[] = { SIG_CLICKED, NULL }; -static const Eobj_Class_Description class_desc = { +static const Eo_Class_Description class_desc = { "Elw Button", - EOBJ_CLASS_TYPE_REGULAR, - EOBJ_CLASS_DESCRIPTION_OPS(&ELW_BUTTON_BASE_ID, op_desc, ELW_BUTTON_SUB_ID_LAST), + EO_CLASS_TYPE_REGULAR, + EO_CLASS_DESCRIPTION_OPS(&ELW_BUTTON_BASE_ID, op_desc, ELW_BUTTON_SUB_ID_LAST), event_desc, sizeof(Widget_Data), _constructor, @@ -108,5 +108,5 @@ static const Eobj_Class_Description class_desc = { NULL }; -EOBJ_DEFINE_CLASS(elw_button_class_get, &class_desc, EVAS_OBJ_CLASS, NULL) +EO_DEFINE_CLASS(elw_button_class_get, &class_desc, EVAS_OBJ_CLASS, NULL) diff --git a/legacy/eobj/examples/evas/elw_button.h b/legacy/eobj/examples/evas/elw_button.h index 02875df24a..ff6f182530 100644 --- a/legacy/eobj/examples/evas/elw_button.h +++ b/legacy/eobj/examples/evas/elw_button.h @@ -1,9 +1,9 @@ #ifndef ELW_BUTTON_H #define ELW_BUTTON_H -#include "Eobj.h" +#include "Eo.h" -extern EAPI Eobj_Op ELW_BUTTON_BASE_ID; +extern EAPI Eo_Op ELW_BUTTON_BASE_ID; enum { ELW_BUTTON_SUB_ID_TEXT_SET, @@ -18,12 +18,12 @@ enum { * @param[in] text text to assing to button * FIXME Doesn't belong here, but just for the example... */ -#define elw_button_text_set(text) ELW_BUTTON_ID(ELW_BUTTON_SUB_ID_TEXT_SET), EOBJ_TYPECHECK(const char *, text) +#define elw_button_text_set(text) ELW_BUTTON_ID(ELW_BUTTON_SUB_ID_TEXT_SET), EO_TYPECHECK(const char *, text) -extern const Eobj_Event_Description _SIG_CLICKED; +extern const Eo_Event_Description _SIG_CLICKED; #define SIG_CLICKED (&(_SIG_CLICKED)) #define ELW_BUTTON_CLASS elw_button_class_get() -const Eobj_Class *elw_button_class_get(void) EINA_CONST; +const Eo_Class *elw_button_class_get(void) EINA_CONST; #endif diff --git a/legacy/eobj/examples/evas/elw_win.c b/legacy/eobj/examples/evas/elw_win.c index 2393bada42..aad69f5fba 100644 --- a/legacy/eobj/examples/evas/elw_win.c +++ b/legacy/eobj/examples/evas/elw_win.c @@ -1,6 +1,6 @@ #include -#include "Eobj.h" +#include "Eo.h" #include "evas_obj.h" #include "elw_win.h" @@ -23,15 +23,15 @@ my_win_del(void *data, Evas_Object *obj, void *event_info) } static void -_constructor(Eobj *obj, void *class_data) +_constructor(Eo *obj, void *class_data) { - eobj_constructor_super(obj); + eo_constructor_super(obj); Widget_Data *wd = class_data; /* FIXME: Will actually do something about those when I care... */ - wd->win = elm_win_add(NULL, "eobj-test", ELM_WIN_BASIC); - elm_win_title_set(wd->win, "Eobj Test"); + wd->win = elm_win_add(NULL, "eo-test", ELM_WIN_BASIC); + elm_win_title_set(wd->win, "Eo Test"); elm_win_autodel_set(wd->win, EINA_TRUE); evas_object_smart_callback_add(wd->win, "delete,request", my_win_del, NULL); @@ -40,13 +40,13 @@ _constructor(Eobj *obj, void *class_data) evas_object_size_hint_weight_set(wd->bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_show(wd->bg); - eobj_evas_object_set(obj, wd->win); + eo_evas_object_set(obj, wd->win); } -static const Eobj_Class_Description class_desc = { +static const Eo_Class_Description class_desc = { "Elw Win", - EOBJ_CLASS_TYPE_REGULAR, - EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), + EO_CLASS_TYPE_REGULAR, + EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), NULL, sizeof(Widget_Data), _constructor, @@ -56,5 +56,5 @@ static const Eobj_Class_Description class_desc = { }; -EOBJ_DEFINE_CLASS(elw_win_class_get, &class_desc, EVAS_OBJ_CLASS, NULL) +EO_DEFINE_CLASS(elw_win_class_get, &class_desc, EVAS_OBJ_CLASS, NULL) diff --git a/legacy/eobj/examples/evas/elw_win.h b/legacy/eobj/examples/evas/elw_win.h index a59b2ec0a5..a97b89bd4d 100644 --- a/legacy/eobj/examples/evas/elw_win.h +++ b/legacy/eobj/examples/evas/elw_win.h @@ -1,9 +1,9 @@ #ifndef ELW_WIN_H #define ELW_WIN_H -#include "Eobj.h" +#include "Eo.h" #define ELW_WIN_CLASS elw_win_class_get() -const Eobj_Class *elw_win_class_get(void) EINA_CONST; +const Eo_Class *elw_win_class_get(void) EINA_CONST; #endif diff --git a/legacy/eobj/examples/evas/evas_obj.c b/legacy/eobj/examples/evas/evas_obj.c index 2528ea8457..89f68cb26e 100644 --- a/legacy/eobj/examples/evas/evas_obj.c +++ b/legacy/eobj/examples/evas/evas_obj.c @@ -1,13 +1,13 @@ #include -#include "Eobj.h" +#include "Eo.h" #include "evas_obj.h" #include "config.h" #define MY_CLASS EVAS_OBJ_CLASS -EAPI Eobj_Op EVAS_OBJ_BASE_ID = 0; +EAPI Eo_Op EVAS_OBJ_BASE_ID = 0; typedef struct { @@ -15,9 +15,9 @@ typedef struct } Widget_Data; static void -_position_set(Eobj *obj, void *class_data EINA_UNUSED, va_list *list) +_position_set(Eo *obj, void *class_data EINA_UNUSED, va_list *list) { - Evas_Object *evas_obj = eobj_evas_object_get(obj); + Evas_Object *evas_obj = eo_evas_object_get(obj); Evas_Coord x, y; x = va_arg(*list, Evas_Coord); y = va_arg(*list, Evas_Coord); @@ -25,9 +25,9 @@ _position_set(Eobj *obj, void *class_data EINA_UNUSED, va_list *list) } static void -_size_set(Eobj *obj, void *class_data EINA_UNUSED, va_list *list) +_size_set(Eo *obj, void *class_data EINA_UNUSED, va_list *list) { - Evas_Object *evas_obj = eobj_evas_object_get(obj); + Evas_Object *evas_obj = eo_evas_object_get(obj); Evas_Coord w, h; w = va_arg(*list, Evas_Coord); h = va_arg(*list, Evas_Coord); @@ -35,9 +35,9 @@ _size_set(Eobj *obj, void *class_data EINA_UNUSED, va_list *list) } static void -_color_set(Eobj *obj, void *class_data EINA_UNUSED, va_list *list) +_color_set(Eo *obj, void *class_data EINA_UNUSED, va_list *list) { - Evas_Object *evas_obj = eobj_evas_object_get(obj); + Evas_Object *evas_obj = eo_evas_object_get(obj); int r, g, b, a; r = va_arg(*list, int); g = va_arg(*list, int); @@ -47,9 +47,9 @@ _color_set(Eobj *obj, void *class_data EINA_UNUSED, va_list *list) } static void -_color_get(const Eobj *obj, const void *class_data EINA_UNUSED, va_list *list) +_color_get(const Eo *obj, const void *class_data EINA_UNUSED, va_list *list) { - Evas_Object *evas_obj = eobj_evas_object_get(obj); + Evas_Object *evas_obj = eo_evas_object_get(obj); int *r, *g, *b, *a; r = va_arg(*list, int *); g = va_arg(*list, int *); @@ -59,9 +59,9 @@ _color_get(const Eobj *obj, const void *class_data EINA_UNUSED, va_list *list) } static void -_visibility_set(Eobj *obj, void *class_data EINA_UNUSED, va_list *list) +_visibility_set(Eo *obj, void *class_data EINA_UNUSED, va_list *list) { - Evas_Object *evas_obj = eobj_evas_object_get(obj); + Evas_Object *evas_obj = eo_evas_object_get(obj); Eina_Bool v; v = va_arg(*list, int); if (v) evas_object_show(evas_obj); @@ -69,69 +69,69 @@ _visibility_set(Eobj *obj, void *class_data EINA_UNUSED, va_list *list) } static void -_child_add(Eobj *obj, void *class_data, va_list *list) +_child_add(Eo *obj, void *class_data, va_list *list) { Widget_Data *wd = class_data; - Eobj *child; - child = va_arg(*list, Eobj *); - wd->children = eina_list_append(wd->children, eobj_xref(child, obj)); + Eo *child; + child = va_arg(*list, Eo *); + wd->children = eina_list_append(wd->children, eo_xref(child, obj)); } static void -_constructor(Eobj *obj, void *class_data EINA_UNUSED) +_constructor(Eo *obj, void *class_data EINA_UNUSED) { - eobj_constructor_super(obj); + eo_constructor_super(obj); /* Add type check. */ - Eobj *parent = eobj_parent_get(obj); + Eo *parent = eo_parent_get(obj); if (parent) - eobj_do(parent, evas_obj_child_add(obj)); + eo_do(parent, evas_obj_child_add(obj)); } static void -_destructor(Eobj *obj, void *class_data) +_destructor(Eo *obj, void *class_data) { - eobj_destructor_super(obj); + eo_destructor_super(obj); Widget_Data *wd = class_data; - Eobj *child; + Eo *child; EINA_LIST_FREE(wd->children, child) { - eobj_xunref(child, obj); + eo_xunref(child, obj); } } static void -_class_constructor(Eobj_Class *klass) +_class_constructor(Eo_Class *klass) { - const Eobj_Op_Func_Description func_desc[] = { - EOBJ_OP_FUNC(EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_POSITION_SET), _position_set), - EOBJ_OP_FUNC(EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_SIZE_SET), _size_set), - EOBJ_OP_FUNC(EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_COLOR_SET), _color_set), - EOBJ_OP_FUNC_CONST(EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_COLOR_GET), _color_get), - EOBJ_OP_FUNC(EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_VISIBILITY_SET), _visibility_set), - EOBJ_OP_FUNC(EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_CHILD_ADD), _child_add), - EOBJ_OP_FUNC_SENTINEL + const Eo_Op_Func_Description func_desc[] = { + EO_OP_FUNC(EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_POSITION_SET), _position_set), + EO_OP_FUNC(EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_SIZE_SET), _size_set), + EO_OP_FUNC(EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_COLOR_SET), _color_set), + EO_OP_FUNC_CONST(EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_COLOR_GET), _color_get), + EO_OP_FUNC(EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_VISIBILITY_SET), _visibility_set), + EO_OP_FUNC(EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_CHILD_ADD), _child_add), + EO_OP_FUNC_SENTINEL }; - eobj_class_funcs_set(klass, func_desc); + eo_class_funcs_set(klass, func_desc); } -static const Eobj_Op_Description op_desc[] = { - EOBJ_OP_DESCRIPTION(EVAS_OBJ_SUB_ID_POSITION_SET, "ii", "Position of an evas object."), - EOBJ_OP_DESCRIPTION(EVAS_OBJ_SUB_ID_SIZE_SET, "ii", "Size of an evas object."), - EOBJ_OP_DESCRIPTION(EVAS_OBJ_SUB_ID_COLOR_SET, "iiii", "Color of an evas object."), - EOBJ_OP_DESCRIPTION_CONST(EVAS_OBJ_SUB_ID_COLOR_GET, "iiii", "Color of an evas object."), - EOBJ_OP_DESCRIPTION(EVAS_OBJ_SUB_ID_VISIBILITY_SET, "b", "Visibility of an evas object."), - EOBJ_OP_DESCRIPTION(EVAS_OBJ_SUB_ID_CHILD_ADD, "o", "Add a child eobj."), - EOBJ_OP_DESCRIPTION_SENTINEL +static const Eo_Op_Description op_desc[] = { + EO_OP_DESCRIPTION(EVAS_OBJ_SUB_ID_POSITION_SET, "ii", "Position of an evas object."), + EO_OP_DESCRIPTION(EVAS_OBJ_SUB_ID_SIZE_SET, "ii", "Size of an evas object."), + EO_OP_DESCRIPTION(EVAS_OBJ_SUB_ID_COLOR_SET, "iiii", "Color of an evas object."), + EO_OP_DESCRIPTION_CONST(EVAS_OBJ_SUB_ID_COLOR_GET, "iiii", "Color of an evas object."), + EO_OP_DESCRIPTION(EVAS_OBJ_SUB_ID_VISIBILITY_SET, "b", "Visibility of an evas object."), + EO_OP_DESCRIPTION(EVAS_OBJ_SUB_ID_CHILD_ADD, "o", "Add a child eo."), + EO_OP_DESCRIPTION_SENTINEL }; -static const Eobj_Class_Description class_desc = { +static const Eo_Class_Description class_desc = { "Evas Object", - EOBJ_CLASS_TYPE_REGULAR_NO_INSTANT, - EOBJ_CLASS_DESCRIPTION_OPS(&EVAS_OBJ_BASE_ID, op_desc, EVAS_OBJ_SUB_ID_LAST), + EO_CLASS_TYPE_REGULAR_NO_INSTANT, + EO_CLASS_DESCRIPTION_OPS(&EVAS_OBJ_BASE_ID, op_desc, EVAS_OBJ_SUB_ID_LAST), NULL, sizeof(Widget_Data), _constructor, @@ -140,4 +140,4 @@ static const Eobj_Class_Description class_desc = { NULL }; -EOBJ_DEFINE_CLASS(evas_object_class_get, &class_desc, EOBJ_BASE_CLASS, NULL) +EO_DEFINE_CLASS(evas_object_class_get, &class_desc, EO_BASE_CLASS, NULL) diff --git a/legacy/eobj/examples/evas/evas_obj.h b/legacy/eobj/examples/evas/evas_obj.h index e76e68a7e6..9efdaf3da7 100644 --- a/legacy/eobj/examples/evas/evas_obj.h +++ b/legacy/eobj/examples/evas/evas_obj.h @@ -1,9 +1,9 @@ #ifndef EVAS_OBJ_H #define EVAS_OBJ_H -#include "Eobj.h" +#include "Eo.h" -extern EAPI Eobj_Op EVAS_OBJ_BASE_ID; +extern EAPI Eo_Op EVAS_OBJ_BASE_ID; enum { EVAS_OBJ_SUB_ID_POSITION_SET, @@ -23,7 +23,7 @@ enum { * @param[in] x object's X position * @param[in] y object's Y position */ -#define evas_obj_position_set(x, y) EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_POSITION_SET), EOBJ_TYPECHECK(Evas_Coord, x), EOBJ_TYPECHECK(Evas_Coord, y) +#define evas_obj_position_set(x, y) EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_POSITION_SET), EO_TYPECHECK(Evas_Coord, x), EO_TYPECHECK(Evas_Coord, y) /** * @def evas_obj_size_set(w, h) @@ -31,7 +31,7 @@ enum { * @param[in] w object's width * @param[in] h object's height */ -#define evas_obj_size_set(w, h) EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_SIZE_SET), EOBJ_TYPECHECK(Evas_Coord, w), EOBJ_TYPECHECK(Evas_Coord, h) +#define evas_obj_size_set(w, h) EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_SIZE_SET), EO_TYPECHECK(Evas_Coord, w), EO_TYPECHECK(Evas_Coord, h) /** * @def evas_obj_color_set(r, g, b, a) @@ -41,7 +41,7 @@ enum { * @param[in] b b-value of color * @param[in] a a-value of color */ -#define evas_obj_color_set(r, g, b, a) EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_COLOR_SET), EOBJ_TYPECHECK(int, r), EOBJ_TYPECHECK(int, g), EOBJ_TYPECHECK(int, b), EOBJ_TYPECHECK(int, a) +#define evas_obj_color_set(r, g, b, a) EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_COLOR_SET), EO_TYPECHECK(int, r), EO_TYPECHECK(int, g), EO_TYPECHECK(int, b), EO_TYPECHECK(int, a) /** * @def evas_obj_color_get(r, g, b, a) @@ -51,40 +51,40 @@ enum { * @param[out] b integer pointer for b-value of color * @param[out] a integer pointer for a-value of color */ -#define evas_obj_color_get(r, g, b, a) EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_COLOR_GET), EOBJ_TYPECHECK(int *, r), EOBJ_TYPECHECK(int *, g), EOBJ_TYPECHECK(int *, b), EOBJ_TYPECHECK(int *, a) +#define evas_obj_color_get(r, g, b, a) EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_COLOR_GET), EO_TYPECHECK(int *, r), EO_TYPECHECK(int *, g), EO_TYPECHECK(int *, b), EO_TYPECHECK(int *, a) /** * @def evas_obj_visibility_set(v) * @brief Set object's visible property * @param[in] v True/False value */ -#define evas_obj_visibility_set(v) EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_VISIBILITY_SET), EOBJ_TYPECHECK(Eina_Bool, v) +#define evas_obj_visibility_set(v) EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_VISIBILITY_SET), EO_TYPECHECK(Eina_Bool, v) /** * @def evas_obj_child_add(child) * @brief Add child to current object * @param[in] pointer to child object */ -#define evas_obj_child_add(child) EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_CHILD_ADD), EOBJ_TYPECHECK(Eobj *, child) +#define evas_obj_child_add(child) EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_CHILD_ADD), EO_TYPECHECK(Eo *, child) #define EVAS_OBJ_CLASS evas_object_class_get() -const Eobj_Class *evas_object_class_get(void) EINA_CONST; +const Eo_Class *evas_object_class_get(void) EINA_CONST; #define EVAS_OBJ_STR "Evas_Obj" /* FIXME: Hack in the meanwhile. */ static inline Evas_Object * -eobj_evas_object_get(const Eobj *obj) +eo_evas_object_get(const Eo *obj) { void *data; - eobj_query(obj, eobj_base_data_get(EVAS_OBJ_STR, &data)); + eo_query(obj, eo_base_data_get(EVAS_OBJ_STR, &data)); return data; } /* FIXME: Hack in the meanwhile. */ static inline void -eobj_evas_object_set(Eobj *obj, Evas_Object *evas_obj) +eo_evas_object_set(Eo *obj, Evas_Object *evas_obj) { - eobj_do(obj, eobj_base_data_set(EVAS_OBJ_STR, evas_obj, NULL)); + eo_do(obj, eo_base_data_set(EVAS_OBJ_STR, evas_obj, NULL)); } #endif diff --git a/legacy/eobj/examples/evas/test.c b/legacy/eobj/examples/evas/test.c index a5706bd4a3..ffda21ceef 100644 --- a/legacy/eobj/examples/evas/test.c +++ b/legacy/eobj/examples/evas/test.c @@ -7,14 +7,14 @@ #include "elw_win.h" Eina_Bool -_btn_clicked_cb(void *data, Eobj *obj, const Eobj_Event_Description *desc, void *event_info) +_btn_clicked_cb(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info) { (void) obj; (void) event_info; - const Eobj_Class *klass = eobj_class_get(obj); - printf("%s obj-type:'%s' data:'%s'\n", desc->name, eobj_class_name_get(klass), (const char *) data); + const Eo_Class *klass = eo_class_get(obj); + printf("%s obj-type:'%s' data:'%s'\n", desc->name, eo_class_name_get(klass), (const char *) data); - return EOBJ_CALLBACK_CONTINUE; + return EO_CALLBACK_CONTINUE; } int @@ -27,37 +27,37 @@ main(int argc, char *argv[]) } elm_init(argc, argv); - eobj_init(); + eo_init(); - Eobj *win = eobj_add(ELW_WIN_CLASS, NULL); - eobj_do(win, evas_obj_size_set(winw, winh), evas_obj_visibility_set(EINA_TRUE)); + Eo *win = eo_add(ELW_WIN_CLASS, NULL); + eo_do(win, evas_obj_size_set(winw, winh), evas_obj_visibility_set(EINA_TRUE)); - Eobj *bt = eobj_add(ELW_BUTTON_CLASS, win); - eobj_do(bt, evas_obj_position_set(25, 25), + Eo *bt = eo_add(ELW_BUTTON_CLASS, win); + eo_do(bt, evas_obj_position_set(25, 25), evas_obj_size_set(50, 50), evas_obj_color_set(255, 0, 0, 255), elw_button_text_set("Click"), evas_obj_visibility_set(EINA_TRUE)); - eobj_event_callback_add(bt, SIG_CLICKED, _btn_clicked_cb, "btn"); + eo_event_callback_add(bt, SIG_CLICKED, _btn_clicked_cb, "btn"); int r, g, b, a; - eobj_do(bt, evas_obj_color_get(&r, &g, &b, &a)); + eo_do(bt, evas_obj_color_get(&r, &g, &b, &a)); printf("RGBa(%d, %d, %d, %d)\n", r, g, b, a); - Eobj *bx = eobj_add(ELW_BOXEDBUTTON_CLASS, win); - eobj_do(bx, evas_obj_position_set(100, 100), + Eo *bx = eo_add(ELW_BOXEDBUTTON_CLASS, win); + eo_do(bx, evas_obj_position_set(100, 100), evas_obj_size_set(70, 70), evas_obj_color_set(0, 0, 255, 255), elw_button_text_set("Click2"), evas_obj_visibility_set(EINA_TRUE)); - eobj_event_callback_add(bx, SIG_CLICKED, _btn_clicked_cb, "bxedbtn"); + eo_event_callback_add(bx, SIG_CLICKED, _btn_clicked_cb, "bxedbtn"); elm_run(); - eobj_unref(bx); - eobj_unref(bt); - eobj_unref(win); - eobj_shutdown(); + eo_unref(bx); + eo_unref(bt); + eo_unref(win); + eo_shutdown(); elm_shutdown(); return 0; } diff --git a/legacy/eobj/examples/function_overrides/CMakeLists.txt b/legacy/eobj/examples/function_overrides/CMakeLists.txt index a3344e4133..85b2d10c84 100644 --- a/legacy/eobj/examples/function_overrides/CMakeLists.txt +++ b/legacy/eobj/examples/function_overrides/CMakeLists.txt @@ -14,13 +14,13 @@ include_directories( add_executable(function_overrides ${FUNCTION_OVERRIDES_CC_SOURCES}) -get_target_property(eobj_LIB_FILE eobj LOCATION) +get_target_property(eo_LIB_FILE eo LOCATION) target_link_libraries(function_overrides ${EINA_LIBRARIES} ${EINA_LDFLAGS_OTHER} - ${eobj_LIB_FILE} + ${eo_LIB_FILE} ) -add_dependencies(function_overrides eobj) +add_dependencies(function_overrides eo) add_test(Example_function_overrides function_overrides) diff --git a/legacy/eobj/examples/function_overrides/inherit.c b/legacy/eobj/examples/function_overrides/inherit.c index 043be9a644..a8cde28921 100644 --- a/legacy/eobj/examples/function_overrides/inherit.c +++ b/legacy/eobj/examples/function_overrides/inherit.c @@ -1,14 +1,14 @@ -#include "Eobj.h" +#include "Eo.h" #include "simple.h" #include "inherit.h" #define MY_CLASS INHERIT_CLASS -static const Eobj_Class_Description class_desc = { +static const Eo_Class_Description class_desc = { "Inherit", - EOBJ_CLASS_TYPE_REGULAR, - EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), + EO_CLASS_TYPE_REGULAR, + EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), NULL, 0, NULL, @@ -17,4 +17,4 @@ static const Eobj_Class_Description class_desc = { NULL }; -EOBJ_DEFINE_CLASS(inherit_class_get, &class_desc, SIMPLE_CLASS, NULL); +EO_DEFINE_CLASS(inherit_class_get, &class_desc, SIMPLE_CLASS, NULL); diff --git a/legacy/eobj/examples/function_overrides/inherit.h b/legacy/eobj/examples/function_overrides/inherit.h index 44007d72b2..7300b9655a 100644 --- a/legacy/eobj/examples/function_overrides/inherit.h +++ b/legacy/eobj/examples/function_overrides/inherit.h @@ -1,9 +1,9 @@ #ifndef INHERIT_H #define INHERIT_H -#include "Eobj.h" +#include "Eo.h" #define INHERIT_CLASS inherit_class_get() -const Eobj_Class *inherit_class_get(void) EINA_CONST; +const Eo_Class *inherit_class_get(void) EINA_CONST; #endif diff --git a/legacy/eobj/examples/function_overrides/inherit2.c b/legacy/eobj/examples/function_overrides/inherit2.c index db5089f6d5..66f8168b60 100644 --- a/legacy/eobj/examples/function_overrides/inherit2.c +++ b/legacy/eobj/examples/function_overrides/inherit2.c @@ -1,4 +1,4 @@ -#include "Eobj.h" +#include "Eo.h" #include "simple.h" #include "inherit.h" @@ -8,58 +8,58 @@ #include "../eunit_tests.h" -EAPI Eobj_Op INHERIT2_BASE_ID = 0; +EAPI Eo_Op INHERIT2_BASE_ID = 0; #define MY_CLASS INHERIT2_CLASS static void -_a_set(Eobj *obj, void *class_data EINA_UNUSED, va_list *list) +_a_set(Eo *obj, void *class_data EINA_UNUSED, va_list *list) { int a; a = va_arg(*list, int); - printf("%s %d\n", eobj_class_name_get(MY_CLASS), a); - eobj_do(obj, simple_a_print()); - eobj_do_super(obj, simple_a_set(a + 1)); + printf("%s %d\n", eo_class_name_get(MY_CLASS), a); + eo_do(obj, simple_a_print()); + eo_do_super(obj, simple_a_set(a + 1)); - fail_if(eobj_do_super(obj, simple_a_print())); + fail_if(eo_do_super(obj, simple_a_print())); } static void -_print(Eobj *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED) +_print(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED) { printf("Hey\n"); - fail_if(eobj_do_super(obj, inherit2_print())); + fail_if(eo_do_super(obj, inherit2_print())); } static void -_print2(Eobj *obj EINA_UNUSED, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED) +_print2(Eo *obj EINA_UNUSED, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED) { printf("Hey2\n"); } static void -_class_constructor(Eobj_Class *klass) +_class_constructor(Eo_Class *klass) { - const Eobj_Op_Func_Description func_desc[] = { - EOBJ_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_A_SET), _a_set), - EOBJ_OP_FUNC(INHERIT2_ID(INHERIT2_SUB_ID_PRINT), _print), - EOBJ_OP_FUNC(INHERIT2_ID(INHERIT2_SUB_ID_PRINT2), _print2), - EOBJ_OP_FUNC_SENTINEL + const Eo_Op_Func_Description func_desc[] = { + EO_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_A_SET), _a_set), + EO_OP_FUNC(INHERIT2_ID(INHERIT2_SUB_ID_PRINT), _print), + EO_OP_FUNC(INHERIT2_ID(INHERIT2_SUB_ID_PRINT2), _print2), + EO_OP_FUNC_SENTINEL }; - eobj_class_funcs_set(klass, func_desc); + eo_class_funcs_set(klass, func_desc); } -static const Eobj_Op_Description op_desc[] = { - EOBJ_OP_DESCRIPTION(INHERIT2_SUB_ID_PRINT, "", "Print hey"), - EOBJ_OP_DESCRIPTION(INHERIT2_SUB_ID_PRINT2, "", "Print hey2"), - EOBJ_OP_DESCRIPTION_SENTINEL +static const Eo_Op_Description op_desc[] = { + EO_OP_DESCRIPTION(INHERIT2_SUB_ID_PRINT, "", "Print hey"), + EO_OP_DESCRIPTION(INHERIT2_SUB_ID_PRINT2, "", "Print hey2"), + EO_OP_DESCRIPTION_SENTINEL }; -static const Eobj_Class_Description class_desc = { +static const Eo_Class_Description class_desc = { "Inherit2", - EOBJ_CLASS_TYPE_REGULAR, - EOBJ_CLASS_DESCRIPTION_OPS(&INHERIT2_BASE_ID, op_desc, INHERIT2_SUB_ID_LAST), + EO_CLASS_TYPE_REGULAR, + EO_CLASS_DESCRIPTION_OPS(&INHERIT2_BASE_ID, op_desc, INHERIT2_SUB_ID_LAST), NULL, 0, NULL, @@ -68,5 +68,5 @@ static const Eobj_Class_Description class_desc = { NULL }; -EOBJ_DEFINE_CLASS(inherit2_class_get, &class_desc, INHERIT_CLASS, NULL); +EO_DEFINE_CLASS(inherit2_class_get, &class_desc, INHERIT_CLASS, NULL); diff --git a/legacy/eobj/examples/function_overrides/inherit2.h b/legacy/eobj/examples/function_overrides/inherit2.h index c85544d333..dc6a7231c6 100644 --- a/legacy/eobj/examples/function_overrides/inherit2.h +++ b/legacy/eobj/examples/function_overrides/inherit2.h @@ -1,9 +1,9 @@ #ifndef INHERIT2_H #define INHERIT2_H -#include "Eobj.h" +#include "Eo.h" -extern EAPI Eobj_Op INHERIT2_BASE_ID; +extern EAPI Eo_Op INHERIT2_BASE_ID; enum { INHERIT2_SUB_ID_PRINT, @@ -17,6 +17,6 @@ enum { #define inherit2_print2() INHERIT2_ID(INHERIT2_SUB_ID_PRINT2) #define INHERIT2_CLASS inherit2_class_get() -const Eobj_Class *inherit2_class_get(void) EINA_CONST; +const Eo_Class *inherit2_class_get(void) EINA_CONST; #endif diff --git a/legacy/eobj/examples/function_overrides/inherit3.c b/legacy/eobj/examples/function_overrides/inherit3.c index 385b2c3fd8..43be75fe42 100644 --- a/legacy/eobj/examples/function_overrides/inherit3.c +++ b/legacy/eobj/examples/function_overrides/inherit3.c @@ -1,4 +1,4 @@ -#include "Eobj.h" +#include "Eo.h" #include "simple.h" #include "inherit2.h" @@ -9,29 +9,29 @@ #define MY_CLASS INHERIT3_CLASS static void -_a_set(Eobj *obj, void *class_data EINA_UNUSED, va_list *list) +_a_set(Eo *obj, void *class_data EINA_UNUSED, va_list *list) { int a; a = va_arg(*list, int); - printf("%s %d\n", eobj_class_name_get(MY_CLASS), a); - eobj_do_super(obj, simple_a_set(a + 1)); + printf("%s %d\n", eo_class_name_get(MY_CLASS), a); + eo_do_super(obj, simple_a_set(a + 1)); } static void -_class_constructor(Eobj_Class *klass) +_class_constructor(Eo_Class *klass) { - const Eobj_Op_Func_Description func_desc[] = { - EOBJ_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_A_SET), _a_set), - EOBJ_OP_FUNC_SENTINEL + const Eo_Op_Func_Description func_desc[] = { + EO_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_A_SET), _a_set), + EO_OP_FUNC_SENTINEL }; - eobj_class_funcs_set(klass, func_desc); + eo_class_funcs_set(klass, func_desc); } -static const Eobj_Class_Description class_desc = { +static const Eo_Class_Description class_desc = { "Inherit3", - EOBJ_CLASS_TYPE_REGULAR, - EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), + EO_CLASS_TYPE_REGULAR, + EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), NULL, 0, NULL, @@ -40,5 +40,5 @@ static const Eobj_Class_Description class_desc = { NULL }; -EOBJ_DEFINE_CLASS(inherit3_class_get, &class_desc, INHERIT2_CLASS, NULL); +EO_DEFINE_CLASS(inherit3_class_get, &class_desc, INHERIT2_CLASS, NULL); diff --git a/legacy/eobj/examples/function_overrides/inherit3.h b/legacy/eobj/examples/function_overrides/inherit3.h index 19feca9d7d..78001478df 100644 --- a/legacy/eobj/examples/function_overrides/inherit3.h +++ b/legacy/eobj/examples/function_overrides/inherit3.h @@ -1,9 +1,9 @@ #ifndef INHERIT3_H #define INHERIT3_H -#include "Eobj.h" +#include "Eo.h" #define INHERIT3_CLASS inherit3_class_get() -const Eobj_Class *inherit3_class_get(void) EINA_CONST; +const Eo_Class *inherit3_class_get(void) EINA_CONST; #endif diff --git a/legacy/eobj/examples/function_overrides/main.c b/legacy/eobj/examples/function_overrides/main.c index 59de0fc536..16e9682d09 100644 --- a/legacy/eobj/examples/function_overrides/main.c +++ b/legacy/eobj/examples/function_overrides/main.c @@ -1,4 +1,4 @@ -#include "Eobj.h" +#include "Eo.h" #include "simple.h" #include "inherit.h" #include "inherit2.h" @@ -11,39 +11,39 @@ main(int argc, char *argv[]) { (void) argc; (void) argv; - eobj_init(); + eo_init(); - Eobj *obj = eobj_add(INHERIT2_CLASS, NULL); + Eo *obj = eo_add(INHERIT2_CLASS, NULL); - eobj_do(obj, simple_a_set(1)); - Simple_Public_Data *pd = eobj_data_get(obj, SIMPLE_CLASS); + eo_do(obj, simple_a_set(1)); + Simple_Public_Data *pd = eo_data_get(obj, SIMPLE_CLASS); fail_if(pd->a != 2); - eobj_unref(obj); + eo_unref(obj); - obj = eobj_add(INHERIT3_CLASS, NULL); + obj = eo_add(INHERIT3_CLASS, NULL); - eobj_do(obj, simple_a_set(1)); - pd = eobj_data_get(obj, SIMPLE_CLASS); + eo_do(obj, simple_a_set(1)); + pd = eo_data_get(obj, SIMPLE_CLASS); fail_if(pd->a != 3); - eobj_unref(obj); + eo_unref(obj); - obj = eobj_add(INHERIT2_CLASS, NULL); - eobj_do(obj, inherit2_print()); - eobj_unref(obj); + obj = eo_add(INHERIT2_CLASS, NULL); + eo_do(obj, inherit2_print()); + eo_unref(obj); - obj = eobj_add(SIMPLE_CLASS, NULL); - fail_if(eobj_do(obj, inherit2_print2())); + obj = eo_add(SIMPLE_CLASS, NULL); + fail_if(eo_do(obj, inherit2_print2())); - fail_if(eobj_do_super(obj, simple_a_print())); + fail_if(eo_do_super(obj, simple_a_print())); - eobj_constructor_super(obj); - eobj_destructor_super(obj); + eo_constructor_super(obj); + eo_destructor_super(obj); - eobj_unref(obj); + eo_unref(obj); - eobj_shutdown(); + eo_shutdown(); return 0; } diff --git a/legacy/eobj/examples/function_overrides/simple.c b/legacy/eobj/examples/function_overrides/simple.c index adeabfbad5..fa152d26ef 100644 --- a/legacy/eobj/examples/function_overrides/simple.c +++ b/legacy/eobj/examples/function_overrides/simple.c @@ -1,52 +1,52 @@ -#include "Eobj.h" +#include "Eo.h" #include "simple.h" #include "config.h" -EAPI Eobj_Op SIMPLE_BASE_ID = 0; +EAPI Eo_Op SIMPLE_BASE_ID = 0; #define MY_CLASS SIMPLE_CLASS static void -_a_set(Eobj *obj EINA_UNUSED, void *class_data, va_list *list) +_a_set(Eo *obj EINA_UNUSED, void *class_data, va_list *list) { Simple_Public_Data *pd = class_data; int a; a = va_arg(*list, int); - printf("%s %d\n", eobj_class_name_get(MY_CLASS), a); + printf("%s %d\n", eo_class_name_get(MY_CLASS), a); pd->a = a; } static void -_a_print(const Eobj *obj EINA_UNUSED, const void *class_data, va_list *list) +_a_print(const Eo *obj EINA_UNUSED, const void *class_data, va_list *list) { const Simple_Public_Data *pd = class_data; (void) list; - printf("Print %s %d\n", eobj_class_name_get(MY_CLASS), pd->a); + printf("Print %s %d\n", eo_class_name_get(MY_CLASS), pd->a); } static void -_class_constructor(Eobj_Class *klass) +_class_constructor(Eo_Class *klass) { - const Eobj_Op_Func_Description func_desc[] = { - EOBJ_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_A_SET), _a_set), - EOBJ_OP_FUNC_CONST(SIMPLE_ID(SIMPLE_SUB_ID_A_PRINT), _a_print), - EOBJ_OP_FUNC_SENTINEL + const Eo_Op_Func_Description func_desc[] = { + EO_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_A_SET), _a_set), + EO_OP_FUNC_CONST(SIMPLE_ID(SIMPLE_SUB_ID_A_PRINT), _a_print), + EO_OP_FUNC_SENTINEL }; - eobj_class_funcs_set(klass, func_desc); + eo_class_funcs_set(klass, func_desc); } -static const Eobj_Op_Description op_desc[] = { - EOBJ_OP_DESCRIPTION(SIMPLE_SUB_ID_A_SET, "i", "Set property A"), - EOBJ_OP_DESCRIPTION_CONST(SIMPLE_SUB_ID_A_PRINT, "", "Print property A"), - EOBJ_OP_DESCRIPTION_SENTINEL +static const Eo_Op_Description op_desc[] = { + EO_OP_DESCRIPTION(SIMPLE_SUB_ID_A_SET, "i", "Set property A"), + EO_OP_DESCRIPTION_CONST(SIMPLE_SUB_ID_A_PRINT, "", "Print property A"), + EO_OP_DESCRIPTION_SENTINEL }; -static const Eobj_Class_Description class_desc = { +static const Eo_Class_Description class_desc = { "Simple", - EOBJ_CLASS_TYPE_REGULAR, - EOBJ_CLASS_DESCRIPTION_OPS(&SIMPLE_BASE_ID, op_desc, SIMPLE_SUB_ID_LAST), + EO_CLASS_TYPE_REGULAR, + EO_CLASS_DESCRIPTION_OPS(&SIMPLE_BASE_ID, op_desc, SIMPLE_SUB_ID_LAST), NULL, sizeof(Simple_Public_Data), NULL, @@ -55,5 +55,5 @@ static const Eobj_Class_Description class_desc = { NULL }; -EOBJ_DEFINE_CLASS(simple_class_get, &class_desc, EOBJ_BASE_CLASS, NULL); +EO_DEFINE_CLASS(simple_class_get, &class_desc, EO_BASE_CLASS, NULL); diff --git a/legacy/eobj/examples/function_overrides/simple.h b/legacy/eobj/examples/function_overrides/simple.h index 64d15b6e8b..c2c8766afd 100644 --- a/legacy/eobj/examples/function_overrides/simple.h +++ b/legacy/eobj/examples/function_overrides/simple.h @@ -1,9 +1,9 @@ #ifndef SIMPLE_H #define SIMPLE_H -#include "Eobj.h" +#include "Eo.h" -extern EAPI Eobj_Op SIMPLE_BASE_ID; +extern EAPI Eo_Op SIMPLE_BASE_ID; enum { SIMPLE_SUB_ID_A_SET, @@ -18,13 +18,13 @@ typedef struct #define SIMPLE_ID(sub_id) (SIMPLE_BASE_ID + sub_id) -#define simple_a_set(a) SIMPLE_ID(SIMPLE_SUB_ID_A_SET), EOBJ_TYPECHECK(int, a) +#define simple_a_set(a) SIMPLE_ID(SIMPLE_SUB_ID_A_SET), EO_TYPECHECK(int, a) #define simple_a_print() SIMPLE_ID(SIMPLE_SUB_ID_A_PRINT) -extern const Eobj_Event_Description _SIG_A_CHANGED; +extern const Eo_Event_Description _SIG_A_CHANGED; #define SIG_A_CHANGED (&(_SIG_A_CHANGED)) #define SIMPLE_CLASS simple_class_get() -const Eobj_Class *simple_class_get(void) EINA_CONST; +const Eo_Class *simple_class_get(void) EINA_CONST; #endif diff --git a/legacy/eobj/examples/mixin/CMakeLists.txt b/legacy/eobj/examples/mixin/CMakeLists.txt index 0fd70d8c2d..d09adacd44 100644 --- a/legacy/eobj/examples/mixin/CMakeLists.txt +++ b/legacy/eobj/examples/mixin/CMakeLists.txt @@ -14,13 +14,13 @@ include_directories( add_executable(mixin ${MIXIN_CC_SOURCES}) -get_target_property(eobj_LIB_FILE eobj LOCATION) +get_target_property(eo_LIB_FILE eo LOCATION) target_link_libraries(mixin ${EINA_LIBRARIES} ${EINA_LDFLAGS_OTHER} - ${eobj_LIB_FILE} + ${eo_LIB_FILE} ) -add_dependencies(mixin eobj) +add_dependencies(mixin eo) add_test(Example_mixin mixin) diff --git a/legacy/eobj/examples/mixin/main.c b/legacy/eobj/examples/mixin/main.c index be3b94b85a..b7109a108d 100644 --- a/legacy/eobj/examples/mixin/main.c +++ b/legacy/eobj/examples/mixin/main.c @@ -1,4 +1,4 @@ -#include "Eobj.h" +#include "Eo.h" #include "simple.h" #include "mixin.h" #include "mixin2.h" @@ -11,26 +11,26 @@ main(int argc, char *argv[]) { (void) argc; (void) argv; - eobj_init(); + eo_init(); - Eobj *obj = eobj_add(SIMPLE_CLASS, NULL); + Eo *obj = eo_add(SIMPLE_CLASS, NULL); - eobj_do(obj, simple_a_set(1), simple_b_set(2)); + eo_do(obj, simple_a_set(1), simple_b_set(2)); int a, b, sum = 0; - eobj_do(obj, simple_a_get(&a), simple_b_get(&b), mixin_ab_sum_get(&sum)); + eo_do(obj, simple_a_get(&a), simple_b_get(&b), mixin_ab_sum_get(&sum)); fail_if(sum != a + b + 2); /* 2 for the two mixins... */ - eobj_do(obj, mixin_ab_sum_get(&sum), mixin_ab_sum_get(&sum)); + eo_do(obj, mixin_ab_sum_get(&sum), mixin_ab_sum_get(&sum)); - Mixin2_Public_Data *pd2 = eobj_data_get(obj, MIXIN2_CLASS); + Mixin2_Public_Data *pd2 = eo_data_get(obj, MIXIN2_CLASS); fail_if(pd2->count != 6); - Mixin3_Public_Data *pd3 = eobj_data_get(obj, MIXIN3_CLASS); + Mixin3_Public_Data *pd3 = eo_data_get(obj, MIXIN3_CLASS); fail_if(pd3->count != 9); - eobj_unref(obj); - eobj_shutdown(); + eo_unref(obj); + eo_shutdown(); return 0; } diff --git a/legacy/eobj/examples/mixin/mixin.c b/legacy/eobj/examples/mixin/mixin.c index c0a49e8fe8..fdfda63839 100644 --- a/legacy/eobj/examples/mixin/mixin.c +++ b/legacy/eobj/examples/mixin/mixin.c @@ -1,57 +1,57 @@ -#include "Eobj.h" +#include "Eo.h" #include "mixin.h" #include "simple.h" #include "config.h" -EAPI Eobj_Op MIXIN_BASE_ID = 0; +EAPI Eo_Op MIXIN_BASE_ID = 0; #define MY_CLASS MIXIN_CLASS static void -_ab_sum_get(const Eobj *obj, const void *class_data EINA_UNUSED, va_list *list) +_ab_sum_get(const Eo *obj, const void *class_data EINA_UNUSED, va_list *list) { int a, b; - eobj_query(obj, simple_a_get(&a), simple_b_get(&b)); + eo_query(obj, simple_a_get(&a), simple_b_get(&b)); int *sum = va_arg(*list, int *); if (sum) *sum = a + b; - printf("%s %s\n", eobj_class_name_get(MY_CLASS), __func__); + printf("%s %s\n", eo_class_name_get(MY_CLASS), __func__); } static void -_constructor(Eobj *obj, void *class_data EINA_UNUSED) +_constructor(Eo *obj, void *class_data EINA_UNUSED) { - eobj_constructor_super(obj); + eo_constructor_super(obj); } static void -_destructor(Eobj *obj, void *class_data EINA_UNUSED) +_destructor(Eo *obj, void *class_data EINA_UNUSED) { - eobj_destructor_super(obj); + eo_destructor_super(obj); } static void -_class_constructor(Eobj_Class *klass) +_class_constructor(Eo_Class *klass) { - const Eobj_Op_Func_Description func_desc[] = { - EOBJ_OP_FUNC_CONST(MIXIN_ID(MIXIN_SUB_ID_AB_SUM_GET), _ab_sum_get), - EOBJ_OP_FUNC_SENTINEL + const Eo_Op_Func_Description func_desc[] = { + EO_OP_FUNC_CONST(MIXIN_ID(MIXIN_SUB_ID_AB_SUM_GET), _ab_sum_get), + EO_OP_FUNC_SENTINEL }; - eobj_class_funcs_set(klass, func_desc); + eo_class_funcs_set(klass, func_desc); } -static const Eobj_Op_Description op_desc[] = { - EOBJ_OP_DESCRIPTION_CONST(MIXIN_SUB_ID_AB_SUM_GET, "i", "Get the sum of a and b."), - EOBJ_OP_DESCRIPTION_SENTINEL +static const Eo_Op_Description op_desc[] = { + EO_OP_DESCRIPTION_CONST(MIXIN_SUB_ID_AB_SUM_GET, "i", "Get the sum of a and b."), + EO_OP_DESCRIPTION_SENTINEL }; -static const Eobj_Class_Description class_desc = { +static const Eo_Class_Description class_desc = { "Mixin", - EOBJ_CLASS_TYPE_MIXIN, - EOBJ_CLASS_DESCRIPTION_OPS(&MIXIN_BASE_ID, op_desc, MIXIN_SUB_ID_LAST), + EO_CLASS_TYPE_MIXIN, + EO_CLASS_DESCRIPTION_OPS(&MIXIN_BASE_ID, op_desc, MIXIN_SUB_ID_LAST), NULL, 0, _constructor, @@ -60,5 +60,5 @@ static const Eobj_Class_Description class_desc = { NULL }; -EOBJ_DEFINE_CLASS(mixin_class_get, &class_desc, NULL, NULL) +EO_DEFINE_CLASS(mixin_class_get, &class_desc, NULL, NULL) diff --git a/legacy/eobj/examples/mixin/mixin.h b/legacy/eobj/examples/mixin/mixin.h index 81237bf5d5..c03564c49c 100644 --- a/legacy/eobj/examples/mixin/mixin.h +++ b/legacy/eobj/examples/mixin/mixin.h @@ -1,9 +1,9 @@ #ifndef MIXIN_H #define MIXIN_H -#include "Eobj.h" +#include "Eo.h" -extern EAPI Eobj_Op MIXIN_BASE_ID; +extern EAPI Eo_Op MIXIN_BASE_ID; enum { MIXIN_SUB_ID_AB_SUM_GET, @@ -18,9 +18,9 @@ enum { * @brief Get sum of a,b integer elements * @param[out] sum integer pointer to sum - value */ -#define mixin_ab_sum_get(sum) MIXIN_ID(MIXIN_SUB_ID_AB_SUM_GET), EOBJ_TYPECHECK(int *, sum) +#define mixin_ab_sum_get(sum) MIXIN_ID(MIXIN_SUB_ID_AB_SUM_GET), EO_TYPECHECK(int *, sum) #define MIXIN_CLASS mixin_class_get() -const Eobj_Class *mixin_class_get(void) EINA_CONST; +const Eo_Class *mixin_class_get(void) EINA_CONST; #endif diff --git a/legacy/eobj/examples/mixin/mixin2.c b/legacy/eobj/examples/mixin/mixin2.c index 771d6140ee..2244ffdd96 100644 --- a/legacy/eobj/examples/mixin/mixin2.c +++ b/legacy/eobj/examples/mixin/mixin2.c @@ -1,4 +1,4 @@ -#include "Eobj.h" +#include "Eo.h" #include "mixin.h" #include "mixin2.h" #include "simple.h" @@ -10,51 +10,51 @@ #define MY_CLASS MIXIN2_CLASS static void -_ab_sum_get(const Eobj *obj, const void *class_data, va_list *list) +_ab_sum_get(const Eo *obj, const void *class_data, va_list *list) { /* This cast is a hack just for the tests... */ Mixin2_Public_Data *pd = (Mixin2_Public_Data *) class_data; int *sum = va_arg(*list, int *); - printf("%s %s\n", eobj_class_name_get(MY_CLASS), __func__); - eobj_query_super(obj, mixin_ab_sum_get(sum)); + printf("%s %s\n", eo_class_name_get(MY_CLASS), __func__); + eo_query_super(obj, mixin_ab_sum_get(sum)); ++*sum; pd->count += 2; { int _a, _b; - eobj_query(obj, simple_a_get(&_a), simple_b_get(&_b)); + eo_query(obj, simple_a_get(&_a), simple_b_get(&_b)); fail_if(*sum != _a + _b + 1); } } static void -_constructor(Eobj *obj, void *class_data EINA_UNUSED) +_constructor(Eo *obj, void *class_data EINA_UNUSED) { - eobj_constructor_super(obj); + eo_constructor_super(obj); } static void -_destructor(Eobj *obj, void *class_data EINA_UNUSED) +_destructor(Eo *obj, void *class_data EINA_UNUSED) { - eobj_destructor_super(obj); + eo_destructor_super(obj); } static void -_class_constructor(Eobj_Class *klass) +_class_constructor(Eo_Class *klass) { - const Eobj_Op_Func_Description func_desc[] = { - EOBJ_OP_FUNC_CONST(MIXIN_ID(MIXIN_SUB_ID_AB_SUM_GET), _ab_sum_get), - EOBJ_OP_FUNC_SENTINEL + const Eo_Op_Func_Description func_desc[] = { + EO_OP_FUNC_CONST(MIXIN_ID(MIXIN_SUB_ID_AB_SUM_GET), _ab_sum_get), + EO_OP_FUNC_SENTINEL }; - eobj_class_funcs_set(klass, func_desc); + eo_class_funcs_set(klass, func_desc); } -static const Eobj_Class_Description class_desc = { +static const Eo_Class_Description class_desc = { "Mixin2", - EOBJ_CLASS_TYPE_MIXIN, - EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), + EO_CLASS_TYPE_MIXIN, + EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), NULL, sizeof(Mixin2_Public_Data), _constructor, @@ -63,5 +63,5 @@ static const Eobj_Class_Description class_desc = { NULL }; -EOBJ_DEFINE_CLASS(mixin2_class_get, &class_desc, MIXIN_CLASS, NULL); +EO_DEFINE_CLASS(mixin2_class_get, &class_desc, MIXIN_CLASS, NULL); diff --git a/legacy/eobj/examples/mixin/mixin2.h b/legacy/eobj/examples/mixin/mixin2.h index 1a73fd4bfa..d1a5e77c57 100644 --- a/legacy/eobj/examples/mixin/mixin2.h +++ b/legacy/eobj/examples/mixin/mixin2.h @@ -1,7 +1,7 @@ #ifndef MIXIN2_H #define MIXIN2_H -#include "Eobj.h" +#include "Eo.h" typedef struct { @@ -9,6 +9,6 @@ typedef struct } Mixin2_Public_Data; #define MIXIN2_CLASS mixin2_class_get() -const Eobj_Class *mixin2_class_get(void) EINA_CONST; +const Eo_Class *mixin2_class_get(void) EINA_CONST; #endif diff --git a/legacy/eobj/examples/mixin/mixin3.c b/legacy/eobj/examples/mixin/mixin3.c index 904ad3b00b..c1821f9a7b 100644 --- a/legacy/eobj/examples/mixin/mixin3.c +++ b/legacy/eobj/examples/mixin/mixin3.c @@ -1,4 +1,4 @@ -#include "Eobj.h" +#include "Eo.h" #include "mixin.h" #include "mixin3.h" #include "simple.h" @@ -10,51 +10,51 @@ #define MY_CLASS MIXIN3_CLASS static void -_ab_sum_get(const Eobj *obj, const void *class_data EINA_UNUSED, va_list *list) +_ab_sum_get(const Eo *obj, const void *class_data EINA_UNUSED, va_list *list) { /* This cast is just a hack for the test. */ Mixin3_Public_Data *pd = (Mixin3_Public_Data *) class_data; int *sum = va_arg(*list, int *); - printf("%s %s\n", eobj_class_name_get(MY_CLASS), __func__); - eobj_query_super(obj, mixin_ab_sum_get(sum)); + printf("%s %s\n", eo_class_name_get(MY_CLASS), __func__); + eo_query_super(obj, mixin_ab_sum_get(sum)); ++*sum; pd->count += 3; { int _a, _b; - eobj_query(obj, simple_a_get(&_a), simple_b_get(&_b)); + eo_query(obj, simple_a_get(&_a), simple_b_get(&_b)); fail_if(*sum != _a + _b + 2); } } static void -_constructor(Eobj *obj, void *class_data EINA_UNUSED) +_constructor(Eo *obj, void *class_data EINA_UNUSED) { - eobj_constructor_super(obj); + eo_constructor_super(obj); } static void -_destructor(Eobj *obj, void *class_data EINA_UNUSED) +_destructor(Eo *obj, void *class_data EINA_UNUSED) { - eobj_destructor_super(obj); + eo_destructor_super(obj); } static void -_class_constructor(Eobj_Class *klass) +_class_constructor(Eo_Class *klass) { - const Eobj_Op_Func_Description func_desc[] = { - EOBJ_OP_FUNC_CONST(MIXIN_ID(MIXIN_SUB_ID_AB_SUM_GET), _ab_sum_get), - EOBJ_OP_FUNC_SENTINEL + const Eo_Op_Func_Description func_desc[] = { + EO_OP_FUNC_CONST(MIXIN_ID(MIXIN_SUB_ID_AB_SUM_GET), _ab_sum_get), + EO_OP_FUNC_SENTINEL }; - eobj_class_funcs_set(klass, func_desc); + eo_class_funcs_set(klass, func_desc); } -static const Eobj_Class_Description class_desc = { +static const Eo_Class_Description class_desc = { "Mixin3", - EOBJ_CLASS_TYPE_MIXIN, - EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), + EO_CLASS_TYPE_MIXIN, + EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), NULL, sizeof(Mixin3_Public_Data), _constructor, @@ -63,5 +63,5 @@ static const Eobj_Class_Description class_desc = { NULL }; -EOBJ_DEFINE_CLASS(mixin3_class_get, &class_desc, MIXIN_CLASS, NULL); +EO_DEFINE_CLASS(mixin3_class_get, &class_desc, MIXIN_CLASS, NULL); diff --git a/legacy/eobj/examples/mixin/mixin3.h b/legacy/eobj/examples/mixin/mixin3.h index d2ce84000f..74011fab4f 100644 --- a/legacy/eobj/examples/mixin/mixin3.h +++ b/legacy/eobj/examples/mixin/mixin3.h @@ -1,7 +1,7 @@ #ifndef MIXIN3_H #define MIXIN3_H -#include "Eobj.h" +#include "Eo.h" typedef struct { @@ -9,6 +9,6 @@ typedef struct } Mixin3_Public_Data; #define MIXIN3_CLASS mixin3_class_get() -const Eobj_Class *mixin3_class_get(void) EINA_CONST; +const Eo_Class *mixin3_class_get(void) EINA_CONST; #endif diff --git a/legacy/eobj/examples/mixin/simple.c b/legacy/eobj/examples/mixin/simple.c index f6c6232da2..f230441094 100644 --- a/legacy/eobj/examples/mixin/simple.c +++ b/legacy/eobj/examples/mixin/simple.c @@ -1,4 +1,4 @@ -#include "Eobj.h" +#include "Eo.h" #include "mixin.h" #include "mixin2.h" #include "mixin3.h" @@ -6,7 +6,7 @@ #include "config.h" -EAPI Eobj_Op SIMPLE_BASE_ID = 0; +EAPI Eo_Op SIMPLE_BASE_ID = 0; typedef struct { @@ -18,7 +18,7 @@ typedef struct #define _GET_SET_FUNC(name) \ static void \ -_##name##_get(const Eobj *obj EINA_UNUSED, const void *class_data, va_list *list) \ +_##name##_get(const Eo *obj EINA_UNUSED, const void *class_data, va_list *list) \ { \ const Private_Data *pd = class_data; \ int *name; \ @@ -27,7 +27,7 @@ _##name##_get(const Eobj *obj EINA_UNUSED, const void *class_data, va_list *list printf("%s %d\n", __func__, pd->name); \ } \ static void \ -_##name##_set(Eobj *obj EINA_UNUSED, void *class_data, va_list *list) \ +_##name##_set(Eo *obj EINA_UNUSED, void *class_data, va_list *list) \ { \ Private_Data *pd = class_data; \ int name; \ @@ -40,31 +40,31 @@ _GET_SET_FUNC(a) _GET_SET_FUNC(b) static void -_class_constructor(Eobj_Class *klass) +_class_constructor(Eo_Class *klass) { - const Eobj_Op_Func_Description func_desc[] = { - EOBJ_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_A_SET), _a_set), - EOBJ_OP_FUNC_CONST(SIMPLE_ID(SIMPLE_SUB_ID_A_GET), _a_get), - EOBJ_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_B_SET), _b_set), - EOBJ_OP_FUNC_CONST(SIMPLE_ID(SIMPLE_SUB_ID_B_GET), _b_get), - EOBJ_OP_FUNC_SENTINEL + const Eo_Op_Func_Description func_desc[] = { + 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), + EO_OP_FUNC_CONST(SIMPLE_ID(SIMPLE_SUB_ID_B_GET), _b_get), + EO_OP_FUNC_SENTINEL }; - eobj_class_funcs_set(klass, func_desc); + eo_class_funcs_set(klass, func_desc); } -static const Eobj_Op_Description op_desc[] = { - EOBJ_OP_DESCRIPTION(SIMPLE_SUB_ID_A_SET, "i", "Set property A"), - EOBJ_OP_DESCRIPTION_CONST(SIMPLE_SUB_ID_A_GET, "i", "Get property A"), - EOBJ_OP_DESCRIPTION(SIMPLE_SUB_ID_B_SET, "i", "Set property B"), - EOBJ_OP_DESCRIPTION_CONST(SIMPLE_SUB_ID_B_GET, "i", "Get property B"), - EOBJ_OP_DESCRIPTION_SENTINEL +static const Eo_Op_Description op_desc[] = { + EO_OP_DESCRIPTION(SIMPLE_SUB_ID_A_SET, "i", "Set property A"), + EO_OP_DESCRIPTION_CONST(SIMPLE_SUB_ID_A_GET, "i", "Get property A"), + EO_OP_DESCRIPTION(SIMPLE_SUB_ID_B_SET, "i", "Set property B"), + EO_OP_DESCRIPTION_CONST(SIMPLE_SUB_ID_B_GET, "i", "Get property B"), + EO_OP_DESCRIPTION_SENTINEL }; -static const Eobj_Class_Description class_desc = { +static const Eo_Class_Description class_desc = { "Simple", - EOBJ_CLASS_TYPE_REGULAR, - EOBJ_CLASS_DESCRIPTION_OPS(&SIMPLE_BASE_ID, op_desc, SIMPLE_SUB_ID_LAST), + EO_CLASS_TYPE_REGULAR, + EO_CLASS_DESCRIPTION_OPS(&SIMPLE_BASE_ID, op_desc, SIMPLE_SUB_ID_LAST), NULL, sizeof(Private_Data), NULL, @@ -73,4 +73,4 @@ static const Eobj_Class_Description class_desc = { NULL }; -EOBJ_DEFINE_CLASS(simple_class_get, &class_desc, EOBJ_BASE_CLASS, MIXIN3_CLASS, MIXIN2_CLASS, NULL); +EO_DEFINE_CLASS(simple_class_get, &class_desc, EO_BASE_CLASS, MIXIN3_CLASS, MIXIN2_CLASS, NULL); diff --git a/legacy/eobj/examples/mixin/simple.h b/legacy/eobj/examples/mixin/simple.h index 76070ba3a4..1c29e19470 100644 --- a/legacy/eobj/examples/mixin/simple.h +++ b/legacy/eobj/examples/mixin/simple.h @@ -1,9 +1,9 @@ #ifndef SIMPLE_H #define SIMPLE_H -#include "Eobj.h" +#include "Eo.h" -extern EAPI Eobj_Op SIMPLE_BASE_ID; +extern EAPI Eo_Op SIMPLE_BASE_ID; enum { SIMPLE_SUB_ID_A_SET, @@ -20,30 +20,30 @@ enum { * @brief Set value to a-property * @param[in] a integer value to set */ -#define simple_a_set(a) SIMPLE_ID(SIMPLE_SUB_ID_A_SET), EOBJ_TYPECHECK(int, a) +#define simple_a_set(a) SIMPLE_ID(SIMPLE_SUB_ID_A_SET), EO_TYPECHECK(int, a) /** * @def simple_a_get(a) * @brief Get value of a-property * @param[out] integer pointer to a-value */ -#define simple_a_get(a) SIMPLE_ID(SIMPLE_SUB_ID_A_GET), EOBJ_TYPECHECK(int *, a) +#define simple_a_get(a) SIMPLE_ID(SIMPLE_SUB_ID_A_GET), EO_TYPECHECK(int *, a) /** * @def simple_b_set(b) * @brief Set value to b-property * @param[in] a integer value to set */ -#define simple_b_set(b) SIMPLE_ID(SIMPLE_SUB_ID_B_SET), EOBJ_TYPECHECK(int, b) +#define simple_b_set(b) SIMPLE_ID(SIMPLE_SUB_ID_B_SET), EO_TYPECHECK(int, b) /** * @def simple_b_get(b) * @brief Get value of b-property * @param[out] integer pointer to b-value */ -#define simple_b_get(b) SIMPLE_ID(SIMPLE_SUB_ID_B_GET), EOBJ_TYPECHECK(int *, b) +#define simple_b_get(b) SIMPLE_ID(SIMPLE_SUB_ID_B_GET), EO_TYPECHECK(int *, b) #define SIMPLE_CLASS simple_class_get() -const Eobj_Class *simple_class_get(void) EINA_CONST; +const Eo_Class *simple_class_get(void) EINA_CONST; #endif diff --git a/legacy/eobj/examples/signals/CMakeLists.txt b/legacy/eobj/examples/signals/CMakeLists.txt index 98cdd902d1..04742a7050 100644 --- a/legacy/eobj/examples/signals/CMakeLists.txt +++ b/legacy/eobj/examples/signals/CMakeLists.txt @@ -11,13 +11,13 @@ include_directories( add_executable(signals ${SIGNALS_CC_SOURCES}) -get_target_property(eobj_LIB_FILE eobj LOCATION) +get_target_property(eo_LIB_FILE eo LOCATION) target_link_libraries(signals ${EINA_LIBRARIES} ${EINA_LDFLAGS_OTHER} - ${eobj_LIB_FILE} + ${eo_LIB_FILE} ) -add_dependencies(signals eobj) +add_dependencies(signals eo) add_test(Example_signals signals) diff --git a/legacy/eobj/examples/signals/main.c b/legacy/eobj/examples/signals/main.c index 619979688a..205dcb305f 100644 --- a/legacy/eobj/examples/signals/main.c +++ b/legacy/eobj/examples/signals/main.c @@ -1,4 +1,4 @@ -#include "Eobj.h" +#include "Eo.h" #include "simple.h" #include "../eunit_tests.h" @@ -6,7 +6,7 @@ static int cb_count = 0; static Eina_Bool -_a_changed_cb(void *data, Eobj *obj, const Eobj_Event_Description *desc, void *event_info) +_a_changed_cb(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info) { (void) desc; (void) obj; @@ -24,47 +24,47 @@ main(int argc, char *argv[]) { (void) argc; (void) argv; - eobj_init(); + eo_init(); - Eobj *obj = eobj_add(SIMPLE_CLASS, NULL); - Simple_Public_Data *pd = eobj_data_get(obj, SIMPLE_CLASS); + Eo *obj = eo_add(SIMPLE_CLASS, NULL); + Simple_Public_Data *pd = eo_data_get(obj, SIMPLE_CLASS); /* The order of these two is undetermined. */ - eobj_event_callback_priority_add(obj, SIG_A_CHANGED, EOBJ_CALLBACK_PRIORITY_BEFORE, _a_changed_cb, (void *) 2); - eobj_event_callback_priority_add(obj, SIG_A_CHANGED, EOBJ_CALLBACK_PRIORITY_BEFORE, _a_changed_cb, (void *) 1); + eo_event_callback_priority_add(obj, SIG_A_CHANGED, EO_CALLBACK_PRIORITY_BEFORE, _a_changed_cb, (void *) 2); + eo_event_callback_priority_add(obj, SIG_A_CHANGED, EO_CALLBACK_PRIORITY_BEFORE, _a_changed_cb, (void *) 1); /* This will be called afterwards. */ - eobj_event_callback_priority_add(obj, SIG_A_CHANGED, EOBJ_CALLBACK_PRIORITY_DEFAULT, _a_changed_cb, (void *) 3); + eo_event_callback_priority_add(obj, SIG_A_CHANGED, EO_CALLBACK_PRIORITY_DEFAULT, _a_changed_cb, (void *) 3); /* This will never be called because the previous callback returns NULL. */ - eobj_event_callback_priority_add(obj, SIG_A_CHANGED, EOBJ_CALLBACK_PRIORITY_AFTER, _a_changed_cb, (void *) 4); + eo_event_callback_priority_add(obj, SIG_A_CHANGED, EO_CALLBACK_PRIORITY_AFTER, _a_changed_cb, (void *) 4); - eobj_do(obj, simple_a_set(1)); + eo_do(obj, simple_a_set(1)); fail_if(cb_count != 3); - eobj_event_callback_del(obj, SIG_A_CHANGED, _a_changed_cb, (void *) 3); + eo_event_callback_del(obj, SIG_A_CHANGED, _a_changed_cb, (void *) 3); fail_if(pd->cb_count != 3); - fail_if(eobj_event_callback_del(obj, SIG_A_CHANGED, _a_changed_cb, (void *) 12)); + fail_if(eo_event_callback_del(obj, SIG_A_CHANGED, _a_changed_cb, (void *) 12)); fail_if(pd->cb_count != 3); - fail_if(4 != (int) eobj_event_callback_del(obj, SIG_A_CHANGED, _a_changed_cb, (void *) 4)); + fail_if(4 != (int) eo_event_callback_del(obj, SIG_A_CHANGED, _a_changed_cb, (void *) 4)); fail_if(pd->cb_count != 2); - eobj_event_callback_del_lazy(obj, SIG_A_CHANGED, _a_changed_cb); + eo_event_callback_del_lazy(obj, SIG_A_CHANGED, _a_changed_cb); fail_if(pd->cb_count != 1); - fail_if(eobj_event_callback_del_lazy(obj, SIG_A_CHANGED, NULL)); + fail_if(eo_event_callback_del_lazy(obj, SIG_A_CHANGED, NULL)); fail_if(pd->cb_count != 1); - fail_if(eobj_event_callback_del(obj, SIG_A_CHANGED, NULL, 0)); + fail_if(eo_event_callback_del(obj, SIG_A_CHANGED, NULL, 0)); fail_if(pd->cb_count != 1); - eobj_event_callback_del_lazy(obj, SIG_A_CHANGED, _a_changed_cb); + eo_event_callback_del_lazy(obj, SIG_A_CHANGED, _a_changed_cb); fail_if(pd->cb_count != 0); - fail_if(eobj_event_callback_del_lazy(obj, SIG_A_CHANGED, _a_changed_cb)); + fail_if(eo_event_callback_del_lazy(obj, SIG_A_CHANGED, _a_changed_cb)); fail_if(pd->cb_count != 0); - eobj_unref(obj); - eobj_shutdown(); + eo_unref(obj); + eo_shutdown(); return 0; } diff --git a/legacy/eobj/examples/signals/simple.c b/legacy/eobj/examples/signals/simple.c index 53559f4425..41ffbefa0b 100644 --- a/legacy/eobj/examples/signals/simple.c +++ b/legacy/eobj/examples/signals/simple.c @@ -1,9 +1,9 @@ -#include "Eobj.h" +#include "Eo.h" #include "simple.h" #include "config.h" -EAPI Eobj_Op SIMPLE_BASE_ID = 0; +EAPI Eo_Op SIMPLE_BASE_ID = 0; typedef struct { @@ -11,13 +11,13 @@ typedef struct int a; } Private_Data; -EAPI const Eobj_Event_Description _SIG_A_CHANGED = - EOBJ_EVENT_DESCRIPTION("a,changed", "i", "Called when a has changed."); +EAPI const Eo_Event_Description _SIG_A_CHANGED = + EO_EVENT_DESCRIPTION("a,changed", "i", "Called when a has changed."); #define MY_CLASS SIMPLE_CLASS static void -_a_set(Eobj *obj, void *class_data, va_list *list) +_a_set(Eo *obj, void *class_data, va_list *list) { Private_Data *pd = class_data; int a; @@ -25,14 +25,14 @@ _a_set(Eobj *obj, void *class_data, va_list *list) pd->a = a; printf("%s %d\n", __func__, pd->a); - eobj_event_callback_call(obj, SIG_A_CHANGED, &pd->a); + eo_event_callback_call(obj, SIG_A_CHANGED, &pd->a); } Eina_Bool -_cb_added(void *data, Eobj *obj, const Eobj_Event_Description *desc, void *event_info) +_cb_added(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info) { - Simple_Public_Data *pd = eobj_data_get(obj, MY_CLASS); - const Eobj_Event_Description *cb_desc = event_info; + Simple_Public_Data *pd = eo_data_get(obj, MY_CLASS); + const Eo_Event_Description *cb_desc = event_info; (void) data; (void) desc; @@ -42,14 +42,14 @@ _cb_added(void *data, Eobj *obj, const Eobj_Event_Description *desc, void *event pd->cb_count++; printf("Added SIG_A_CHANGED callback to %p. Count: %d\n", obj, pd->cb_count); - return EOBJ_CALLBACK_CONTINUE; + return EO_CALLBACK_CONTINUE; } Eina_Bool -_cb_deled(void *data, Eobj *obj, const Eobj_Event_Description *desc, void *event_info) +_cb_deled(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info) { - Simple_Public_Data *pd = eobj_data_get(obj, MY_CLASS); - const Eobj_Event_Description *cb_desc = event_info; + Simple_Public_Data *pd = eo_data_get(obj, MY_CLASS); + const Eo_Event_Description *cb_desc = event_info; (void) data; (void) desc; @@ -59,45 +59,45 @@ _cb_deled(void *data, Eobj *obj, const Eobj_Event_Description *desc, void *event pd->cb_count--; printf("Removed SIG_A_CHANGED callback from %p. Count: %d\n", obj, pd->cb_count); - return EOBJ_CALLBACK_CONTINUE; + return EO_CALLBACK_CONTINUE; } static void -_constructor(Eobj *obj, void *class_data EINA_UNUSED) +_constructor(Eo *obj, void *class_data EINA_UNUSED) { - eobj_constructor_super(obj); + eo_constructor_super(obj); - eobj_event_callback_add(obj, EOBJ_EV_CALLBACK_ADD, _cb_added, NULL); - eobj_event_callback_add(obj, EOBJ_EV_CALLBACK_DEL, _cb_deled, NULL); + eo_event_callback_add(obj, EO_EV_CALLBACK_ADD, _cb_added, NULL); + eo_event_callback_add(obj, EO_EV_CALLBACK_DEL, _cb_deled, NULL); - eobj_do(obj, eobj_base_data_set("cb_count", (intptr_t) 0, NULL)); + eo_do(obj, eo_base_data_set("cb_count", (intptr_t) 0, NULL)); } static void -_class_constructor(Eobj_Class *klass) +_class_constructor(Eo_Class *klass) { - const Eobj_Op_Func_Description func_desc[] = { - EOBJ_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_A_SET), _a_set), - EOBJ_OP_FUNC_SENTINEL + const Eo_Op_Func_Description func_desc[] = { + EO_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_A_SET), _a_set), + EO_OP_FUNC_SENTINEL }; - eobj_class_funcs_set(klass, func_desc); + eo_class_funcs_set(klass, func_desc); } -static const Eobj_Op_Description op_desc[] = { - EOBJ_OP_DESCRIPTION(SIMPLE_SUB_ID_A_SET, "i", "Set property A"), - EOBJ_OP_DESCRIPTION_SENTINEL +static const Eo_Op_Description op_desc[] = { + EO_OP_DESCRIPTION(SIMPLE_SUB_ID_A_SET, "i", "Set property A"), + EO_OP_DESCRIPTION_SENTINEL }; -static const Eobj_Event_Description *event_desc[] = { +static const Eo_Event_Description *event_desc[] = { SIG_A_CHANGED, NULL }; -static const Eobj_Class_Description class_desc = { +static const Eo_Class_Description class_desc = { "Simple", - EOBJ_CLASS_TYPE_REGULAR, - EOBJ_CLASS_DESCRIPTION_OPS(&SIMPLE_BASE_ID, op_desc, SIMPLE_SUB_ID_LAST), + EO_CLASS_TYPE_REGULAR, + EO_CLASS_DESCRIPTION_OPS(&SIMPLE_BASE_ID, op_desc, SIMPLE_SUB_ID_LAST), event_desc, sizeof(Private_Data), _constructor, @@ -106,5 +106,5 @@ static const Eobj_Class_Description class_desc = { NULL }; -EOBJ_DEFINE_CLASS(simple_class_get, &class_desc, EOBJ_BASE_CLASS, NULL); +EO_DEFINE_CLASS(simple_class_get, &class_desc, EO_BASE_CLASS, NULL); diff --git a/legacy/eobj/examples/signals/simple.h b/legacy/eobj/examples/signals/simple.h index 946a76f17a..d912a68e79 100644 --- a/legacy/eobj/examples/signals/simple.h +++ b/legacy/eobj/examples/signals/simple.h @@ -1,9 +1,9 @@ #ifndef SIMPLE_H #define SIMPLE_H -#include "Eobj.h" +#include "Eo.h" -extern EAPI Eobj_Op SIMPLE_BASE_ID; +extern EAPI Eo_Op SIMPLE_BASE_ID; enum { SIMPLE_SUB_ID_A_SET, @@ -22,12 +22,12 @@ typedef struct * @brief Set value to a - property * @param[in] a integer value to set */ -#define simple_a_set(a) SIMPLE_ID(SIMPLE_SUB_ID_A_SET), EOBJ_TYPECHECK(int, a) +#define simple_a_set(a) SIMPLE_ID(SIMPLE_SUB_ID_A_SET), EO_TYPECHECK(int, a) -extern const Eobj_Event_Description _SIG_A_CHANGED; +extern const Eo_Event_Description _SIG_A_CHANGED; #define SIG_A_CHANGED (&(_SIG_A_CHANGED)) #define SIMPLE_CLASS simple_class_get() -const Eobj_Class *simple_class_get(void) EINA_CONST; +const Eo_Class *simple_class_get(void) EINA_CONST; #endif diff --git a/legacy/eobj/lib/CMakeLists.txt b/legacy/eobj/lib/CMakeLists.txt index 2600c35460..6e91345519 100644 --- a/legacy/eobj/lib/CMakeLists.txt +++ b/legacy/eobj/lib/CMakeLists.txt @@ -1,27 +1,27 @@ -LIST(APPEND EOBJ_CC_SOURCES - eobj.c - eobj_base_class.c +LIST(APPEND EO_CC_SOURCES + eo.c + eo_base_class.c ) -ADD_DEFINITIONS(-DEFL_EOBJ_BUILD=1) +ADD_DEFINITIONS(-DEFL_EO_BUILD=1) include_directories( ${EINA_INCLUDE_DIRS} ) -add_library(eobj SHARED ${EOBJ_CC_SOURCES}) -target_link_libraries(eobj +add_library(eo SHARED ${EO_CC_SOURCES}) +target_link_libraries(eo ${EINA_LIBRARIES} ${EINA_LDFLAGS_OTHER} ${EFL_COVERAGE_LIBS} ) -set_target_properties(eobj PROPERTIES +set_target_properties(eo PROPERTIES COMPILE_FLAGS "${EFL_COVERAGE_CFLAGS}") -set_target_properties(eobj PROPERTIES - VERSION ${EOBJ_VERSION} SOVERSION ${EOBJ_VERSION_MAJOR}) -set_target_properties(eobj PROPERTIES OUTPUT_NAME "eobj") +set_target_properties(eo PROPERTIES + VERSION ${EO_VERSION} SOVERSION ${EO_VERSION_MAJOR}) +set_target_properties(eo PROPERTIES OUTPUT_NAME "eo") -INSTALL(TARGETS eobj DESTINATION "lib") -INSTALL(FILES "${CMAKE_CURRENT_SOURCE_DIR}/Eobj.h" +INSTALL(TARGETS eo DESTINATION "lib") +INSTALL(FILES "${CMAKE_CURRENT_SOURCE_DIR}/Eo.h" DESTINATION "include") diff --git a/legacy/eobj/lib/Eo.h b/legacy/eobj/lib/Eo.h new file mode 100644 index 0000000000..4ec155bf5b --- /dev/null +++ b/legacy/eobj/lib/Eo.h @@ -0,0 +1,969 @@ +#ifndef EO_H +#define EO_H + +#include +#include + +#ifdef EAPI +# undef EAPI +#endif + +#ifdef _WIN32 +# ifdef EFL_EO_BUILD +# ifdef DLL_EXPORT +# define EAPI __declspec(dllexport) +# else +# define EAPI +# endif /* ! DLL_EXPORT */ +# else +# define EAPI __declspec(dllimport) +# endif /* ! EFL_EO_BUILD */ +#else +# ifdef __GNUC__ +# if __GNUC__ >= 4 +# define EAPI __attribute__ ((visibility("default"))) +# else +# define EAPI +# endif +# else +# define EAPI +# endif +#endif /* ! _WIN32 */ + +/** + * @var _eo_class_creation_lock + * This variable is used for locking purposes in the class_get function + * defined in #EO_DEFINE_CLASS. + * This is just to work around the fact that we need to init locks before + * using them. + * Don't touch it if you don't know what you are doing. + * @internal + */ +EAPI extern Eina_Lock _eo_class_creation_lock; + +/** + * @defgroup Eo Eo Generic Object System + * + * The Eo generic object system. It was designed to be the base object + * system for the EFL. + * + * @{ + */ + +/** + * @def EO_TYPECHECK(type, x) + * + * Checks x is castable to type "type" and casts it to it. + * @param type The C type to check against. + * @param x the variable to test and cast. + */ +#define EO_TYPECHECK(type, x) \ + ({ \ + type __x; \ + __x = x; \ + (void) __x; \ + (type) x; \ + }) + +/** + * @typedef Eo + * The basic Object type. + */ +typedef struct _Eo Eo; +/** + * @typedef Eo_Op + * The Eo operation type id. + */ +typedef unsigned int Eo_Op; + +/** + * @def EO_NOOP + * A special #Eo_Op meaning "No operation". + */ +#define EO_NOOP ((Eo_Op) 0) + +/** + * @typedef eo_op_func_type + * The type of the Op functions. This is the type of the functions used by + * Eo. + * + * @see eo_op_func_type_const + */ +typedef void (*eo_op_func_type)(Eo *, void *class_data, va_list *list); + +/** + * @typedef eo_op_func_type_const + * The type of the const Op functions. This is the type of the functions used + * by Eo. This is the same as #eo_op_func_type, except that this should + * be used with functions that don't modify the data. + * + * @see eo_op_func_type + */ +typedef void (*eo_op_func_type_const)(const Eo *, const void *class_data, va_list *list); + +/** + * @addtogroup Eo_Events Eo's Event Handling + * @{ + */ + +/** + * @struct _Eo_Event_Description + * This struct holds the description of a specific event. + */ +struct _Eo_Event_Description +{ + const char *name; /**< name of the event. */ + const char *type; /**< describes the data passed in event_info */ + const char *doc; /**< Explanation about the event. */ +}; + +/** + * @typedef Eo_Event_Description + * A convenience typedef for #_Eo_Event_Description + */ +typedef struct _Eo_Event_Description Eo_Event_Description; + +/** + * @def EO_EVENT_DESCRIPTION(name, type, doc) + * An helper macro to help populating #Eo_Event_Description + * @param name The name of the event. + * @param type The type string of the event. + * @param doc Additional doc for the event. + * @see Eo_Event_Description + */ +#define EO_EVENT_DESCRIPTION(name, type, doc) { name, type, doc } + +/** + * @} + */ + +/** + * @addtogroup Eo_Class Eo Class + * @{ + */ + +/** + * @typedef Eo_Class + * The basic Object class type. + */ +typedef struct _Eo_Class Eo_Class; + +/** + * @def EO_DEFINE_CLASS(class_get_func_name, class_desc, parent_class, ...) + * A convenience macro to be used for creating the class_get function. This + * macro is fairly simple but should still be used as it'll let us improve + * things easily. + * @param class_get_func_name the name of the wanted class_get function name. + * @param class_desc the class description. + * @param parent_class The parent class for the function. Look at eo_class_new() for more information. + * @param ... List of etxensions. Look at eo_class_new() for more information. + * + * You must use this macro if you want thread safety in class creation. + */ +#define EO_DEFINE_CLASS(class_get_func_name, class_desc, parent_class, ...) \ +EAPI const Eo_Class * \ +class_get_func_name(void) \ +{ \ + static volatile char lk_init = 0; \ + static Eina_Lock _my_lock; \ + static const Eo_Class * volatile _my_class = NULL; \ + if (EINA_LIKELY(!!_my_class)) return _my_class; \ + \ + eina_lock_take(&_eo_class_creation_lock); \ + if (!lk_init) \ + eina_lock_new(&_my_lock); \ + if (lk_init < 2) eina_lock_take(&_my_lock); \ + if (!lk_init) \ + lk_init = 1; \ + else \ + { \ + if (lk_init < 2) eina_lock_release(&_my_lock); \ + eina_lock_release(&_eo_class_creation_lock); \ + return _my_class; \ + } \ + eina_lock_release(&_eo_class_creation_lock); \ + _my_class = eo_class_new(class_desc, parent_class, __VA_ARGS__); \ + eina_lock_release(&_my_lock); \ + \ + eina_lock_take(&_eo_class_creation_lock); \ + eina_lock_free(&_my_lock); \ + lk_init = 2; \ + eina_lock_release(&_eo_class_creation_lock); \ + return _my_class; \ +} + + +/** + * An enum representing the possible types of an Eo class. + */ +enum _Eo_Class_Type +{ + EO_CLASS_TYPE_REGULAR = 0, /**< Regular class. */ + EO_CLASS_TYPE_REGULAR_NO_INSTANT, /**< Regular non instant-able class. */ + EO_CLASS_TYPE_INTERFACE, /**< Interface */ + EO_CLASS_TYPE_MIXIN /**< Mixin */ +}; + +/** + * @typedef Eo_Class_Type + * A convenience typedef for #_Eo_Class_Type. + */ +typedef enum _Eo_Class_Type Eo_Class_Type; + +/** + * @struct _Eo_Op_Func_Description + * Used to associate an Op with a func. + * @see eo_class_funcs_set + */ +struct _Eo_Op_Func_Description +{ + Eo_Op op; /**< The op */ + eo_op_func_type func; /**< The function to call for the op. */ + Eina_Bool constant; /**< #EINA_TRUE if this function is a const. */ +}; + +/** + * @typedef Eo_Op_Func_Description + * A convenience typedef for #_Eo_Op_Func_Description + */ +typedef struct _Eo_Op_Func_Description Eo_Op_Func_Description; + +/** + * @def EO_OP_FUNC(op, func) + * A convenience macro to be used when populating the #Eo_Op_Func_Description + * array. + * + * @see EO_OP_FUNC_CONST + */ +#define EO_OP_FUNC(op, func) { op, EO_TYPECHECK(eo_op_func_type, func), EINA_FALSE } + +/** + * @def EO_OP_FUNC_CONST(op, func) + * A convenience macro to be used when populating the #Eo_Op_Func_Description + * array. + * The same as #EO_OP_FUNC but for const functions. + * + * @see EO_OP_FUNC + */ +#define EO_OP_FUNC_CONST(op, func) { op, (eo_op_func_type) EO_TYPECHECK(eo_op_func_type_const, func), EINA_TRUE } + +/** + * @def EO_OP_FUNC_SENTINEL + * A convenience macro to be used when populating the #Eo_Op_Func_Description + * array. It must appear at the end of the ARRAY. + */ +#define EO_OP_FUNC_SENTINEL { 0, NULL, EINA_FALSE } + +/** + * @struct _Eo_Op_Description + * This struct holds the description of a specific op. + */ +struct _Eo_Op_Description +{ + Eo_Op sub_op; /**< The sub_id of the op in it's class. */ + const char *name; /**< The name of the op. */ + const char *type; /**< descripbes the Op's function signature. */ + const char *doc; /**< Explanation about the Op. */ + Eina_Bool constant; /**< #EINA_TRUE if this op's implementation should not change the obj. */ +}; + +/** + * @typedef Eo_Op_Description + * A convenience typedef for #_Eo_Op_Description + */ +typedef struct _Eo_Op_Description Eo_Op_Description; + +/** + * @struct _Eo_Class_Description + * This struct holds the description of a class. + * This description should be passed to eo_class_new. + * Please use the #EO_CLASS_DESCRIPTION_OPS macro when populating it. + */ +struct _Eo_Class_Description +{ + const char *name; /**< The name of the class. */ + Eo_Class_Type type; /**< The type of the class. */ + struct { + Eo_Op *base_op_id; + const Eo_Op_Description *descs; + size_t count; + } 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. */ +}; + +/** + * @typedef Eo_Class_Description + * A convenience typedef for #_Eo_Class_Description + */ +typedef struct _Eo_Class_Description Eo_Class_Description; + +/** + * @def EO_CLASS_DESCRIPTION_OPS(base_op_id, op_descs, count) + * An helper macro to help populating #Eo_Class_Description. + * @param base_op_id A pointer to the base op id of the class. + * @param op_descs the op descriptions array. + * @param count the number of ops in the op descriptions array. + */ +#define EO_CLASS_DESCRIPTION_OPS(base_op_id, op_descs, count) { base_op_id, op_descs, count } + +/** + * @def EO_OP_DESCRIPTION(op, type, doc) + * An helper macro to help populating #Eo_Op_Description + * @param sub_id The sub id of the op being described. + * @param type The type string for the op. + * @param doc Additional doc for the op. + * @see Eo_Op_Description + * @see EO_OP_DESCRIPTION_CONST + * @see EO_OP_DESCRIPTION_SENTINEL + */ +#define EO_OP_DESCRIPTION(sub_id, type, doc) { sub_id, #sub_id, type, doc, EINA_FALSE } + +/** + * @def EO_OP_DESCRIPTION_CONST(op, type, doc) + * An helper macro to help populating #Eo_Op_Description + * This macro is the same as EO_OP_DESCRIPTION but indicates that the op's + * implementation should not change the object. + * @param sub_id The sub id of the op being described. + * @param type The type string for the op. + * @param doc Additional doc for the op. + * @see Eo_Op_Description + * @see EO_OP_DESCRIPTION + * @see EO_OP_DESCRIPTION_SENTINEL + */ +#define EO_OP_DESCRIPTION_CONST(sub_id, type, doc) { sub_id, #sub_id, type, doc, EINA_TRUE } + +/** + * @def EO_OP_DESCRIPTION_SENTINEL + * An helper macro to help populating #Eo_Op_Description + * Should be placed at the end of the array. + * @see Eo_Op_Description + * @see EO_OP_DESCRIPTION + */ +#define EO_OP_DESCRIPTION_SENTINEL { 0, NULL, NULL, NULL, EINA_FALSE } + +/** + * @brief Create a new class. + * @param desc the class description to create the class with. + * @param parent the class to inherit from. + * @param ... A NULL terminated list of extensions (interfaces, mixins and the classes of any composite objects). + * @return The new class's handle on success, or NULL otherwise. + * + * You should use #EO_DEFINE_CLASS. It'll provide thread safety and other + * features easily. + * + * @see #EO_DEFINE_CLASS + */ +EAPI const Eo_Class *eo_class_new(const Eo_Class_Description *desc, const Eo_Class *parent, ...); + +/** + * @brief Sets the OP functions for a class. + * @param klass the class to set the functions to. + * @param func_descs a NULL terminated array of #Eo_Op_Func_Description + * + * Should be called from within the class constructor. + */ +EAPI void eo_class_funcs_set(Eo_Class *klass, const Eo_Op_Func_Description *func_descs); + +/** + * @brief Gets the name of the passed class. + * @param klass the class to work on. + * @return The class's name. + * + * @see eo_class_get() + */ +EAPI const char *eo_class_name_get(const Eo_Class *klass); + +/** + * @} + */ + +/** + * @brief Init the eo subsystem + * @return #EINA_TRUE on success. + * + * @see eo_shutfown() + */ +EAPI Eina_Bool eo_init(void); + +/** + * @brief Shutdown the eo subsystem + * @return #EINA_TRUE on success. + * + * @see eo_init() + */ +EAPI Eina_Bool eo_shutdown(void); + +/** + * @def eo_do + * A convenience wrapper around eo_do_internal() + * @see eo_do_internal + */ +#define eo_do(obj, ...) eo_do_internal(obj, EINA_FALSE, __VA_ARGS__, EO_NOOP) + +/** + * @def eo_query + * Same as #eo_do but only for const ops. + * @see eo_do + */ +#define eo_query(obj, ...) eo_do_internal((Eo *) EO_TYPECHECK(const Eo *, obj), EINA_TRUE, __VA_ARGS__, EO_NOOP) + +/** + * @brief Issues ops on an object. + * @param obj The object to work on + * @param constant #EINA_TRUE if this call is on a constant object. + * @param ... NULL terminated list of OPs and parameters. + * @return #EINA_TRUE on success. + * + * Use the helper macros, don't pass the parameters manually. + * Use #eo_do instead of this function. + * + * @see #eo_do + */ +EAPI Eina_Bool eo_do_internal(Eo *obj, Eina_Bool constant, ...); + +/** + * @brief Calls the super function for the specific op. + * @param obj The object to work on + * @param ... list of parameters. + * @return #EINA_TRUE on success. + * + * Unlike eo_do() and eo_query(), this function only accepts one op. + * + * Use the helper macros, don't pass the parameters manually. + * + * Same as eo_do_super() just for const objects. + * + * @see #eo_query + * @see eo_do_super() + */ +#define eo_query_super(obj, ...) eo_do_super_internal((Eo *) EO_TYPECHECK(const Eo *, obj), EINA_TRUE, __VA_ARGS__) + +/** + * @brief Calls the super function for the specific op. + * @param obj The object to work on + * @param ... list of parameters. + * @return #EINA_TRUE on success. + * + * Unlike eo_do() and eo_query(), this function only accepts one op. + * + * @see #eo_query + * @see eo_query_super() + */ +#define eo_do_super(obj, ...) eo_do_super_internal((Eo *) EO_TYPECHECK(const Eo *, obj), EINA_FALSE, __VA_ARGS__) + +/** + * @brief Calls the super function for the specific op. + * @param obj The object to work on + * @param constant #EINA_TRUE if this call is on a constant object. + * @param op The wanted op. + * @param ... list of parameters. + * @return #EINA_TRUE on success. + * + * Don't use this function, use the wrapping macros instead. + * + * @see #eo_do + * @see #eo_do_super + * @see #eo_query_super + */ +EAPI Eina_Bool eo_do_super_internal(Eo *obj, Eina_Bool constant, Eo_Op op, ...); + +/** + * @brief Gets the class of the object. + * @param obj The object to work on + * @return The object's class. + * + * @see eo_class_name_get() + */ +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); + +/** + * @brief Notify eo that there was an error when constructing the object. + * @param obj the object to work on. + * + * (Should only be called from within a constructor/destructor). + * + * @see eo_constructor_error_get() + */ +EAPI void eo_constructor_error_set(Eo *obj); + +/** + * @brief Check if there was an error constructing obj + * @param obj the object to work on. + * @return #EINA_TRUE if there was an error. + * + * (Should only be called from within a constructor/destructor). + * + * @see eo_constructor_error_set() + */ +EAPI Eina_Bool eo_constructor_error_get(const Eo *obj); + +/** + * @brief Create a new object. + * @param klass the class of the object to create. + * @param parent the parent to set to the object. + * @return An handle to the new object on success, NULL otherwise. + */ +EAPI Eo *eo_add(const Eo_Class *klass, Eo *parent); + +/** + * @brief Get the parent of an object + * @param obj the object to get the parent of. + * @return a pointer to the parent object. + */ +EAPI Eo *eo_parent_get(Eo *obj); + +/** + * @brief Get a pointer to the data of an object for a specific class. + * @param obj the object to work on. + * @param klass the klass associated with the data. + * @return a pointer to the data. + */ +EAPI void *eo_data_get(const Eo *obj, const Eo_Class *klass); + +/** + * @brief Increment the object's reference count by 1. + * @param obj the object to work on. + * @return The object passed. + * + * It's very easy to get a refcount leak and start leaking memory because + * of a forgotten unref or an extra ref. That is why there are eo_xref + * and eo_xunref that will make debugging easier in such a case. + * Therefor, these functions should only be used in small scopes, i.e at the + * start of some section in which the object may get freed, or if you know + * what you are doing. + * + * @see eo_unref() + * @see eo_ref_get() + */ +EAPI Eo *eo_ref(Eo *obj); + +/** + * @brief Decrement the object's reference count by 1 and free it if needed. + * @param obj the object to work on. + * + * @see eo_ref() + * @see eo_ref_get() + */ +EAPI void eo_unref(Eo *obj); + +/** + * @brief Return the ref count of the object passed. + * @param obj the object to work on. + * @return the ref count of the object. + * + * @see eo_ref() + * @see eo_unref() + */ +EAPI int eo_ref_get(const Eo *obj); + +/** + * @def eo_xref(obj, ref_obj) + * Convenience macro around eo_xref() + * @see eo_xref() + */ +#define eo_xref(obj, ref_obj) eo_xref_internal(obj, ref_obj, __FILE__, __LINE__) + +/** + * @brief Increment the object's reference count by 1 (and associate the ref with ref_obj) + * @param obj the object to work on. + * @param ref_obj the object that references obj. + * @param file the call's filename. + * @param line the call's line number. + * @return The object passed (obj) + * + * People should not use this function, use #eo_xref instead. + * + * @see eo_xunref() + */ +EAPI Eo *eo_xref_internal(Eo *obj, const Eo *ref_obj, const char *file, int line); + +/** + * @brief Decrement the object's reference count by 1 and free it if needed. Will free the ref associated with ref_obj). + * @param obj the object to work on. + * @param ref_obj the object that references obj. + * + * This function only enforces the checks for object association. I.e don't rely + * on it. If such enforces are compiled out, this function behaves the same as + * eo_unref(). + * + * @see eo_xref_internal() + */ +EAPI void eo_xunref(Eo *obj, const Eo *ref_obj); + +/** + * @brief Delete the object passed (disregarding ref count). + * @param obj the object to work on. + * + * @see eo_unref() + */ +EAPI void eo_del(Eo *obj); + +/** + * @addtogroup Eo_Composite_Objects Composite Objects. + * @{ + */ + +/** + * @brief Make an object a composite object of another. + * @param obj the "parent" object. + * @param comp_obj the object that will be used to composite obj. + * + * @see eo_composite_object_detach() + * @see eo_composite_is() + */ +EAPI void eo_composite_object_attach(Eo *obj, Eo *comp_obj); + +/** + * @brief Detach a composite object from another object. + * @param obj the "parent" object. + * @param comp_obj the object attached to obj. + * + * @see eo_composite_object_attach() + * @see eo_composite_is() + */ +EAPI void eo_composite_object_detach(Eo *obj, Eo *comp_obj); + +/** + * @brief Check if an object is a composite object. + * @param comp_obj the object to be checked. + * @return #EINA_TRUE if it is, #EINA_FALSE otherwise. + * + * @see eo_composite_object_attach() + * @see eo_composite_object_detach() + */ +EAPI Eina_Bool eo_composite_is(Eo *comp_obj); + +/** + * @} + */ + +/** + * @addtogroup Eo_Events Eo's Event Handling + * @{ + */ + +/** + * @def EO_CALLBACK_PRIORITY_BEFORE + * Slightly more prioritized than default. + */ +#define EO_CALLBACK_PRIORITY_BEFORE -100 +/** + * @def EO_CALLBACK_PRIORITY_DEFAULT + * Default callback priority level + */ +#define EO_CALLBACK_PRIORITY_DEFAULT 0 +/** + * @def EO_CALLBACK_PRIORITY_AFTER + * Slightly less prioritized than default. + */ +#define EO_CALLBACK_PRIORITY_AFTER 100 + +/** + * @typedef Eo_Callback_Priority + * + * Callback priority value. Range is -32k - 32k. The lower the number, the + * higher the priority. + * + * @see EO_CALLBACK_PRIORITY_AFTER + * @see EO_CALLBACK_PRIORITY_BEFORE + * @see EO_CALLBACK_PRIORITY_DEFAULT + */ +typedef short Eo_Callback_Priority; + +/** + * @def EO_CALLBACK_STOP + * Stop calling callbacks for the even of which the callback was called for. + * @see EO_CALLBACK_CONTINUE + */ +#define EO_CALLBACK_STOP EINA_FALSE + +/** + * @def EO_CALLBACK_CONTINUE + * Continue calling callbacks for the even of which the callback was called for. + * @see EO_CALLBACK_STOP + */ +#define EO_CALLBACK_CONTINUE EINA_TRUE + +/** + * @typedef Eo_Event_Cb + * + * An event callback prototype. + * + * @param data The user data registered with the callback. + * @param obj The object which initiated the event. + * @param desc The event's description. + * @param event_info additional data passed with the event. + * @return #EO_CALLBACK_STOP to stop calling additional callbacks for the event, #EO_CALLBACK_CONTINUE to continue. + */ +typedef Eina_Bool (*Eo_Event_Cb)(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info); + +/** + * @brief Add an event callback forwarder for an event and an object. + * @param obj The object to listen to events on. + * @param desc The description of the event to listen to. + * @param new_obj The object to emit events from. + * @return #EINA_TRUE on success, #EINA_FALSE otherwise. + * + * @see eo_event_callback_forwarder_del() + */ +EAPI Eina_Bool eo_event_callback_forwarder_add(Eo *obj, const Eo_Event_Description *desc, Eo *new_obj); + +/** + * @brief Remove an event callback forwarder for an event and an object. + * @param obj The object to listen to events on. + * @param desc The description of the event to listen to. + * @param new_obj The object to emit events from. + * @return #EINA_TRUE on success, #EINA_FALSE otherwise. + * + * @see eo_event_callback_forwarder_add() + */ +EAPI Eina_Bool eo_event_callback_forwarder_del(Eo *obj, const Eo_Event_Description *desc, Eo *new_obj); + +/** + * @def eo_event_callback_add(obj, desc, cb, data) + * Add a callback for an event. + * @param obj The object to listen to events on. + * @param desc The description of the event to listen to. + * @param cb the callback to call. + * @param data additional data to pass to the callback. + * @return #EINA_TRUE on success, #EINA_FALSE otherwise. + * + * callbacks of the same priority are called in reverse order of creation. + * + * @see eo_event_callback_priority_add() + */ +#define eo_event_callback_add(obj, desc, cb, data) \ + eo_event_callback_priority_add(obj, desc, \ + EO_CALLBACK_PRIORITY_DEFAULT, cb, data) + +/** + * @brief Add a callback for an event with a specific priority. + * @param obj The object to listen to events on. + * @param desc The description of the event to listen to. + * @param priority The priority of the callback. + * @param cb the callback to call. + * @param data additional data to pass to the callback. + * @return #EINA_TRUE on success, #EINA_FALSE otherwise. + * + * callbacks of the same priority are called in reverse order of creation. + * + * @see #eo_event_callback_add + */ +EAPI Eina_Bool eo_event_callback_priority_add(Eo *obj, const Eo_Event_Description *desc, Eo_Callback_Priority priority, Eo_Event_Cb cb, const void *data); + +/** + * @brief Del a callback for an event + * @param obj The object to listen to delete from. + * @param desc The description of the event to listen to. + * @param func the callback to delete. + * @return The additional data that was set to be passed to the callback. + * + * @see eo_event_callback_del() + */ +EAPI void *eo_event_callback_del_lazy(Eo *obj, const Eo_Event_Description *desc, Eo_Event_Cb func); + +/** + * @brief Del a callback with a specific data associated to it for an event. + * @param obj The object to listen to delete from. + * @param desc The description of the event to listen to. + * @param func the callback to delete. + * @param user_data The data to compare. + * @return The additional data that was set to be passed to the callback. + * + * @see eo_event_callback_del_lazy() + */ +EAPI void *eo_event_callback_del(Eo *obj, const Eo_Event_Description *desc, Eo_Event_Cb func, const void *user_data); + +/** + * @brief Call the callbacks for an event of an object. + * @param obj The object to work on. + * @param desc The description of the event to call. + * @param event_info Extra event info to pass to the callbacks. + * @return #EINA_FALSE if one of the callbacks aborted the callback calls or #EINA_TRUE otherwise. + */ +EAPI Eina_Bool eo_event_callback_call(Eo *obj, const Eo_Event_Description *desc, const void *event_info); + +/** + * @} + */ + +/** + * @addtogroup Eo_Class_Base Eo's Base class. + * @{ + */ + +/** + * @def EO_BASE_CLASS + * The class type for the Eo base class. + */ +#define EO_BASE_CLASS eo_base_class_get() +/** + * @brief Use #EO_BASE_CLASS + * @internal + * */ +EAPI const Eo_Class *eo_base_class_get(void) EINA_CONST; + +/** + * @typedef eo_base_data_free_func + * Data free func prototype. + */ +typedef void (*eo_base_data_free_func)(void *); + +/** + * @var EO_BASE_BASE_ID + * #EO_BASE_CLASS 's base id. + */ +extern EAPI Eo_Op EO_BASE_BASE_ID; + +enum { + EO_BASE_SUB_ID_DATA_SET, + EO_BASE_SUB_ID_DATA_GET, + EO_BASE_SUB_ID_DATA_DEL, + EO_BASE_SUB_ID_WREF_ADD, + EO_BASE_SUB_ID_WREF_DEL, + EO_BASE_SUB_ID_LAST +}; + +/** + * @def EO_BASE_ID(sub_id) + * Helper macro to get the full Op ID out of the sub_id for EO_BASE. + * @param sub_id the sub id inside EO_BASE. + */ +#define EO_BASE_ID(sub_id) (EO_BASE_BASE_ID + sub_id) + +/** + * @def eo_base_data_set(key, data, free_func) + * Set generic data to object. + * @param[in] key the key associated with the data + * @param[in] data the data to set. + * @param[in] free_func the func to free data with (NULL means "do nothing"). + * + * @see #eo_base_data_get + * @see #eo_base_data_del + */ +#define eo_base_data_set(key, data, free_func) EO_BASE_ID(EO_BASE_SUB_ID_DATA_SET), EO_TYPECHECK(const char *, key), EO_TYPECHECK(const void *, data), EO_TYPECHECK(eo_base_data_free_func, free_func) + +/** + * @def eo_base_data_get(key, data) + * Get generic data from object. + * @param[in] key the key associated with the data + * @param[out] data the data for the key + * + * @see #eo_base_data_set + * @see #eo_base_data_del + */ +#define eo_base_data_get(key, data) EO_BASE_ID(EO_BASE_SUB_ID_DATA_GET), EO_TYPECHECK(const char *, key), EO_TYPECHECK(void **, data) + +/** + * @def eo_base_data_del(key) + * Del generic data from object. + * @param[in] key the key associated with the data + * + * @see #eo_base_data_set + * @see #eo_base_data_get + */ +#define eo_base_data_del(key) EO_BASE_ID(EO_BASE_SUB_ID_DATA_DEL), EO_TYPECHECK(const char *, key) + +/** + * @def eo_wref_add + * @brief Add a new weak reference to obj. + * @param wref The pointer to use for the weak ref. + * + * This function registers the object handle pointed by wref to obj so when + * obj is deleted it'll be updated to NULL. This functions should be used + * when you want to keep track of an object in a safe way, but you don't want + * to prevent it from being freed. + * + * @see #eo_wref_del + */ +#define eo_wref_add(wref) EO_BASE_ID(EO_BASE_SUB_ID_WREF_ADD), EO_TYPECHECK(Eo **, wref) + +/** + * @def eo_wref_del + * @brief Delete the weak reference passed. + * @param wref the weak reference to free. + * + * @see #eo_wref_add + */ +#define eo_wref_del(wref) EO_BASE_ID(EO_BASE_SUB_ID_WREF_DEL), EO_TYPECHECK(Eo **, wref) + +/** + * @var _EO_EV_CALLBACK_ADD + * see EO_EV_CALLBACK_ADD + */ +EAPI extern const Eo_Event_Description _EO_EV_CALLBACK_ADD; + +/** + * @def EO_EV_CALLBACK_ADD + * The event description (of type #Eo_Event_Description) for + * The "Callback listener added" event. + */ +#define EO_EV_CALLBACK_ADD (&(_EO_EV_CALLBACK_ADD)) + +/** + * @var _EO_EV_CALLBACK_DEL + * see EO_EV_CALLBACK_DEL + */ +EAPI extern const Eo_Event_Description _EO_EV_CALLBACK_DEL; + +/** + * @def EO_EV_CALLBACK_DEL + * The event description (of type #Eo_Event_Description) for + * The "Callback listener deleted" event. + */ +#define EO_EV_CALLBACK_DEL (&(_EO_EV_CALLBACK_DEL)) + +/** + * @var _EO_EV_FREE + * see #EO_EV_FREE + */ +EAPI extern const Eo_Event_Description _EO_EV_FREE; + +/** + * @def EO_EV_FREE + * Object is being freed. + */ +#define EO_EV_FREE (&(_EO_EV_FREE)) + +/** + * @var _EO_EV_DEL + * see #EO_EV_DEL + */ +EAPI extern const Eo_Event_Description _EO_EV_DEL; + +/** + * @def EO_EV_DEL + * Object is being deleted. + */ +#define EO_EV_DEL (&(_EO_EV_DEL)) + +/** + * @} + */ + +/** + * @} + */ + +#endif diff --git a/legacy/eobj/lib/Eobj.h b/legacy/eobj/lib/Eobj.h deleted file mode 100644 index 662d686f22..0000000000 --- a/legacy/eobj/lib/Eobj.h +++ /dev/null @@ -1,969 +0,0 @@ -#ifndef EOBJ_H -#define EOBJ_H - -#include -#include - -#ifdef EAPI -# undef EAPI -#endif - -#ifdef _WIN32 -# ifdef EFL_EOBJ_BUILD -# ifdef DLL_EXPORT -# define EAPI __declspec(dllexport) -# else -# define EAPI -# endif /* ! DLL_EXPORT */ -# else -# define EAPI __declspec(dllimport) -# endif /* ! EFL_EOBJ_BUILD */ -#else -# ifdef __GNUC__ -# if __GNUC__ >= 4 -# define EAPI __attribute__ ((visibility("default"))) -# else -# define EAPI -# endif -# else -# define EAPI -# endif -#endif /* ! _WIN32 */ - -/** - * @var _eobj_class_creation_lock - * This variable is used for locking purposes in the class_get function - * defined in #EOBJ_DEFINE_CLASS. - * This is just to work around the fact that we need to init locks before - * using them. - * Don't touch it if you don't know what you are doing. - * @internal - */ -EAPI extern Eina_Lock _eobj_class_creation_lock; - -/** - * @defgroup Eobj Eobj Generic Object System - * - * The Eobj generic object system. It was designed to be the base object - * system for the EFL. - * - * @{ - */ - -/** - * @def EOBJ_TYPECHECK(type, x) - * - * Checks x is castable to type "type" and casts it to it. - * @param type The C type to check against. - * @param x the variable to test and cast. - */ -#define EOBJ_TYPECHECK(type, x) \ - ({ \ - type __x; \ - __x = x; \ - (void) __x; \ - (type) x; \ - }) - -/** - * @typedef Eobj - * The basic Object type. - */ -typedef struct _Eobj Eobj; -/** - * @typedef Eobj_Op - * The Eobj operation type id. - */ -typedef unsigned int Eobj_Op; - -/** - * @def EOBJ_NOOP - * A special #Eobj_Op meaning "No operation". - */ -#define EOBJ_NOOP ((Eobj_Op) 0) - -/** - * @typedef eobj_op_func_type - * The type of the Op functions. This is the type of the functions used by - * Eobj. - * - * @see eobj_op_func_type_const - */ -typedef void (*eobj_op_func_type)(Eobj *, void *class_data, va_list *list); - -/** - * @typedef eobj_op_func_type_const - * The type of the const Op functions. This is the type of the functions used - * by Eobj. This is the same as #eobj_op_func_type, except that this should - * be used with functions that don't modify the data. - * - * @see eobj_op_func_type - */ -typedef void (*eobj_op_func_type_const)(const Eobj *, const void *class_data, va_list *list); - -/** - * @addtogroup Eobj_Events Eobj's Event Handling - * @{ - */ - -/** - * @struct _Eobj_Event_Description - * This struct holds the description of a specific event. - */ -struct _Eobj_Event_Description -{ - const char *name; /**< name of the event. */ - const char *type; /**< describes the data passed in event_info */ - const char *doc; /**< Explanation about the event. */ -}; - -/** - * @typedef Eobj_Event_Description - * A convenience typedef for #_Eobj_Event_Description - */ -typedef struct _Eobj_Event_Description Eobj_Event_Description; - -/** - * @def EOBJ_EVENT_DESCRIPTION(name, type, doc) - * An helper macro to help populating #Eobj_Event_Description - * @param name The name of the event. - * @param type The type string of the event. - * @param doc Additional doc for the event. - * @see Eobj_Event_Description - */ -#define EOBJ_EVENT_DESCRIPTION(name, type, doc) { name, type, doc } - -/** - * @} - */ - -/** - * @addtogroup Eobj_Class Eobj Class - * @{ - */ - -/** - * @typedef Eobj_Class - * The basic Object class type. - */ -typedef struct _Eobj_Class Eobj_Class; - -/** - * @def EOBJ_DEFINE_CLASS(class_get_func_name, class_desc, parent_class, ...) - * A convenience macro to be used for creating the class_get function. This - * macro is fairly simple but should still be used as it'll let us improve - * things easily. - * @param class_get_func_name the name of the wanted class_get function name. - * @param class_desc the class description. - * @param parent_class The parent class for the function. Look at eobj_class_new() for more information. - * @param ... List of etxensions. Look at eobj_class_new() for more information. - * - * You must use this macro if you want thread safety in class creation. - */ -#define EOBJ_DEFINE_CLASS(class_get_func_name, class_desc, parent_class, ...) \ -EAPI const Eobj_Class * \ -class_get_func_name(void) \ -{ \ - static volatile char lk_init = 0; \ - static Eina_Lock _my_lock; \ - static const Eobj_Class * volatile _my_class = NULL; \ - if (EINA_LIKELY(!!_my_class)) return _my_class; \ - \ - eina_lock_take(&_eobj_class_creation_lock); \ - if (!lk_init) \ - eina_lock_new(&_my_lock); \ - if (lk_init < 2) eina_lock_take(&_my_lock); \ - if (!lk_init) \ - lk_init = 1; \ - else \ - { \ - if (lk_init < 2) eina_lock_release(&_my_lock); \ - eina_lock_release(&_eobj_class_creation_lock); \ - return _my_class; \ - } \ - eina_lock_release(&_eobj_class_creation_lock); \ - _my_class = eobj_class_new(class_desc, parent_class, __VA_ARGS__); \ - eina_lock_release(&_my_lock); \ - \ - eina_lock_take(&_eobj_class_creation_lock); \ - eina_lock_free(&_my_lock); \ - lk_init = 2; \ - eina_lock_release(&_eobj_class_creation_lock); \ - return _my_class; \ -} - - -/** - * An enum representing the possible types of an Eobj class. - */ -enum _Eobj_Class_Type -{ - EOBJ_CLASS_TYPE_REGULAR = 0, /**< Regular class. */ - EOBJ_CLASS_TYPE_REGULAR_NO_INSTANT, /**< Regular non instant-able class. */ - EOBJ_CLASS_TYPE_INTERFACE, /**< Interface */ - EOBJ_CLASS_TYPE_MIXIN /**< Mixin */ -}; - -/** - * @typedef Eobj_Class_Type - * A convenience typedef for #_Eobj_Class_Type. - */ -typedef enum _Eobj_Class_Type Eobj_Class_Type; - -/** - * @struct _Eobj_Op_Func_Description - * Used to associate an Op with a func. - * @see eobj_class_funcs_set - */ -struct _Eobj_Op_Func_Description -{ - Eobj_Op op; /**< The op */ - eobj_op_func_type func; /**< The function to call for the op. */ - Eina_Bool constant; /**< #EINA_TRUE if this function is a const. */ -}; - -/** - * @typedef Eobj_Op_Func_Description - * A convenience typedef for #_Eobj_Op_Func_Description - */ -typedef struct _Eobj_Op_Func_Description Eobj_Op_Func_Description; - -/** - * @def EOBJ_OP_FUNC(op, func) - * A convenience macro to be used when populating the #Eobj_Op_Func_Description - * array. - * - * @see EOBJ_OP_FUNC_CONST - */ -#define EOBJ_OP_FUNC(op, func) { op, EOBJ_TYPECHECK(eobj_op_func_type, func), EINA_FALSE } - -/** - * @def EOBJ_OP_FUNC_CONST(op, func) - * A convenience macro to be used when populating the #Eobj_Op_Func_Description - * array. - * The same as #EOBJ_OP_FUNC but for const functions. - * - * @see EOBJ_OP_FUNC - */ -#define EOBJ_OP_FUNC_CONST(op, func) { op, (eobj_op_func_type) EOBJ_TYPECHECK(eobj_op_func_type_const, func), EINA_TRUE } - -/** - * @def EOBJ_OP_FUNC_SENTINEL - * A convenience macro to be used when populating the #Eobj_Op_Func_Description - * array. It must appear at the end of the ARRAY. - */ -#define EOBJ_OP_FUNC_SENTINEL { 0, NULL, EINA_FALSE } - -/** - * @struct _Eobj_Op_Description - * This struct holds the description of a specific op. - */ -struct _Eobj_Op_Description -{ - Eobj_Op sub_op; /**< The sub_id of the op in it's class. */ - const char *name; /**< The name of the op. */ - const char *type; /**< descripbes the Op's function signature. */ - const char *doc; /**< Explanation about the Op. */ - Eina_Bool constant; /**< #EINA_TRUE if this op's implementation should not change the obj. */ -}; - -/** - * @typedef Eobj_Op_Description - * A convenience typedef for #_Eobj_Op_Description - */ -typedef struct _Eobj_Op_Description Eobj_Op_Description; - -/** - * @struct _Eobj_Class_Description - * This struct holds the description of a class. - * This description should be passed to eobj_class_new. - * Please use the #EOBJ_CLASS_DESCRIPTION_OPS macro when populating it. - */ -struct _Eobj_Class_Description -{ - const char *name; /**< The name of the class. */ - Eobj_Class_Type type; /**< The type of the class. */ - struct { - Eobj_Op *base_op_id; - const Eobj_Op_Description *descs; - size_t count; - } ops; /**< The ops description, should be filled using #EOBJ_CLASS_DESCRIPTION_OPS */ - const Eobj_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)(Eobj *obj, void *class_data); /**< The constructor of the object. */ - void (*destructor)(Eobj *obj, void *class_data); /**< The destructor of the object. */ - void (*class_constructor)(Eobj_Class *klass); /**< The constructor of the class. */ - void (*class_destructor)(Eobj_Class *klass); /**< The destructor of the class. */ -}; - -/** - * @typedef Eobj_Class_Description - * A convenience typedef for #_Eobj_Class_Description - */ -typedef struct _Eobj_Class_Description Eobj_Class_Description; - -/** - * @def EOBJ_CLASS_DESCRIPTION_OPS(base_op_id, op_descs, count) - * An helper macro to help populating #Eobj_Class_Description. - * @param base_op_id A pointer to the base op id of the class. - * @param op_descs the op descriptions array. - * @param count the number of ops in the op descriptions array. - */ -#define EOBJ_CLASS_DESCRIPTION_OPS(base_op_id, op_descs, count) { base_op_id, op_descs, count } - -/** - * @def EOBJ_OP_DESCRIPTION(op, type, doc) - * An helper macro to help populating #Eobj_Op_Description - * @param sub_id The sub id of the op being described. - * @param type The type string for the op. - * @param doc Additional doc for the op. - * @see Eobj_Op_Description - * @see EOBJ_OP_DESCRIPTION_CONST - * @see EOBJ_OP_DESCRIPTION_SENTINEL - */ -#define EOBJ_OP_DESCRIPTION(sub_id, type, doc) { sub_id, #sub_id, type, doc, EINA_FALSE } - -/** - * @def EOBJ_OP_DESCRIPTION_CONST(op, type, doc) - * An helper macro to help populating #Eobj_Op_Description - * This macro is the same as EOBJ_OP_DESCRIPTION but indicates that the op's - * implementation should not change the object. - * @param sub_id The sub id of the op being described. - * @param type The type string for the op. - * @param doc Additional doc for the op. - * @see Eobj_Op_Description - * @see EOBJ_OP_DESCRIPTION - * @see EOBJ_OP_DESCRIPTION_SENTINEL - */ -#define EOBJ_OP_DESCRIPTION_CONST(sub_id, type, doc) { sub_id, #sub_id, type, doc, EINA_TRUE } - -/** - * @def EOBJ_OP_DESCRIPTION_SENTINEL - * An helper macro to help populating #Eobj_Op_Description - * Should be placed at the end of the array. - * @see Eobj_Op_Description - * @see EOBJ_OP_DESCRIPTION - */ -#define EOBJ_OP_DESCRIPTION_SENTINEL { 0, NULL, NULL, NULL, EINA_FALSE } - -/** - * @brief Create a new class. - * @param desc the class description to create the class with. - * @param parent the class to inherit from. - * @param ... A NULL terminated list of extensions (interfaces, mixins and the classes of any composite objects). - * @return The new class's handle on success, or NULL otherwise. - * - * You should use #EOBJ_DEFINE_CLASS. It'll provide thread safety and other - * features easily. - * - * @see #EOBJ_DEFINE_CLASS - */ -EAPI const Eobj_Class *eobj_class_new(const Eobj_Class_Description *desc, const Eobj_Class *parent, ...); - -/** - * @brief Sets the OP functions for a class. - * @param klass the class to set the functions to. - * @param func_descs a NULL terminated array of #Eobj_Op_Func_Description - * - * Should be called from within the class constructor. - */ -EAPI void eobj_class_funcs_set(Eobj_Class *klass, const Eobj_Op_Func_Description *func_descs); - -/** - * @brief Gets the name of the passed class. - * @param klass the class to work on. - * @return The class's name. - * - * @see eobj_class_get() - */ -EAPI const char *eobj_class_name_get(const Eobj_Class *klass); - -/** - * @} - */ - -/** - * @brief Init the eobj subsystem - * @return #EINA_TRUE on success. - * - * @see eobj_shutfown() - */ -EAPI Eina_Bool eobj_init(void); - -/** - * @brief Shutdown the eobj subsystem - * @return #EINA_TRUE on success. - * - * @see eobj_init() - */ -EAPI Eina_Bool eobj_shutdown(void); - -/** - * @def eobj_do - * A convenience wrapper around eobj_do_internal() - * @see eobj_do_internal - */ -#define eobj_do(obj, ...) eobj_do_internal(obj, EINA_FALSE, __VA_ARGS__, EOBJ_NOOP) - -/** - * @def eobj_query - * Same as #eobj_do but only for const ops. - * @see eobj_do - */ -#define eobj_query(obj, ...) eobj_do_internal((Eobj *) EOBJ_TYPECHECK(const Eobj *, obj), EINA_TRUE, __VA_ARGS__, EOBJ_NOOP) - -/** - * @brief Issues ops on an object. - * @param obj The object to work on - * @param constant #EINA_TRUE if this call is on a constant object. - * @param ... NULL terminated list of OPs and parameters. - * @return #EINA_TRUE on success. - * - * Use the helper macros, don't pass the parameters manually. - * Use #eobj_do instead of this function. - * - * @see #eobj_do - */ -EAPI Eina_Bool eobj_do_internal(Eobj *obj, Eina_Bool constant, ...); - -/** - * @brief Calls the super function for the specific op. - * @param obj The object to work on - * @param ... list of parameters. - * @return #EINA_TRUE on success. - * - * Unlike eobj_do() and eobj_query(), this function only accepts one op. - * - * Use the helper macros, don't pass the parameters manually. - * - * Same as eobj_do_super() just for const objects. - * - * @see #eobj_query - * @see eobj_do_super() - */ -#define eobj_query_super(obj, ...) eobj_do_super_internal((Eobj *) EOBJ_TYPECHECK(const Eobj *, obj), EINA_TRUE, __VA_ARGS__) - -/** - * @brief Calls the super function for the specific op. - * @param obj The object to work on - * @param ... list of parameters. - * @return #EINA_TRUE on success. - * - * Unlike eobj_do() and eobj_query(), this function only accepts one op. - * - * @see #eobj_query - * @see eobj_query_super() - */ -#define eobj_do_super(obj, ...) eobj_do_super_internal((Eobj *) EOBJ_TYPECHECK(const Eobj *, obj), EINA_FALSE, __VA_ARGS__) - -/** - * @brief Calls the super function for the specific op. - * @param obj The object to work on - * @param constant #EINA_TRUE if this call is on a constant object. - * @param op The wanted op. - * @param ... list of parameters. - * @return #EINA_TRUE on success. - * - * Don't use this function, use the wrapping macros instead. - * - * @see #eobj_do - * @see #eobj_do_super - * @see #eobj_query_super - */ -EAPI Eina_Bool eobj_do_super_internal(Eobj *obj, Eina_Bool constant, Eobj_Op op, ...); - -/** - * @brief Gets the class of the object. - * @param obj The object to work on - * @return The object's class. - * - * @see eobj_class_name_get() - */ -EAPI const Eobj_Class *eobj_class_get(const Eobj *obj); - -/** - * @brief Calls the super constructor of the object passed. - * @param obj the object to work on. - * - * @see eobj_destructor_super() - */ -EAPI void eobj_constructor_super(Eobj *obj); - -/** - * @brief Calls the super destructor of the object passed. - * @param obj the object to work on. - * - * @see eobj_constructor_super() - */ -EAPI void eobj_destructor_super(Eobj *obj); - -/** - * @brief Notify eobj that there was an error when constructing the object. - * @param obj the object to work on. - * - * (Should only be called from within a constructor/destructor). - * - * @see eobj_constructor_error_get() - */ -EAPI void eobj_constructor_error_set(Eobj *obj); - -/** - * @brief Check if there was an error constructing obj - * @param obj the object to work on. - * @return #EINA_TRUE if there was an error. - * - * (Should only be called from within a constructor/destructor). - * - * @see eobj_constructor_error_set() - */ -EAPI Eina_Bool eobj_constructor_error_get(const Eobj *obj); - -/** - * @brief Create a new object. - * @param klass the class of the object to create. - * @param parent the parent to set to the object. - * @return An handle to the new object on success, NULL otherwise. - */ -EAPI Eobj *eobj_add(const Eobj_Class *klass, Eobj *parent); - -/** - * @brief Get the parent of an object - * @param obj the object to get the parent of. - * @return a pointer to the parent object. - */ -EAPI Eobj *eobj_parent_get(Eobj *obj); - -/** - * @brief Get a pointer to the data of an object for a specific class. - * @param obj the object to work on. - * @param klass the klass associated with the data. - * @return a pointer to the data. - */ -EAPI void *eobj_data_get(const Eobj *obj, const Eobj_Class *klass); - -/** - * @brief Increment the object's reference count by 1. - * @param obj the object to work on. - * @return The object passed. - * - * It's very easy to get a refcount leak and start leaking memory because - * of a forgotten unref or an extra ref. That is why there are eobj_xref - * and eobj_xunref that will make debugging easier in such a case. - * Therefor, these functions should only be used in small scopes, i.e at the - * start of some section in which the object may get freed, or if you know - * what you are doing. - * - * @see eobj_unref() - * @see eobj_ref_get() - */ -EAPI Eobj *eobj_ref(Eobj *obj); - -/** - * @brief Decrement the object's reference count by 1 and free it if needed. - * @param obj the object to work on. - * - * @see eobj_ref() - * @see eobj_ref_get() - */ -EAPI void eobj_unref(Eobj *obj); - -/** - * @brief Return the ref count of the object passed. - * @param obj the object to work on. - * @return the ref count of the object. - * - * @see eobj_ref() - * @see eobj_unref() - */ -EAPI int eobj_ref_get(const Eobj *obj); - -/** - * @def eobj_xref(obj, ref_obj) - * Convenience macro around eobj_xref() - * @see eobj_xref() - */ -#define eobj_xref(obj, ref_obj) eobj_xref_internal(obj, ref_obj, __FILE__, __LINE__) - -/** - * @brief Increment the object's reference count by 1 (and associate the ref with ref_obj) - * @param obj the object to work on. - * @param ref_obj the object that references obj. - * @param file the call's filename. - * @param line the call's line number. - * @return The object passed (obj) - * - * People should not use this function, use #eobj_xref instead. - * - * @see eobj_xunref() - */ -EAPI Eobj *eobj_xref_internal(Eobj *obj, const Eobj *ref_obj, const char *file, int line); - -/** - * @brief Decrement the object's reference count by 1 and free it if needed. Will free the ref associated with ref_obj). - * @param obj the object to work on. - * @param ref_obj the object that references obj. - * - * This function only enforces the checks for object association. I.e don't rely - * on it. If such enforces are compiled out, this function behaves the same as - * eobj_unref(). - * - * @see eobj_xref_internal() - */ -EAPI void eobj_xunref(Eobj *obj, const Eobj *ref_obj); - -/** - * @brief Delete the object passed (disregarding ref count). - * @param obj the object to work on. - * - * @see eobj_unref() - */ -EAPI void eobj_del(Eobj *obj); - -/** - * @addtogroup Eobj_Composite_Objects Composite Objects. - * @{ - */ - -/** - * @brief Make an object a composite object of another. - * @param obj the "parent" object. - * @param comp_obj the object that will be used to composite obj. - * - * @see eobj_composite_object_detach() - * @see eobj_composite_is() - */ -EAPI void eobj_composite_object_attach(Eobj *obj, Eobj *comp_obj); - -/** - * @brief Detach a composite object from another object. - * @param obj the "parent" object. - * @param comp_obj the object attached to obj. - * - * @see eobj_composite_object_attach() - * @see eobj_composite_is() - */ -EAPI void eobj_composite_object_detach(Eobj *obj, Eobj *comp_obj); - -/** - * @brief Check if an object is a composite object. - * @param comp_obj the object to be checked. - * @return #EINA_TRUE if it is, #EINA_FALSE otherwise. - * - * @see eobj_composite_object_attach() - * @see eobj_composite_object_detach() - */ -EAPI Eina_Bool eobj_composite_is(Eobj *comp_obj); - -/** - * @} - */ - -/** - * @addtogroup Eobj_Events Eobj's Event Handling - * @{ - */ - -/** - * @def EOBJ_CALLBACK_PRIORITY_BEFORE - * Slightly more prioritized than default. - */ -#define EOBJ_CALLBACK_PRIORITY_BEFORE -100 -/** - * @def EOBJ_CALLBACK_PRIORITY_DEFAULT - * Default callback priority level - */ -#define EOBJ_CALLBACK_PRIORITY_DEFAULT 0 -/** - * @def EOBJ_CALLBACK_PRIORITY_AFTER - * Slightly less prioritized than default. - */ -#define EOBJ_CALLBACK_PRIORITY_AFTER 100 - -/** - * @typedef Eobj_Callback_Priority - * - * Callback priority value. Range is -32k - 32k. The lower the number, the - * higher the priority. - * - * @see EOBJ_CALLBACK_PRIORITY_AFTER - * @see EOBJ_CALLBACK_PRIORITY_BEFORE - * @see EOBJ_CALLBACK_PRIORITY_DEFAULT - */ -typedef short Eobj_Callback_Priority; - -/** - * @def EOBJ_CALLBACK_STOP - * Stop calling callbacks for the even of which the callback was called for. - * @see EOBJ_CALLBACK_CONTINUE - */ -#define EOBJ_CALLBACK_STOP EINA_FALSE - -/** - * @def EOBJ_CALLBACK_CONTINUE - * Continue calling callbacks for the even of which the callback was called for. - * @see EOBJ_CALLBACK_STOP - */ -#define EOBJ_CALLBACK_CONTINUE EINA_TRUE - -/** - * @typedef Eobj_Event_Cb - * - * An event callback prototype. - * - * @param data The user data registered with the callback. - * @param obj The object which initiated the event. - * @param desc The event's description. - * @param event_info additional data passed with the event. - * @return #EOBJ_CALLBACK_STOP to stop calling additional callbacks for the event, #EOBJ_CALLBACK_CONTINUE to continue. - */ -typedef Eina_Bool (*Eobj_Event_Cb)(void *data, Eobj *obj, const Eobj_Event_Description *desc, void *event_info); - -/** - * @brief Add an event callback forwarder for an event and an object. - * @param obj The object to listen to events on. - * @param desc The description of the event to listen to. - * @param new_obj The object to emit events from. - * @return #EINA_TRUE on success, #EINA_FALSE otherwise. - * - * @see eobj_event_callback_forwarder_del() - */ -EAPI Eina_Bool eobj_event_callback_forwarder_add(Eobj *obj, const Eobj_Event_Description *desc, Eobj *new_obj); - -/** - * @brief Remove an event callback forwarder for an event and an object. - * @param obj The object to listen to events on. - * @param desc The description of the event to listen to. - * @param new_obj The object to emit events from. - * @return #EINA_TRUE on success, #EINA_FALSE otherwise. - * - * @see eobj_event_callback_forwarder_add() - */ -EAPI Eina_Bool eobj_event_callback_forwarder_del(Eobj *obj, const Eobj_Event_Description *desc, Eobj *new_obj); - -/** - * @def eobj_event_callback_add(obj, desc, cb, data) - * Add a callback for an event. - * @param obj The object to listen to events on. - * @param desc The description of the event to listen to. - * @param cb the callback to call. - * @param data additional data to pass to the callback. - * @return #EINA_TRUE on success, #EINA_FALSE otherwise. - * - * callbacks of the same priority are called in reverse order of creation. - * - * @see eobj_event_callback_priority_add() - */ -#define eobj_event_callback_add(obj, desc, cb, data) \ - eobj_event_callback_priority_add(obj, desc, \ - EOBJ_CALLBACK_PRIORITY_DEFAULT, cb, data) - -/** - * @brief Add a callback for an event with a specific priority. - * @param obj The object to listen to events on. - * @param desc The description of the event to listen to. - * @param priority The priority of the callback. - * @param cb the callback to call. - * @param data additional data to pass to the callback. - * @return #EINA_TRUE on success, #EINA_FALSE otherwise. - * - * callbacks of the same priority are called in reverse order of creation. - * - * @see #eobj_event_callback_add - */ -EAPI Eina_Bool eobj_event_callback_priority_add(Eobj *obj, const Eobj_Event_Description *desc, Eobj_Callback_Priority priority, Eobj_Event_Cb cb, const void *data); - -/** - * @brief Del a callback for an event - * @param obj The object to listen to delete from. - * @param desc The description of the event to listen to. - * @param func the callback to delete. - * @return The additional data that was set to be passed to the callback. - * - * @see eobj_event_callback_del() - */ -EAPI void *eobj_event_callback_del_lazy(Eobj *obj, const Eobj_Event_Description *desc, Eobj_Event_Cb func); - -/** - * @brief Del a callback with a specific data associated to it for an event. - * @param obj The object to listen to delete from. - * @param desc The description of the event to listen to. - * @param func the callback to delete. - * @param user_data The data to compare. - * @return The additional data that was set to be passed to the callback. - * - * @see eobj_event_callback_del_lazy() - */ -EAPI void *eobj_event_callback_del(Eobj *obj, const Eobj_Event_Description *desc, Eobj_Event_Cb func, const void *user_data); - -/** - * @brief Call the callbacks for an event of an object. - * @param obj The object to work on. - * @param desc The description of the event to call. - * @param event_info Extra event info to pass to the callbacks. - * @return #EINA_FALSE if one of the callbacks aborted the callback calls or #EINA_TRUE otherwise. - */ -EAPI Eina_Bool eobj_event_callback_call(Eobj *obj, const Eobj_Event_Description *desc, const void *event_info); - -/** - * @} - */ - -/** - * @addtogroup Eobj_Class_Base Eobj's Base class. - * @{ - */ - -/** - * @def EOBJ_BASE_CLASS - * The class type for the Eobj base class. - */ -#define EOBJ_BASE_CLASS eobj_base_class_get() -/** - * @brief Use #EOBJ_BASE_CLASS - * @internal - * */ -EAPI const Eobj_Class *eobj_base_class_get(void) EINA_CONST; - -/** - * @typedef eobj_base_data_free_func - * Data free func prototype. - */ -typedef void (*eobj_base_data_free_func)(void *); - -/** - * @var EOBJ_BASE_BASE_ID - * #EOBJ_BASE_CLASS 's base id. - */ -extern EAPI Eobj_Op EOBJ_BASE_BASE_ID; - -enum { - EOBJ_BASE_SUB_ID_DATA_SET, - EOBJ_BASE_SUB_ID_DATA_GET, - EOBJ_BASE_SUB_ID_DATA_DEL, - EOBJ_BASE_SUB_ID_WREF_ADD, - EOBJ_BASE_SUB_ID_WREF_DEL, - EOBJ_BASE_SUB_ID_LAST -}; - -/** - * @def EOBJ_BASE_ID(sub_id) - * Helper macro to get the full Op ID out of the sub_id for EOBJ_BASE. - * @param sub_id the sub id inside EOBJ_BASE. - */ -#define EOBJ_BASE_ID(sub_id) (EOBJ_BASE_BASE_ID + sub_id) - -/** - * @def eobj_base_data_set(key, data, free_func) - * Set generic data to object. - * @param[in] key the key associated with the data - * @param[in] data the data to set. - * @param[in] free_func the func to free data with (NULL means "do nothing"). - * - * @see #eobj_base_data_get - * @see #eobj_base_data_del - */ -#define eobj_base_data_set(key, data, free_func) EOBJ_BASE_ID(EOBJ_BASE_SUB_ID_DATA_SET), EOBJ_TYPECHECK(const char *, key), EOBJ_TYPECHECK(const void *, data), EOBJ_TYPECHECK(eobj_base_data_free_func, free_func) - -/** - * @def eobj_base_data_get(key, data) - * Get generic data from object. - * @param[in] key the key associated with the data - * @param[out] data the data for the key - * - * @see #eobj_base_data_set - * @see #eobj_base_data_del - */ -#define eobj_base_data_get(key, data) EOBJ_BASE_ID(EOBJ_BASE_SUB_ID_DATA_GET), EOBJ_TYPECHECK(const char *, key), EOBJ_TYPECHECK(void **, data) - -/** - * @def eobj_base_data_del(key) - * Del generic data from object. - * @param[in] key the key associated with the data - * - * @see #eobj_base_data_set - * @see #eobj_base_data_get - */ -#define eobj_base_data_del(key) EOBJ_BASE_ID(EOBJ_BASE_SUB_ID_DATA_DEL), EOBJ_TYPECHECK(const char *, key) - -/** - * @def eobj_wref_add - * @brief Add a new weak reference to obj. - * @param wref The pointer to use for the weak ref. - * - * This function registers the object handle pointed by wref to obj so when - * obj is deleted it'll be updated to NULL. This functions should be used - * when you want to keep track of an object in a safe way, but you don't want - * to prevent it from being freed. - * - * @see #eobj_wref_del - */ -#define eobj_wref_add(wref) EOBJ_BASE_ID(EOBJ_BASE_SUB_ID_WREF_ADD), EOBJ_TYPECHECK(Eobj **, wref) - -/** - * @def eobj_wref_del - * @brief Delete the weak reference passed. - * @param wref the weak reference to free. - * - * @see #eobj_wref_add - */ -#define eobj_wref_del(wref) EOBJ_BASE_ID(EOBJ_BASE_SUB_ID_WREF_DEL), EOBJ_TYPECHECK(Eobj **, wref) - -/** - * @var _EOBJ_EV_CALLBACK_ADD - * see EOBJ_EV_CALLBACK_ADD - */ -EAPI extern const Eobj_Event_Description _EOBJ_EV_CALLBACK_ADD; - -/** - * @def EOBJ_EV_CALLBACK_ADD - * The event description (of type #Eobj_Event_Description) for - * The "Callback listener added" event. - */ -#define EOBJ_EV_CALLBACK_ADD (&(_EOBJ_EV_CALLBACK_ADD)) - -/** - * @var _EOBJ_EV_CALLBACK_DEL - * see EOBJ_EV_CALLBACK_DEL - */ -EAPI extern const Eobj_Event_Description _EOBJ_EV_CALLBACK_DEL; - -/** - * @def EOBJ_EV_CALLBACK_DEL - * The event description (of type #Eobj_Event_Description) for - * The "Callback listener deleted" event. - */ -#define EOBJ_EV_CALLBACK_DEL (&(_EOBJ_EV_CALLBACK_DEL)) - -/** - * @var _EOBJ_EV_FREE - * see #EOBJ_EV_FREE - */ -EAPI extern const Eobj_Event_Description _EOBJ_EV_FREE; - -/** - * @def EOBJ_EV_FREE - * Object is being freed. - */ -#define EOBJ_EV_FREE (&(_EOBJ_EV_FREE)) - -/** - * @var _EOBJ_EV_DEL - * see #EOBJ_EV_DEL - */ -EAPI extern const Eobj_Event_Description _EOBJ_EV_DEL; - -/** - * @def EOBJ_EV_DEL - * Object is being deleted. - */ -#define EOBJ_EV_DEL (&(_EOBJ_EV_DEL)) - -/** - * @} - */ - -/** - * @} - */ - -#endif diff --git a/legacy/eobj/lib/eobj.c b/legacy/eobj/lib/eo.c similarity index 58% rename from legacy/eobj/lib/eobj.c rename to legacy/eobj/lib/eo.c index e467e86e40..177bfa9f59 100644 --- a/legacy/eobj/lib/eobj.c +++ b/legacy/eobj/lib/eo.c @@ -1,33 +1,33 @@ #include -#include "Eobj.h" -#include "eobj_private.h" +#include "Eo.h" +#include "eo_private.h" #include "config.h" -typedef int Eobj_Class_Id; +typedef int Eo_Class_Id; -/* Used inside the class_get functions of classes, see #EOBJ_DEFINE_CLASS */ -EAPI Eina_Lock _eobj_class_creation_lock; -int _eobj_log_dom = -1; +/* Used inside the class_get functions of classes, see #EO_DEFINE_CLASS */ +EAPI Eina_Lock _eo_class_creation_lock; +int _eo_log_dom = -1; -static Eobj_Class **_eobj_classes; -static Eobj_Class_Id _eobj_classes_last_id; -static Eina_Bool _eobj_init_count = 0; +static Eo_Class **_eo_classes; +static Eo_Class_Id _eo_classes_last_id; +static Eina_Bool _eo_init_count = 0; -static void _eobj_callback_remove_all(Eobj *obj); -static void _eobj_constructor(Eobj *obj, const Eobj_Class *klass); -static void _eobj_destructor(Eobj *obj, const Eobj_Class *klass); -static void eobj_constructor_error_unset(Eobj *obj); +static void _eo_callback_remove_all(Eo *obj); +static void _eo_constructor(Eo *obj, const Eo_Class *klass); +static void _eo_destructor(Eo *obj, const Eo_Class *klass); +static void eo_constructor_error_unset(Eo *obj); -typedef struct _Eobj_Callback_Description Eobj_Callback_Description; +typedef struct _Eo_Callback_Description Eo_Callback_Description; -#define EOBJ_EINA_MAGIC 0xa186bc32 /* Nothing magical about this number. */ -#define EOBJ_EINA_MAGIC_STR "Eobj" -#define EOBJ_CLASS_EINA_MAGIC 0xa186bb32 /* Nothing magical about this number. */ -#define EOBJ_CLASS_EINA_MAGIC_STR "Eobj Class" +#define EO_EINA_MAGIC 0xa186bc32 /* Nothing magical about this number. */ +#define EO_EINA_MAGIC_STR "Eo" +#define EO_CLASS_EINA_MAGIC 0xa186bb32 /* Nothing magical about this number. */ +#define EO_CLASS_EINA_MAGIC_STR "Eo Class" -#define EOBJ_MAGIC_RETURN_VAL(d, magic, ret) \ +#define EO_MAGIC_RETURN_VAL(d, magic, ret) \ do { \ if (!EINA_MAGIC_CHECK(d, magic)) \ { \ @@ -36,7 +36,7 @@ typedef struct _Eobj_Callback_Description Eobj_Callback_Description; } \ } while (0) -#define EOBJ_MAGIC_RETURN(d, magic) \ +#define EO_MAGIC_RETURN(d, magic) \ do { \ if (!EINA_MAGIC_CHECK(d, magic)) \ { \ @@ -45,10 +45,10 @@ typedef struct _Eobj_Callback_Description Eobj_Callback_Description; } \ } while (0) -struct _Eobj { +struct _Eo { EINA_MAGIC - Eobj *parent; - const Eobj_Class *klass; + Eo *parent; + const Eo_Class *klass; int refcount; #ifndef NDEBUG Eina_Inlist *xrefs; @@ -81,16 +81,16 @@ struct _Eobj { #define OP_CLASS_OFFSET 16 #define OP_CLASS_OFFSET_GET(x) (((x) >> OP_CLASS_OFFSET) & 0xffff) #define OP_CLASS_GET(op) ({ \ - Eobj_Class_Id tmp = OP_CLASS_OFFSET_GET(op); \ - (Eobj_Class *) ((tmp <= _eobj_classes_last_id) && (tmp > 0)) ? \ - (_eobj_classes[tmp - 1]) : NULL; \ + Eo_Class_Id tmp = OP_CLASS_OFFSET_GET(op); \ + (Eo_Class *) ((tmp <= _eo_classes_last_id) && (tmp > 0)) ? \ + (_eo_classes[tmp - 1]) : NULL; \ }) #define OP_SUB_ID_GET(op) ((op) & 0xffff) -#define EOBJ_ALIGN_SIZE(size) \ +#define EO_ALIGN_SIZE(size) \ ((size) + (sizeof(void *) - ((size) % sizeof(void *)))) -/* Structure of Eobj_Op is: +/* Structure of Eo_Op is: * 16bit: class * 16bit: op. */ @@ -99,7 +99,7 @@ typedef struct _Dich_Chain1 Dich_Chain1; typedef struct { - eobj_op_func_type func; + eo_op_func_type func; } op_type_funcs; typedef struct @@ -115,36 +115,36 @@ struct _Dich_Chain1 typedef struct { EINA_INLIST; - const Eobj_Class *klass; -} Eobj_Extension_Node; + const Eo_Class *klass; +} Eo_Extension_Node; typedef struct { - const Eobj_Class *klass; + const Eo_Class *klass; size_t offset; -} Eobj_Extension_Data_Offset; +} Eo_Extension_Data_Offset; -struct _Eobj_Class +struct _Eo_Class { EINA_MAGIC - Eobj_Class_Id class_id; - const Eobj_Class *parent; - const Eobj_Class_Description *desc; + Eo_Class_Id class_id; + const Eo_Class *parent; + const Eo_Class_Description *desc; Dich_Chain1 chain[DICH_CHAIN1_SIZE]; Eina_Inlist *extensions; - Eobj_Extension_Data_Offset *extn_data_off; + Eo_Extension_Data_Offset *extn_data_off; size_t extn_data_size; - const Eobj_Class **mro; + const Eo_Class **mro; size_t data_offset; /* < Offset of the data within object data. */ Eina_Bool constructed : 1; }; -static inline eobj_op_func_type -dich_func_get(const Eobj_Class *klass, Eobj_Op op) +static inline eo_op_func_type +dich_func_get(const Eo_Class *klass, Eo_Op op) { const Dich_Chain1 *chain1 = &klass->chain[DICH_CHAIN1(op)]; if (!chain1) return NULL; @@ -154,7 +154,7 @@ dich_func_get(const Eobj_Class *klass, Eobj_Op op) if (!chain2->funcs) return NULL; /* num_ops is calculated from the class. */ - const Eobj_Class *op_klass = OP_CLASS_GET(op); + const Eo_Class *op_klass = OP_CLASS_GET(op); if (!op_klass || (DICH_CHAIN_LAST(op) >= op_klass->desc->ops.count)) return NULL; @@ -162,9 +162,9 @@ dich_func_get(const Eobj_Class *klass, Eobj_Op op) } static inline void -dich_func_set(Eobj_Class *klass, Eobj_Op op, eobj_op_func_type func) +dich_func_set(Eo_Class *klass, Eo_Op op, eo_op_func_type func) { - const Eobj_Class *op_klass = OP_CLASS_GET(op); + const Eo_Class *op_klass = OP_CLASS_GET(op); size_t num_ops; /* Verify op is valid. */ @@ -201,7 +201,7 @@ dich_func_set(Eobj_Class *klass, Eobj_Op op, eobj_op_func_type func) } static inline void -dich_func_clean_all(Eobj_Class *klass) +dich_func_clean_all(Eo_Class *klass) { int i; Dich_Chain1 *chain1 = klass->chain; @@ -225,16 +225,16 @@ dich_func_clean_all(Eobj_Class *klass) /* END OF DICH */ -static const Eobj_Op_Description noop_desc = - EOBJ_OP_DESCRIPTION(EOBJ_NOOP, "", "No operation."); +static const Eo_Op_Description noop_desc = + EO_OP_DESCRIPTION(EO_NOOP, "", "No operation."); -static const Eobj_Op_Description * -_eobj_op_id_desc_get(Eobj_Op op) +static const Eo_Op_Description * +_eo_op_id_desc_get(Eo_Op op) { - const Eobj_Class *klass = OP_CLASS_GET(op); - Eobj_Op sub_id = OP_SUB_ID_GET(op); + const Eo_Class *klass = OP_CLASS_GET(op); + Eo_Op sub_id = OP_SUB_ID_GET(op); - if (op == EOBJ_NOOP) + if (op == EO_NOOP) return &noop_desc; if (klass && (sub_id < klass->desc->ops.count)) @@ -244,26 +244,26 @@ _eobj_op_id_desc_get(Eobj_Op op) } static const char * -_eobj_op_id_name_get(Eobj_Op op) +_eo_op_id_name_get(Eo_Op op) { - const Eobj_Op_Description *desc = _eobj_op_id_desc_get(op); + const Eo_Op_Description *desc = _eo_op_id_desc_get(op); return (desc) ? desc->name : NULL; } typedef struct { EINA_INLIST; - Eobj_Op op; - const Eobj_Class **kls_itr; -} Eobj_Kls_Itr_Node; + Eo_Op op; + const Eo_Class **kls_itr; +} Eo_Kls_Itr_Node; static inline Eina_Bool -_eobj_kls_itr_init(Eobj *obj, Eobj_Op op) +_eo_kls_itr_init(Eo *obj, Eo_Op op) { if (obj->kls_itr) { - Eobj_Kls_Itr_Node *node = - EINA_INLIST_CONTAINER_GET(obj->kls_itr, Eobj_Kls_Itr_Node); + Eo_Kls_Itr_Node *node = + EINA_INLIST_CONTAINER_GET(obj->kls_itr, Eo_Kls_Itr_Node); if (node->op == op) { return EINA_FALSE; @@ -272,7 +272,7 @@ _eobj_kls_itr_init(Eobj *obj, Eobj_Op op) { - Eobj_Kls_Itr_Node *node = calloc(1, sizeof(*node)); + Eo_Kls_Itr_Node *node = calloc(1, sizeof(*node)); node->op = op; node->kls_itr = obj->klass->mro; obj->kls_itr = eina_inlist_prepend(obj->kls_itr, @@ -283,10 +283,10 @@ _eobj_kls_itr_init(Eobj *obj, Eobj_Op op) } static inline void -_eobj_kls_itr_end(Eobj *obj, Eobj_Op op) +_eo_kls_itr_end(Eo *obj, Eo_Op op) { - Eobj_Kls_Itr_Node *node = - EINA_INLIST_CONTAINER_GET(obj->kls_itr, Eobj_Kls_Itr_Node); + Eo_Kls_Itr_Node *node = + EINA_INLIST_CONTAINER_GET(obj->kls_itr, Eo_Kls_Itr_Node); if (node->op != op) return; @@ -295,31 +295,31 @@ _eobj_kls_itr_end(Eobj *obj, Eobj_Op op) free(node); } -static inline const Eobj_Class * -_eobj_kls_itr_get(Eobj *obj) +static inline const Eo_Class * +_eo_kls_itr_get(Eo *obj) { - Eobj_Kls_Itr_Node *node = - EINA_INLIST_CONTAINER_GET(obj->kls_itr, Eobj_Kls_Itr_Node); + Eo_Kls_Itr_Node *node = + EINA_INLIST_CONTAINER_GET(obj->kls_itr, Eo_Kls_Itr_Node); return (node) ? *(node->kls_itr) : NULL; } -static inline const Eobj_Class * -_eobj_kls_itr_next(Eobj *obj, Eobj_Op op) +static inline const Eo_Class * +_eo_kls_itr_next(Eo *obj, Eo_Op op) { - Eobj_Kls_Itr_Node *node = - EINA_INLIST_CONTAINER_GET(obj->kls_itr, Eobj_Kls_Itr_Node); + Eo_Kls_Itr_Node *node = + EINA_INLIST_CONTAINER_GET(obj->kls_itr, Eo_Kls_Itr_Node); if (!node || (node->op != op)) { - Eobj_Op node_op = (node) ? node->op : EOBJ_NOOP; - ERR("Called with op %d ('%s') while expecting: %d ('%s'). This probaly means you called eobj_*_super functions from a wrong place.", - op, _eobj_op_id_name_get(op), - node_op, _eobj_op_id_name_get(node_op)); + Eo_Op node_op = (node) ? node->op : EO_NOOP; + ERR("Called with op %d ('%s') while expecting: %d ('%s'). This probaly means you called eo_*_super functions from a wrong place.", + op, _eo_op_id_name_get(op), + node_op, _eo_op_id_name_get(node_op)); return NULL; } - const Eobj_Class **kls_itr = node->kls_itr; + const Eo_Class **kls_itr = node->kls_itr; if (*kls_itr) { kls_itr++; @@ -333,22 +333,22 @@ _eobj_kls_itr_next(Eobj *obj, Eobj_Op op) } static inline Eina_Bool -_eobj_kls_itr_reached_end(const Eobj *obj) +_eo_kls_itr_reached_end(const Eo *obj) { - Eobj_Kls_Itr_Node *node = - EINA_INLIST_CONTAINER_GET(obj->kls_itr, Eobj_Kls_Itr_Node); - const Eobj_Class **kls_itr = node->kls_itr; + Eo_Kls_Itr_Node *node = + EINA_INLIST_CONTAINER_GET(obj->kls_itr, Eo_Kls_Itr_Node); + const Eo_Class **kls_itr = node->kls_itr; return !(*kls_itr && *(kls_itr + 1)); } static Eina_Bool -_eobj_op_internal(Eobj *obj, Eina_Bool constant, Eobj_Op op, va_list *p_list) +_eo_op_internal(Eo *obj, Eina_Bool constant, Eo_Op op, va_list *p_list) { - const Eobj_Class *klass; + const Eo_Class *klass; Eina_Bool ret = EINA_FALSE; Eina_Bool _itr_init; - const Eobj_Op_Description *op_desc = _eobj_op_id_desc_get(op); + const Eo_Op_Description *op_desc = _eo_op_id_desc_get(op); if (op_desc && ((constant == EINA_TRUE) && (op_desc->constant == EINA_FALSE))) @@ -357,29 +357,29 @@ _eobj_op_internal(Eobj *obj, Eina_Bool constant, Eobj_Op op, va_list *p_list) return EINA_FALSE; } - _itr_init = _eobj_kls_itr_init(obj, op); - klass = _eobj_kls_itr_get(obj); + _itr_init = _eo_kls_itr_init(obj, op); + klass = _eo_kls_itr_get(obj); while (klass) { - eobj_op_func_type func = dich_func_get(klass, op); + eo_op_func_type func = dich_func_get(klass, op); if (func) { - func(obj, eobj_data_get(obj, klass), p_list); + func(obj, eo_data_get(obj, klass), p_list); ret = EINA_TRUE; goto end; } - klass = _eobj_kls_itr_next(obj, op); + klass = _eo_kls_itr_next(obj, op); } /* Try composite objects */ { Eina_List *itr; - Eobj *emb_obj; + Eo *emb_obj; EINA_LIST_FOREACH(obj->composite_objects, itr, emb_obj) { - if (_eobj_op_internal(emb_obj, constant, op, p_list)) + if (_eo_op_internal(emb_obj, constant, op, p_list)) { ret = EINA_TRUE; goto end; @@ -389,55 +389,55 @@ _eobj_op_internal(Eobj *obj, Eina_Bool constant, Eobj_Op op, va_list *p_list) end: - if (_itr_init) _eobj_kls_itr_end(obj, op); + if (_itr_init) _eo_kls_itr_end(obj, op); return ret; } EAPI Eina_Bool -eobj_do_internal(Eobj *obj, Eina_Bool constant, ...) +eo_do_internal(Eo *obj, Eina_Bool constant, ...) { Eina_Bool ret = EINA_TRUE; - Eobj_Op op = EOBJ_NOOP; + Eo_Op op = EO_NOOP; va_list p_list; - EOBJ_MAGIC_RETURN_VAL(obj, EOBJ_EINA_MAGIC, EINA_FALSE); + EO_MAGIC_RETURN_VAL(obj, EO_EINA_MAGIC, EINA_FALSE); - eobj_ref(obj); + eo_ref(obj); va_start(p_list, constant); - op = va_arg(p_list, Eobj_Op); + op = va_arg(p_list, Eo_Op); while (op) { - if (!_eobj_op_internal(obj, constant, op, &p_list)) + if (!_eo_op_internal(obj, constant, op, &p_list)) { - const Eobj_Class *op_klass = OP_CLASS_GET(op); + const Eo_Class *op_klass = OP_CLASS_GET(op); const char *_dom_name = (op_klass) ? op_klass->desc->name : NULL; ERR("Can't find func for op %x ('%s' of domain '%s') for class '%s'. Aborting.", - op, _eobj_op_id_name_get(op), _dom_name, + op, _eo_op_id_name_get(op), _dom_name, obj->klass->desc->name); ret = EINA_FALSE; break; } - op = va_arg(p_list, Eobj_Op); + op = va_arg(p_list, Eo_Op); } va_end(p_list); - eobj_unref(obj); + eo_unref(obj); return ret; } EAPI Eina_Bool -eobj_do_super_internal(Eobj *obj, Eina_Bool constant, Eobj_Op op, ...) +eo_do_super_internal(Eo *obj, Eina_Bool constant, Eo_Op op, ...) { - const Eobj_Class *obj_klass; + const Eo_Class *obj_klass; Eina_Bool ret = EINA_TRUE; va_list p_list; - EOBJ_MAGIC_RETURN_VAL(obj, EOBJ_EINA_MAGIC, EINA_FALSE); + EO_MAGIC_RETURN_VAL(obj, EO_EINA_MAGIC, EINA_FALSE); /* Advance the kls itr. */ - obj_klass = _eobj_kls_itr_next(obj, op); + obj_klass = _eo_kls_itr_next(obj, op); if (!obj_klass) { @@ -445,12 +445,12 @@ eobj_do_super_internal(Eobj *obj, Eina_Bool constant, Eobj_Op op, ...) } va_start(p_list, op); - if (!_eobj_op_internal(obj, constant, op, &p_list)) + if (!_eo_op_internal(obj, constant, op, &p_list)) { - const Eobj_Class *op_klass = OP_CLASS_GET(op); + const Eo_Class *op_klass = OP_CLASS_GET(op); const char *_dom_name = (op_klass) ? op_klass->desc->name : NULL; ERR("Can't find func for op %x ('%s' of domain '%s') for class '%s'. Aborting.", - op, _eobj_op_id_name_get(op), _dom_name, + op, _eo_op_id_name_get(op), _dom_name, (obj_klass) ? obj_klass->desc->name : NULL); ret = EINA_FALSE; } @@ -459,26 +459,26 @@ eobj_do_super_internal(Eobj *obj, Eina_Bool constant, Eobj_Op op, ...) return ret; } -EAPI const Eobj_Class * -eobj_class_get(const Eobj *obj) +EAPI const Eo_Class * +eo_class_get(const Eo *obj) { - EOBJ_MAGIC_RETURN_VAL(obj, EOBJ_EINA_MAGIC, EINA_FALSE); + EO_MAGIC_RETURN_VAL(obj, EO_EINA_MAGIC, EINA_FALSE); return obj->klass; } EAPI const char * -eobj_class_name_get(const Eobj_Class *klass) +eo_class_name_get(const Eo_Class *klass) { - EOBJ_MAGIC_RETURN_VAL(klass, EOBJ_CLASS_EINA_MAGIC, NULL); + EO_MAGIC_RETURN_VAL(klass, EO_CLASS_EINA_MAGIC, NULL); return klass->desc->name; } static void -_eobj_class_base_op_init(Eobj_Class *klass) +_eo_class_base_op_init(Eo_Class *klass) { - const Eobj_Class_Description *desc = klass->desc; + const Eo_Class_Description *desc = klass->desc; if (!desc || !desc->ops.base_op_id) return; @@ -487,7 +487,7 @@ _eobj_class_base_op_init(Eobj_Class *klass) } static Eina_List * -_eobj_class_mro_add(Eina_List *mro, const Eobj_Class *klass) +_eo_class_mro_add(Eina_List *mro, const Eo_Class *klass) { Eina_List *extn_pos = NULL; Eina_Bool check_consistency = !mro; @@ -498,10 +498,10 @@ _eobj_class_mro_add(Eina_List *mro, const Eobj_Class *klass) /* Recursively add extenions. */ { - Eobj_Extension_Node *extn; + Eo_Extension_Node *extn; EINA_INLIST_FOREACH(klass->extensions, extn) { - mro = _eobj_class_mro_add(mro, extn->klass); + mro = _eo_class_mro_add(mro, extn->klass); /* Not possible: if (!mro) return NULL; */ if (check_consistency) @@ -515,7 +515,7 @@ _eobj_class_mro_add(Eina_List *mro, const Eobj_Class *klass) * we are working on (i.e no parents). */ if (check_consistency) { - Eobj_Extension_Node *extn; + Eo_Extension_Node *extn; Eina_List *itr = extn_pos; EINA_INLIST_FOREACH(klass->extensions, extn) @@ -536,18 +536,18 @@ _eobj_class_mro_add(Eina_List *mro, const Eobj_Class *klass) } - mro = _eobj_class_mro_add(mro, klass->parent); + mro = _eo_class_mro_add(mro, klass->parent); return mro; } static Eina_Bool -_eobj_class_mro_init(Eobj_Class *klass) +_eo_class_mro_init(Eo_Class *klass) { Eina_List *mro = NULL; DBG("Started creating MRO for class '%s'", klass->desc->name); - mro = _eobj_class_mro_add(mro, klass); + mro = _eo_class_mro_add(mro, klass); if (!mro) return EINA_FALSE; @@ -579,8 +579,8 @@ _eobj_class_mro_init(Eobj_Class *klass) /* Copy the mro and free the list. */ { - const Eobj_Class *kls_itr; - const Eobj_Class **mro_itr; + const Eo_Class *kls_itr; + const Eo_Class **mro_itr; klass->mro = calloc(sizeof(*klass->mro), eina_list_count(mro) + 1); mro_itr = klass->mro; @@ -600,7 +600,7 @@ _eobj_class_mro_init(Eobj_Class *klass) } static void -_eobj_class_constructor(Eobj_Class *klass) +_eo_class_constructor(Eo_Class *klass) { if (klass->constructed) return; @@ -612,17 +612,17 @@ _eobj_class_constructor(Eobj_Class *klass) } EAPI void -eobj_class_funcs_set(Eobj_Class *klass, const Eobj_Op_Func_Description *func_descs) +eo_class_funcs_set(Eo_Class *klass, const Eo_Op_Func_Description *func_descs) { - EOBJ_MAGIC_RETURN(klass, EOBJ_CLASS_EINA_MAGIC); + EO_MAGIC_RETURN(klass, EO_CLASS_EINA_MAGIC); - const Eobj_Op_Func_Description *itr; + const Eo_Op_Func_Description *itr; itr = func_descs; if (itr) { for ( ; itr->op != 0 ; itr++) { - const Eobj_Op_Description *op_desc = _eobj_op_id_desc_get(itr->op); + const Eo_Op_Description *op_desc = _eo_op_id_desc_get(itr->op); if (EINA_LIKELY(!op_desc || (itr->constant == op_desc->constant))) { @@ -637,7 +637,7 @@ eobj_class_funcs_set(Eobj_Class *klass, const Eobj_Op_Func_Description *func_des } static void -eobj_class_free(Eobj_Class *klass) +eo_class_free(Eo_Class *klass) { if (klass->constructed) { @@ -649,7 +649,7 @@ eobj_class_free(Eobj_Class *klass) { Eina_Inlist *itrn; - Eobj_Extension_Node *extn = NULL; + Eo_Extension_Node *extn = NULL; EINA_INLIST_FOREACH_SAFE(klass->extensions, itrn, extn) { free(extn); @@ -667,10 +667,10 @@ eobj_class_free(Eobj_Class *klass) /* DEVCHECK */ static Eina_Bool -_eobj_class_check_op_descs(const Eobj_Class *klass) +_eo_class_check_op_descs(const Eo_Class *klass) { - const Eobj_Class_Description *desc = klass->desc; - const Eobj_Op_Description *itr; + const Eo_Class_Description *desc = klass->desc; + const Eo_Op_Description *itr; size_t i; if (desc->ops.count > 0) @@ -716,15 +716,15 @@ _eobj_class_check_op_descs(const Eobj_Class *klass) return EINA_TRUE; } -EAPI const Eobj_Class * -eobj_class_new(const Eobj_Class_Description *desc, const Eobj_Class *parent, ...) +EAPI const Eo_Class * +eo_class_new(const Eo_Class_Description *desc, const Eo_Class *parent, ...) { - Eobj_Class *klass; + Eo_Class *klass; va_list p_list; - if (parent && !EINA_MAGIC_CHECK(parent, EOBJ_CLASS_EINA_MAGIC)) + if (parent && !EINA_MAGIC_CHECK(parent, EO_CLASS_EINA_MAGIC)) { - EINA_MAGIC_FAIL(parent, EOBJ_CLASS_EINA_MAGIC); + EINA_MAGIC_FAIL(parent, EO_CLASS_EINA_MAGIC); return NULL; } @@ -734,7 +734,7 @@ eobj_class_new(const Eobj_Class_Description *desc, const Eobj_Class *parent, ... EINA_SAFETY_ON_NULL_RETURN_VAL(desc->name, NULL); /* Check restrictions on Interface types. */ - if (desc->type == EOBJ_CLASS_TYPE_INTERFACE) + 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); @@ -743,26 +743,26 @@ eobj_class_new(const Eobj_Class_Description *desc, const Eobj_Class *parent, ... EINA_SAFETY_ON_FALSE_RETURN_VAL(!desc->data_size, NULL); } - klass = calloc(1, sizeof(Eobj_Class)); + klass = calloc(1, sizeof(Eo_Class)); klass->parent = parent; /* Handle class extensions */ { - Eobj_Class *extn = NULL; + Eo_Class *extn = NULL; - extn = va_arg(p_list, Eobj_Class *); + extn = va_arg(p_list, Eo_Class *); while (extn) { switch (extn->desc->type) { - case EOBJ_CLASS_TYPE_REGULAR: - case EOBJ_CLASS_TYPE_REGULAR_NO_INSTANT: + case EO_CLASS_TYPE_REGULAR: + case EO_CLASS_TYPE_REGULAR_NO_INSTANT: /* Use it like an interface. */ - case EOBJ_CLASS_TYPE_INTERFACE: + case EO_CLASS_TYPE_INTERFACE: break; - case EOBJ_CLASS_TYPE_MIXIN: + case EO_CLASS_TYPE_MIXIN: { - Eobj_Extension_Node *node = calloc(1, sizeof(*node)); + Eo_Extension_Node *node = calloc(1, sizeof(*node)); node->klass = extn; klass->extensions = eina_inlist_append(klass->extensions, @@ -771,7 +771,7 @@ eobj_class_new(const Eobj_Class_Description *desc, const Eobj_Class *parent, ... break; } - extn = va_arg(p_list, Eobj_Class *); + extn = va_arg(p_list, Eo_Class *); } } @@ -783,19 +783,19 @@ eobj_class_new(const Eobj_Class_Description *desc, const Eobj_Class *parent, ... /* Verify the inheritance is allowed. */ switch (klass->desc->type) { - case EOBJ_CLASS_TYPE_REGULAR: - case EOBJ_CLASS_TYPE_REGULAR_NO_INSTANT: - if ((klass->parent->desc->type != EOBJ_CLASS_TYPE_REGULAR) && - (klass->parent->desc->type != EOBJ_CLASS_TYPE_REGULAR_NO_INSTANT)) + case EO_CLASS_TYPE_REGULAR: + case EO_CLASS_TYPE_REGULAR_NO_INSTANT: + if ((klass->parent->desc->type != EO_CLASS_TYPE_REGULAR) && + (klass->parent->desc->type != EO_CLASS_TYPE_REGULAR_NO_INSTANT)) { ERR("Regular classes ('%s') aren't allowed to inherit from non-regular classes ('%s').", klass->desc->name, klass->parent->desc->name); goto cleanup; } break; - case EOBJ_CLASS_TYPE_INTERFACE: - case EOBJ_CLASS_TYPE_MIXIN: - if ((klass->parent->desc->type != EOBJ_CLASS_TYPE_INTERFACE) && - (klass->parent->desc->type != EOBJ_CLASS_TYPE_MIXIN)) + case EO_CLASS_TYPE_INTERFACE: + case EO_CLASS_TYPE_MIXIN: + if ((klass->parent->desc->type != EO_CLASS_TYPE_INTERFACE) && + (klass->parent->desc->type != EO_CLASS_TYPE_MIXIN)) { ERR("Non-regular classes ('%s') aren't allowed to inherit from regular classes ('%s').", klass->desc->name, klass->parent->desc->name); goto cleanup; @@ -807,31 +807,31 @@ eobj_class_new(const Eobj_Class_Description *desc, const Eobj_Class *parent, ... /* Update the current offset. */ /* FIXME: Make sure this alignment is enough. */ klass->data_offset = klass->parent->data_offset + - EOBJ_ALIGN_SIZE(klass->parent->desc->data_size); + EO_ALIGN_SIZE(klass->parent->desc->data_size); } - if (!_eobj_class_check_op_descs(klass)) + if (!_eo_class_check_op_descs(klass)) { goto cleanup; } - if (!_eobj_class_mro_init(klass)) + if (!_eo_class_mro_init(klass)) { goto cleanup; } /* create MIXIN offset table. */ { - const Eobj_Class **mro_itr = klass->mro; - Eobj_Extension_Data_Offset *extn_data_itr; + const Eo_Class **mro_itr = klass->mro; + Eo_Extension_Data_Offset *extn_data_itr; size_t extn_num = 0; size_t extn_data_off = klass->data_offset + - EOBJ_ALIGN_SIZE(klass->desc->data_size); + EO_ALIGN_SIZE(klass->desc->data_size); /* FIXME: Make faster... */ while (*mro_itr) { - if (((*mro_itr)->desc->type == EOBJ_CLASS_TYPE_MIXIN) && + if (((*mro_itr)->desc->type == EO_CLASS_TYPE_MIXIN) && ((*mro_itr)->desc->data_size > 0)) { extn_num++; @@ -846,13 +846,13 @@ eobj_class_new(const Eobj_Class_Description *desc, const Eobj_Class *parent, ... mro_itr = klass->mro; while (*mro_itr) { - if (((*mro_itr)->desc->type == EOBJ_CLASS_TYPE_MIXIN) && + if (((*mro_itr)->desc->type == EO_CLASS_TYPE_MIXIN) && ((*mro_itr)->desc->data_size > 0)) { extn_data_itr->klass = *mro_itr; extn_data_itr->offset = extn_data_off; - extn_data_off += EOBJ_ALIGN_SIZE(extn_data_itr->klass->desc->data_size); + extn_data_off += EO_ALIGN_SIZE(extn_data_itr->klass->desc->data_size); extn_data_itr++; } mro_itr++; @@ -861,100 +861,100 @@ eobj_class_new(const Eobj_Class_Description *desc, const Eobj_Class *parent, ... klass->extn_data_size = extn_data_off; } - eina_lock_take(&_eobj_class_creation_lock); - klass->class_id = ++_eobj_classes_last_id; + eina_lock_take(&_eo_class_creation_lock); + klass->class_id = ++_eo_classes_last_id; { /* FIXME: Handle errors. */ - Eobj_Class **tmp; - tmp = realloc(_eobj_classes, _eobj_classes_last_id * sizeof(*_eobj_classes)); - _eobj_classes = tmp; - _eobj_classes[klass->class_id - 1] = klass; + Eo_Class **tmp; + tmp = realloc(_eo_classes, _eo_classes_last_id * sizeof(*_eo_classes)); + _eo_classes = tmp; + _eo_classes[klass->class_id - 1] = klass; } - eina_lock_release(&_eobj_class_creation_lock); + eina_lock_release(&_eo_class_creation_lock); - EINA_MAGIC_SET(klass, EOBJ_CLASS_EINA_MAGIC); + EINA_MAGIC_SET(klass, EO_CLASS_EINA_MAGIC); - _eobj_class_base_op_init(klass); + _eo_class_base_op_init(klass); - _eobj_class_constructor(klass); + _eo_class_constructor(klass); va_end(p_list); return klass; cleanup: - eobj_class_free(klass); + eo_class_free(klass); return NULL; } -EAPI Eobj * -eobj_add(const Eobj_Class *klass, Eobj *parent) +EAPI Eo * +eo_add(const Eo_Class *klass, Eo *parent) { - EOBJ_MAGIC_RETURN_VAL(klass, EOBJ_CLASS_EINA_MAGIC, NULL); + EO_MAGIC_RETURN_VAL(klass, EO_CLASS_EINA_MAGIC, NULL); - if (parent) EOBJ_MAGIC_RETURN_VAL(parent, EOBJ_EINA_MAGIC, NULL); + if (parent) EO_MAGIC_RETURN_VAL(parent, EO_EINA_MAGIC, NULL); - if (EINA_UNLIKELY(klass->desc->type != EOBJ_CLASS_TYPE_REGULAR)) + if (EINA_UNLIKELY(klass->desc->type != EO_CLASS_TYPE_REGULAR)) { ERR("Class '%s' is not instantiate-able. Aborting.", klass->desc->name); return NULL; } - Eobj *obj = calloc(1, EOBJ_ALIGN_SIZE(sizeof(*obj)) + - (klass->data_offset + EOBJ_ALIGN_SIZE(klass->desc->data_size)) + + Eo *obj = calloc(1, EO_ALIGN_SIZE(sizeof(*obj)) + + (klass->data_offset + EO_ALIGN_SIZE(klass->desc->data_size)) + klass->extn_data_size); obj->klass = klass; obj->parent = parent; obj->refcount++; - _eobj_kls_itr_init(obj, EOBJ_NOOP); - eobj_constructor_error_unset(obj); + _eo_kls_itr_init(obj, EO_NOOP); + eo_constructor_error_unset(obj); - EINA_MAGIC_SET(obj, EOBJ_EINA_MAGIC); - eobj_ref(obj); - _eobj_constructor(obj, klass); + EINA_MAGIC_SET(obj, EO_EINA_MAGIC); + eo_ref(obj); + _eo_constructor(obj, klass); - if (EINA_UNLIKELY(eobj_constructor_error_get(obj))) + if (EINA_UNLIKELY(eo_constructor_error_get(obj))) { ERR("Type '%s' - One of the object constructors have failed.", klass->desc->name); goto fail; } - if (EINA_UNLIKELY(!_eobj_kls_itr_reached_end(obj))) + if (EINA_UNLIKELY(!_eo_kls_itr_reached_end(obj))) { ERR("Type '%s' - Not all of the object constructors have been executed.", klass->desc->name); goto fail; } - _eobj_kls_itr_end(obj, EOBJ_NOOP); - eobj_unref(obj); + _eo_kls_itr_end(obj, EO_NOOP); + eo_unref(obj); return obj; fail: /* Unref twice, once for the ref above, and once for the basic object ref. */ - eobj_unref(obj); - eobj_unref(obj); + eo_unref(obj); + eo_unref(obj); return NULL; } typedef struct { EINA_INLIST; - const Eobj *ref_obj; + const Eo *ref_obj; const char *file; int line; -} Eobj_Xref_Node; +} Eo_Xref_Node; -EAPI Eobj * -eobj_xref_internal(Eobj *obj, const Eobj *ref_obj, const char *file, int line) +EAPI Eo * +eo_xref_internal(Eo *obj, const Eo *ref_obj, const char *file, int line) { - EOBJ_MAGIC_RETURN_VAL(obj, EOBJ_EINA_MAGIC, obj); + EO_MAGIC_RETURN_VAL(obj, EO_EINA_MAGIC, obj); - eobj_ref(obj); + eo_ref(obj); #ifndef NDEBUG - Eobj_Xref_Node *xref = calloc(1, sizeof(*xref)); + Eo_Xref_Node *xref = calloc(1, sizeof(*xref)); xref->ref_obj = ref_obj; xref->file = file; xref->line = line; @@ -971,11 +971,11 @@ eobj_xref_internal(Eobj *obj, const Eobj *ref_obj, const char *file, int line) } EAPI void -eobj_xunref(Eobj *obj, const Eobj *ref_obj) +eo_xunref(Eo *obj, const Eo *ref_obj) { - EOBJ_MAGIC_RETURN(obj, EOBJ_EINA_MAGIC); + EO_MAGIC_RETURN(obj, EO_EINA_MAGIC); #ifndef NDEBUG - Eobj_Xref_Node *xref = NULL; + Eo_Xref_Node *xref = NULL; EINA_INLIST_FOREACH(obj->xrefs, xref) { if (xref->ref_obj == ref_obj) @@ -995,76 +995,76 @@ eobj_xunref(Eobj *obj, const Eobj *ref_obj) #else (void) ref_obj; #endif - eobj_unref(obj); + eo_unref(obj); } -EAPI Eobj * -eobj_ref(Eobj *obj) +EAPI Eo * +eo_ref(Eo *obj) { - EOBJ_MAGIC_RETURN_VAL(obj, EOBJ_EINA_MAGIC, obj); + EO_MAGIC_RETURN_VAL(obj, EO_EINA_MAGIC, obj); obj->refcount++; return obj; } static void -_eobj_del_internal(Eobj *obj) +_eo_del_internal(Eo *obj) { if (obj->delete) return; /* We need that for the event callbacks that may ref/unref. */ obj->refcount++; - eobj_event_callback_call(obj, EOBJ_EV_DEL, NULL); + eo_event_callback_call(obj, EO_EV_DEL, NULL); obj->delete = EINA_TRUE; obj->refcount--; - const Eobj_Class *klass = eobj_class_get(obj); - _eobj_kls_itr_init(obj, EOBJ_NOOP); - eobj_constructor_error_unset(obj); - _eobj_destructor(obj, klass); - if (eobj_constructor_error_get(obj)) + const Eo_Class *klass = eo_class_get(obj); + _eo_kls_itr_init(obj, EO_NOOP); + eo_constructor_error_unset(obj); + _eo_destructor(obj, klass); + if (eo_constructor_error_get(obj)) { ERR("Type '%s' - One of the object destructors have failed.", klass->desc->name); } - if (!_eobj_kls_itr_reached_end(obj)) + if (!_eo_kls_itr_reached_end(obj)) { ERR("Type '%s' - Not all of the object destructors have been executed.", klass->desc->name); } - _eobj_kls_itr_end(obj, EOBJ_NOOP); - /*FIXME: add eobj_class_unref(klass) ? - just to clear the caches. */ + _eo_kls_itr_end(obj, EO_NOOP); + /*FIXME: add eo_class_unref(klass) ? - just to clear the caches. */ /* If for some reason it's not empty, clear it. */ while (obj->kls_itr) { WRN("Kls_Itr is not empty, possibly a bug, please report. - An error will be reported for each kls_itr in the stack."); Eina_Inlist *nitr = obj->kls_itr->next; - free(EINA_INLIST_CONTAINER_GET(obj->kls_itr, Eobj_Kls_Itr_Node)); + free(EINA_INLIST_CONTAINER_GET(obj->kls_itr, Eo_Kls_Itr_Node)); obj->kls_itr = nitr; } Eina_List *itr, *itr_n; - Eobj *emb_obj; + Eo *emb_obj; EINA_LIST_FOREACH_SAFE(obj->composite_objects, itr, itr_n, emb_obj) { - eobj_composite_object_detach(obj, emb_obj); + eo_composite_object_detach(obj, emb_obj); } } EAPI void -eobj_unref(Eobj *obj) +eo_unref(Eo *obj) { - EOBJ_MAGIC_RETURN(obj, EOBJ_EINA_MAGIC); + EO_MAGIC_RETURN(obj, EO_EINA_MAGIC); if (--(obj->refcount) == 0) { - _eobj_del_internal(obj); + _eo_del_internal(obj); /* We need that for the event callbacks that may ref/unref. */ obj->refcount++; - eobj_event_callback_call(obj, EOBJ_EV_FREE, NULL); + eo_event_callback_call(obj, EO_EV_FREE, NULL); obj->refcount--; @@ -1074,129 +1074,129 @@ eobj_unref(Eobj *obj) { WRN("obj->xrefs is not empty, possibly a bug, please report. - An error will be reported for each xref in the stack."); Eina_Inlist *nitr = obj->xrefs->next; - free(EINA_INLIST_CONTAINER_GET(obj->xrefs, Eobj_Kls_Itr_Node)); + free(EINA_INLIST_CONTAINER_GET(obj->xrefs, Eo_Kls_Itr_Node)); obj->xrefs = nitr; } #endif - _eobj_callback_remove_all(obj); + _eo_callback_remove_all(obj); free(obj); } } EAPI int -eobj_ref_get(const Eobj *obj) +eo_ref_get(const Eo *obj) { - EOBJ_MAGIC_RETURN_VAL(obj, EOBJ_EINA_MAGIC, 0); + EO_MAGIC_RETURN_VAL(obj, EO_EINA_MAGIC, 0); return obj->refcount; } EAPI void -eobj_del(Eobj *obj) +eo_del(Eo *obj) { - EOBJ_MAGIC_RETURN(obj, EOBJ_EINA_MAGIC); + EO_MAGIC_RETURN(obj, EO_EINA_MAGIC); - _eobj_del_internal(obj); - eobj_unref(obj); + _eo_del_internal(obj); + eo_unref(obj); } -EAPI Eobj * -eobj_parent_get(Eobj *obj) +EAPI Eo * +eo_parent_get(Eo *obj) { - EOBJ_MAGIC_RETURN_VAL(obj, EOBJ_EINA_MAGIC, NULL); + EO_MAGIC_RETURN_VAL(obj, EO_EINA_MAGIC, NULL); return obj->parent; } EAPI void -eobj_constructor_error_set(Eobj *obj) +eo_constructor_error_set(Eo *obj) { - EOBJ_MAGIC_RETURN(obj, EOBJ_EINA_MAGIC); + EO_MAGIC_RETURN(obj, EO_EINA_MAGIC); obj->construct_error = EINA_TRUE; } static void -eobj_constructor_error_unset(Eobj *obj) +eo_constructor_error_unset(Eo *obj) { obj->construct_error = EINA_FALSE; } EAPI Eina_Bool -eobj_constructor_error_get(const Eobj *obj) +eo_constructor_error_get(const Eo *obj) { - EOBJ_MAGIC_RETURN_VAL(obj, EOBJ_EINA_MAGIC, EINA_TRUE); + EO_MAGIC_RETURN_VAL(obj, EO_EINA_MAGIC, EINA_TRUE); return obj->construct_error; } static inline void -_eobj_constructor_default(Eobj *obj) +_eo_constructor_default(Eo *obj) { - eobj_constructor_super(obj); + eo_constructor_super(obj); } static inline void -_eobj_destructor_default(Eobj *obj) +_eo_destructor_default(Eo *obj) { - eobj_destructor_super(obj); + eo_destructor_super(obj); } static void -_eobj_constructor(Eobj *obj, const Eobj_Class *klass) +_eo_constructor(Eo *obj, const Eo_Class *klass) { if (!klass) return; if (klass->desc->constructor) - klass->desc->constructor(obj, eobj_data_get(obj, klass)); + klass->desc->constructor(obj, eo_data_get(obj, klass)); else - _eobj_constructor_default(obj); + _eo_constructor_default(obj); } static void -_eobj_destructor(Eobj *obj, const Eobj_Class *klass) +_eo_destructor(Eo *obj, const Eo_Class *klass) { if (!klass) return; if (klass->desc->destructor) - klass->desc->destructor(obj, eobj_data_get(obj, klass)); + klass->desc->destructor(obj, eo_data_get(obj, klass)); else - _eobj_destructor_default(obj); + _eo_destructor_default(obj); } EAPI void -eobj_constructor_super(Eobj *obj) +eo_constructor_super(Eo *obj) { - EOBJ_MAGIC_RETURN(obj, EOBJ_EINA_MAGIC); + EO_MAGIC_RETURN(obj, EO_EINA_MAGIC); - _eobj_constructor(obj, _eobj_kls_itr_next(obj, EOBJ_NOOP)); + _eo_constructor(obj, _eo_kls_itr_next(obj, EO_NOOP)); } EAPI void -eobj_destructor_super(Eobj *obj) +eo_destructor_super(Eo *obj) { - EOBJ_MAGIC_RETURN(obj, EOBJ_EINA_MAGIC); + EO_MAGIC_RETURN(obj, EO_EINA_MAGIC); - _eobj_destructor(obj, _eobj_kls_itr_next(obj, EOBJ_NOOP)); + _eo_destructor(obj, _eo_kls_itr_next(obj, EO_NOOP)); } EAPI void * -eobj_data_get(const Eobj *obj, const Eobj_Class *klass) +eo_data_get(const Eo *obj, const Eo_Class *klass) { - EOBJ_MAGIC_RETURN_VAL(obj, EOBJ_EINA_MAGIC, NULL); + EO_MAGIC_RETURN_VAL(obj, EO_EINA_MAGIC, NULL); /* FIXME: Add a check that this is of the right klass and we don't seg. * Probably just return NULL. */ if (EINA_LIKELY(klass->desc->data_size > 0)) { - if (EINA_UNLIKELY(klass->desc->type == EOBJ_CLASS_TYPE_MIXIN)) + if (EINA_UNLIKELY(klass->desc->type == EO_CLASS_TYPE_MIXIN)) { - Eobj_Extension_Data_Offset *doff_itr = - eobj_class_get(obj)->extn_data_off; + Eo_Extension_Data_Offset *doff_itr = + eo_class_get(obj)->extn_data_off; if (!doff_itr) return NULL; @@ -1204,14 +1204,14 @@ eobj_data_get(const Eobj *obj, const Eobj_Class *klass) while (doff_itr->klass) { if (doff_itr->klass == klass) - return ((char *) obj) + EOBJ_ALIGN_SIZE(sizeof(*obj)) + + return ((char *) obj) + EO_ALIGN_SIZE(sizeof(*obj)) + doff_itr->offset; doff_itr++; } } else { - return ((char *) obj) + EOBJ_ALIGN_SIZE(sizeof(*obj)) + + return ((char *) obj) + EO_ALIGN_SIZE(sizeof(*obj)) + klass->data_offset; } } @@ -1220,95 +1220,95 @@ eobj_data_get(const Eobj *obj, const Eobj_Class *klass) } EAPI Eina_Bool -eobj_init(void) +eo_init(void) { - const char *log_dom = "eobj"; - if (_eobj_init_count++ > 0) + const char *log_dom = "eo"; + if (_eo_init_count++ > 0) return EINA_TRUE; eina_init(); - _eobj_classes = NULL; - _eobj_classes_last_id = 0; - _eobj_log_dom = eina_log_domain_register(log_dom, EINA_COLOR_LIGHTBLUE); - if (_eobj_log_dom < 0) + _eo_classes = NULL; + _eo_classes_last_id = 0; + _eo_log_dom = eina_log_domain_register(log_dom, EINA_COLOR_LIGHTBLUE); + if (_eo_log_dom < 0) { EINA_LOG_ERR("Could not register log domain: %s", log_dom); return EINA_FALSE; } - if (!eina_lock_new(&_eobj_class_creation_lock)) + if (!eina_lock_new(&_eo_class_creation_lock)) { EINA_LOG_ERR("Could not init lock."); return EINA_FALSE; } - eina_magic_string_static_set(EOBJ_EINA_MAGIC, EOBJ_EINA_MAGIC_STR); - eina_magic_string_static_set(EOBJ_CLASS_EINA_MAGIC, - EOBJ_CLASS_EINA_MAGIC_STR); + eina_magic_string_static_set(EO_EINA_MAGIC, EO_EINA_MAGIC_STR); + eina_magic_string_static_set(EO_CLASS_EINA_MAGIC, + EO_CLASS_EINA_MAGIC_STR); return EINA_TRUE; } EAPI Eina_Bool -eobj_shutdown(void) +eo_shutdown(void) { int i; - Eobj_Class **cls_itr = _eobj_classes; + Eo_Class **cls_itr = _eo_classes; - if (--_eobj_init_count > 0) + if (--_eo_init_count > 0) return EINA_TRUE; - for (i = 0 ; i < _eobj_classes_last_id ; i++, cls_itr++) + for (i = 0 ; i < _eo_classes_last_id ; i++, cls_itr++) { if (*cls_itr) - eobj_class_free(*cls_itr); + eo_class_free(*cls_itr); } - if (_eobj_classes) - free(_eobj_classes); + if (_eo_classes) + free(_eo_classes); - eina_lock_free(&_eobj_class_creation_lock); + eina_lock_free(&_eo_class_creation_lock); - eina_log_domain_unregister(_eobj_log_dom); - _eobj_log_dom = -1; + eina_log_domain_unregister(_eo_log_dom); + _eo_log_dom = -1; eina_shutdown(); return EINA_TRUE; } EAPI void -eobj_composite_object_attach(Eobj *obj, Eobj *emb_obj) +eo_composite_object_attach(Eo *obj, Eo *emb_obj) { - EOBJ_MAGIC_RETURN(obj, EOBJ_EINA_MAGIC); - EOBJ_MAGIC_RETURN(emb_obj, EOBJ_EINA_MAGIC); + EO_MAGIC_RETURN(obj, EO_EINA_MAGIC); + EO_MAGIC_RETURN(emb_obj, EO_EINA_MAGIC); - eobj_xref(emb_obj, obj); + eo_xref(emb_obj, obj); obj->composite_objects = eina_list_prepend(obj->composite_objects, emb_obj); } EAPI void -eobj_composite_object_detach(Eobj *obj, Eobj *emb_obj) +eo_composite_object_detach(Eo *obj, Eo *emb_obj) { - EOBJ_MAGIC_RETURN(obj, EOBJ_EINA_MAGIC); - EOBJ_MAGIC_RETURN(emb_obj, EOBJ_EINA_MAGIC); + EO_MAGIC_RETURN(obj, EO_EINA_MAGIC); + EO_MAGIC_RETURN(emb_obj, EO_EINA_MAGIC); obj->composite_objects = eina_list_remove(obj->composite_objects, emb_obj); - eobj_xunref(emb_obj, obj); + eo_xunref(emb_obj, obj); } EAPI Eina_Bool -eobj_composite_is(Eobj *emb_obj) +eo_composite_is(Eo *emb_obj) { - if (!EINA_MAGIC_CHECK(emb_obj, EOBJ_EINA_MAGIC)) + if (!EINA_MAGIC_CHECK(emb_obj, EO_EINA_MAGIC)) { - EINA_MAGIC_FAIL(emb_obj, EOBJ_EINA_MAGIC); + EINA_MAGIC_FAIL(emb_obj, EO_EINA_MAGIC); return EINA_FALSE; } - Eobj *obj = eobj_parent_get(emb_obj); + Eo *obj = eo_parent_get(emb_obj); Eina_List *itr; - Eobj *tmp; + Eo *tmp; if (!obj) return EINA_FALSE; @@ -1323,19 +1323,19 @@ eobj_composite_is(Eobj *emb_obj) } /* Callbacks */ -struct _Eobj_Callback_Description +struct _Eo_Callback_Description { EINA_INLIST; - const Eobj_Event_Description *event; - Eobj_Event_Cb func; + const Eo_Event_Description *event; + Eo_Event_Cb func; void *func_data; - Eobj_Callback_Priority priority; + Eo_Callback_Priority priority; Eina_Bool delete_me : 1; }; /* Actually remove, doesn't care about walking list, or delete_me */ static void -_eobj_callback_remove(Eobj *obj, Eobj_Callback_Description *cb) +_eo_callback_remove(Eo *obj, Eo_Callback_Description *cb) { obj->callbacks = eina_inlist_remove(obj->callbacks, EINA_INLIST_GET(cb)); @@ -1344,21 +1344,21 @@ _eobj_callback_remove(Eobj *obj, Eobj_Callback_Description *cb) /* Actually remove, doesn't care about walking list, or delete_me */ static void -_eobj_callback_remove_all(Eobj *obj) +_eo_callback_remove_all(Eo *obj) { Eina_Inlist *initr; - Eobj_Callback_Description *cb = NULL; + Eo_Callback_Description *cb = NULL; EINA_INLIST_FOREACH_SAFE(obj->callbacks, initr, cb) { - _eobj_callback_remove(obj, cb); + _eo_callback_remove(obj, cb); } } static void -_eobj_callbacks_clear(Eobj *obj) +_eo_callbacks_clear(Eo *obj) { Eina_Inlist *itn; - Eobj_Callback_Description *cb = NULL; + Eo_Callback_Description *cb = NULL; /* Abort if we are currently walking the list. */ if (obj->walking_list > 0) @@ -1368,7 +1368,7 @@ _eobj_callbacks_clear(Eobj *obj) { if (cb->delete_me) { - _eobj_callback_remove(obj, cb); + _eo_callback_remove(obj, cb); } } } @@ -1376,9 +1376,9 @@ _eobj_callbacks_clear(Eobj *obj) static int _callback_priority_cmp(const void *_a, const void *_b) { - const Eobj_Callback_Description *a, *b; - a = (const Eobj_Callback_Description *) _a; - b = (const Eobj_Callback_Description *) _b; + const Eo_Callback_Description *a, *b; + a = (const Eo_Callback_Description *) _a; + b = (const Eo_Callback_Description *) _b; if (a->priority < b->priority) return -1; else @@ -1386,15 +1386,15 @@ _callback_priority_cmp(const void *_a, const void *_b) } EAPI Eina_Bool -eobj_event_callback_priority_add(Eobj *obj, - const Eobj_Event_Description *desc, - Eobj_Callback_Priority priority, - Eobj_Event_Cb func, +eo_event_callback_priority_add(Eo *obj, + const Eo_Event_Description *desc, + Eo_Callback_Priority priority, + Eo_Event_Cb func, const void *data) { - EOBJ_MAGIC_RETURN_VAL(obj, EOBJ_EINA_MAGIC, EINA_FALSE); + EO_MAGIC_RETURN_VAL(obj, EO_EINA_MAGIC, EINA_FALSE); - Eobj_Callback_Description *cb = calloc(1, sizeof(*cb)); + Eo_Callback_Description *cb = calloc(1, sizeof(*cb)); cb->event = desc; cb->func = func; cb->func_data = (void *) data; @@ -1402,18 +1402,18 @@ eobj_event_callback_priority_add(Eobj *obj, obj->callbacks = eina_inlist_sorted_insert(obj->callbacks, EINA_INLIST_GET(cb), _callback_priority_cmp); - eobj_event_callback_call(obj, EOBJ_EV_CALLBACK_ADD, desc); + eo_event_callback_call(obj, EO_EV_CALLBACK_ADD, desc); return EINA_TRUE; } EAPI void * -eobj_event_callback_del_lazy(Eobj *obj, const Eobj_Event_Description *desc, Eobj_Event_Cb func) +eo_event_callback_del_lazy(Eo *obj, const Eo_Event_Description *desc, Eo_Event_Cb func) { - EOBJ_MAGIC_RETURN_VAL(obj, EOBJ_EINA_MAGIC, NULL); + EO_MAGIC_RETURN_VAL(obj, EO_EINA_MAGIC, NULL); void *ret = NULL; - Eobj_Callback_Description *cb; + Eo_Callback_Description *cb; EINA_INLIST_FOREACH(obj->callbacks, cb) { if ((cb->event == desc) && (cb->func == func)) @@ -1422,7 +1422,7 @@ eobj_event_callback_del_lazy(Eobj *obj, const Eobj_Event_Description *desc, Eobj data = cb->func_data; cb->delete_me = EINA_TRUE; - _eobj_callbacks_clear(obj); + _eo_callbacks_clear(obj); ret = data; goto found; } @@ -1431,17 +1431,17 @@ eobj_event_callback_del_lazy(Eobj *obj, const Eobj_Event_Description *desc, Eobj return NULL; found: - eobj_event_callback_call(obj, EOBJ_EV_CALLBACK_DEL, desc); + eo_event_callback_call(obj, EO_EV_CALLBACK_DEL, desc); return ret; } EAPI void * -eobj_event_callback_del(Eobj *obj, const Eobj_Event_Description *desc, Eobj_Event_Cb func, const void *user_data) +eo_event_callback_del(Eo *obj, const Eo_Event_Description *desc, Eo_Event_Cb func, const void *user_data) { - EOBJ_MAGIC_RETURN_VAL(obj, EOBJ_EINA_MAGIC, NULL); + EO_MAGIC_RETURN_VAL(obj, EO_EINA_MAGIC, NULL); void *ret = NULL; - Eobj_Callback_Description *cb; + Eo_Callback_Description *cb; EINA_INLIST_FOREACH(obj->callbacks, cb) { if ((cb->event == desc) && (cb->func == func) && @@ -1451,7 +1451,7 @@ eobj_event_callback_del(Eobj *obj, const Eobj_Event_Description *desc, Eobj_Even data = cb->func_data; cb->delete_me = EINA_TRUE; - _eobj_callbacks_clear(obj); + _eo_callbacks_clear(obj); ret = data; goto found; } @@ -1460,20 +1460,20 @@ eobj_event_callback_del(Eobj *obj, const Eobj_Event_Description *desc, Eobj_Even return NULL; found: - eobj_event_callback_call(obj, EOBJ_EV_CALLBACK_DEL, desc); + eo_event_callback_call(obj, EO_EV_CALLBACK_DEL, desc); return ret; } EAPI Eina_Bool -eobj_event_callback_call(Eobj *obj, const Eobj_Event_Description *desc, +eo_event_callback_call(Eo *obj, const Eo_Event_Description *desc, const void *event_info) { - EOBJ_MAGIC_RETURN_VAL(obj, EOBJ_EINA_MAGIC, EINA_FALSE); + EO_MAGIC_RETURN_VAL(obj, EO_EINA_MAGIC, EINA_FALSE); Eina_Bool ret = EINA_TRUE; - Eobj_Callback_Description *cb; + Eo_Callback_Description *cb; - eobj_ref(obj); + eo_ref(obj); obj->walking_list++; EINA_INLIST_FOREACH(obj->callbacks, cb) @@ -1492,37 +1492,37 @@ eobj_event_callback_call(Eobj *obj, const Eobj_Event_Description *desc, break; } obj->walking_list--; - _eobj_callbacks_clear(obj); - eobj_unref(obj); + _eo_callbacks_clear(obj); + eo_unref(obj); return ret; } static Eina_Bool -_eobj_event_forwarder_callback(void *data, Eobj *obj, const Eobj_Event_Description *desc, void *event_info) +_eo_event_forwarder_callback(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info) { (void) obj; - Eobj *new_obj = (Eobj *) data; - return eobj_event_callback_call(new_obj, desc, event_info); + Eo *new_obj = (Eo *) data; + return eo_event_callback_call(new_obj, desc, event_info); } /* FIXME: Change default priority? Maybe call later? */ EAPI Eina_Bool -eobj_event_callback_forwarder_add(Eobj *obj, const Eobj_Event_Description *desc, Eobj *new_obj) +eo_event_callback_forwarder_add(Eo *obj, const Eo_Event_Description *desc, Eo *new_obj) { - EOBJ_MAGIC_RETURN_VAL(obj, EOBJ_EINA_MAGIC, EINA_FALSE); - EOBJ_MAGIC_RETURN_VAL(new_obj, EOBJ_EINA_MAGIC, EINA_FALSE); + EO_MAGIC_RETURN_VAL(obj, EO_EINA_MAGIC, EINA_FALSE); + EO_MAGIC_RETURN_VAL(new_obj, EO_EINA_MAGIC, EINA_FALSE); - return eobj_event_callback_add(obj, desc, _eobj_event_forwarder_callback, new_obj); + return eo_event_callback_add(obj, desc, _eo_event_forwarder_callback, new_obj); } EAPI Eina_Bool -eobj_event_callback_forwarder_del(Eobj *obj, const Eobj_Event_Description *desc, Eobj *new_obj) +eo_event_callback_forwarder_del(Eo *obj, const Eo_Event_Description *desc, Eo *new_obj) { - EOBJ_MAGIC_RETURN_VAL(obj, EOBJ_EINA_MAGIC, EINA_FALSE); - EOBJ_MAGIC_RETURN_VAL(new_obj, EOBJ_EINA_MAGIC, EINA_FALSE); + EO_MAGIC_RETURN_VAL(obj, EO_EINA_MAGIC, EINA_FALSE); + EO_MAGIC_RETURN_VAL(new_obj, EO_EINA_MAGIC, EINA_FALSE); - eobj_event_callback_del(obj, desc, _eobj_event_forwarder_callback, new_obj); + eo_event_callback_del(obj, desc, _eo_event_forwarder_callback, new_obj); return EINA_TRUE; } diff --git a/legacy/eobj/lib/eo_base_class.c b/legacy/eobj/lib/eo_base_class.c new file mode 100644 index 0000000000..787e48bb1d --- /dev/null +++ b/legacy/eobj/lib/eo_base_class.c @@ -0,0 +1,226 @@ +#include + +#include "Eo.h" +#include "eo_private.h" + +#include "config.h" + +EAPI Eo_Op EO_BASE_BASE_ID = EO_NOOP; + +typedef struct +{ + Eina_Inlist *generic_data; +} Private_Data; + +typedef struct +{ + EINA_INLIST; + Eina_Stringshare *key; + void *data; + eo_base_data_free_func free_func; +} Eo_Generic_Data_Node; + +static void +_eo_generic_data_node_free(Eo_Generic_Data_Node *node) +{ + eina_stringshare_del(node->key); + if (node->free_func) + node->free_func(node->data); + free(node); +} + +static void +_eo_generic_data_del_all(Private_Data *pd) +{ + Eina_Inlist *nnode; + Eo_Generic_Data_Node *node = NULL; + + EINA_INLIST_FOREACH_SAFE(pd->generic_data, nnode, node) + { + pd->generic_data = eina_inlist_remove(pd->generic_data, + EINA_INLIST_GET(node)); + + _eo_generic_data_node_free(node); + } +} + +static void +_data_set(Eo *obj, void *class_data, va_list *list) +{ + Private_Data *pd = class_data; + const char *key = va_arg(*list, const char *); + const void *data = va_arg(*list, const void *); + eo_base_data_free_func free_func = va_arg(*list, eo_base_data_free_func); + + Eo_Generic_Data_Node *node; + + if (!key) return; + + eo_do(obj, eo_base_data_del(key)); + + node = malloc(sizeof(Eo_Generic_Data_Node)); + node->key = eina_stringshare_add(key); + node->data = (void *) data; + node->free_func = free_func; + pd->generic_data = eina_inlist_prepend(pd->generic_data, + EINA_INLIST_GET(node)); +} + +static void +_data_get(const Eo *obj EINA_UNUSED, const void *class_data, va_list *list) +{ + /* We don't really change it... */ + Private_Data *pd = (Private_Data *) class_data; + const char *key = va_arg(*list, const char *); + void **data = va_arg(*list, void **); + Eo_Generic_Data_Node *node; + + if (!data) return; + *data = NULL; + + if (!key) return; + + EINA_INLIST_FOREACH(pd->generic_data, node) + { + if (!strcmp(node->key, key)) + { + pd->generic_data = + eina_inlist_promote(pd->generic_data, EINA_INLIST_GET(node)); + *data = node->data; + return; + } + } +} + +static void +_data_del(Eo *obj EINA_UNUSED, void *class_data, va_list *list) +{ + Private_Data *pd = class_data; + const char *key = va_arg(*list, const char *); + + Eo_Generic_Data_Node *node; + + if (!key) return; + + EINA_INLIST_FOREACH(pd->generic_data, node) + { + if (!strcmp(node->key, key)) + { + pd->generic_data = eina_inlist_remove(pd->generic_data, + EINA_INLIST_GET(node)); + _eo_generic_data_node_free(node); + return; + } + } +} + +/* Weak reference. */ +static Eina_Bool +_eo_weak_ref_cb(void *data, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) +{ + Eo **wref = data; + *wref = NULL; + + return EO_CALLBACK_CONTINUE; +} + +static void +_wref_add(const Eo *obj, const void *class_data EINA_UNUSED, va_list *list) +{ + Eo **wref = va_arg(*list, Eo **); + + *wref = (Eo *) obj; + /* FIXME: The cast and the one in the next func are both bad and should be + * fixed once the event callback functions are fixed. */ + eo_event_callback_add((Eo *) obj, EO_EV_DEL, _eo_weak_ref_cb, wref); +} + +static void +_wref_del(const Eo *obj, const void *class_data EINA_UNUSED, va_list *list) +{ + Eo **wref = va_arg(*list, Eo **); + if (*wref != obj) + { + ERR("Wref is a weak ref to %p, while this function was called on %p.", + *wref, obj); + return; + } + eo_event_callback_del((Eo *) obj, EO_EV_DEL, _eo_weak_ref_cb, wref); +} + +/* EOF Weak reference. */ + + +/* EO_BASE_CLASS stuff */ +#define MY_CLASS EO_BASE_CLASS + +/* FIXME: Set proper type descriptions. */ +EAPI const Eo_Event_Description _EO_EV_CALLBACK_ADD = + EO_EVENT_DESCRIPTION("callback,add", "?", "A callback was added."); +EAPI const Eo_Event_Description _EO_EV_CALLBACK_DEL = + EO_EVENT_DESCRIPTION("callback,del", "?", "A callback was deleted."); +EAPI const Eo_Event_Description _EO_EV_FREE = + EO_EVENT_DESCRIPTION("free", "", "Obj is being freed."); +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) +{ + DBG("%p - %s.", obj, eo_class_name_get(MY_CLASS)); +} + +static void +_destructor(Eo *obj, void *class_data) +{ + DBG("%p - %s.", obj, eo_class_name_get(MY_CLASS)); + + _eo_generic_data_del_all(class_data); +} + +static void +_class_constructor(Eo_Class *klass) +{ + const Eo_Op_Func_Description func_desc[] = { + 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), + EO_OP_FUNC_CONST(EO_BASE_ID(EO_BASE_SUB_ID_WREF_ADD), _wref_add), + EO_OP_FUNC_CONST(EO_BASE_ID(EO_BASE_SUB_ID_WREF_DEL), _wref_del), + EO_OP_FUNC_SENTINEL + }; + + eo_class_funcs_set(klass, func_desc); +} + +static const Eo_Op_Description op_desc[] = { + 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."), + EO_OP_DESCRIPTION_CONST(EO_BASE_SUB_ID_WREF_ADD, "?", "Add a weak ref to the object."), + EO_OP_DESCRIPTION_CONST(EO_BASE_SUB_ID_WREF_DEL, "?", "Delete the weak ref."), + EO_OP_DESCRIPTION_SENTINEL +}; + +static const Eo_Event_Description *event_desc[] = { + EO_EV_CALLBACK_ADD, + EO_EV_CALLBACK_DEL, + EO_EV_FREE, + EO_EV_DEL, + NULL +}; + +static const Eo_Class_Description class_desc = { + "Eo Base", + EO_CLASS_TYPE_REGULAR_NO_INSTANT, + EO_CLASS_DESCRIPTION_OPS(&EO_BASE_BASE_ID, op_desc, EO_BASE_SUB_ID_LAST), + event_desc, + sizeof(Private_Data), + _constructor, + _destructor, + _class_constructor, + NULL +}; + +EO_DEFINE_CLASS(eo_base_class_get, &class_desc, NULL, NULL) + diff --git a/legacy/eobj/lib/eo_private.h b/legacy/eobj/lib/eo_private.h new file mode 100644 index 0000000000..bdaa01ef2f --- /dev/null +++ b/legacy/eobj/lib/eo_private.h @@ -0,0 +1,32 @@ +#ifndef _EO_PRIVATE_H +#define _EO_PRIVATE_H + +extern int _eo_log_dom; + +#ifdef CRITICAL +#undef CRITICAL +#endif +#define CRITICAL(...) EINA_LOG_DOM_CRIT(_eo_log_dom, __VA_ARGS__) + +#ifdef ERR +#undef ERR +#endif +#define ERR(...) EINA_LOG_DOM_ERR(_eo_log_dom, __VA_ARGS__) + +#ifdef WRN +#undef WRN +#endif +#define WRN(...) EINA_LOG_DOM_WARN(_eo_log_dom, __VA_ARGS__) + +#ifdef INF +#undef INF +#endif +#define INF(...) EINA_LOG_DOM_INFO(_eo_log_dom, __VA_ARGS__) + +#ifdef DBG +#undef DBG +#endif +#define DBG(...) EINA_LOG_DOM_DBG(_eo_log_dom, __VA_ARGS__) + +#endif + diff --git a/legacy/eobj/lib/eobj_base_class.c b/legacy/eobj/lib/eobj_base_class.c deleted file mode 100644 index 776bd06b21..0000000000 --- a/legacy/eobj/lib/eobj_base_class.c +++ /dev/null @@ -1,226 +0,0 @@ -#include - -#include "Eobj.h" -#include "eobj_private.h" - -#include "config.h" - -EAPI Eobj_Op EOBJ_BASE_BASE_ID = EOBJ_NOOP; - -typedef struct -{ - Eina_Inlist *generic_data; -} Private_Data; - -typedef struct -{ - EINA_INLIST; - Eina_Stringshare *key; - void *data; - eobj_base_data_free_func free_func; -} Eobj_Generic_Data_Node; - -static void -_eobj_generic_data_node_free(Eobj_Generic_Data_Node *node) -{ - eina_stringshare_del(node->key); - if (node->free_func) - node->free_func(node->data); - free(node); -} - -static void -_eobj_generic_data_del_all(Private_Data *pd) -{ - Eina_Inlist *nnode; - Eobj_Generic_Data_Node *node = NULL; - - EINA_INLIST_FOREACH_SAFE(pd->generic_data, nnode, node) - { - pd->generic_data = eina_inlist_remove(pd->generic_data, - EINA_INLIST_GET(node)); - - _eobj_generic_data_node_free(node); - } -} - -static void -_data_set(Eobj *obj, void *class_data, va_list *list) -{ - Private_Data *pd = class_data; - const char *key = va_arg(*list, const char *); - const void *data = va_arg(*list, const void *); - eobj_base_data_free_func free_func = va_arg(*list, eobj_base_data_free_func); - - Eobj_Generic_Data_Node *node; - - if (!key) return; - - eobj_do(obj, eobj_base_data_del(key)); - - node = malloc(sizeof(Eobj_Generic_Data_Node)); - node->key = eina_stringshare_add(key); - node->data = (void *) data; - node->free_func = free_func; - pd->generic_data = eina_inlist_prepend(pd->generic_data, - EINA_INLIST_GET(node)); -} - -static void -_data_get(const Eobj *obj EINA_UNUSED, const void *class_data, va_list *list) -{ - /* We don't really change it... */ - Private_Data *pd = (Private_Data *) class_data; - const char *key = va_arg(*list, const char *); - void **data = va_arg(*list, void **); - Eobj_Generic_Data_Node *node; - - if (!data) return; - *data = NULL; - - if (!key) return; - - EINA_INLIST_FOREACH(pd->generic_data, node) - { - if (!strcmp(node->key, key)) - { - pd->generic_data = - eina_inlist_promote(pd->generic_data, EINA_INLIST_GET(node)); - *data = node->data; - return; - } - } -} - -static void -_data_del(Eobj *obj EINA_UNUSED, void *class_data, va_list *list) -{ - Private_Data *pd = class_data; - const char *key = va_arg(*list, const char *); - - Eobj_Generic_Data_Node *node; - - if (!key) return; - - EINA_INLIST_FOREACH(pd->generic_data, node) - { - if (!strcmp(node->key, key)) - { - pd->generic_data = eina_inlist_remove(pd->generic_data, - EINA_INLIST_GET(node)); - _eobj_generic_data_node_free(node); - return; - } - } -} - -/* Weak reference. */ -static Eina_Bool -_eobj_weak_ref_cb(void *data, Eobj *obj EINA_UNUSED, const Eobj_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) -{ - Eobj **wref = data; - *wref = NULL; - - return EOBJ_CALLBACK_CONTINUE; -} - -static void -_wref_add(const Eobj *obj, const void *class_data EINA_UNUSED, va_list *list) -{ - Eobj **wref = va_arg(*list, Eobj **); - - *wref = (Eobj *) obj; - /* FIXME: The cast and the one in the next func are both bad and should be - * fixed once the event callback functions are fixed. */ - eobj_event_callback_add((Eobj *) obj, EOBJ_EV_DEL, _eobj_weak_ref_cb, wref); -} - -static void -_wref_del(const Eobj *obj, const void *class_data EINA_UNUSED, va_list *list) -{ - Eobj **wref = va_arg(*list, Eobj **); - if (*wref != obj) - { - ERR("Wref is a weak ref to %p, while this function was called on %p.", - *wref, obj); - return; - } - eobj_event_callback_del((Eobj *) obj, EOBJ_EV_DEL, _eobj_weak_ref_cb, wref); -} - -/* EOF Weak reference. */ - - -/* EOBJ_BASE_CLASS stuff */ -#define MY_CLASS EOBJ_BASE_CLASS - -/* FIXME: Set proper type descriptions. */ -EAPI const Eobj_Event_Description _EOBJ_EV_CALLBACK_ADD = - EOBJ_EVENT_DESCRIPTION("callback,add", "?", "A callback was added."); -EAPI const Eobj_Event_Description _EOBJ_EV_CALLBACK_DEL = - EOBJ_EVENT_DESCRIPTION("callback,del", "?", "A callback was deleted."); -EAPI const Eobj_Event_Description _EOBJ_EV_FREE = - EOBJ_EVENT_DESCRIPTION("free", "", "Obj is being freed."); -EAPI const Eobj_Event_Description _EOBJ_EV_DEL = - EOBJ_EVENT_DESCRIPTION("del", "", "Obj is being deleted."); - -static void -_constructor(Eobj *obj, void *class_data EINA_UNUSED) -{ - DBG("%p - %s.", obj, eobj_class_name_get(MY_CLASS)); -} - -static void -_destructor(Eobj *obj, void *class_data) -{ - DBG("%p - %s.", obj, eobj_class_name_get(MY_CLASS)); - - _eobj_generic_data_del_all(class_data); -} - -static void -_class_constructor(Eobj_Class *klass) -{ - const Eobj_Op_Func_Description func_desc[] = { - EOBJ_OP_FUNC(EOBJ_BASE_ID(EOBJ_BASE_SUB_ID_DATA_SET), _data_set), - EOBJ_OP_FUNC_CONST(EOBJ_BASE_ID(EOBJ_BASE_SUB_ID_DATA_GET), _data_get), - EOBJ_OP_FUNC(EOBJ_BASE_ID(EOBJ_BASE_SUB_ID_DATA_DEL), _data_del), - EOBJ_OP_FUNC_CONST(EOBJ_BASE_ID(EOBJ_BASE_SUB_ID_WREF_ADD), _wref_add), - EOBJ_OP_FUNC_CONST(EOBJ_BASE_ID(EOBJ_BASE_SUB_ID_WREF_DEL), _wref_del), - EOBJ_OP_FUNC_SENTINEL - }; - - eobj_class_funcs_set(klass, func_desc); -} - -static const Eobj_Op_Description op_desc[] = { - EOBJ_OP_DESCRIPTION(EOBJ_BASE_SUB_ID_DATA_SET, "?", "Set data for key."), - EOBJ_OP_DESCRIPTION_CONST(EOBJ_BASE_SUB_ID_DATA_GET, "?", "Get data for key."), - EOBJ_OP_DESCRIPTION(EOBJ_BASE_SUB_ID_DATA_DEL, "?", "Del key."), - EOBJ_OP_DESCRIPTION_CONST(EOBJ_BASE_SUB_ID_WREF_ADD, "?", "Add a weak ref to the object."), - EOBJ_OP_DESCRIPTION_CONST(EOBJ_BASE_SUB_ID_WREF_DEL, "?", "Delete the weak ref."), - EOBJ_OP_DESCRIPTION_SENTINEL -}; - -static const Eobj_Event_Description *event_desc[] = { - EOBJ_EV_CALLBACK_ADD, - EOBJ_EV_CALLBACK_DEL, - EOBJ_EV_FREE, - EOBJ_EV_DEL, - NULL -}; - -static const Eobj_Class_Description class_desc = { - "Eobj Base", - EOBJ_CLASS_TYPE_REGULAR_NO_INSTANT, - EOBJ_CLASS_DESCRIPTION_OPS(&EOBJ_BASE_BASE_ID, op_desc, EOBJ_BASE_SUB_ID_LAST), - event_desc, - sizeof(Private_Data), - _constructor, - _destructor, - _class_constructor, - NULL -}; - -EOBJ_DEFINE_CLASS(eobj_base_class_get, &class_desc, NULL, NULL) - diff --git a/legacy/eobj/lib/eobj_private.h b/legacy/eobj/lib/eobj_private.h deleted file mode 100644 index 83e2ce72bd..0000000000 --- a/legacy/eobj/lib/eobj_private.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef _EOBJ_PRIVATE_H -#define _EOBJ_PRIVATE_H - -extern int _eobj_log_dom; - -#ifdef CRITICAL -#undef CRITICAL -#endif -#define CRITICAL(...) EINA_LOG_DOM_CRIT(_eobj_log_dom, __VA_ARGS__) - -#ifdef ERR -#undef ERR -#endif -#define ERR(...) EINA_LOG_DOM_ERR(_eobj_log_dom, __VA_ARGS__) - -#ifdef WRN -#undef WRN -#endif -#define WRN(...) EINA_LOG_DOM_WARN(_eobj_log_dom, __VA_ARGS__) - -#ifdef INF -#undef INF -#endif -#define INF(...) EINA_LOG_DOM_INFO(_eobj_log_dom, __VA_ARGS__) - -#ifdef DBG -#undef DBG -#endif -#define DBG(...) EINA_LOG_DOM_DBG(_eobj_log_dom, __VA_ARGS__) - -#endif - diff --git a/legacy/eobj/tests/CMakeLists.txt b/legacy/eobj/tests/CMakeLists.txt index 10f8135770..88befcff8d 100644 --- a/legacy/eobj/tests/CMakeLists.txt +++ b/legacy/eobj/tests/CMakeLists.txt @@ -1,14 +1,14 @@ if (CHECK_ENABLED) - LIST(APPEND EOBJ_SUITE_CC_SOURCES - eobj_suite.c - eobj_test_init.c - eobj_test_general.c - eobj_test_class_errors.c + LIST(APPEND EO_SUITE_CC_SOURCES + eo_suite.c + eo_test_init.c + eo_test_general.c + eo_test_class_errors.c class_simple.c ) - add_executable(eobj_suite ${EOBJ_SUITE_CC_SOURCES}) + add_executable(eo_suite ${EO_SUITE_CC_SOURCES}) include_directories( ${EINA_INCLUDE_DIRS} @@ -16,14 +16,14 @@ if (CHECK_ENABLED) ${CHECK_INCLUDE_DIRS} ) - get_target_property(eobj_LIB_FILE eobj LOCATION) - target_link_libraries(eobj_suite + get_target_property(eo_LIB_FILE eo LOCATION) + target_link_libraries(eo_suite ${EINA_LIBRARIES} ${EINA_LDFLAGS_OTHER} - ${eobj_LIB_FILE} + ${eo_LIB_FILE} ${CHECK_LIBRARIES} ) - add_test(eobj_suite eobj_suite) - add_dependencies(check eobj_suite) + add_test(eo_suite eo_suite) + add_dependencies(check eo_suite) endif (CHECK_ENABLED) diff --git a/legacy/eobj/tests/class_simple.c b/legacy/eobj/tests/class_simple.c index aba52ff919..889be040af 100644 --- a/legacy/eobj/tests/class_simple.c +++ b/legacy/eobj/tests/class_simple.c @@ -1,52 +1,52 @@ -#include "Eobj.h" +#include "Eo.h" #include "class_simple.h" #include "config.h" #define MY_CLASS SIMPLE_CLASS -EAPI Eobj_Op SIMPLE_BASE_ID = 0; +EAPI Eo_Op SIMPLE_BASE_ID = 0; static void -_a_set(Eobj *obj EINA_UNUSED, void *class_data, va_list *list) +_a_set(Eo *obj EINA_UNUSED, void *class_data, va_list *list) { Simple_Public_Data *pd = class_data; int a; a = va_arg(*list, int); - printf("%s %d\n", eobj_class_name_get(MY_CLASS), a); + printf("%s %d\n", eo_class_name_get(MY_CLASS), a); pd->a = a; } static void -_a_print(const Eobj *obj EINA_UNUSED, const void *class_data, va_list *list) +_a_print(const Eo *obj EINA_UNUSED, const void *class_data, va_list *list) { const Simple_Public_Data *pd = class_data; (void) list; - printf("Print %s %d\n", eobj_class_name_get(MY_CLASS), pd->a); + printf("Print %s %d\n", eo_class_name_get(MY_CLASS), pd->a); } static void -_class_constructor(Eobj_Class *klass) +_class_constructor(Eo_Class *klass) { - const Eobj_Op_Func_Description func_desc[] = { - EOBJ_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_A_SET), _a_set), - EOBJ_OP_FUNC_CONST(SIMPLE_ID(SIMPLE_SUB_ID_A_PRINT), _a_print), - EOBJ_OP_FUNC_SENTINEL + const Eo_Op_Func_Description func_desc[] = { + EO_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_A_SET), _a_set), + EO_OP_FUNC_CONST(SIMPLE_ID(SIMPLE_SUB_ID_A_PRINT), _a_print), + EO_OP_FUNC_SENTINEL }; - eobj_class_funcs_set(klass, func_desc); + eo_class_funcs_set(klass, func_desc); } -static const Eobj_Op_Description op_desc[] = { - EOBJ_OP_DESCRIPTION(SIMPLE_SUB_ID_A_SET, "i", "Set property A"), - EOBJ_OP_DESCRIPTION_CONST(SIMPLE_SUB_ID_A_PRINT, "", "Print property A"), - EOBJ_OP_DESCRIPTION_SENTINEL +static const Eo_Op_Description op_desc[] = { + EO_OP_DESCRIPTION(SIMPLE_SUB_ID_A_SET, "i", "Set property A"), + EO_OP_DESCRIPTION_CONST(SIMPLE_SUB_ID_A_PRINT, "", "Print property A"), + EO_OP_DESCRIPTION_SENTINEL }; -static const Eobj_Class_Description class_desc = { +static const Eo_Class_Description class_desc = { "Simple", - EOBJ_CLASS_TYPE_REGULAR, - EOBJ_CLASS_DESCRIPTION_OPS(&SIMPLE_BASE_ID, op_desc, SIMPLE_SUB_ID_LAST), + EO_CLASS_TYPE_REGULAR, + EO_CLASS_DESCRIPTION_OPS(&SIMPLE_BASE_ID, op_desc, SIMPLE_SUB_ID_LAST), NULL, sizeof(Simple_Public_Data), NULL, @@ -55,5 +55,5 @@ static const Eobj_Class_Description class_desc = { NULL }; -EOBJ_DEFINE_CLASS(simple_class_get, &class_desc, EOBJ_BASE_CLASS, NULL) +EO_DEFINE_CLASS(simple_class_get, &class_desc, EO_BASE_CLASS, NULL) diff --git a/legacy/eobj/tests/class_simple.h b/legacy/eobj/tests/class_simple.h index 64d15b6e8b..c2c8766afd 100644 --- a/legacy/eobj/tests/class_simple.h +++ b/legacy/eobj/tests/class_simple.h @@ -1,9 +1,9 @@ #ifndef SIMPLE_H #define SIMPLE_H -#include "Eobj.h" +#include "Eo.h" -extern EAPI Eobj_Op SIMPLE_BASE_ID; +extern EAPI Eo_Op SIMPLE_BASE_ID; enum { SIMPLE_SUB_ID_A_SET, @@ -18,13 +18,13 @@ typedef struct #define SIMPLE_ID(sub_id) (SIMPLE_BASE_ID + sub_id) -#define simple_a_set(a) SIMPLE_ID(SIMPLE_SUB_ID_A_SET), EOBJ_TYPECHECK(int, a) +#define simple_a_set(a) SIMPLE_ID(SIMPLE_SUB_ID_A_SET), EO_TYPECHECK(int, a) #define simple_a_print() SIMPLE_ID(SIMPLE_SUB_ID_A_PRINT) -extern const Eobj_Event_Description _SIG_A_CHANGED; +extern const Eo_Event_Description _SIG_A_CHANGED; #define SIG_A_CHANGED (&(_SIG_A_CHANGED)) #define SIMPLE_CLASS simple_class_get() -const Eobj_Class *simple_class_get(void) EINA_CONST; +const Eo_Class *simple_class_get(void) EINA_CONST; #endif diff --git a/legacy/eobj/tests/eobj_suite.c b/legacy/eobj/tests/eo_suite.c similarity index 77% rename from legacy/eobj/tests/eobj_suite.c rename to legacy/eobj/tests/eo_suite.c index acd06ae85f..5291a7b5d5 100644 --- a/legacy/eobj/tests/eobj_suite.c +++ b/legacy/eobj/tests/eo_suite.c @@ -5,29 +5,29 @@ #include #include -#include "Eobj.h" +#include "Eo.h" -#include "eobj_suite.h" +#include "eo_suite.h" -typedef struct _Eobj_Test_Case Eobj_Test_Case; +typedef struct _Eo_Test_Case Eo_Test_Case; -struct _Eobj_Test_Case +struct _Eo_Test_Case { const char *test_case; void (*build)(TCase *tc); }; -static const Eobj_Test_Case etc[] = { - { "Eobj init", eobj_test_init }, - { "Eobj general", eobj_test_general }, - { "Eobj class errors", eobj_test_class_errors }, +static const Eo_Test_Case etc[] = { + { "Eo init", eo_test_init }, + { "Eo general", eo_test_general }, + { "Eo class errors", eo_test_class_errors }, { NULL, NULL } }; static void _list_tests(void) { - const Eobj_Test_Case *itr; + const Eo_Test_Case *itr; itr = etc; fputs("Available Test Cases:\n", stderr); @@ -47,13 +47,13 @@ _use_test(int argc, const char **argv, const char *test_case) } static Suite * -eobj_suite_build(int argc, const char **argv) +eo_suite_build(int argc, const char **argv) { TCase *tc; Suite *s; int i; - s = suite_create("Eobj"); + s = suite_create("Eo"); for (i = 0; etc[i].test_case; ++i) { @@ -92,7 +92,7 @@ main(int argc, char **argv) return 0; } - s = eobj_suite_build(argc - 1, (const char **)argv + 1); + s = eo_suite_build(argc - 1, (const char **)argv + 1); sr = srunner_create(s); srunner_run_all(sr, CK_ENV); diff --git a/legacy/eobj/tests/eo_suite.h b/legacy/eobj/tests/eo_suite.h new file mode 100644 index 0000000000..9d79f42f8e --- /dev/null +++ b/legacy/eobj/tests/eo_suite.h @@ -0,0 +1,11 @@ +#ifndef _EO_SUITE_H +#define _EO_SUITE_H + +#include + +void eo_test_init(TCase *tc); +void eo_test_general(TCase *tc); +void eo_test_class_errors(TCase *tc); + + +#endif /* _EO_SUITE_H */ diff --git a/legacy/eobj/tests/eo_test_class_errors.c b/legacy/eobj/tests/eo_test_class_errors.c new file mode 100644 index 0000000000..d2ed29f0fe --- /dev/null +++ b/legacy/eobj/tests/eo_test_class_errors.c @@ -0,0 +1,362 @@ +#include "config.h" + +#include + +#include "eo_suite.h" +#include "Eo.h" + +#include "class_simple.h" + +START_TEST(eo_incomplete_desc) +{ + eo_init(); + + const Eo_Class *klass; + static Eo_Op TMP_BASE_ID = EO_NOOP; + + enum { + TEST_SUB_ID_FOO, + TEST_SUB_ID_FOO2, + TEST_SUB_ID_LAST + }; + + static const Eo_Op_Description op_desc[] = { + EO_OP_DESCRIPTION(TEST_SUB_ID_FOO, "i", "Foo"), + EO_OP_DESCRIPTION(TEST_SUB_ID_FOO2, "i", "Foo2"), + EO_OP_DESCRIPTION_SENTINEL + }; + + static const Eo_Op_Description op_desc_wrong[] = { + EO_OP_DESCRIPTION(TEST_SUB_ID_FOO2, "i", "Foo2"), + EO_OP_DESCRIPTION(TEST_SUB_ID_FOO, "i", "Foo"), + EO_OP_DESCRIPTION_SENTINEL + }; + + /* XXX: In real life this should be const, this is just for testing. */ + static Eo_Class_Description class_desc = { + "Simple", + EO_CLASS_TYPE_REGULAR, + EO_CLASS_DESCRIPTION_OPS(NULL, op_desc, 1), + NULL, + 0, + NULL, + NULL, + NULL, + NULL + }; + + klass = eo_class_new(&class_desc, NULL, NULL); + fail_if(klass); + + class_desc.ops.base_op_id = &TMP_BASE_ID; + class_desc.ops.descs = NULL; + + klass = eo_class_new(&class_desc, NULL, NULL); + fail_if(klass); + + class_desc.ops.descs = op_desc; + class_desc.ops.count = TEST_SUB_ID_LAST + 1; + + klass = eo_class_new(&class_desc, NULL, NULL); + fail_if(klass); + + class_desc.ops.count = 0; + + klass = eo_class_new(&class_desc, NULL, NULL); + fail_if(klass); + + class_desc.ops.count = TEST_SUB_ID_LAST; + class_desc.ops.descs = op_desc_wrong; + + klass = eo_class_new(&class_desc, NULL, NULL); + fail_if(klass); + + class_desc.ops.descs = op_desc; + class_desc.name = NULL; + + klass = eo_class_new(&class_desc, NULL, NULL); + fail_if(klass); + + class_desc.name = "Simple"; + + + klass = eo_class_new(NULL, NULL, NULL); + fail_if(klass); + + /* Should create a class. */ + klass = eo_class_new(&class_desc, NULL, NULL); + fail_if(!klass); + + (void) klass; + + eo_shutdown(); +} +END_TEST + +START_TEST(eo_inherit_errors) +{ + eo_init(); + + const Eo_Class *klass; + const Eo_Class *klass_mixin; + const Eo_Class *klass_simple; + + static const Eo_Class_Description class_desc_simple = { + "Simple", + EO_CLASS_TYPE_REGULAR, + EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), + NULL, + 0, + NULL, + NULL, + NULL, + NULL + }; + + static const Eo_Class_Description class_desc_mixin = { + "Mixin", + EO_CLASS_TYPE_MIXIN, + EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), + NULL, + 0, + NULL, + NULL, + NULL, + NULL + }; + + static Eo_Class_Description class_desc = { + "General", + EO_CLASS_TYPE_MIXIN, + EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), + NULL, + 0, + NULL, + NULL, + NULL, + NULL + }; + + klass_mixin = eo_class_new(&class_desc_mixin, NULL, NULL); + fail_if(!klass_mixin); + + klass_simple = eo_class_new(&class_desc_simple, NULL, NULL); + fail_if(!klass_simple); + + klass = eo_class_new(&class_desc, klass_simple, NULL); + fail_if(klass); + + class_desc.type = EO_CLASS_TYPE_REGULAR; + + klass = eo_class_new(&class_desc, klass_mixin, NULL); + fail_if(klass); + + (void) klass; + + eo_shutdown(); +} +END_TEST + +START_TEST(eo_inconsistent_mro) +{ + eo_init(); + + const Eo_Class *klass; + const Eo_Class *klass_mixin; + const Eo_Class *klass_mixin2; + const Eo_Class *klass_mixin3; + + static const Eo_Class_Description class_desc_simple = { + "Simple", + EO_CLASS_TYPE_REGULAR, + EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), + NULL, + 0, + NULL, + NULL, + NULL, + NULL + }; + + static const Eo_Class_Description class_desc_mixin = { + "Mixin", + EO_CLASS_TYPE_MIXIN, + EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), + NULL, + 0, + NULL, + NULL, + NULL, + NULL + }; + + static const Eo_Class_Description class_desc_mixin2 = { + "Mixin2", + EO_CLASS_TYPE_MIXIN, + EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), + NULL, + 0, + NULL, + NULL, + NULL, + NULL + }; + + static const Eo_Class_Description class_desc_mixin3 = { + "Mixin3", + EO_CLASS_TYPE_MIXIN, + EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), + NULL, + 0, + NULL, + NULL, + NULL, + NULL + }; + + klass_mixin = eo_class_new(&class_desc_mixin, NULL, NULL); + fail_if(!klass_mixin); + + klass_mixin2 = eo_class_new(&class_desc_mixin2, klass_mixin, NULL); + fail_if(!klass_mixin2); + + klass_mixin3 = eo_class_new(&class_desc_mixin3, klass_mixin, NULL); + fail_if(!klass_mixin3); + + klass = eo_class_new(&class_desc_simple, EO_BASE_CLASS, klass_mixin, klass_mixin2, NULL); + fail_if(klass); + + klass = eo_class_new(&class_desc_simple, EO_BASE_CLASS, klass_mixin2, klass_mixin, NULL); + fail_if(!klass); + + klass = eo_class_new(&class_desc_simple, EO_BASE_CLASS, klass_mixin2, klass_mixin3, NULL); + fail_if(!klass); + + eo_shutdown(); +} +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) +{ + eo_init(); + + const Eo_Class *klass; + + static Eo_Class_Description class_desc = { + "Interface", + EO_CLASS_TYPE_INTERFACE, + EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), + NULL, + 10, + NULL, + NULL, + NULL, + NULL + }; + + klass = eo_class_new(&class_desc, NULL, NULL); + fail_if(klass); + + class_desc.data_size = 0; + class_desc.constructor = _stub_constructor; + + klass = eo_class_new(&class_desc, NULL, NULL); + fail_if(klass); + + class_desc.constructor = NULL; + class_desc.destructor = _stub_constructor; + + klass = eo_class_new(&class_desc, NULL, NULL); + fail_if(klass); + + class_desc.destructor = NULL; + class_desc.class_constructor = _stub_class_constructor; + + klass = eo_class_new(&class_desc, NULL, NULL); + fail_if(klass); + + class_desc.class_constructor = NULL; + class_desc.class_destructor = _stub_class_constructor; + + klass = eo_class_new(&class_desc, NULL, NULL); + fail_if(klass); + + class_desc.class_destructor = NULL; + + klass = eo_class_new(&class_desc, NULL, NULL); + fail_if(!klass); + + eo_shutdown(); +} +END_TEST + +static int _const_ops_counter = 0; + +static void +_const_ops_a_set(const Eo *obj EINA_UNUSED, const void *class_data EINA_UNUSED, va_list *list) +{ + int a = va_arg(*list, int); + (void) a; + _const_ops_counter++; +} + +static void +_const_ops_a_print(Eo *obj EINA_UNUSED, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED) +{ + _const_ops_counter++; +} + +static void +_const_ops_class_constructor(Eo_Class *klass) +{ + const Eo_Op_Func_Description func_desc[] = { + EO_OP_FUNC_CONST(SIMPLE_ID(SIMPLE_SUB_ID_A_SET), _const_ops_a_set), + EO_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_A_PRINT), _const_ops_a_print), + EO_OP_FUNC_SENTINEL + }; + + eo_class_funcs_set(klass, func_desc); +} + +START_TEST(eo_const_ops) +{ + eo_init(); + + const Eo_Class *klass; + + static Eo_Class_Description class_desc = { + "Simple", + EO_CLASS_TYPE_REGULAR, + EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), + NULL, + 0, + NULL, + NULL, + _const_ops_class_constructor, + NULL + }; + + klass = eo_class_new(&class_desc, SIMPLE_CLASS, NULL); + fail_if(!klass); + + Eo *obj = eo_add(klass, NULL); + eo_do(obj, simple_a_set(7), simple_a_print()); + fail_if(_const_ops_counter != 0); + + eo_unref(obj); + + eo_shutdown(); +} +END_TEST + +void eo_test_class_errors(TCase *tc) +{ + tcase_add_test(tc, eo_incomplete_desc); + tcase_add_test(tc, eo_inherit_errors); + tcase_add_test(tc, eo_inconsistent_mro); + tcase_add_test(tc, eo_bad_interface); + tcase_add_test(tc, eo_const_ops); +} diff --git a/legacy/eobj/tests/eo_test_general.c b/legacy/eobj/tests/eo_test_general.c new file mode 100644 index 0000000000..ff4dcfd03c --- /dev/null +++ b/legacy/eobj/tests/eo_test_general.c @@ -0,0 +1,327 @@ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include + +#include "eo_suite.h" +#include "Eo.h" + +#include "class_simple.h" + +START_TEST(eo_simple) +{ + eo_init(); + Eo *obj = eo_add(EO_BASE_CLASS, NULL); + fail_if(obj); + + eo_shutdown(); +} +END_TEST + +START_TEST(eo_refs) +{ + eo_init(); + Eo *obj = eo_add(SIMPLE_CLASS, NULL); + Eo *obj2 = eo_add(SIMPLE_CLASS, NULL); + Eo *obj3 = eo_add(SIMPLE_CLASS, NULL); + + eo_xref(obj, obj2); + fail_if(eo_ref_get(obj) != 2); + eo_xref(obj, obj3); + fail_if(eo_ref_get(obj) != 3); + + eo_xunref(obj, obj2); + fail_if(eo_ref_get(obj) != 2); + eo_xunref(obj, obj3); + fail_if(eo_ref_get(obj) != 1); + +#ifndef NDEBUG + eo_xunref(obj, obj3); + fail_if(eo_ref_get(obj) != 1); + + eo_xref(obj, obj2); + fail_if(eo_ref_get(obj) != 2); + + eo_xunref(obj, obj3); + fail_if(eo_ref_get(obj) != 2); + + eo_xunref(obj, obj2); + fail_if(eo_ref_get(obj) != 1); +#endif + + eo_unref(obj); + eo_unref(obj2); + eo_unref(obj3); + + /* Just check it doesn't seg atm. */ + obj = eo_add(SIMPLE_CLASS, NULL); + eo_ref(obj); + eo_del(obj); + eo_del(obj); + + eo_shutdown(); +} +END_TEST + +START_TEST(eo_weak_reference) +{ + eo_init(); + + Eo *obj = eo_add(SIMPLE_CLASS, NULL); + Eo *wref; + eo_do(obj, eo_wref_add(&wref)); + fail_if(!wref); + + eo_unref(obj); + fail_if(wref); + + obj = eo_add(SIMPLE_CLASS, NULL); + eo_do(obj, eo_wref_add(&wref)); + + eo_ref(obj); + fail_if(!wref); + + eo_del(obj); + fail_if(wref); + + eo_unref(obj); + fail_if(wref); + + obj = eo_add(SIMPLE_CLASS, NULL); + + eo_do(obj, eo_wref_add(&wref)); + eo_do(obj, eo_wref_del(&wref)); + + eo_unref(obj); + + + eo_shutdown(); +} +END_TEST + +static void +_a_set(Eo *obj EINA_UNUSED, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED) +{ + fail_if(EINA_TRUE); +} + +static void +_op_errors_class_constructor(Eo_Class *klass) +{ + const Eo_Op_Func_Description func_desc[] = { + EO_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_LAST), _a_set), + EO_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_LAST + 1), _a_set), + EO_OP_FUNC(0x0F010111, _a_set), + EO_OP_FUNC_SENTINEL + }; + + eo_class_funcs_set(klass, func_desc); +} + +START_TEST(eo_op_errors) +{ + eo_init(); + + static const Eo_Class_Description class_desc = { + "Simple", + EO_CLASS_TYPE_REGULAR, + EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), + NULL, + 0, + NULL, + NULL, + _op_errors_class_constructor, + NULL + }; + + const Eo_Class *klass = eo_class_new(&class_desc, SIMPLE_CLASS, NULL); + fail_if(!klass); + + Eo *obj = eo_add(klass, NULL); + + /* Out of bounds op for a legal class. */ + fail_if(eo_do(obj, 0x00010111)); + + /* Ilegal class. */ + fail_if(eo_do(obj, 0x0F010111)); + + fail_if(eo_ref_get(obj) != 1); + + eo_ref(obj); + fail_if(eo_ref_get(obj) != 2); + + eo_ref(obj); + fail_if(eo_ref_get(obj) != 3); + + eo_unref(obj); + fail_if(eo_ref_get(obj) != 2); + + eo_unref(obj); + fail_if(eo_ref_get(obj) != 1); + + eo_unref(obj); + + obj = eo_add(SIMPLE_CLASS, NULL); + fail_if(!eo_do(obj, simple_a_print())); + fail_if(!eo_query(obj, simple_a_print())); + fail_if(eo_query(obj, simple_a_set(1))); + + eo_shutdown(); +} +END_TEST + +static void +_fake_free_func(void *data) +{ + if (!data) + return; + + int *a = data; + ++*a; +} + +START_TEST(eo_generic_data) +{ + eo_init(); + Eo *obj = eo_add(SIMPLE_CLASS, NULL); + void *data; + + eo_do(obj, eo_base_data_set("test1", (void *) 1, NULL)); + eo_do(obj, eo_base_data_get("test1", &data)); + fail_if(1 != (int) data); + eo_do(obj, eo_base_data_del("test1")); + eo_do(obj, eo_base_data_get("test1", &data)); + fail_if(data); + + eo_do(obj, eo_base_data_set("test1", (void *) 1, NULL)); + eo_do(obj, eo_base_data_set("test2", (void *) 2, NULL)); + eo_do(obj, eo_base_data_get("test1", &data)); + fail_if(1 != (int) data); + eo_do(obj, eo_base_data_get("test2", &data)); + fail_if(2 != (int) data); + + eo_do(obj, eo_base_data_get("test2", &data)); + fail_if(2 != (int) data); + eo_do(obj, eo_base_data_del("test2")); + eo_do(obj, eo_base_data_get("test2", &data)); + fail_if(data); + + eo_do(obj, eo_base_data_get("test1", &data)); + fail_if(1 != (int) data); + eo_do(obj, eo_base_data_del("test1")); + eo_do(obj, eo_base_data_get("test1", &data)); + fail_if(data); + + int a = 0; + eo_do(obj, eo_base_data_set("test3", &a, _fake_free_func)); + eo_do(obj, eo_base_data_get("test3", &data)); + fail_if(&a != data); + eo_do(obj, eo_base_data_get("test3", NULL)); + eo_do(obj, eo_base_data_del("test3")); + fail_if(a != 1); + + a = 0; + eo_do(obj, eo_base_data_set("test3", &a, _fake_free_func)); + eo_do(obj, eo_base_data_set("test3", NULL, _fake_free_func)); + fail_if(a != 1); + a = 0; + data = (void *) 123; + eo_do(obj, eo_base_data_set(NULL, &a, _fake_free_func)); + eo_do(obj, eo_base_data_get(NULL, &data)); + fail_if(data); + eo_do(obj, eo_base_data_del(NULL)); + + a = 0; + eo_do(obj, eo_base_data_set("test3", &a, _fake_free_func)); + eo_do(obj, eo_base_data_set("test3", NULL, NULL)); + fail_if(a != 1); + eo_do(obj, eo_base_data_set("test3", &a, _fake_free_func)); + + eo_unref(obj); + fail_if(a != 2); + + eo_shutdown(); +} +END_TEST + +START_TEST(eo_magic_checks) +{ + char buf[sizeof(long)]; /* Just enough to hold eina magic + a bit more. */ + eo_init(); + + memset(buf, 1, sizeof(buf)); + Eo *obj = eo_add((Eo_Class *) buf, NULL); + fail_if(obj); + + obj = eo_add(SIMPLE_CLASS, (Eo *) buf); + fail_if(obj); + + obj = eo_add(SIMPLE_CLASS, NULL); + fail_if(!obj); + + fail_if(eo_do((Eo *) buf, EO_NOOP)); + fail_if(eo_do_super((Eo *) buf, EO_NOOP)); + fail_if(eo_class_get((Eo *) buf)); + fail_if(eo_class_name_get((Eo_Class*) buf)); + eo_class_funcs_set((Eo_Class *) buf, NULL); + + fail_if(eo_class_new(NULL, (Eo_Class *) buf), NULL); + + eo_xref(obj, (Eo *) buf); + eo_xunref(obj, (Eo *) buf); + eo_xref((Eo *) buf, obj); + eo_xunref((Eo *) buf, obj); + + eo_ref((Eo *) buf); + eo_unref((Eo *) buf); + + fail_if(0 != eo_ref_get((Eo *) buf)); + + Eo *wref = NULL; + eo_do((Eo *) buf, eo_wref_add(&wref)); + fail_if(wref); + + eo_del((Eo *) buf); + + fail_if(eo_parent_get((Eo *) buf)); + + eo_constructor_error_set((Eo *) buf); + fail_if(!eo_constructor_error_get((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); + eo_composite_object_attach(obj, (Eo *) buf); + eo_composite_object_detach((Eo *) buf, obj); + eo_composite_object_detach(obj, (Eo *) buf); + eo_composite_is((Eo *) buf); + + fail_if(eo_event_callback_add((Eo *) buf, NULL, NULL, NULL)); + fail_if(eo_event_callback_del_lazy((Eo *) buf, NULL, NULL)); + fail_if(eo_event_callback_del((Eo *) buf, NULL, NULL, NULL)); + fail_if(eo_event_callback_call((Eo *) buf, NULL, NULL)); + + fail_if(eo_event_callback_forwarder_add((Eo *) buf, NULL, obj)); + fail_if(eo_event_callback_forwarder_add(obj, NULL, (Eo *) buf)); + fail_if(eo_event_callback_forwarder_del((Eo *) buf, NULL, obj)); + fail_if(eo_event_callback_forwarder_del(obj, NULL, (Eo *) buf)); + + eo_unref(obj); + + eo_shutdown(); +} +END_TEST + +void eo_test_general(TCase *tc) +{ + tcase_add_test(tc, eo_generic_data); + tcase_add_test(tc, eo_op_errors); + tcase_add_test(tc, eo_simple); + tcase_add_test(tc, eo_weak_reference); + tcase_add_test(tc, eo_refs); + tcase_add_test(tc, eo_magic_checks); +} diff --git a/legacy/eobj/tests/eo_test_init.c b/legacy/eobj/tests/eo_test_init.c new file mode 100644 index 0000000000..851b857f1a --- /dev/null +++ b/legacy/eobj/tests/eo_test_init.c @@ -0,0 +1,22 @@ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include + +#include "eo_suite.h" +#include "Eo.h" + +START_TEST(eo_simple) +{ + fail_if(!eo_init()); /* one init by test suite */ + fail_if(eo_init() != 1); + fail_if(eo_shutdown() != 1); + fail_if(!eo_shutdown()); +} +END_TEST + +void eo_test_init(TCase *tc) +{ + tcase_add_test(tc, eo_simple); +} diff --git a/legacy/eobj/tests/eobj_suite.h b/legacy/eobj/tests/eobj_suite.h deleted file mode 100644 index 252cd6e172..0000000000 --- a/legacy/eobj/tests/eobj_suite.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef _EOBJ_SUITE_H -#define _EOBJ_SUITE_H - -#include - -void eobj_test_init(TCase *tc); -void eobj_test_general(TCase *tc); -void eobj_test_class_errors(TCase *tc); - - -#endif /* _EOBJ_SUITE_H */ diff --git a/legacy/eobj/tests/eobj_test_class_errors.c b/legacy/eobj/tests/eobj_test_class_errors.c deleted file mode 100644 index e9e3768bd0..0000000000 --- a/legacy/eobj/tests/eobj_test_class_errors.c +++ /dev/null @@ -1,362 +0,0 @@ -#include "config.h" - -#include - -#include "eobj_suite.h" -#include "Eobj.h" - -#include "class_simple.h" - -START_TEST(eobj_incomplete_desc) -{ - eobj_init(); - - const Eobj_Class *klass; - static Eobj_Op TMP_BASE_ID = EOBJ_NOOP; - - enum { - TEST_SUB_ID_FOO, - TEST_SUB_ID_FOO2, - TEST_SUB_ID_LAST - }; - - static const Eobj_Op_Description op_desc[] = { - EOBJ_OP_DESCRIPTION(TEST_SUB_ID_FOO, "i", "Foo"), - EOBJ_OP_DESCRIPTION(TEST_SUB_ID_FOO2, "i", "Foo2"), - EOBJ_OP_DESCRIPTION_SENTINEL - }; - - static const Eobj_Op_Description op_desc_wrong[] = { - EOBJ_OP_DESCRIPTION(TEST_SUB_ID_FOO2, "i", "Foo2"), - EOBJ_OP_DESCRIPTION(TEST_SUB_ID_FOO, "i", "Foo"), - EOBJ_OP_DESCRIPTION_SENTINEL - }; - - /* XXX: In real life this should be const, this is just for testing. */ - static Eobj_Class_Description class_desc = { - "Simple", - EOBJ_CLASS_TYPE_REGULAR, - EOBJ_CLASS_DESCRIPTION_OPS(NULL, op_desc, 1), - NULL, - 0, - NULL, - NULL, - NULL, - NULL - }; - - klass = eobj_class_new(&class_desc, NULL, NULL); - fail_if(klass); - - class_desc.ops.base_op_id = &TMP_BASE_ID; - class_desc.ops.descs = NULL; - - klass = eobj_class_new(&class_desc, NULL, NULL); - fail_if(klass); - - class_desc.ops.descs = op_desc; - class_desc.ops.count = TEST_SUB_ID_LAST + 1; - - klass = eobj_class_new(&class_desc, NULL, NULL); - fail_if(klass); - - class_desc.ops.count = 0; - - klass = eobj_class_new(&class_desc, NULL, NULL); - fail_if(klass); - - class_desc.ops.count = TEST_SUB_ID_LAST; - class_desc.ops.descs = op_desc_wrong; - - klass = eobj_class_new(&class_desc, NULL, NULL); - fail_if(klass); - - class_desc.ops.descs = op_desc; - class_desc.name = NULL; - - klass = eobj_class_new(&class_desc, NULL, NULL); - fail_if(klass); - - class_desc.name = "Simple"; - - - klass = eobj_class_new(NULL, NULL, NULL); - fail_if(klass); - - /* Should create a class. */ - klass = eobj_class_new(&class_desc, NULL, NULL); - fail_if(!klass); - - (void) klass; - - eobj_shutdown(); -} -END_TEST - -START_TEST(eobj_inherit_errors) -{ - eobj_init(); - - const Eobj_Class *klass; - const Eobj_Class *klass_mixin; - const Eobj_Class *klass_simple; - - static const Eobj_Class_Description class_desc_simple = { - "Simple", - EOBJ_CLASS_TYPE_REGULAR, - EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), - NULL, - 0, - NULL, - NULL, - NULL, - NULL - }; - - static const Eobj_Class_Description class_desc_mixin = { - "Mixin", - EOBJ_CLASS_TYPE_MIXIN, - EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), - NULL, - 0, - NULL, - NULL, - NULL, - NULL - }; - - static Eobj_Class_Description class_desc = { - "General", - EOBJ_CLASS_TYPE_MIXIN, - EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), - NULL, - 0, - NULL, - NULL, - NULL, - NULL - }; - - klass_mixin = eobj_class_new(&class_desc_mixin, NULL, NULL); - fail_if(!klass_mixin); - - klass_simple = eobj_class_new(&class_desc_simple, NULL, NULL); - fail_if(!klass_simple); - - klass = eobj_class_new(&class_desc, klass_simple, NULL); - fail_if(klass); - - class_desc.type = EOBJ_CLASS_TYPE_REGULAR; - - klass = eobj_class_new(&class_desc, klass_mixin, NULL); - fail_if(klass); - - (void) klass; - - eobj_shutdown(); -} -END_TEST - -START_TEST(eobj_inconsistent_mro) -{ - eobj_init(); - - const Eobj_Class *klass; - const Eobj_Class *klass_mixin; - const Eobj_Class *klass_mixin2; - const Eobj_Class *klass_mixin3; - - static const Eobj_Class_Description class_desc_simple = { - "Simple", - EOBJ_CLASS_TYPE_REGULAR, - EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), - NULL, - 0, - NULL, - NULL, - NULL, - NULL - }; - - static const Eobj_Class_Description class_desc_mixin = { - "Mixin", - EOBJ_CLASS_TYPE_MIXIN, - EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), - NULL, - 0, - NULL, - NULL, - NULL, - NULL - }; - - static const Eobj_Class_Description class_desc_mixin2 = { - "Mixin2", - EOBJ_CLASS_TYPE_MIXIN, - EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), - NULL, - 0, - NULL, - NULL, - NULL, - NULL - }; - - static const Eobj_Class_Description class_desc_mixin3 = { - "Mixin3", - EOBJ_CLASS_TYPE_MIXIN, - EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), - NULL, - 0, - NULL, - NULL, - NULL, - NULL - }; - - klass_mixin = eobj_class_new(&class_desc_mixin, NULL, NULL); - fail_if(!klass_mixin); - - klass_mixin2 = eobj_class_new(&class_desc_mixin2, klass_mixin, NULL); - fail_if(!klass_mixin2); - - klass_mixin3 = eobj_class_new(&class_desc_mixin3, klass_mixin, NULL); - fail_if(!klass_mixin3); - - klass = eobj_class_new(&class_desc_simple, EOBJ_BASE_CLASS, klass_mixin, klass_mixin2, NULL); - fail_if(klass); - - klass = eobj_class_new(&class_desc_simple, EOBJ_BASE_CLASS, klass_mixin2, klass_mixin, NULL); - fail_if(!klass); - - klass = eobj_class_new(&class_desc_simple, EOBJ_BASE_CLASS, klass_mixin2, klass_mixin3, NULL); - fail_if(!klass); - - eobj_shutdown(); -} -END_TEST - -static void _stub_constructor(Eobj *obj EINA_UNUSED, void *data EINA_UNUSED) {} -static void _stub_class_constructor(Eobj_Class *klass EINA_UNUSED) {} - -START_TEST(eobj_bad_interface) -{ - eobj_init(); - - const Eobj_Class *klass; - - static Eobj_Class_Description class_desc = { - "Interface", - EOBJ_CLASS_TYPE_INTERFACE, - EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), - NULL, - 10, - NULL, - NULL, - NULL, - NULL - }; - - klass = eobj_class_new(&class_desc, NULL, NULL); - fail_if(klass); - - class_desc.data_size = 0; - class_desc.constructor = _stub_constructor; - - klass = eobj_class_new(&class_desc, NULL, NULL); - fail_if(klass); - - class_desc.constructor = NULL; - class_desc.destructor = _stub_constructor; - - klass = eobj_class_new(&class_desc, NULL, NULL); - fail_if(klass); - - class_desc.destructor = NULL; - class_desc.class_constructor = _stub_class_constructor; - - klass = eobj_class_new(&class_desc, NULL, NULL); - fail_if(klass); - - class_desc.class_constructor = NULL; - class_desc.class_destructor = _stub_class_constructor; - - klass = eobj_class_new(&class_desc, NULL, NULL); - fail_if(klass); - - class_desc.class_destructor = NULL; - - klass = eobj_class_new(&class_desc, NULL, NULL); - fail_if(!klass); - - eobj_shutdown(); -} -END_TEST - -static int _const_ops_counter = 0; - -static void -_const_ops_a_set(const Eobj *obj EINA_UNUSED, const void *class_data EINA_UNUSED, va_list *list) -{ - int a = va_arg(*list, int); - (void) a; - _const_ops_counter++; -} - -static void -_const_ops_a_print(Eobj *obj EINA_UNUSED, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED) -{ - _const_ops_counter++; -} - -static void -_const_ops_class_constructor(Eobj_Class *klass) -{ - const Eobj_Op_Func_Description func_desc[] = { - EOBJ_OP_FUNC_CONST(SIMPLE_ID(SIMPLE_SUB_ID_A_SET), _const_ops_a_set), - EOBJ_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_A_PRINT), _const_ops_a_print), - EOBJ_OP_FUNC_SENTINEL - }; - - eobj_class_funcs_set(klass, func_desc); -} - -START_TEST(eobj_const_ops) -{ - eobj_init(); - - const Eobj_Class *klass; - - static Eobj_Class_Description class_desc = { - "Simple", - EOBJ_CLASS_TYPE_REGULAR, - EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), - NULL, - 0, - NULL, - NULL, - _const_ops_class_constructor, - NULL - }; - - klass = eobj_class_new(&class_desc, SIMPLE_CLASS, NULL); - fail_if(!klass); - - Eobj *obj = eobj_add(klass, NULL); - eobj_do(obj, simple_a_set(7), simple_a_print()); - fail_if(_const_ops_counter != 0); - - eobj_unref(obj); - - eobj_shutdown(); -} -END_TEST - -void eobj_test_class_errors(TCase *tc) -{ - tcase_add_test(tc, eobj_incomplete_desc); - tcase_add_test(tc, eobj_inherit_errors); - tcase_add_test(tc, eobj_inconsistent_mro); - tcase_add_test(tc, eobj_bad_interface); - tcase_add_test(tc, eobj_const_ops); -} diff --git a/legacy/eobj/tests/eobj_test_general.c b/legacy/eobj/tests/eobj_test_general.c deleted file mode 100644 index 6185f6f89a..0000000000 --- a/legacy/eobj/tests/eobj_test_general.c +++ /dev/null @@ -1,327 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include - -#include "eobj_suite.h" -#include "Eobj.h" - -#include "class_simple.h" - -START_TEST(eobj_simple) -{ - eobj_init(); - Eobj *obj = eobj_add(EOBJ_BASE_CLASS, NULL); - fail_if(obj); - - eobj_shutdown(); -} -END_TEST - -START_TEST(eobj_refs) -{ - eobj_init(); - Eobj *obj = eobj_add(SIMPLE_CLASS, NULL); - Eobj *obj2 = eobj_add(SIMPLE_CLASS, NULL); - Eobj *obj3 = eobj_add(SIMPLE_CLASS, NULL); - - eobj_xref(obj, obj2); - fail_if(eobj_ref_get(obj) != 2); - eobj_xref(obj, obj3); - fail_if(eobj_ref_get(obj) != 3); - - eobj_xunref(obj, obj2); - fail_if(eobj_ref_get(obj) != 2); - eobj_xunref(obj, obj3); - fail_if(eobj_ref_get(obj) != 1); - -#ifndef NDEBUG - eobj_xunref(obj, obj3); - fail_if(eobj_ref_get(obj) != 1); - - eobj_xref(obj, obj2); - fail_if(eobj_ref_get(obj) != 2); - - eobj_xunref(obj, obj3); - fail_if(eobj_ref_get(obj) != 2); - - eobj_xunref(obj, obj2); - fail_if(eobj_ref_get(obj) != 1); -#endif - - eobj_unref(obj); - eobj_unref(obj2); - eobj_unref(obj3); - - /* Just check it doesn't seg atm. */ - obj = eobj_add(SIMPLE_CLASS, NULL); - eobj_ref(obj); - eobj_del(obj); - eobj_del(obj); - - eobj_shutdown(); -} -END_TEST - -START_TEST(eobj_weak_reference) -{ - eobj_init(); - - Eobj *obj = eobj_add(SIMPLE_CLASS, NULL); - Eobj *wref; - eobj_do(obj, eobj_wref_add(&wref)); - fail_if(!wref); - - eobj_unref(obj); - fail_if(wref); - - obj = eobj_add(SIMPLE_CLASS, NULL); - eobj_do(obj, eobj_wref_add(&wref)); - - eobj_ref(obj); - fail_if(!wref); - - eobj_del(obj); - fail_if(wref); - - eobj_unref(obj); - fail_if(wref); - - obj = eobj_add(SIMPLE_CLASS, NULL); - - eobj_do(obj, eobj_wref_add(&wref)); - eobj_do(obj, eobj_wref_del(&wref)); - - eobj_unref(obj); - - - eobj_shutdown(); -} -END_TEST - -static void -_a_set(Eobj *obj EINA_UNUSED, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED) -{ - fail_if(EINA_TRUE); -} - -static void -_op_errors_class_constructor(Eobj_Class *klass) -{ - const Eobj_Op_Func_Description func_desc[] = { - EOBJ_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_LAST), _a_set), - EOBJ_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_LAST + 1), _a_set), - EOBJ_OP_FUNC(0x0F010111, _a_set), - EOBJ_OP_FUNC_SENTINEL - }; - - eobj_class_funcs_set(klass, func_desc); -} - -START_TEST(eobj_op_errors) -{ - eobj_init(); - - static const Eobj_Class_Description class_desc = { - "Simple", - EOBJ_CLASS_TYPE_REGULAR, - EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), - NULL, - 0, - NULL, - NULL, - _op_errors_class_constructor, - NULL - }; - - const Eobj_Class *klass = eobj_class_new(&class_desc, SIMPLE_CLASS, NULL); - fail_if(!klass); - - Eobj *obj = eobj_add(klass, NULL); - - /* Out of bounds op for a legal class. */ - fail_if(eobj_do(obj, 0x00010111)); - - /* Ilegal class. */ - fail_if(eobj_do(obj, 0x0F010111)); - - fail_if(eobj_ref_get(obj) != 1); - - eobj_ref(obj); - fail_if(eobj_ref_get(obj) != 2); - - eobj_ref(obj); - fail_if(eobj_ref_get(obj) != 3); - - eobj_unref(obj); - fail_if(eobj_ref_get(obj) != 2); - - eobj_unref(obj); - fail_if(eobj_ref_get(obj) != 1); - - eobj_unref(obj); - - obj = eobj_add(SIMPLE_CLASS, NULL); - fail_if(!eobj_do(obj, simple_a_print())); - fail_if(!eobj_query(obj, simple_a_print())); - fail_if(eobj_query(obj, simple_a_set(1))); - - eobj_shutdown(); -} -END_TEST - -static void -_fake_free_func(void *data) -{ - if (!data) - return; - - int *a = data; - ++*a; -} - -START_TEST(eobj_generic_data) -{ - eobj_init(); - Eobj *obj = eobj_add(SIMPLE_CLASS, NULL); - void *data; - - eobj_do(obj, eobj_base_data_set("test1", (void *) 1, NULL)); - eobj_do(obj, eobj_base_data_get("test1", &data)); - fail_if(1 != (int) data); - eobj_do(obj, eobj_base_data_del("test1")); - eobj_do(obj, eobj_base_data_get("test1", &data)); - fail_if(data); - - eobj_do(obj, eobj_base_data_set("test1", (void *) 1, NULL)); - eobj_do(obj, eobj_base_data_set("test2", (void *) 2, NULL)); - eobj_do(obj, eobj_base_data_get("test1", &data)); - fail_if(1 != (int) data); - eobj_do(obj, eobj_base_data_get("test2", &data)); - fail_if(2 != (int) data); - - eobj_do(obj, eobj_base_data_get("test2", &data)); - fail_if(2 != (int) data); - eobj_do(obj, eobj_base_data_del("test2")); - eobj_do(obj, eobj_base_data_get("test2", &data)); - fail_if(data); - - eobj_do(obj, eobj_base_data_get("test1", &data)); - fail_if(1 != (int) data); - eobj_do(obj, eobj_base_data_del("test1")); - eobj_do(obj, eobj_base_data_get("test1", &data)); - fail_if(data); - - int a = 0; - eobj_do(obj, eobj_base_data_set("test3", &a, _fake_free_func)); - eobj_do(obj, eobj_base_data_get("test3", &data)); - fail_if(&a != data); - eobj_do(obj, eobj_base_data_get("test3", NULL)); - eobj_do(obj, eobj_base_data_del("test3")); - fail_if(a != 1); - - a = 0; - eobj_do(obj, eobj_base_data_set("test3", &a, _fake_free_func)); - eobj_do(obj, eobj_base_data_set("test3", NULL, _fake_free_func)); - fail_if(a != 1); - a = 0; - data = (void *) 123; - eobj_do(obj, eobj_base_data_set(NULL, &a, _fake_free_func)); - eobj_do(obj, eobj_base_data_get(NULL, &data)); - fail_if(data); - eobj_do(obj, eobj_base_data_del(NULL)); - - a = 0; - eobj_do(obj, eobj_base_data_set("test3", &a, _fake_free_func)); - eobj_do(obj, eobj_base_data_set("test3", NULL, NULL)); - fail_if(a != 1); - eobj_do(obj, eobj_base_data_set("test3", &a, _fake_free_func)); - - eobj_unref(obj); - fail_if(a != 2); - - eobj_shutdown(); -} -END_TEST - -START_TEST(eobj_magic_checks) -{ - char buf[sizeof(long)]; /* Just enough to hold eina magic + a bit more. */ - eobj_init(); - - memset(buf, 1, sizeof(buf)); - Eobj *obj = eobj_add((Eobj_Class *) buf, NULL); - fail_if(obj); - - obj = eobj_add(SIMPLE_CLASS, (Eobj *) buf); - fail_if(obj); - - obj = eobj_add(SIMPLE_CLASS, NULL); - fail_if(!obj); - - fail_if(eobj_do((Eobj *) buf, EOBJ_NOOP)); - fail_if(eobj_do_super((Eobj *) buf, EOBJ_NOOP)); - fail_if(eobj_class_get((Eobj *) buf)); - fail_if(eobj_class_name_get((Eobj_Class*) buf)); - eobj_class_funcs_set((Eobj_Class *) buf, NULL); - - fail_if(eobj_class_new(NULL, (Eobj_Class *) buf), NULL); - - eobj_xref(obj, (Eobj *) buf); - eobj_xunref(obj, (Eobj *) buf); - eobj_xref((Eobj *) buf, obj); - eobj_xunref((Eobj *) buf, obj); - - eobj_ref((Eobj *) buf); - eobj_unref((Eobj *) buf); - - fail_if(0 != eobj_ref_get((Eobj *) buf)); - - Eobj *wref = NULL; - eobj_do((Eobj *) buf, eobj_wref_add(&wref)); - fail_if(wref); - - eobj_del((Eobj *) buf); - - fail_if(eobj_parent_get((Eobj *) buf)); - - eobj_constructor_error_set((Eobj *) buf); - fail_if(!eobj_constructor_error_get((Eobj *) buf)); - - eobj_constructor_super((Eobj *) buf); - eobj_destructor_super((Eobj *) buf); - - fail_if(eobj_data_get((Eobj *) buf, SIMPLE_CLASS)); - - eobj_composite_object_attach((Eobj *) buf, obj); - eobj_composite_object_attach(obj, (Eobj *) buf); - eobj_composite_object_detach((Eobj *) buf, obj); - eobj_composite_object_detach(obj, (Eobj *) buf); - eobj_composite_is((Eobj *) buf); - - fail_if(eobj_event_callback_add((Eobj *) buf, NULL, NULL, NULL)); - fail_if(eobj_event_callback_del_lazy((Eobj *) buf, NULL, NULL)); - fail_if(eobj_event_callback_del((Eobj *) buf, NULL, NULL, NULL)); - fail_if(eobj_event_callback_call((Eobj *) buf, NULL, NULL)); - - fail_if(eobj_event_callback_forwarder_add((Eobj *) buf, NULL, obj)); - fail_if(eobj_event_callback_forwarder_add(obj, NULL, (Eobj *) buf)); - fail_if(eobj_event_callback_forwarder_del((Eobj *) buf, NULL, obj)); - fail_if(eobj_event_callback_forwarder_del(obj, NULL, (Eobj *) buf)); - - eobj_unref(obj); - - eobj_shutdown(); -} -END_TEST - -void eobj_test_general(TCase *tc) -{ - tcase_add_test(tc, eobj_generic_data); - tcase_add_test(tc, eobj_op_errors); - tcase_add_test(tc, eobj_simple); - tcase_add_test(tc, eobj_weak_reference); - tcase_add_test(tc, eobj_refs); - tcase_add_test(tc, eobj_magic_checks); -} diff --git a/legacy/eobj/tests/eobj_test_init.c b/legacy/eobj/tests/eobj_test_init.c deleted file mode 100644 index e6f33070db..0000000000 --- a/legacy/eobj/tests/eobj_test_init.c +++ /dev/null @@ -1,22 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include - -#include "eobj_suite.h" -#include "Eobj.h" - -START_TEST(eobj_simple) -{ - fail_if(!eobj_init()); /* one init by test suite */ - fail_if(eobj_init() != 1); - fail_if(eobj_shutdown() != 1); - fail_if(!eobj_shutdown()); -} -END_TEST - -void eobj_test_init(TCase *tc) -{ - tcase_add_test(tc, eobj_simple); -}