eolian: generate implicit typedef for each class

And use these typedefs instead of just Eo in API.
This commit is contained in:
Daniel Kolesa 2014-08-01 15:11:28 +01:00
parent ac2ea63867
commit bb24b60638
9 changed files with 72 additions and 3 deletions

View File

@ -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)
{

View File

@ -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;
}

View File

@ -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

View File

@ -2525,6 +2525,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.
@ -2627,6 +2629,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.
*
@ -2901,6 +2905,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.
@ -3009,16 +3015,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
/**
* @}
*/
@ -3051,6 +3063,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
/**
* @}
*/

View File

@ -7,6 +7,8 @@
*
*/
#define _EDJE_EDIT_EO_CLASS_TYPE
#include "edje_private.h"
#define EDJE_EDIT_IS_UNSTABLE_AND_I_KNOW_ABOUT_IT

View File

@ -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

View File

@ -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;

View File

@ -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
*

View File

@ -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
*