summaryrefslogtreecommitdiff
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
parent13a9650491edac356c098a2c605a444d2e16af09 (diff)
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
98 p = strncpy(env->upper_func, funcname, PATH_MAX - 1); 98 p = strncpy(env->upper_func, funcname, PATH_MAX - 1);
99 eina_str_toupper(&p); 99 eina_str_toupper(&p);
100 100
101 ret = eolian_function_full_c_name_get(funcid, tmp_env.upper_eo_prefix); 101 ret = eolian_function_full_c_name_get(funcid);
102 sprintf(p = env->upper_eo_func, "%s%s", ret, suffix); 102 sprintf(p = env->upper_eo_func, "%s%s", ret, suffix);
103 eina_str_toupper(&p); 103 eina_str_toupper(&p);
104 eina_stringshare_del(ret);
105
106 ret = eolian_function_full_c_name_get(funcid, tmp_env.lower_eo_prefix);
107 sprintf(p = env->lower_eo_func, "%s%s", ret, suffix); 104 sprintf(p = env->lower_eo_func, "%s%s", ret, suffix);
108 eina_str_tolower(&p); 105 eina_str_tolower(&p);
109 eina_stringshare_del(ret); 106 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)
807 goto end; 807 goto end;
808 } 808 }
809 809
810 rets = eolian_function_full_c_name_get(fnid, impl_env.lower_eo_prefix); 810 rets = eolian_function_full_c_name_get(fnid);
811 811
812 const char *class_str = ""; 812 const char *class_str = "";
813 if (eolian_function_is_class(fnid)) class_str = "CLASS_"; 813 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
728EAPI Eina_Stringshare *eolian_function_name_get(const Eolian_Function *function_id); 728EAPI Eina_Stringshare *eolian_function_name_get(const Eolian_Function *function_id);
729 729
730/* 730/*
731 * @brief Returns the full C name of a function (with prefix). 731 * @brief Returns the full C name of a function.
732 * 732 *
733 * @param[in] function_id Id of the function 733 * @param[in] function_id Id of the function
734 * @return the function name 734 * @return the function name
@@ -740,7 +740,7 @@ EAPI Eina_Stringshare *eolian_function_name_get(const Eolian_Function *function_
740 * 740 *
741 * @ingroup Eolian 741 * @ingroup Eolian
742 */ 742 */
743EAPI Eina_Stringshare *eolian_function_full_c_name_get(const Eolian_Function *function_id, const char *prefix); 743EAPI Eina_Stringshare *eolian_function_full_c_name_get(const Eolian_Function *function_id);
744 744
745/* 745/*
746 * @brief Get a function in a class by its name and type 746 * @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)
26 return fid->name; 26 return fid->name;
27} 27}
28 28
29static const char *
30get_eo_prefix(const Eolian_Function *foo_id, char *buf)
31{
32 char *tmp = buf;
33 if (foo_id->klass->eo_prefix)
34 return foo_id->klass->eo_prefix;
35 strcpy(buf, foo_id->klass->full_name);
36 eina_str_tolower(&buf);
37 while ((tmp = strchr(tmp, '.'))) *tmp = '_';
38 return buf;
39}
40
29EAPI Eina_Stringshare * 41EAPI Eina_Stringshare *
30eolian_function_full_c_name_get(const Eolian_Function *foo_id, const char *prefix) 42eolian_function_full_c_name_get(const Eolian_Function *foo_id)
31{ 43{
44 char tbuf[512];
45 const char *prefix = get_eo_prefix(foo_id, tbuf);
32 const char *funcn = eolian_function_name_get(foo_id); 46 const char *funcn = eolian_function_name_get(foo_id);
33 const char *last_p = strrchr(prefix, '_'); 47 const char *last_p = strrchr(prefix, '_');
34 const char *func_p = strchr(funcn, '_'); 48 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)
1329 has_keys = EINA_FALSE, has_values = EINA_FALSE, 1329 has_keys = EINA_FALSE, has_values = EINA_FALSE,
1330 has_protected = EINA_FALSE, has_class = EINA_FALSE; 1330 has_protected = EINA_FALSE, has_class = EINA_FALSE;
1331 prop = calloc(1, sizeof(Eolian_Function)); 1331 prop = calloc(1, sizeof(Eolian_Function));
1332 prop->klass = ls->tmp.kls;
1332 prop->type = EOLIAN_UNRESOLVED; 1333 prop->type = EOLIAN_UNRESOLVED;
1333 prop->base.file = eina_stringshare_ref(ls->filename); 1334 prop->base.file = eina_stringshare_ref(ls->filename);
1334 prop->base.line = ls->line_number; 1335 prop->base.line = ls->line_number;
@@ -1399,6 +1400,7 @@ parse_method(Eo_Lexer *ls, Eina_Bool ctor)
1399 has_protected = EINA_FALSE, has_class = EINA_FALSE, 1400 has_protected = EINA_FALSE, has_class = EINA_FALSE,
1400 has_eo = EINA_FALSE; 1401 has_eo = EINA_FALSE;
1401 meth = calloc(1, sizeof(Eolian_Function)); 1402 meth = calloc(1, sizeof(Eolian_Function));
1403 meth->klass = ls->tmp.kls;
1402 meth->type = EOLIAN_METHOD; 1404 meth->type = EOLIAN_METHOD;
1403 meth->base.file = eina_stringshare_ref(ls->filename); 1405 meth->base.file = eina_stringshare_ref(ls->filename);
1404 meth->base.line = ls->line_number; 1406 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
118 Eina_Bool set_only_legacy: 1; 118 Eina_Bool set_only_legacy: 1;
119 Eina_Bool is_class :1; 119 Eina_Bool is_class :1;
120 Eina_List *ctor_of; 120 Eina_List *ctor_of;
121 Eolian_Class *klass;
121}; 122};
122 123
123struct _Eolian_Function_Parameter 124struct _Eolian_Function_Parameter