aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2014-09-25 15:37:18 +0100
committerDaniel Kolesa <d.kolesa@samsung.com>2014-09-25 15:37:18 +0100
commit8631212e454a26ddd51bdf9a2d6c9090fa23b36f (patch)
tree259188a8087015fa2fdcb82e1e06f0e4ae600c0d
parenteolian: properly replace commas in event_c_name_get and cleanup generator (diff)
downloadefl-8631212e454a26ddd51bdf9a2d6c9090fa23b36f.tar.gz
eolian: remove the need to pass prefix to eolian_function_full_c_name_get
-rw-r--r--src/bin/eolian/common_funcs.c5
-rw-r--r--src/bin/eolian/eo_generator.c2
-rw-r--r--src/lib/eolian/Eolian.h4
-rw-r--r--src/lib/eolian/database_function_api.c16
-rw-r--r--src/lib/eolian/eo_parser.c2
-rw-r--r--src/lib/eolian/eolian_database.h1
6 files changed, 22 insertions, 8 deletions
diff --git a/src/bin/eolian/common_funcs.c b/src/bin/eolian/common_funcs.c
index faa52bb6ff..4bfd3036e7 100644
--- a/src/bin/eolian/common_funcs.c
+++ b/src/bin/eolian/common_funcs.c
@@ -98,12 +98,9 @@ _class_func_env_create(const Eolian_Class *class, const char *funcname, Eolian_F
p = strncpy(env->upper_func, funcname, PATH_MAX - 1);
eina_str_toupper(&p);
- ret = eolian_function_full_c_name_get(funcid, tmp_env.upper_eo_prefix);
+ ret = eolian_function_full_c_name_get(funcid);
sprintf(p = env->upper_eo_func, "%s%s", ret, suffix);
eina_str_toupper(&p);
- eina_stringshare_del(ret);
-
- ret = eolian_function_full_c_name_get(funcid, tmp_env.lower_eo_prefix);
sprintf(p = env->lower_eo_func, "%s%s", ret, suffix);
eina_str_tolower(&p);
eina_stringshare_del(ret);
diff --git a/src/bin/eolian/eo_generator.c b/src/bin/eolian/eo_generator.c
index 31431abbfc..5255c9fa69 100644
--- a/src/bin/eolian/eo_generator.c
+++ b/src/bin/eolian/eo_generator.c
@@ -807,7 +807,7 @@ eo_source_end_generate(const Eolian_Class *class, Eina_Strbuf *buf)
goto end;
}
- rets = eolian_function_full_c_name_get(fnid, impl_env.lower_eo_prefix);
+ rets = eolian_function_full_c_name_get(fnid);
const char *class_str = "";
if (eolian_function_is_class(fnid)) class_str = "CLASS_";
diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h
index 33310710b0..0fcecd8af1 100644
--- a/src/lib/eolian/Eolian.h
+++ b/src/lib/eolian/Eolian.h
@@ -728,7 +728,7 @@ EAPI Eolian_Object_Scope eolian_function_scope_get(const Eolian_Function *functi
EAPI Eina_Stringshare *eolian_function_name_get(const Eolian_Function *function_id);
/*
- * @brief Returns the full C name of a function (with prefix).
+ * @brief Returns the full C name of a function.
*
* @param[in] function_id Id of the function
* @return the function name
@@ -740,7 +740,7 @@ EAPI Eina_Stringshare *eolian_function_name_get(const Eolian_Function *function_
*
* @ingroup Eolian
*/
-EAPI Eina_Stringshare *eolian_function_full_c_name_get(const Eolian_Function *function_id, const char *prefix);
+EAPI Eina_Stringshare *eolian_function_full_c_name_get(const Eolian_Function *function_id);
/*
* @brief Get a function in a class by its name and type
diff --git a/src/lib/eolian/database_function_api.c b/src/lib/eolian/database_function_api.c
index 2fe0ae337a..95bf12c6b9 100644
--- a/src/lib/eolian/database_function_api.c
+++ b/src/lib/eolian/database_function_api.c
@@ -26,9 +26,23 @@ eolian_function_name_get(const Eolian_Function *fid)
return fid->name;
}
+static const char *
+get_eo_prefix(const Eolian_Function *foo_id, char *buf)
+{
+ char *tmp = buf;
+ if (foo_id->klass->eo_prefix)
+ return foo_id->klass->eo_prefix;
+ strcpy(buf, foo_id->klass->full_name);
+ eina_str_tolower(&buf);
+ while ((tmp = strchr(tmp, '.'))) *tmp = '_';
+ return buf;
+}
+
EAPI Eina_Stringshare *
-eolian_function_full_c_name_get(const Eolian_Function *foo_id, const char *prefix)
+eolian_function_full_c_name_get(const Eolian_Function *foo_id)
{
+ char tbuf[512];
+ const char *prefix = get_eo_prefix(foo_id, tbuf);
const char *funcn = eolian_function_name_get(foo_id);
const char *last_p = strrchr(prefix, '_');
const char *func_p = strchr(funcn, '_');
diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c
index 70f7dc1a4c..c14efa7bd4 100644
--- a/src/lib/eolian/eo_parser.c
+++ b/src/lib/eolian/eo_parser.c
@@ -1329,6 +1329,7 @@ parse_property(Eo_Lexer *ls)
has_keys = EINA_FALSE, has_values = EINA_FALSE,
has_protected = EINA_FALSE, has_class = EINA_FALSE;
prop = calloc(1, sizeof(Eolian_Function));
+ prop->klass = ls->tmp.kls;
prop->type = EOLIAN_UNRESOLVED;
prop->base.file = eina_stringshare_ref(ls->filename);
prop->base.line = ls->line_number;
@@ -1399,6 +1400,7 @@ parse_method(Eo_Lexer *ls, Eina_Bool ctor)
has_protected = EINA_FALSE, has_class = EINA_FALSE,
has_eo = EINA_FALSE;
meth = calloc(1, sizeof(Eolian_Function));
+ meth->klass = ls->tmp.kls;
meth->type = EOLIAN_METHOD;
meth->base.file = eina_stringshare_ref(ls->filename);
meth->base.line = ls->line_number;
diff --git a/src/lib/eolian/eolian_database.h b/src/lib/eolian/eolian_database.h
index 393fee61d2..acf8e61369 100644
--- a/src/lib/eolian/eolian_database.h
+++ b/src/lib/eolian/eolian_database.h
@@ -118,6 +118,7 @@ struct _Eolian_Function
Eina_Bool set_only_legacy: 1;
Eina_Bool is_class :1;
Eina_List *ctor_of;
+ Eolian_Class *klass;
};
struct _Eolian_Function_Parameter