summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2014-08-01 15:11:28 +0100
committerDaniel Kolesa <d.kolesa@samsung.com>2014-08-04 16:29:13 +0100
commita07e9a6a3663a43981cecb7e138bb4f6185d361c (patch)
tree7ea670c3ff27515360fa1a8582965890c8b6dc67
parent8f2f8921aef862bb194c919312b9eed2f5d341d8 (diff)
downloadefl-a07e9a6a3663a43981cecb7e138bb4f6185d361c.tar.gz
eolian: generate implicit typedef for each class
And use these typedefs instead of just Eo in API.
-rw-r--r--src/bin/eolian/main.c18
-rw-r--r--src/bin/eolian/types_generator.c14
-rw-r--r--src/bin/eolian/types_generator.h2
-rw-r--r--src/lib/ecore/Ecore_Common.h14
-rw-r--r--src/lib/edje/edje_edit.c2
-rw-r--r--src/lib/eo/Eo.h1
-rw-r--r--src/lib/eolian/database_type.c4
-rw-r--r--src/lib/evas/Evas_Common.h4
-rw-r--r--src/lib/evas/Evas_Eo.h16
9 files changed, 72 insertions, 3 deletions
diff --git a/src/bin/eolian/main.c b/src/bin/eolian/main.c
index 0b288d1d38..bcd13fc482 100644
--- a/src/bin/eolian/main.c
+++ b/src/bin/eolian/main.c
@@ -126,6 +126,15 @@ _generate_eo_header_file(char *filename, const char *eo_filename)
buffer = _include_guard_enclose(eo_filename, "TYPES", buffer);
}
+ Eina_Strbuf *ctbuf = eina_strbuf_new();
+ if (types_class_typedef_generate(eo_filename, ctbuf))
+ {
+ ctbuf = _include_guard_enclose(eo_filename, "CLASS_TYPE", ctbuf);
+ eina_strbuf_append_char(ctbuf, '\n');
+ eina_strbuf_prepend(buffer, eina_strbuf_string_get(ctbuf));
+ }
+ eina_strbuf_free(ctbuf);
+
const Eolian_Class *class = eolian_class_get_by_file(eo_filename);
if (class)
{
@@ -218,6 +227,15 @@ _generate_legacy_header_file(char *filename, const char *eo_filename)
goto end;
}
+ Eina_Strbuf *ctbuf = eina_strbuf_new();
+ if (types_class_typedef_generate(eo_filename, ctbuf))
+ {
+ ctbuf = _include_guard_enclose(eo_filename, "CLASS_TYPE", ctbuf);
+ eina_strbuf_append_char(ctbuf, '\n');
+ eina_strbuf_prepend(buffer, eina_strbuf_string_get(ctbuf));
+ }
+ eina_strbuf_free(ctbuf);
+
const Eolian_Class *class = eolian_class_get_by_file(eo_filename);
if (class)
{
diff --git a/src/bin/eolian/types_generator.c b/src/bin/eolian/types_generator.c
index f5adcce192..7f42362467 100644
--- a/src/bin/eolian/types_generator.c
+++ b/src/bin/eolian/types_generator.c
@@ -132,3 +132,17 @@ types_header_generate(const char *eo_filename, Eina_Strbuf *buf)
eina_iterator_free(itr);
return EINA_TRUE;
}
+
+Eina_Bool
+types_class_typedef_generate(const char *eo_filename, Eina_Strbuf *buf)
+{
+ const Eolian_Class *class = eolian_class_get_by_file(eo_filename);
+ if (!class)
+ return EINA_FALSE;
+
+ static _eolian_class_vars class_env;
+ _class_env_create(class, NULL, &class_env);
+
+ eina_strbuf_append_printf(buf, "typedef Eo %s;\n", class_env.full_classname);
+ return EINA_TRUE;
+}
diff --git a/src/bin/eolian/types_generator.h b/src/bin/eolian/types_generator.h
index 6738b022c2..2e07b2057f 100644
--- a/src/bin/eolian/types_generator.h
+++ b/src/bin/eolian/types_generator.h
@@ -14,5 +14,7 @@
*/
Eina_Bool types_header_generate(const char *eo_filename, Eina_Strbuf *buf);
+Eina_Bool types_class_typedef_generate(const char *eo_filename, Eina_Strbuf *buf);
+
#endif
diff --git a/src/lib/ecore/Ecore_Common.h b/src/lib/ecore/Ecore_Common.h
index 06b35e5074..97551bc8fa 100644
--- a/src/lib/ecore/Ecore_Common.h
+++ b/src/lib/ecore/Ecore_Common.h
@@ -2524,6 +2524,8 @@ typedef enum _Ecore_Poller_Type Ecore_Poller_Type;
typedef Eo Ecore_Poller; /**< A handle for pollers */
+#define _ECORE_POLLER_EO_CLASS_TYPE
+
/**
* @brief Sets the time(in seconds) between ticks for the given poller type.
* @param type The poller type to adjust.
@@ -2626,6 +2628,8 @@ typedef Eina_Bool (*Ecore_Timeline_Cb)(void *data, double pos);
*/
typedef Eo Ecore_Animator; /**< A handle for animators */
+#define _ECORE_ANIMATOR_EO_CLASS_TYPE
+
/**
* @brief Set the animator call interval in seconds.
*
@@ -2900,6 +2904,8 @@ EAPI void ecore_animator_custom_tick(void);
*/
typedef Eo Ecore_Timer; /**< A handle for timers */
+#define _ECORE_TIMER_EO_CLASS_TYPE
+
/**
* Retrieves the current precision used by timer infrastructure.
* @return Current precision.
@@ -3008,16 +3014,22 @@ EAPI char *ecore_timer_dump(void);
*/
typedef Eo Ecore_Idler; /**< A handle for idlers */
+#define _ECORE_IDLER_EO_CLASS_TYPE
+
/*
* @since 1.8
*/
typedef Eo Ecore_Idle_Enterer; /**< A handle for idle enterers */
+#define _ECORE_IDLE_ENTERER_EO_CLASS_TYPE
+
/*
* @since 1.8
*/
typedef Eo Ecore_Idle_Exiter; /**< A handle for idle exiters */
+#define _ECORE_IDLE_EXITER_EO_CLASS_TYPE
+
/**
* @}
*/
@@ -3050,6 +3062,8 @@ typedef Eo Ecore_Idle_Exiter; /**< A handle for idle exiters */
* @since 1.8
*/
typedef Eo Ecore_Job; /**< A job handle */
+
+#define _ECORE_JOB_EO_CLASS_TYPE
/**
* @}
*/
diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c
index 629df59bf2..e4f1d9fa5e 100644
--- a/src/lib/edje/edje_edit.c
+++ b/src/lib/edje/edje_edit.c
@@ -7,6 +7,8 @@
*
*/
+#define _EDJE_EDIT_EO_CLASS_TYPE
+
#include "edje_private.h"
#define EDJE_EDIT_IS_UNSTABLE_AND_I_KNOW_ABOUT_IT
diff --git a/src/lib/eo/Eo.h b/src/lib/eo/Eo.h
index 14728cb13c..eaf673eb14 100644
--- a/src/lib/eo/Eo.h
+++ b/src/lib/eo/Eo.h
@@ -1109,6 +1109,7 @@ struct _Eo_Callback_Array_Item
* @}
*/
+#define _EO_BASE_EO_CLASS_TYPE
#include "eo_base.eo.h"
#define EO_CLASS EO_BASE_CLASS
diff --git a/src/lib/eolian/database_type.c b/src/lib/eolian/database_type.c
index d3d2037213..cfb8bc7355 100644
--- a/src/lib/eolian/database_type.c
+++ b/src/lib/eolian/database_type.c
@@ -155,7 +155,7 @@ database_type_to_str(const Eolian_Type *tp, Eina_Strbuf *buf, const char *name)
{
eina_strbuf_append(buf, "const ");
}
- if (tp->type == EOLIAN_TYPE_REGULAR)
+ if (tp->type == EOLIAN_TYPE_REGULAR || tp->type == EOLIAN_TYPE_CLASS)
{
Eina_List *l;
const char *sp;
@@ -173,8 +173,6 @@ database_type_to_str(const Eolian_Type *tp, Eina_Strbuf *buf, const char *name)
}
else if (tp->type == EOLIAN_TYPE_VOID)
eina_strbuf_append(buf, "void");
- else if (tp->type == EOLIAN_TYPE_CLASS)
- eina_strbuf_append(buf, "Eo");
else
{
Eolian_Type *btp = tp->base_type;
diff --git a/src/lib/evas/Evas_Common.h b/src/lib/evas/Evas_Common.h
index e9abd7368b..adafbdd570 100644
--- a/src/lib/evas/Evas_Common.h
+++ b/src/lib/evas/Evas_Common.h
@@ -276,6 +276,8 @@ typedef struct _Evas_Public_Data Evas_Public_Data;
*/
typedef Eo Evas_Object;
+#define _EVAS_OBJECT_EO_CLASS_TYPE
+
typedef void Evas_Performance; /**< An Evas Performance handle */
typedef struct _Evas_Modifier Evas_Modifier; /**< An opaque type containing information on which modifier keys are registered in an Evas canvas */
typedef struct _Evas_Lock Evas_Lock; /**< An opaque type containing information on which lock keys are registered in an Evas canvas */
@@ -5241,6 +5243,8 @@ EAPI Eina_Bool evas_key_lock_is_set(const Evas_Lock *l, const char *k
typedef Eo Evas_Out;
+#define _EVAS_OUT_EO_CLASS_TYPE
+
/**
* @ingroup Evas_Font_Group
*
diff --git a/src/lib/evas/Evas_Eo.h b/src/lib/evas/Evas_Eo.h
index 5f20e3fbbe..5f578cf966 100644
--- a/src/lib/evas/Evas_Eo.h
+++ b/src/lib/evas/Evas_Eo.h
@@ -344,6 +344,8 @@ typedef double Evas_Real;
*/
typedef Eo Evas_3D_Object;
+#define _EVAS_3D_OBJECT_EO_CLASS_TYPE
+
/**
* @typedef Evas_3D_Scene
*
@@ -354,6 +356,8 @@ typedef Eo Evas_3D_Object;
*/
typedef Eo Evas_3D_Scene;
+#define _EVAS_3D_SCENE_EO_CLASS_TYPE
+
/**
* @typedef Evas_3D_Node
*
@@ -364,6 +368,8 @@ typedef Eo Evas_3D_Scene;
*/
typedef Eo Evas_3D_Node;
+#define _EVAS_3D_NODE_EO_CLASS_TYPE
+
/**
* @typedef Evas_3D_Camera
*
@@ -374,6 +380,8 @@ typedef Eo Evas_3D_Node;
*/
typedef Eo Evas_3D_Camera;
+#define _EVAS_3D_CAMERA_EO_CLASS_TYPE
+
/**
* @typedef Evas_3D_Light
*
@@ -384,6 +392,8 @@ typedef Eo Evas_3D_Camera;
*/
typedef Eo Evas_3D_Light;
+#define _EVAS_3D_LIGHT_EO_CLASS_TYPE
+
/**
* @typedef Evas_3D_Mesh
*
@@ -394,6 +404,8 @@ typedef Eo Evas_3D_Light;
*/
typedef Eo Evas_3D_Mesh;
+#define _EVAS_3D_MESH_EO_CLASS_TYPE
+
/**
* @typedef Evas_3D_Texture
*
@@ -404,6 +416,8 @@ typedef Eo Evas_3D_Mesh;
*/
typedef Eo Evas_3D_Texture;
+#define _EVAS_3D_TEXTURE_EO_CLASS_TYPE
+
/**
* @typedef Evas_3D_Material
*
@@ -414,6 +428,8 @@ typedef Eo Evas_3D_Texture;
*/
typedef Eo Evas_3D_Material;
+#define _EVAS_3D_MATERIAL_EO_CLASS_TYPE
+
/**
* Type of 3D Object
*