Eolian: Remove support of legacy into implement section.

It has been decided that this support is not needed.
This commit is contained in:
Daniel Zaoui 2014-04-24 16:51:04 +03:00
parent cc84a36734
commit 64e947512a
6 changed files with 1163 additions and 1636 deletions

View File

@ -108,8 +108,6 @@ eo_definitions_impl_def_free(Eo_Implement_Def *impl)
{
if (impl->meth_name)
eina_stringshare_del(impl->meth_name);
if (impl->legacy)
free(impl->legacy);
free(impl);
}

View File

@ -107,18 +107,9 @@ typedef struct _eo_implement_legacy_param_def
const char *comment;
} Eo_Implement_Legacy_Param_Def;
typedef struct _eo_implement_legacy_def
{
const char *function_name;
Eina_List *params; /* List of Eo_Implement_Legacy_Param_Def * */
const char *ret_type;
const char *ret_value;
} Eo_Implement_Legacy_Def;
typedef struct _eo_implement_def
{
const char *meth_name;
Eo_Implement_Legacy_Def *legacy;
} Eo_Implement_Def;
/* CLASS */

File diff suppressed because it is too large Load Diff

View File

@ -892,80 +892,7 @@ _eo_tokenizer_implement_get(Eo_Tokenizer *toknz, char *p)
toknz->tmp.kls->implements = eina_list_append(toknz->tmp.kls->implements, toknz->tmp.impl);
}
action impl_legacy_create {
if (!toknz->tmp.impl) ABORT(toknz, "No implement!!!");
if (toknz->tmp.impl->legacy)
ABORT(toknz, "Legacy section already allocated for implement item");
toknz->tmp.impl->legacy = calloc(1, sizeof(Eo_Implement_Legacy_Def));
}
action impl_legacy_function_name_store {
if (!toknz->tmp.impl) ABORT(toknz, "No implement!!!");
if (!toknz->tmp.impl->legacy)
ABORT(toknz, "No legacy section");
toknz->tmp.impl->legacy->function_name = _eo_tokenizer_token_get(toknz, fpc);
}
action impl_legacy_eo_param_store {
if (!toknz->tmp.impl) ABORT(toknz, "No implement!!!");
toknz->tmp.impl_leg_param = calloc(1, sizeof(Eo_Implement_Legacy_Param_Def));
toknz->tmp.impl->legacy->params = eina_list_append(
toknz->tmp.impl->legacy->params, toknz->tmp.impl_leg_param);
toknz->tmp.impl_leg_param->eo_name = _eo_tokenizer_token_get(toknz, fpc);
}
action impl_legacy_leg_param_store {
if (!toknz->tmp.impl_leg_param)
ABORT(toknz, "No implement legacy param!!!");
toknz->tmp.impl_leg_param->legacy_name = _eo_tokenizer_token_get(toknz, fpc);
}
action impl_legacy_param_comment_store {
if (!toknz->tmp.impl_leg_param)
ABORT(toknz, "No implement legacy param!!!");
toknz->tmp.impl_leg_param->comment = _eo_tokenizer_token_get(toknz, fpc-2);
}
action impl_legacy_return_type_store {
if (!toknz->tmp.impl) ABORT(toknz, "No implement!!!");
if (!toknz->tmp.impl->legacy)
ABORT(toknz, "No legacy section");
toknz->tmp.impl->legacy->ret_type= _eo_tokenizer_token_get(toknz, fpc);
}
action impl_legacy_return_val_store {
if (!toknz->tmp.impl) ABORT(toknz, "No implement!!!");
if (!toknz->tmp.impl->legacy)
ABORT(toknz, "No legacy section");
toknz->tmp.impl->legacy->ret_value = _eo_tokenizer_token_get(toknz, fpc);
}
# legacy legacy_function_name
# {
# params {
# grp: NULL; /*@ in case 'grp' is in Eo but not in legacy, have to give default */
# file; /*@ in case the 'file' parameter is the same */
# :index; /*@ in case the param is in legacy but not in Eo */
# };
# return Eina_Bool::EINA_TRUE;
# };
impl_legacy_param_comment = ws* eo_comment %impl_legacy_param_comment_store;
impl_legacy_eo_param = ident %impl_legacy_eo_param_store;
impl_legacy_leg_param = ws* colon ws* ident %impl_legacy_leg_param_store ignore*;
impl_legacy_param = impl_legacy_eo_param? ws* impl_legacy_leg_param? end_statement impl_legacy_param_comment? ignore*;
impl_legacy_params = impl_legacy_param+;
impl_legacy_return = 'return' ws+ ident %impl_legacy_return_type_store '::' ident %impl_legacy_return_val_store end_statement ignore*;
impl_legacy_body = 'params' ignore* begin_def ignore* impl_legacy_params ignore* end_def ignore* impl_legacy_return? ignore*;
impl_legacy_function_name = ident %impl_legacy_function_name_store;
impl_legacy_token = 'legacy' %impl_legacy_create;
impl_body = impl_legacy_token ws* impl_legacy_function_name? ignore* (end_statement | (begin_def ignore* impl_legacy_body ignore* end_def)) ignore*;
# class::func ; or { ... }
impl_it = class_meth %impl_meth_store ignore* (end_statement | (begin_def ignore* impl_body ignore* end_def)) ignore*;
impl_it = class_meth %impl_meth_store ignore* end_statement ignore*;
# implements { ... }
implements = 'implements' ignore* begin_def ignore* impl_it* end_def;
@ -1592,21 +1519,6 @@ eo_tokenizer_database_fill(const char *filename)
continue;
}
Eolian_Implement impl_desc = database_implement_new(class, func, ftype);
if (impl->legacy)
{
Eo_Implement_Legacy_Def *eo_leg = impl->legacy;
Eolian_Implement_Legacy leg = database_implement_legacy_add(
impl_desc, eo_leg->function_name);
database_implement_legacy_return_add(leg, eo_leg->ret_type, eo_leg->ret_value);
if (eo_leg->params)
{
Eina_List *itr;
Eo_Implement_Legacy_Param_Def *p;
EINA_LIST_FOREACH(eo_leg->params, itr, p)
database_implement_legacy_param_add(leg, p->eo_name,
p->legacy_name, p->comment);
}
}
database_class_implement_add(kls->name, impl_desc);
}

View File

@ -486,80 +486,6 @@ eolian_implement_information_get(Eolian_Implement impl, const char **class_name,
return EINA_TRUE;
}
Eolian_Implement_Legacy
database_implement_legacy_add(Eolian_Implement impl, const char *legacy_function_name)
{
_Implement_Desc *_impl = (_Implement_Desc *)impl;
EINA_SAFETY_ON_NULL_RETURN_VAL(_impl, NULL);
_impl->leg_desc = calloc(1, sizeof(_Implement_Legacy_Desc));
_Implement_Legacy_Desc *leg_desc = (_Implement_Legacy_Desc *)_impl->leg_desc;
if (leg_desc && legacy_function_name) leg_desc->legacy_function_name = legacy_function_name;
return _impl->leg_desc;
}
Eolian_Implement_Legacy_Parameter
database_implement_legacy_param_add(Eolian_Implement_Legacy leg,
Eina_Stringshare *eo_param, Eina_Stringshare *leg_param,
Eina_Stringshare *comment)
{
_Implement_Legacy_Desc *_leg = (_Implement_Legacy_Desc *)leg;
EINA_SAFETY_ON_NULL_RETURN_VAL(_leg, NULL);
_Implement_Legacy_Param *param = calloc(1, sizeof(_Implement_Legacy_Param));
param->eo_param = eo_param;
param->leg_param = leg_param;
param->comment = comment;
_leg->params = eina_list_append(_leg->params, param);
return (Eolian_Implement_Legacy_Parameter) param;
}
EAPI Eina_Bool
eolian_implement_legacy_param_info_get(Eolian_Implement_Legacy_Parameter param,
Eina_Stringshare **eo_param, Eina_Stringshare **leg_param,
Eina_Stringshare **comment)
{
_Implement_Legacy_Param *_param = (_Implement_Legacy_Param *)param;
EINA_SAFETY_ON_NULL_RETURN_VAL(_param, EINA_FALSE);
if (eo_param) *eo_param = _param->eo_param;
if (leg_param) *leg_param = _param->leg_param;
if (comment) *comment = _param->comment;
return EINA_TRUE;
}
Eina_Bool
database_implement_legacy_return_add(Eolian_Implement_Legacy leg, Eina_Stringshare *ret_type, Eina_Stringshare *ret_value)
{
_Implement_Legacy_Desc *_leg = (_Implement_Legacy_Desc *)leg;
EINA_SAFETY_ON_NULL_RETURN_VAL(_leg, EINA_FALSE);
_leg->ret_type = ret_type;
_leg->ret_value = ret_value;
return EINA_TRUE;
}
EAPI Eolian_Implement_Legacy
eolian_implement_legacy_desc_get(Eolian_Implement impl)
{
_Implement_Desc *_impl = (_Implement_Desc *)impl;
EINA_SAFETY_ON_NULL_RETURN_VAL(_impl, NULL);
return (Eolian_Implement_Legacy) (_impl->leg_desc);
}
EAPI Eina_Bool
eolian_implement_legacy_information_get(const Eolian_Implement_Legacy leg_desc,
Eina_Stringshare **leg_func_name, Eina_List **params,
Eina_Stringshare **ret_type, Eina_Stringshare **ret_value)
{
_Implement_Legacy_Desc *_leg = (_Implement_Legacy_Desc *)leg_desc;
EINA_SAFETY_ON_NULL_RETURN_VAL(_leg, EINA_FALSE);
if (leg_func_name) *leg_func_name = _leg->legacy_function_name;
if (params) *params = _leg->params;
if (ret_type) *ret_type = _leg->ret_type;
if (ret_value) *ret_value = _leg->ret_value;
return EINA_TRUE;
}
EAPI Eolian_Function
eolian_class_function_find_by_name(const char *class_name, const char *func_name, Eolian_Function_Type f_type)
{
@ -1101,29 +1027,6 @@ _implements_print(Eolian_Implement impl, int nb_spaces)
return;
}
printf("%*s <%s :: %s> <%s>\n", nb_spaces + 5, "", cl, fn, t);
Eolian_Implement_Legacy leg_desc = eolian_implement_legacy_desc_get(impl);
if (leg_desc)
{
Eina_Stringshare *func_name, *ret_type, *ret_value;
Eina_List *params = NULL;
eolian_implement_legacy_information_get(leg_desc, &func_name, &params, &ret_type, &ret_value);
printf("%*s Legacy\n", nb_spaces + 8, "");
if (func_name) printf("%*s Function name: %s\n", nb_spaces + 11, "", func_name);
if (ret_type && ret_value)
printf("%*s Return %s::%s\n", nb_spaces + 11, "", ret_type, ret_value);
if (params)
{
printf("%*s Params:\n", nb_spaces + 11, "");
Eina_List *itr;
Eolian_Implement_Legacy_Parameter p;
EINA_LIST_FOREACH(params, itr, p)
{
Eina_Stringshare *eo_param, *leg_param, *comment;
eolian_implement_legacy_param_info_get(p, &eo_param, &leg_param, &comment);
printf("%*s %s -> %s <%s>\n", nb_spaces + 14, "", eo_param, leg_param, comment);
}
}
}
}
static void

View File

@ -116,17 +116,6 @@ database_function_scope_set(Eolian_Function function_id, Eolian_Function_Scope s
Eolian_Implement
database_implement_new(const char *class_name, const char *func_name, Eolian_Function_Type type);
Eolian_Implement_Legacy
database_implement_legacy_add(Eolian_Implement impl, const char *legacy_func_name);
Eolian_Implement_Legacy_Parameter
database_implement_legacy_param_add(Eolian_Implement_Legacy leg,
Eina_Stringshare *eo_param, Eina_Stringshare *leg_param,
Eina_Stringshare *comment);
Eina_Bool
database_implement_legacy_return_add(Eolian_Implement_Legacy leg, Eina_Stringshare *ret_type, Eina_Stringshare *ret_value);
Eina_Bool
database_class_implement_add(const char *class_name, Eolian_Implement impl_id);