Clouseau: Fixed bad change to use pointer for type in the eet.

SVN revision: 83631
This commit is contained in:
Tom Hacohen 2013-02-05 13:53:44 +00:00
parent e9fe6cb2c0
commit 8c2a96b8aa
3 changed files with 108 additions and 94 deletions

View File

@ -29,10 +29,10 @@ clouseau_eo_info_free(Clouseau_Eo_Dbg_Info *parent)
{
Clouseau_Eo_Dbg_Info *eo;
if (parent->type == (uintptr_t) EINA_VALUE_TYPE_LIST)
if (parent->type == CLOUSEAU_DBG_INFO_TYPE_LIST)
EINA_LIST_FREE(parent->un_dbg_info.dbg.list, eo)
clouseau_eo_info_free(eo);
else if (parent->type == (uintptr_t) EINA_VALUE_TYPE_STRING)
else if (parent->type == CLOUSEAU_DBG_INFO_TYPE_STRING)
eina_stringshare_del(parent->un_dbg_info.text.s);
eina_stringshare_del(parent->name);
@ -235,7 +235,7 @@ _clouseau_bmp_req_desc_make(void)
/* START EO descs */
struct _Clouseau_Eo_Dbg_Info_Mapping
{
const Eina_Value_Type *u;
Clouseau_Dbg_Info_Type u;
const char *name;
};
typedef struct _Clouseau_Eo_Dbg_Info_Mapping Clouseau_Eo_Dbg_Info_Mapping;
@ -243,19 +243,19 @@ typedef struct _Clouseau_Eo_Dbg_Info_Mapping Clouseau_Eo_Dbg_Info_Mapping;
/* It's init later. */
static Clouseau_Eo_Dbg_Info_Mapping eet_dbg_info_mapping[] =
{
{ NULL, EO_DBG_INFO_TYPE_STRING_STR },
{ NULL, EO_DBG_INFO_TYPE_INT_STR },
{ NULL, EO_DBG_INFO_TYPE_BOOL_STR },
{ NULL, EO_DBG_INFO_TYPE_PTR_STR },
{ NULL, EO_DBG_INFO_TYPE_DOUBLE_STR },
{ NULL, EO_DBG_INFO_TYPE_LIST_STR },
{ NULL, NULL }
{ CLOUSEAU_DBG_INFO_TYPE_STRING, EO_DBG_INFO_TYPE_STRING_STR },
{ CLOUSEAU_DBG_INFO_TYPE_INT, EO_DBG_INFO_TYPE_INT_STR },
{ CLOUSEAU_DBG_INFO_TYPE_BOOL, EO_DBG_INFO_TYPE_BOOL_STR },
{ CLOUSEAU_DBG_INFO_TYPE_PTR, EO_DBG_INFO_TYPE_PTR_STR },
{ CLOUSEAU_DBG_INFO_TYPE_DOUBLE, EO_DBG_INFO_TYPE_DOUBLE_STR },
{ CLOUSEAU_DBG_INFO_TYPE_LIST, EO_DBG_INFO_TYPE_LIST_STR },
{ CLOUSEAU_DBG_INFO_TYPE_UNKNOWN, NULL }
};
static const char *
_dbg_info_union_type_get(const void *data, Eina_Bool *unknow)
{ /* _union_type_get */
const Eina_Value_Type *const *u = data;
const Clouseau_Dbg_Info_Type *u = data;
int i;
if (unknow)
@ -274,7 +274,7 @@ _dbg_info_union_type_get(const void *data, Eina_Bool *unknow)
static Eina_Bool
_dbg_info_union_type_set(const char *type, void *data, Eina_Bool unknow)
{ /* same as _union_type_set */
Eina_Value_Type **u = data;
Clouseau_Dbg_Info_Type *u = data;
int i;
if (unknow)
@ -283,7 +283,7 @@ _dbg_info_union_type_set(const char *type, void *data, Eina_Bool unknow)
for (i = 0; eet_dbg_info_mapping[i].name != NULL; ++i)
if (strcmp(eet_dbg_info_mapping[i].name, type) == 0)
{
*u = (void *) eet_dbg_info_mapping[i].u;
*u = eet_dbg_info_mapping[i].u;
return EINA_TRUE;
}
@ -385,17 +385,6 @@ _clouseau_eo_descs_make(void)
{
Eet_Data_Descriptor_Class eddc;
/* Init the eet_dbg_info_mapping */
{
int i = 0;
eet_dbg_info_mapping[i++].u = EINA_VALUE_TYPE_STRING;
eet_dbg_info_mapping[i++].u = EINA_VALUE_TYPE_INT;
eet_dbg_info_mapping[i++].u = EINA_VALUE_TYPE_CHAR;
eet_dbg_info_mapping[i++].u = EINA_VALUE_TYPE_UINT64;
eet_dbg_info_mapping[i++].u = EINA_VALUE_TYPE_DOUBLE;
eet_dbg_info_mapping[i++].u = EINA_VALUE_TYPE_LIST;
}
eo_string_edd = clouseau_string_desc_make();
eo_int_edd = clouseau_int_desc_make();
eo_bool_edd = clouseau_bool_desc_make();
@ -407,7 +396,7 @@ _clouseau_eo_descs_make(void)
EET_DATA_DESCRIPTOR_ADD_BASIC (eo_dbg_info_edd, Clouseau_Eo_Dbg_Info,
"name", name, EET_T_STRING);
EET_DATA_DESCRIPTOR_ADD_BASIC (eo_dbg_info_edd, Clouseau_Eo_Dbg_Info,
"type", type, EET_T_ULONG_LONG);
"type", type, EET_T_UINT);
/* Here because clouseau_list_desc_make() uses eo_dbg_info_edd */
eo_list_edd = clouseau_list_desc_make();

View File

@ -51,42 +51,37 @@ clouseau_object_information_free(Clouseau_Object *oinfo)
static void
_clouseau_eo_from_legacy_convert_helper(Eo_Dbg_Info *new_root, Clouseau_Eo_Dbg_Info *root)
{
const Eina_Value_Type *type = (void *) (uintptr_t) root->type;
if (type == EINA_VALUE_TYPE_STRING)
switch (root->type)
{
EO_DBG_INFO_APPEND(new_root, root->name, type, root->un_dbg_info.text.s);
}
else if (type == EINA_VALUE_TYPE_INT)
{
EO_DBG_INFO_APPEND(new_root, root->name, type, root->un_dbg_info.intg.i);
}
else if (type == EINA_VALUE_TYPE_CHAR)
{
EO_DBG_INFO_APPEND(new_root, root->name, type, root->un_dbg_info.bl.b);
}
else if (type == EINA_VALUE_TYPE_UINT64)
{
EO_DBG_INFO_APPEND(new_root, root->name, type, root->un_dbg_info.ptr.p);
}
else if (type == EINA_VALUE_TYPE_DOUBLE)
{
EO_DBG_INFO_APPEND(new_root, root->name, type, root->un_dbg_info.dbl.d);
}
else if (type == EINA_VALUE_TYPE_LIST)
{
Eina_List *l;
Clouseau_Eo_Dbg_Info *eo;
case CLOUSEAU_DBG_INFO_TYPE_STRING:
EO_DBG_INFO_APPEND(new_root, root->name, EINA_VALUE_TYPE_STRING, root->un_dbg_info.text.s);
break;
case CLOUSEAU_DBG_INFO_TYPE_INT:
EO_DBG_INFO_APPEND(new_root, root->name, EINA_VALUE_TYPE_INT, root->un_dbg_info.intg.i);
break;
case CLOUSEAU_DBG_INFO_TYPE_BOOL:
EO_DBG_INFO_APPEND(new_root, root->name, EINA_VALUE_TYPE_CHAR, root->un_dbg_info.bl.b);
break;
case CLOUSEAU_DBG_INFO_TYPE_PTR:
EO_DBG_INFO_APPEND(new_root, root->name, EINA_VALUE_TYPE_UINT64, root->un_dbg_info.ptr.p);
break;
case CLOUSEAU_DBG_INFO_TYPE_DOUBLE:
EO_DBG_INFO_APPEND(new_root, root->name, EINA_VALUE_TYPE_DOUBLE, root->un_dbg_info.dbl.d);
break;
case CLOUSEAU_DBG_INFO_TYPE_LIST:
{
Eina_List *l;
Clouseau_Eo_Dbg_Info *eo;
new_root = EO_DBG_INFO_LIST_APPEND(new_root, root->name);
EINA_LIST_FOREACH(root->un_dbg_info.dbg.list, l, eo)
{
_clouseau_eo_from_legacy_convert_helper(new_root, eo);
}
}
else
{
// FIXME
printf("Oops, wrong type.\n");
new_root = EO_DBG_INFO_LIST_APPEND(new_root, root->name);
EINA_LIST_FOREACH(root->un_dbg_info.dbg.list, l, eo)
_clouseau_eo_from_legacy_convert_helper(new_root, eo);
}
break;
default:
// FIXME
printf("Oops, wrong type.\n");
break;
}
}
@ -112,6 +107,25 @@ clouseau_tree_item_from_legacy_convert(Clouseau_Tree_Item *treeit)
treeit->new_eo_info = new_root;
}
static Clouseau_Dbg_Info_Type
_clouseau_eina_value_type_to_clouseau_type(const Eina_Value_Type *type)
{
if (type == EINA_VALUE_TYPE_STRING)
return CLOUSEAU_DBG_INFO_TYPE_STRING;
else if (type == EINA_VALUE_TYPE_INT)
return CLOUSEAU_DBG_INFO_TYPE_INT;
else if (type == EINA_VALUE_TYPE_CHAR)
return CLOUSEAU_DBG_INFO_TYPE_BOOL;
else if (type == EINA_VALUE_TYPE_UINT64)
return CLOUSEAU_DBG_INFO_TYPE_PTR;
else if (type == EINA_VALUE_TYPE_DOUBLE)
return CLOUSEAU_DBG_INFO_TYPE_DOUBLE;
else if (type == EINA_VALUE_TYPE_LIST)
return CLOUSEAU_DBG_INFO_TYPE_LIST;
return CLOUSEAU_DBG_INFO_TYPE_UNKNOWN;
}
/* This function converts a list of Eo_Dbg_Info
* to a list of Clouseau_Eo_Dbg_Info.
* This is required because we would like to keep the def of
@ -132,43 +146,43 @@ clouseau_eo_to_legacy_convert(Eo_Dbg_Info *root)
EINA_LIST_FOREACH(root_list.list, l, eo)
{
Clouseau_Eo_Dbg_Info *info = calloc(1, sizeof(*info));
info->type = (uintptr_t) eina_value_type_get(&(eo->value));
info->type = _clouseau_eina_value_type_to_clouseau_type(
eina_value_type_get(&(eo->value)));
info->name = eina_stringshare_add(eo->name);
const Eina_Value_Type *type = (void *) (uintptr_t) info->type;
if (type == EINA_VALUE_TYPE_STRING)
switch (info->type)
{
const char *tmp;
eina_value_get(&(eo->value), &tmp);
info->un_dbg_info.text.s = eina_stringshare_add(tmp);
}
else if (type == EINA_VALUE_TYPE_INT)
{
eina_value_get(&(eo->value), &(info->un_dbg_info.intg.i));
}
else if (type == EINA_VALUE_TYPE_CHAR)
{
eina_value_get(&(eo->value), &(info->un_dbg_info.bl.b));
}
else if (type == EINA_VALUE_TYPE_UINT64)
{
uint64_t tmp;
eina_value_get(&(eo->value), &tmp);
info->un_dbg_info.ptr.p = tmp;
}
else if (type == EINA_VALUE_TYPE_DOUBLE)
{
eina_value_get(&(eo->value), &(info->un_dbg_info.dbl.d));
}
else if (type == EINA_VALUE_TYPE_LIST)
{
info->un_dbg_info.dbg.list =
clouseau_eo_to_legacy_convert(eo);
}
else
{
// FIXME
printf("Oops, wrong type.\n");
case CLOUSEAU_DBG_INFO_TYPE_STRING:
{
const char *tmp;
eina_value_get(&(eo->value), &tmp);
info->un_dbg_info.text.s = eina_stringshare_add(tmp);
}
break;
case CLOUSEAU_DBG_INFO_TYPE_INT:
eina_value_get(&(eo->value), &(info->un_dbg_info.intg.i));
break;
case CLOUSEAU_DBG_INFO_TYPE_BOOL:
eina_value_get(&(eo->value), &(info->un_dbg_info.bl.b));
break;
case CLOUSEAU_DBG_INFO_TYPE_PTR:
{
uint64_t tmp;
eina_value_get(&(eo->value), &tmp);
info->un_dbg_info.ptr.p = tmp;
}
break;
case CLOUSEAU_DBG_INFO_TYPE_DOUBLE:
eina_value_get(&(eo->value), &(info->un_dbg_info.dbl.d));
break;
case CLOUSEAU_DBG_INFO_TYPE_LIST:
info->un_dbg_info.dbg.list =
clouseau_eo_to_legacy_convert(eo);
break;
default:
// FIXME
printf("Oops, wrong type.\n");
break;
}
new_list = eina_list_append(new_list, info);

View File

@ -181,10 +181,21 @@ typedef struct _Clouseau_st_dbg_list Clouseau_st_dbg_list;
typedef struct _Clouseau_Eo_Dbg_Info Clouseau_Eo_Dbg_Info;
/* END - EO - debug structs */
typedef enum
{
CLOUSEAU_DBG_INFO_TYPE_STRING,
CLOUSEAU_DBG_INFO_TYPE_INT,
CLOUSEAU_DBG_INFO_TYPE_BOOL,
CLOUSEAU_DBG_INFO_TYPE_PTR,
CLOUSEAU_DBG_INFO_TYPE_DOUBLE,
CLOUSEAU_DBG_INFO_TYPE_LIST,
CLOUSEAU_DBG_INFO_TYPE_UNKNOWN
} Clouseau_Dbg_Info_Type;
struct _Clouseau_Eo_Dbg_Info
{ /* Debug info composed of a list of Eo_Dbg_Info */
const char *name;
unsigned long long type;
Clouseau_Dbg_Info_Type type;
union _un_dbg_info
{