summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2014-08-15 13:51:41 +0100
committerDaniel Kolesa <d.kolesa@samsung.com>2014-08-21 09:26:05 +0100
commit97d9bf37fa3e0297be92805dd5617e75c40cb037 (patch)
treed1608984d1d17ed9e73595f69d3424d268e03dee
parent913e0f09fa789b72fe48d02c042afc49b3a64df9 (diff)
downloadefl-97d9bf37fa3e0297be92805dd5617e75c40cb037.tar.gz
eolian: first batch of database_ functions removal (simplifies code)
-rw-r--r--src/lib/eolian/database_fill.c196
-rw-r--r--src/lib/eolian/database_function.c142
-rw-r--r--src/lib/eolian/eolian_database.h17
3 files changed, 102 insertions, 253 deletions
diff --git a/src/lib/eolian/database_fill.c b/src/lib/eolian/database_fill.c
index fb24709824..e3745f653f 100644
--- a/src/lib/eolian/database_fill.c
+++ b/src/lib/eolian/database_fill.c
@@ -1,56 +1,12 @@
#include "eo_parser.h"
static Eina_Bool
-_db_fill_ctor(Eolian_Class *cl, Eo_Method_Def *meth)
-{
- Eo_Param_Def *param;
- Eina_List *l;
-
- Eolian_Function *foo_id = database_function_new(meth->name, EOLIAN_CTOR);
-
- database_class_function_add(cl, foo_id);
-
- if (meth->ret)
- {
- database_function_return_comment_set(foo_id, EOLIAN_METHOD,
- meth->ret->comment);
- }
-
- database_function_legacy_set(foo_id, EOLIAN_METHOD, meth->legacy);
-
- EINA_LIST_FOREACH(meth->params, l, param)
- {
- database_method_parameter_add(foo_id, (Eolian_Parameter_Dir)param->way,
- param->type, param->name, param->comment);
- param->type = NULL;
- }
-
- foo_id->base = meth->base;
- meth->base.file = NULL;
-
- return EINA_TRUE;
-}
-
-static Eina_Bool
-_db_fill_ctors(Eolian_Class *cl, Eo_Class_Def *kls)
-{
- Eo_Method_Def *meth;
- Eina_List *l;
-
- EINA_LIST_FOREACH(kls->constructors, l, meth)
- if (!_db_fill_ctor(cl, meth)) return EINA_FALSE;
-
- return EINA_TRUE;
-}
-
-
-static Eina_Bool
_db_fill_key(Eolian_Function *foo_id, Eo_Param_Def *param)
{
- Eolian_Function_Parameter *p = database_property_key_add(foo_id,
- param->type,
- param->name,
- param->comment);
+ Eolian_Function_Parameter *p = database_parameter_add(param->type,
+ param->name,
+ param->comment);
+ foo_id->keys = eina_list_append(foo_id->keys, p);
database_parameter_nonull_set(p, param->nonull);
param->type = NULL;
@@ -75,10 +31,10 @@ _db_fill_keys(Eolian_Function *foo_id, Eo_Property_Def *prop)
static Eina_Bool
_db_fill_value(Eolian_Function *foo_id, Eo_Param_Def *param)
{
- Eolian_Function_Parameter *p = database_property_value_add(foo_id,
- param->type,
- param->name,
- param->comment);
+ Eolian_Function_Parameter *p = database_parameter_add(param->type,
+ param->name,
+ param->comment);
+ foo_id->params = eina_list_append(foo_id->params, p);
database_parameter_nonull_set(p, param->nonull);
param->type = NULL;
@@ -103,11 +59,11 @@ _db_fill_values(Eolian_Function *foo_id, Eo_Property_Def *prop)
static Eina_Bool
_db_fill_param(Eolian_Function *foo_id, Eo_Param_Def *param)
{
- Eolian_Function_Parameter *p = database_method_parameter_add(foo_id,
- param->way,
- param->type,
- param->name,
- param->comment);
+ Eolian_Function_Parameter *p = database_parameter_add(param->type,
+ param->name,
+ param->comment);
+ p->param_dir = param->way;
+ foo_id->params = eina_list_append(foo_id->params, p);
database_parameter_nonull_set(p, param->nonull);
param->type = NULL;
@@ -136,29 +92,45 @@ _db_fill_accessor(Eolian_Function *foo_id, Eo_Class_Def *kls,
Eo_Accessor_Param *acc_param;
Eina_List *l;
- database_function_type_set(foo_id, ((accessor->type == SETTER)
- ? EOLIAN_PROP_SET : EOLIAN_PROP_GET));
-
- Eolian_Function_Type ftype = (accessor->type == SETTER)
- ? EOLIAN_PROP_SET : EOLIAN_PROP_GET;
+ if (accessor->type == SETTER)
+ foo_id->type = (foo_id->type == EOLIAN_PROP_GET) ? EOLIAN_PROPERTY
+ : EOLIAN_PROP_SET;
+ else
+ foo_id->type = (foo_id->type == EOLIAN_PROP_SET) ? EOLIAN_PROPERTY
+ : EOLIAN_PROP_GET;
if (accessor->ret && accessor->ret->type)
{
- database_function_return_type_set(foo_id, ftype, accessor->ret->type);
- database_function_return_comment_set(foo_id, ftype,
- accessor->ret->comment);
- database_function_return_flag_set_as_warn_unused(foo_id, ftype,
- accessor->ret->warn_unused);
- database_function_return_default_val_set(foo_id, ftype,
- accessor->ret->default_ret_val);
+ if (accessor->type == SETTER)
+ {
+ foo_id->set_ret_type = accessor->ret->type;
+ foo_id->set_ret_val = accessor->ret->default_ret_val;
+ foo_id->set_return_comment = eina_stringshare_ref(accessor->ret->comment);
+ foo_id->set_return_warn_unused = accessor->ret->warn_unused;
+ }
+ else
+ {
+ foo_id->get_ret_type = accessor->ret->type;
+ foo_id->get_ret_val = accessor->ret->default_ret_val;
+ foo_id->get_return_comment = eina_stringshare_ref(accessor->ret->comment);
+ foo_id->get_return_warn_unused = accessor->ret->warn_unused;
+ }
accessor->ret->type = NULL;
accessor->ret->default_ret_val = NULL;
}
- if (accessor->legacy)
- database_function_legacy_set(foo_id, ftype, accessor->legacy);
-
- database_function_description_set(foo_id, ftype, accessor->comment);
+ if (accessor->type == SETTER)
+ {
+ foo_id->set_description = eina_stringshare_ref(accessor->comment);
+ if (accessor->legacy)
+ foo_id->set_legacy = eina_stringshare_ref(accessor->legacy);
+ }
+ else
+ {
+ foo_id->get_description = eina_stringshare_ref(accessor->comment);
+ if (accessor->legacy)
+ foo_id->get_legacy = eina_stringshare_ref(accessor->legacy);
+ }
EINA_LIST_FOREACH(accessor->params, l, acc_param)
{
@@ -180,9 +152,14 @@ _db_fill_accessor(Eolian_Function *foo_id, Eo_Class_Def *kls,
}
if (kls->type == EOLIAN_CLASS_INTERFACE)
- database_function_set_as_virtual_pure(foo_id, ftype);
+ {
+ if (accessor->type == SETTER)
+ foo_id->set_virtual_pure = EINA_TRUE;
+ else
+ foo_id->get_virtual_pure = EINA_TRUE;
+ }
- if (ftype == EOLIAN_PROP_GET)
+ if (accessor->type == GETTER)
foo_id->base = accessor->base;
else
foo_id->set_base = accessor->base;
@@ -212,8 +189,8 @@ _db_fill_property(Eolian_Class *cl, Eo_Class_Def *kls, Eo_Property_Def *prop)
Eolian_Function *foo_id = database_function_new(prop->name,
EOLIAN_UNRESOLVED);
- database_function_scope_set(foo_id, prop->scope);
- database_function_set_as_class(foo_id, prop->is_class);
+ foo_id->scope = prop->scope;
+ foo_id->is_class = prop->is_class;
if (!_db_fill_keys (foo_id, prop)) goto failure;
if (!_db_fill_values (foo_id, prop)) goto failure;
@@ -221,9 +198,9 @@ _db_fill_property(Eolian_Class *cl, Eo_Class_Def *kls, Eo_Property_Def *prop)
if (!prop->accessors)
{
- database_function_type_set(foo_id, EOLIAN_PROPERTY);
+ foo_id->type = EOLIAN_PROPERTY;
if (kls->type == EOLIAN_CLASS_INTERFACE)
- database_function_set_as_virtual_pure(foo_id, EOLIAN_UNRESOLVED);
+ foo_id->get_virtual_pure = foo_id->set_virtual_pure = EINA_TRUE;
foo_id->base = prop->base;
prop->base.file = NULL;
}
@@ -254,33 +231,29 @@ _db_fill_method(Eolian_Class *cl, Eo_Class_Def *kls, Eo_Method_Def *meth)
{
Eolian_Function *foo_id = database_function_new(meth->name, EOLIAN_METHOD);
- database_function_scope_set(foo_id, meth->scope);
+ foo_id->scope = meth->scope;
database_class_function_add(cl, foo_id);
if (meth->ret)
{
- database_function_return_type_set(foo_id, EOLIAN_METHOD,
- meth->ret->type);
- database_function_return_comment_set(foo_id, EOLIAN_METHOD,
- meth->ret->comment);
- database_function_return_flag_set_as_warn_unused(foo_id, EOLIAN_METHOD,
- meth->ret->warn_unused);
- database_function_return_default_val_set(foo_id, EOLIAN_METHOD,
- meth->ret->default_ret_val);
+ foo_id->get_ret_type = meth->ret->type;
+ foo_id->get_return_comment = eina_stringshare_ref(meth->ret->comment);
+ foo_id->get_return_warn_unused = meth->ret->warn_unused;
+ foo_id->get_ret_val = meth->ret->default_ret_val;
meth->ret->type = NULL;
meth->ret->default_ret_val = NULL;
}
- database_function_description_set(foo_id, EOLIAN_METHOD, meth->comment);
- database_function_legacy_set(foo_id, EOLIAN_METHOD, meth->legacy);
- database_function_object_set_as_const(foo_id, meth->obj_const);
- database_function_set_as_class(foo_id, meth->is_class);
+ foo_id->get_description = eina_stringshare_ref(meth->comment);
+ foo_id->get_legacy = eina_stringshare_ref(meth->legacy);
+ foo_id->obj_is_const = meth->obj_const;
+ foo_id->is_class = meth->is_class;
_db_fill_params(foo_id, meth);
if (kls->type == EOLIAN_CLASS_INTERFACE)
- database_function_set_as_virtual_pure(foo_id, EOLIAN_METHOD);
+ foo_id->get_virtual_pure = EINA_TRUE;
foo_id->base = meth->base;
meth->base.file = NULL;
@@ -300,6 +273,38 @@ _db_fill_methods(Eolian_Class *cl, Eo_Class_Def *kls)
return EINA_TRUE;
}
+static Eina_Bool
+_db_fill_ctor(Eolian_Class *cl, Eo_Method_Def *meth)
+{
+ Eolian_Function *foo_id = database_function_new(meth->name, EOLIAN_CTOR);
+
+ database_class_function_add(cl, foo_id);
+
+ if (meth->ret)
+ foo_id->get_return_comment = eina_stringshare_ref(meth->ret->comment);
+
+ foo_id->get_legacy = eina_stringshare_ref(meth->legacy);
+
+ _db_fill_params(foo_id, meth);
+
+ foo_id->base = meth->base;
+ meth->base.file = NULL;
+
+ return EINA_TRUE;
+}
+
+static Eina_Bool
+_db_fill_ctors(Eolian_Class *cl, Eo_Class_Def *kls)
+{
+ Eo_Method_Def *meth;
+ Eina_List *l;
+
+ EINA_LIST_FOREACH(kls->constructors, l, meth)
+ if (!_db_fill_ctor(cl, meth)) return EINA_FALSE;
+
+ return EINA_TRUE;
+}
+
static int
_db_fill_implement(Eolian_Class *cl, Eolian_Implement *impl)
{
@@ -350,7 +355,10 @@ _db_fill_implement(Eolian_Class *cl, Eolian_Implement *impl)
eolian_class_name_get(cl));
return -1;
}
- database_function_set_as_virtual_pure(foo_id, ftype);
+ if (ftype == EOLIAN_PROP_SET)
+ foo_id->set_virtual_pure = EINA_TRUE;
+ else
+ foo_id->get_virtual_pure = EINA_TRUE;
return 1;
}
database_class_implement_add(cl, impl);
diff --git a/src/lib/eolian/database_function.c b/src/lib/eolian/database_function.c
index d747e169fd..75cd76554c 100644
--- a/src/lib/eolian/database_function.c
+++ b/src/lib/eolian/database_function.c
@@ -32,145 +32,3 @@ database_function_new(const char *function_name, Eolian_Function_Type foo_type)
fid->type = foo_type;
return fid;
}
-
-void
-database_function_scope_set(Eolian_Function *fid, Eolian_Object_Scope scope)
-{
- EINA_SAFETY_ON_NULL_RETURN(fid);
- fid->scope = scope;
-}
-
-void
-database_function_type_set(Eolian_Function *fid, Eolian_Function_Type foo_type)
-{
- EINA_SAFETY_ON_NULL_RETURN(fid);
- switch (foo_type)
- {
- case EOLIAN_PROP_SET:
- if (fid->type == EOLIAN_PROP_GET) foo_type = EOLIAN_PROPERTY;
- break;
- case EOLIAN_PROP_GET:
- if (fid->type == EOLIAN_PROP_SET) foo_type = EOLIAN_PROPERTY;
- break;
- default:
- break;
- }
- fid->type = foo_type;
-}
-
-Eina_Bool
-database_function_set_as_virtual_pure(Eolian_Function *fid, Eolian_Function_Type ftype)
-{
- EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EINA_FALSE);
- switch (ftype)
- {
- case EOLIAN_UNRESOLVED: case EOLIAN_METHOD: case EOLIAN_PROP_GET: fid->get_virtual_pure = EINA_TRUE; break;
- case EOLIAN_PROP_SET: fid->set_virtual_pure = EINA_TRUE; break;
- default: return EINA_FALSE;
- }
- return EINA_TRUE;
-}
-
-void
-database_function_set_as_class(Eolian_Function *fid, Eina_Bool is_class)
-{
- EINA_SAFETY_ON_NULL_RETURN(fid);
- fid->is_class = is_class;
-}
-
-Eolian_Function_Parameter *
-database_property_key_add(Eolian_Function *fid, Eolian_Type *type, const char *name, const char *description)
-{
- EINA_SAFETY_ON_NULL_RETURN_VAL(fid, NULL);
- Eolian_Function_Parameter *param = database_parameter_add(type, name, description);
- fid->keys = eina_list_append(fid->keys, param);
- return param;
-}
-
-Eolian_Function_Parameter *
-database_property_value_add(Eolian_Function *fid, Eolian_Type *type, const char *name, const char *description)
-{
- EINA_SAFETY_ON_NULL_RETURN_VAL(fid, NULL);
- Eolian_Function_Parameter *param = database_parameter_add(type, name, description);
- fid->params = eina_list_append(fid->params, param);
- return param;
-}
-
-Eolian_Function_Parameter *
-database_method_parameter_add(Eolian_Function *fid, Eolian_Parameter_Dir param_dir, Eolian_Type *type, const char *name, const char *description)
-{
- EINA_SAFETY_ON_NULL_RETURN_VAL(fid, NULL);
- Eolian_Function_Parameter *param = database_parameter_add(type, name, description);
- param->param_dir = param_dir;
- fid->params = eina_list_append(fid->params, param);
- return param;
-}
-
-void database_function_return_type_set(Eolian_Function *fid, Eolian_Function_Type ftype, Eolian_Type *ret_type)
-{
- switch (ftype)
- {
- case EOLIAN_PROP_SET: fid->set_ret_type = ret_type; break;
- case EOLIAN_UNRESOLVED: case EOLIAN_METHOD: case EOLIAN_PROP_GET: fid->get_ret_type = ret_type; break;
- default: return;
- }
-}
-
-void database_function_return_default_val_set(Eolian_Function *fid, Eolian_Function_Type ftype, Eolian_Expression *ret_default_value)
-{
- switch (ftype)
- {
- case EOLIAN_PROP_SET: fid->set_ret_val = ret_default_value; break;
- case EOLIAN_UNRESOLVED: case EOLIAN_METHOD: case EOLIAN_PROP_GET: fid->get_ret_val = ret_default_value; break;
- default: return;
- }
-}
-
-void database_function_return_comment_set(Eolian_Function *fid, Eolian_Function_Type ftype, const char *ret_comment)
-{
- switch (ftype)
- {
- case EOLIAN_PROP_SET: fid->set_return_comment = eina_stringshare_ref(ret_comment); break;
- case EOLIAN_UNRESOLVED: case EOLIAN_METHOD: case EOLIAN_PROP_GET: fid->get_return_comment = eina_stringshare_ref(ret_comment); break;
- default: return;
- }
-}
-
-void database_function_return_flag_set_as_warn_unused(Eolian_Function *fid,
- Eolian_Function_Type ftype, Eina_Bool warn_unused)
-{
- EINA_SAFETY_ON_NULL_RETURN(fid);
- switch (ftype)
- {
- case EOLIAN_METHOD: case EOLIAN_PROP_GET: fid->get_return_warn_unused = warn_unused; break;
- case EOLIAN_PROP_SET: fid->set_return_warn_unused = warn_unused; break;
- default: return;
- }
-}
-
-void
-database_function_object_set_as_const(Eolian_Function *fid, Eina_Bool is_const)
-{
- EINA_SAFETY_ON_NULL_RETURN(fid);
- fid->obj_is_const = is_const;
-}
-
-void database_function_legacy_set(Eolian_Function *fid, Eolian_Function_Type ftype, const char *legacy)
-{
- switch (ftype)
- {
- case EOLIAN_PROP_SET: fid->set_legacy = eina_stringshare_ref(legacy); break;
- case EOLIAN_UNRESOLVED: case EOLIAN_METHOD: case EOLIAN_CTOR: case EOLIAN_PROP_GET: fid->get_legacy = eina_stringshare_ref(legacy); break;
- default: return;
- }
-}
-
-void database_function_description_set(Eolian_Function *fid, Eolian_Function_Type ftype, const char *desc)
-{
- switch (ftype)
- {
- case EOLIAN_PROP_SET: fid->set_description = eina_stringshare_ref(desc); break;
- case EOLIAN_UNRESOLVED: case EOLIAN_METHOD: case EOLIAN_CTOR: case EOLIAN_PROP_GET: fid->get_description = eina_stringshare_ref(desc); break;
- default: return;
- }
-}
diff --git a/src/lib/eolian/eolian_database.h b/src/lib/eolian/eolian_database.h
index f3578a79e2..35290f557d 100644
--- a/src/lib/eolian/eolian_database.h
+++ b/src/lib/eolian/eolian_database.h
@@ -310,23 +310,6 @@ Eina_Bool database_class_name_validate(const char *class_name, const Eolian_Clas
Eolian_Function *database_function_new(const char *function_name, Eolian_Function_Type foo_type);
void database_function_del(Eolian_Function *fid);
-void database_function_type_set(Eolian_Function *function_id, Eolian_Function_Type foo_type);
-void database_function_legacy_set(Eolian_Function *fid, Eolian_Function_Type ftype, const char *legacy);
-void database_function_description_set(Eolian_Function *fid, Eolian_Function_Type ftype, const char *desc);
-void database_function_return_type_set(Eolian_Function *foo_id, Eolian_Function_Type ftype, Eolian_Type *ret_type);
-void database_function_return_comment_set(Eolian_Function *foo_id, Eolian_Function_Type ftype, const char *ret_comment);
-void database_function_return_default_val_set(Eolian_Function *foo_id, Eolian_Function_Type ftype, Eolian_Expression *ret_default_value);
-void database_function_return_flag_set_as_warn_unused(Eolian_Function *foo_id, Eolian_Function_Type ftype, Eina_Bool warn_unused);
-
-void database_function_object_set_as_const(Eolian_Function *foo_id, Eina_Bool is_const);
-void database_function_set_as_class(Eolian_Function *foo_id, Eina_Bool is_class);
-Eina_Bool database_function_set_as_virtual_pure(Eolian_Function *function_id, Eolian_Function_Type type);
-void database_function_scope_set(Eolian_Function *function_id, Eolian_Object_Scope scope);
-
-Eolian_Function_Parameter *database_property_key_add(Eolian_Function *foo_id, Eolian_Type *type, const char *name, const char *description);
-Eolian_Function_Parameter *database_property_value_add(Eolian_Function *foo_id, Eolian_Type *type, const char *name, const char *description);
-Eolian_Function_Parameter *database_method_parameter_add(Eolian_Function *foo_id, Eolian_Parameter_Dir param_dir, Eolian_Type *type, const char *name, const char *description);
-
/* func parameters */
Eolian_Function_Parameter *database_parameter_add(Eolian_Type *type, const char *name, const char *description);