From a3e38d78846c2d4e61e7b57cc6c38461ab7ec900 Mon Sep 17 00:00:00 2001 From: Daniel Zaoui Date: Wed, 5 Mar 2014 13:54:39 +0200 Subject: [PATCH] Eolian: generation of the first Eo file. The first object that we generate with Eolian is Evas_Line, as it is a simple one. Two files are generated during build: - the .eo.c contains the APIs definitions invoking Eo, the Eo functions extracting the parameters and calling the hand written functions and Eo structures to define the objects. These hand written functions are located in e.g evas_object_line.c. - the .eo.h contains the APIs and Eo prototyes. We will continue with the other objects. If you note something wrong, please update us asap: daniel.zaoui@samsung.com yossi.kantor@samsung.com --- .gitignore | 3 + src/Makefile.am | 6 +- src/Makefile_Evas.am | 11 ++- src/lib/evas/Evas_Eo.h | 4 ++ src/lib/evas/canvas/evas_line.eo | 29 ++++++++ src/lib/evas/canvas/evas_object_line.c | 98 +++++--------------------- 6 files changed, 70 insertions(+), 81 deletions(-) create mode 100644 src/lib/evas/canvas/evas_line.eo diff --git a/.gitignore b/.gitignore index 1f5d422f85..5589fb4262 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,9 @@ tags *.gcno *.gcda *.dirstamp +*.eo.c +*.eo.h +*.eo.legacy.h /efl-*-doc.tar.bz2 /ar-lib /stamp-h1 diff --git a/src/Makefile.am b/src/Makefile.am index eb158223b0..07d007aeea 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -3,7 +3,10 @@ AUTOMAKE_OPTIONS = subdir-objects MAINTAINERCLEANFILES = Makefile.in CLEANFILES = BUILT_SOURCES = -EOLIAN_FLAGS = + +EOLIAN_FLAGS = \ + -I$(srcdir)/lib/eo \ + -I$(srcdir)/lib/evas DIST_SUBDIRS = SUBDIRS = @@ -16,6 +19,7 @@ check_PROGRAMS = TESTS = EXTRA_DIST = + EFL_INSTALL_EXEC_HOOK= include Makefile_Efl.am diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am index 9c136a3327..adebb2c97a 100644 --- a/src/Makefile_Evas.am +++ b/src/Makefile_Evas.am @@ -1,6 +1,13 @@ ### Library +BUILT_SOURCES += \ + lib/evas/canvas/evas_line.eo.c \ + lib/evas/canvas/evas_line.eo.h + +EXTRA_DIST += \ + lib/evas/canvas/evas_line.eo + lib_LTLIBRARIES += lib/evas/libevas.la noinst_LTLIBRARIES = @@ -11,7 +18,8 @@ lib/evas/Evas_Common.h \ lib/evas/Evas_Eo.h \ lib/evas/Evas_Legacy.h \ lib/evas/Evas_GL.h \ -lib/evas/Evas_Loader.h +lib/evas/Evas_Loader.h \ +lib/evas/canvas/evas_line.eo.h noinst_HEADERS = \ lib/evas/include/evas_inline.x \ @@ -204,6 +212,7 @@ lib/evas/common/evas_font_ot.h lib_evas_libevas_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \ -I$(top_srcdir)/src/lib/evas/common \ +-I$(top_builddir)/src/lib/evas/canvas \ -I$(top_srcdir)/src/lib/evas/cserve2 \ -I$(top_srcdir)/src/lib/evas/file \ -I$(top_srcdir)/src/lib/evas/include \ diff --git a/src/lib/evas/Evas_Eo.h b/src/lib/evas/Evas_Eo.h index 6e3166eed2..c685ea525b 100644 --- a/src/lib/evas/Evas_Eo.h +++ b/src/lib/evas/Evas_Eo.h @@ -2917,6 +2917,9 @@ enum * * @{ */ +#include "evas_line.eo.h" + +#if 0 #define EVAS_OBJ_LINE_CLASS evas_object_line_class_get() const Eo_Class *evas_object_line_class_get(void) EINA_CONST; @@ -2961,6 +2964,7 @@ enum * @see evas_object_line_xy_get */ #define evas_obj_line_xy_get(x1, y1, x2, y2) EVAS_OBJ_LINE_ID(EVAS_OBJ_LINE_SUB_ID_XY_GET), EO_TYPECHECK(Evas_Coord *, x1), EO_TYPECHECK(Evas_Coord *, y1), EO_TYPECHECK(Evas_Coord *, x2), EO_TYPECHECK(Evas_Coord *, y2) +#endif /** * @} diff --git a/src/lib/evas/canvas/evas_line.eo b/src/lib/evas/canvas/evas_line.eo new file mode 100644 index 0000000000..fd53f4f374 --- /dev/null +++ b/src/lib/evas/canvas/evas_line.eo @@ -0,0 +1,29 @@ +class Evas_Line (Evas_Object) +{ + legacy_prefix: evas_object_line; + properties { + xy { + set { + /*@ + @since 1.8 + + Sets the coordinates of the end points of the given evas line object. */ + } + get { + /*@ + Retrieves the coordinates of the end points of the given evas line object. + second end point. */ + } + values { + Evas_Coord x1; /*@ The X coordinate of the first point. */ + Evas_Coord y1; /*@ The Y coordinate of the first point. */ + Evas_Coord x2; /*@ The X coordinate of the second point. */ + Evas_Coord y2; /*@ The Y coordinate of the second point. */ + } + } + } + implements { + Eo_Base::constructor; + } + +} diff --git a/src/lib/evas/canvas/evas_object_line.c b/src/lib/evas/canvas/evas_object_line.c index f5dae37c78..55dd025f63 100644 --- a/src/lib/evas/canvas/evas_object_line.c +++ b/src/lib/evas/canvas/evas_object_line.c @@ -3,17 +3,15 @@ #include "Eo.h" -EAPI Eo_Op EVAS_OBJ_LINE_BASE_ID = EO_NOOP; - #define MY_CLASS EVAS_OBJ_LINE_CLASS /* private magic number for line objects */ static const char o_type[] = "line"; /* private struct for line object internal data */ -typedef struct _Evas_Object_Line Evas_Object_Line; +typedef struct _Evas_Line_Data Evas_Line_Data; -struct _Evas_Object_Line +struct _Evas_Line_Data { struct { struct { @@ -105,21 +103,11 @@ evas_object_line_add(Evas *e) return eo_obj; } -EAPI void -evas_object_line_xy_set(Evas_Object *eo_obj, Evas_Coord x1, Evas_Coord y1, Evas_Coord x2, Evas_Coord y2) +EOLIAN static void +_evas_line_xy_set(Eo *eo_obj, Evas_Line_Data *_pd, Evas_Coord x1, Evas_Coord y1, Evas_Coord x2, Evas_Coord y2) { - eo_do(eo_obj, evas_obj_line_xy_set(x1, y1, x2, y2)); -} -static void -_line_xy_set(Eo *eo_obj, void *_pd, va_list *list) -{ - Evas_Coord x1 = va_arg(*list, Evas_Coord); - Evas_Coord y1 = va_arg(*list, Evas_Coord); - Evas_Coord x2 = va_arg(*list, Evas_Coord); - Evas_Coord y2 = va_arg(*list, Evas_Coord); - - Evas_Object_Line *o = _pd; + Evas_Line_Data *o = _pd; Evas_Coord min_x, max_x, min_y, max_y; int is, was = 0; @@ -204,28 +192,11 @@ _line_xy_set(Eo *eo_obj, void *_pd, va_list *list) evas_object_inform_call_resize(eo_obj); } -EAPI void -evas_object_line_xy_get(const Evas_Object *eo_obj, Evas_Coord *x1, Evas_Coord *y1, Evas_Coord *x2, Evas_Coord *y2) +EOLIAN static void +_evas_line_xy_get(Eo *eo_obj, Evas_Line_Data *_pd, Evas_Coord *x1, Evas_Coord *y1, Evas_Coord *x2, Evas_Coord *y2) { - MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ); - if (x1) *x1 = 0; - if (y1) *y1 = 0; - if (x2) *x2 = 0; - if (y2) *y2 = 0; - return; - MAGIC_CHECK_END(); - eo_do((Eo *)eo_obj, evas_obj_line_xy_get(x1, y1, x2, y2)); -} + const Evas_Line_Data *o = _pd; -static void -_line_xy_get(Eo *eo_obj, void *_pd, va_list *list) -{ - const Evas_Object_Line *o = _pd; - - Evas_Coord *x1 = va_arg(*list, Evas_Coord *); - Evas_Coord *y1 = va_arg(*list, Evas_Coord *); - Evas_Coord *x2 = va_arg(*list, Evas_Coord *); - Evas_Coord *y2 = va_arg(*list, Evas_Coord *); Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS); if (x1) *x1 = obj->cur->geometry.x + o->cur.x1; @@ -245,11 +216,11 @@ evas_object_line_init(Evas_Object *eo_obj) obj->type = o_type; } -static void -_constructor(Eo *eo_obj, void *class_data, va_list *list EINA_UNUSED) +EOLIAN static void +_evas_line_constructor(Eo *eo_obj, Evas_Line_Data *class_data EINA_UNUSED) { Evas_Object_Protected_Data *obj; - Evas_Object_Line *o; + Evas_Line_Data *o; Eo *parent; eo_do_super(eo_obj, MY_CLASS, eo_constructor()); @@ -274,7 +245,7 @@ evas_object_line_render(Evas_Object *eo_obj EINA_UNUSED, void *type_private_data, void *output, void *context, void *surface, int x, int y, Eina_Bool do_async) { - Evas_Object_Line *o = type_private_data; + Evas_Line_Data *o = type_private_data; /* render object to surface with context, and offxet by x,y */ @@ -305,7 +276,7 @@ evas_object_line_render_pre(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, void *type_private_data) { - Evas_Object_Line *o = type_private_data; + Evas_Line_Data *o = type_private_data; int is_v, was_v; Eina_Bool changed_color = EINA_FALSE; @@ -393,7 +364,7 @@ evas_object_line_render_post(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj EINA_UNUSED, void *type_private_data) { - Evas_Object_Line *o = type_private_data; + Evas_Line_Data *o = type_private_data; /* this moves the current data to the previous state parts of the object */ /* in whatever way is safest for the object. also if we don't need object */ @@ -407,21 +378,21 @@ evas_object_line_render_post(Evas_Object *eo_obj, static unsigned int evas_object_line_id_get(Evas_Object *eo_obj) { - Evas_Object_Line *o = eo_data_scope_get(eo_obj, MY_CLASS); + Evas_Line_Data *o = eo_data_scope_get(eo_obj, MY_CLASS); if (!o) return 0; return MAGIC_OBJ_LINE; } static unsigned int evas_object_line_visual_id_get(Evas_Object *eo_obj) { - Evas_Object_Line *o = eo_data_scope_get(eo_obj, MY_CLASS); + Evas_Line_Data *o = eo_data_scope_get(eo_obj, MY_CLASS); if (!o) return 0; return MAGIC_OBJ_SHAPE; } static void *evas_object_line_engine_data_get(Evas_Object *eo_obj) { - Evas_Object_Line *o = eo_data_scope_get(eo_obj, MY_CLASS); + Evas_Line_Data *o = eo_data_scope_get(eo_obj, MY_CLASS); return o->engine_data; } @@ -474,7 +445,7 @@ evas_object_line_coords_recalc(Evas_Object *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj, void *type_private_data) { - Evas_Object_Line *o = type_private_data; + Evas_Line_Data *o = type_private_data; o->cur.cache.x1 = obj->cur->geometry.x + o->cur.x1; o->cur.cache.y1 = obj->cur->geometry.y + o->cur.y1; @@ -484,35 +455,4 @@ evas_object_line_coords_recalc(Evas_Object *eo_obj EINA_UNUSED, o->cur.cache.object.h = obj->cur->geometry.h; } -static void -_class_constructor(Eo_Class *klass) -{ - const Eo_Op_Func_Description func_desc[] = { - EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor), - EO_OP_FUNC(EVAS_OBJ_LINE_ID(EVAS_OBJ_LINE_SUB_ID_XY_SET), _line_xy_set), - EO_OP_FUNC(EVAS_OBJ_LINE_ID(EVAS_OBJ_LINE_SUB_ID_XY_GET), _line_xy_get), - EO_OP_FUNC_SENTINEL - }; - - eo_class_funcs_set(klass, func_desc); -} - -static const Eo_Op_Description op_desc[] = { - EO_OP_DESCRIPTION(EVAS_OBJ_LINE_SUB_ID_XY_SET, "Sets the coordinates of the end points of the given evas line object."), - EO_OP_DESCRIPTION(EVAS_OBJ_LINE_SUB_ID_XY_GET, "Retrieves the coordinates of the end points of the given evas line object."), - EO_OP_DESCRIPTION_SENTINEL -}; - -static const Eo_Class_Description class_desc = { - EO_VERSION, - "Evas_Line", - EO_CLASS_TYPE_REGULAR, - EO_CLASS_DESCRIPTION_OPS(&EVAS_OBJ_LINE_BASE_ID, op_desc, EVAS_OBJ_LINE_SUB_ID_LAST), - NULL, - sizeof(Evas_Object_Line), - _class_constructor, - NULL -}; - -EO_DEFINE_CLASS(evas_object_line_class_get, &class_desc, EVAS_OBJ_CLASS, NULL); - +#include "evas_line.eo.c" \ No newline at end of file