summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2019-05-16 15:52:46 +0200
committerDaniel Kolesa <d.kolesa@samsung.com>2019-05-16 15:52:46 +0200
commitb3a870c7bb29461c6478fae9f51c211229b62d9d (patch)
tree59e42cceb4526bcd8462d5a85a1f95f223957df5 /src
parent4ab1f2388eb303f8e5d9eae31cdcf39df683c736 (diff)
eolian: rename eolian_typedecl_enum_field_c_name_get
This is to allow for better object oriented APIs, as the `c_name` field would be inherited from Object. This also makes it more clear in C.
Diffstat (limited to 'src')
-rw-r--r--src/bin/eolian/docs.c2
-rw-r--r--src/bin/eolian/types.c2
-rw-r--r--src/bin/eolian_js/main.cc2
-rw-r--r--src/bindings/luajit/eolian.lua4
-rw-r--r--src/lib/eolian/Eolian.h4
-rw-r--r--src/lib/eolian/database_type_api.c2
-rw-r--r--src/lib/eolian_cxx/grammar/klass_def.hpp2
-rw-r--r--src/scripts/pyolian/eolian.py4
-rw-r--r--src/scripts/pyolian/eolian_lib.py6
-rwxr-xr-xsrc/scripts/pyolian/test_eolian.py2
-rw-r--r--src/tests/eolian/eolian_parsing.c4
11 files changed, 17 insertions, 17 deletions
diff --git a/src/bin/eolian/docs.c b/src/bin/eolian/docs.c
index 7120612c9d..e497581e83 100644
--- a/src/bin/eolian/docs.c
+++ b/src/bin/eolian/docs.c
@@ -68,7 +68,7 @@ _generate_ref(const Eolian_State *state, const char *refn, Eina_Strbuf *wbuf)
68 eina_stringshare_del(bname); 68 eina_stringshare_del(bname);
69 goto noref; 69 goto noref;
70 } 70 }
71 Eina_Stringshare *str = eolian_typedecl_enum_field_c_name_get(efl); 71 Eina_Stringshare *str = eolian_typedecl_enum_field_c_constant_get(efl);
72 eina_strbuf_append(wbuf, str); 72 eina_strbuf_append(wbuf, str);
73 eina_stringshare_del(bname); 73 eina_stringshare_del(bname);
74 return; 74 return;
diff --git a/src/bin/eolian/types.c b/src/bin/eolian/types.c
index 85e443e6d8..a932a7c046 100644
--- a/src/bin/eolian/types.c
+++ b/src/bin/eolian/types.c
@@ -81,7 +81,7 @@ _type_generate(const Eolian_State *state, const Eolian_Typedecl *tp,
81 const Eolian_Expression *vale = 81 const Eolian_Expression *vale =
82 eolian_typedecl_enum_field_value_get(memb, EINA_FALSE); 82 eolian_typedecl_enum_field_value_get(memb, EINA_FALSE);
83 Eina_Stringshare *membn = 83 Eina_Stringshare *membn =
84 eolian_typedecl_enum_field_c_name_get(memb); 84 eolian_typedecl_enum_field_c_constant_get(memb);
85 if (!vale) 85 if (!vale)
86 eina_strbuf_append_printf(buf, " %s", membn); 86 eina_strbuf_append_printf(buf, " %s", membn);
87 else 87 else
diff --git a/src/bin/eolian_js/main.cc b/src/bin/eolian_js/main.cc
index 86940d1dba..71466a8f83 100644
--- a/src/bin/eolian_js/main.cc
+++ b/src/bin/eolian_js/main.cc
@@ -1174,7 +1174,7 @@ int main(int argc, char** argv)
1174 , ef_end; ef != ef_end; ++ef) 1174 , ef_end; ef != ef_end; ++ef)
1175 { 1175 {
1176 auto field_name = ::eolian_typedecl_enum_field_name_get(&*ef); 1176 auto field_name = ::eolian_typedecl_enum_field_name_get(&*ef);
1177 auto field_c_name = ::eolian_typedecl_enum_field_c_name_get(&*ef); 1177 auto field_c_name = ::eolian_typedecl_enum_field_c_constant_get(&*ef);
1178 if (!field_name || !field_c_name) 1178 if (!field_name || !field_c_name)
1179 { 1179 {
1180 EINA_CXX_DOM_LOG_ERR(eolian::js::domain) << "Could not get enum field name"; 1180 EINA_CXX_DOM_LOG_ERR(eolian::js::domain) << "Could not get enum field name";
diff --git a/src/bindings/luajit/eolian.lua b/src/bindings/luajit/eolian.lua
index d3edf8492b..71886511bf 100644
--- a/src/bindings/luajit/eolian.lua
+++ b/src/bindings/luajit/eolian.lua
@@ -419,7 +419,7 @@ ffi.cdef [[
419 const Eolian_Type *eolian_typedecl_struct_field_type_get(const Eolian_Struct_Type_Field *fl); 419 const Eolian_Type *eolian_typedecl_struct_field_type_get(const Eolian_Struct_Type_Field *fl);
420 Eina_Iterator *eolian_typedecl_enum_fields_get(const Eolian_Typedecl *tp); 420 Eina_Iterator *eolian_typedecl_enum_fields_get(const Eolian_Typedecl *tp);
421 const Eolian_Enum_Type_Field *eolian_typedecl_enum_field_get(const Eolian_Typedecl *tp, const char *field); 421 const Eolian_Enum_Type_Field *eolian_typedecl_enum_field_get(const Eolian_Typedecl *tp, const char *field);
422 const char *eolian_typedecl_enum_field_c_name_get(const Eolian_Enum_Type_Field *fl); 422 const char *eolian_typedecl_enum_field_c_constant_get(const Eolian_Enum_Type_Field *fl);
423 const Eolian_Documentation *eolian_typedecl_enum_field_documentation_get(const Eolian_Enum_Type_Field *fl); 423 const Eolian_Documentation *eolian_typedecl_enum_field_documentation_get(const Eolian_Enum_Type_Field *fl);
424 const Eolian_Expression *eolian_typedecl_enum_field_value_get(const Eolian_Enum_Type_Field *fl, Eina_Bool force); 424 const Eolian_Expression *eolian_typedecl_enum_field_value_get(const Eolian_Enum_Type_Field *fl, Eina_Bool force);
425 425
@@ -979,7 +979,7 @@ ffi.metatype("Eolian_Struct_Type_Field", {
979ffi.metatype("Eolian_Enum_Type_Field", { 979ffi.metatype("Eolian_Enum_Type_Field", {
980 __index = wrap_object { 980 __index = wrap_object {
981 c_name_get = function(self) 981 c_name_get = function(self)
982 local v = eolian.eolian_typedecl_enum_field_c_name_get(self) 982 local v = eolian.eolian_typedecl_enum_field_c_constant_get(self)
983 if v == nil then return nil end 983 if v == nil then return nil end
984 return ffi_stringshare(v) 984 return ffi_stringshare(v)
985 end, 985 end,
diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h
index 662cf39f7a..3207e16634 100644
--- a/src/lib/eolian/Eolian.h
+++ b/src/lib/eolian/Eolian.h
@@ -2469,7 +2469,7 @@ eolian_typedecl_enum_field_name_get(const Eolian_Enum_Type_Field *field)
2469} 2469}
2470 2470
2471/* 2471/*
2472 * @brief Get the C name of a field of an enum type. 2472 * @brief Get the C constant name used to refer to a particular enum field.
2473 * 2473 *
2474 * The user of the API is responsible for the resulting stringshare. 2474 * The user of the API is responsible for the resulting stringshare.
2475 * 2475 *
@@ -2478,7 +2478,7 @@ eolian_typedecl_enum_field_name_get(const Eolian_Enum_Type_Field *field)
2478 * 2478 *
2479 * @ingroup Eolian 2479 * @ingroup Eolian
2480 */ 2480 */
2481EAPI Eina_Stringshare *eolian_typedecl_enum_field_c_name_get(const Eolian_Enum_Type_Field *fl); 2481EAPI Eina_Stringshare *eolian_typedecl_enum_field_c_constant_get(const Eolian_Enum_Type_Field *fl);
2482 2482
2483/* 2483/*
2484 * @brief Get the documentation of a field of an enum type. 2484 * @brief Get the documentation of a field of an enum type.
diff --git a/src/lib/eolian/database_type_api.c b/src/lib/eolian/database_type_api.c
index 7d471c7ee4..b10a9a700f 100644
--- a/src/lib/eolian/database_type_api.c
+++ b/src/lib/eolian/database_type_api.c
@@ -86,7 +86,7 @@ eolian_typedecl_enum_field_get(const Eolian_Typedecl *tp, const char *field)
86} 86}
87 87
88EAPI Eina_Stringshare * 88EAPI Eina_Stringshare *
89eolian_typedecl_enum_field_c_name_get(const Eolian_Enum_Type_Field *fl) 89eolian_typedecl_enum_field_c_constant_get(const Eolian_Enum_Type_Field *fl)
90{ 90{
91 Eina_Stringshare *ret; 91 Eina_Stringshare *ret;
92 Eina_Strbuf *buf; 92 Eina_Strbuf *buf;
diff --git a/src/lib/eolian_cxx/grammar/klass_def.hpp b/src/lib/eolian_cxx/grammar/klass_def.hpp
index fa32dfbe93..60abbb54a6 100644
--- a/src/lib/eolian_cxx/grammar/klass_def.hpp
+++ b/src/lib/eolian_cxx/grammar/klass_def.hpp
@@ -1474,7 +1474,7 @@ struct enum_value_def
1474 enum_value_def(Eolian_Enum_Type_Field const* enum_field, Eolian_Unit const*) 1474 enum_value_def(Eolian_Enum_Type_Field const* enum_field, Eolian_Unit const*)
1475 { 1475 {
1476 name = eolian_typedecl_enum_field_name_get(enum_field); 1476 name = eolian_typedecl_enum_field_name_get(enum_field);
1477 c_name = eolian_typedecl_enum_field_c_name_get(enum_field); 1477 c_name = eolian_typedecl_enum_field_c_constant_get(enum_field);
1478 auto exp = eolian_typedecl_enum_field_value_get(enum_field, EINA_TRUE); 1478 auto exp = eolian_typedecl_enum_field_value_get(enum_field, EINA_TRUE);
1479 value = eolian_expression_eval(exp, EOLIAN_MASK_INT); // FIXME hardcoded int 1479 value = eolian_expression_eval(exp, EOLIAN_MASK_INT); // FIXME hardcoded int
1480 documentation = eolian_typedecl_enum_field_documentation_get(enum_field); 1480 documentation = eolian_typedecl_enum_field_documentation_get(enum_field);
diff --git a/src/scripts/pyolian/eolian.py b/src/scripts/pyolian/eolian.py
index 502c658971..787c9ff694 100644
--- a/src/scripts/pyolian/eolian.py
+++ b/src/scripts/pyolian/eolian.py
@@ -1190,8 +1190,8 @@ class Enum_Type_Field(Object):
1190 return "<eolian.Enum_Type_Field '{0.name}', c_name='{0.c_name}'>".format(self) 1190 return "<eolian.Enum_Type_Field '{0.name}', c_name='{0.c_name}'>".format(self)
1191 1191
1192 @cached_property 1192 @cached_property
1193 def c_name(self): 1193 def c_constant(self):
1194 s = lib.eolian_typedecl_enum_field_c_name_get(self) 1194 s = lib.eolian_typedecl_enum_field_c_constant_get(self)
1195 ret = _str_to_py(s) 1195 ret = _str_to_py(s)
1196 lib.eina_stringshare_del(c_void_p(s)) 1196 lib.eina_stringshare_del(c_void_p(s))
1197 return ret 1197 return ret
diff --git a/src/scripts/pyolian/eolian_lib.py b/src/scripts/pyolian/eolian_lib.py
index 655684b66b..15863cf3b4 100644
--- a/src/scripts/pyolian/eolian_lib.py
+++ b/src/scripts/pyolian/eolian_lib.py
@@ -525,9 +525,9 @@ lib.eolian_typedecl_enum_fields_get.restype = c_void_p
525lib.eolian_typedecl_enum_field_get.argtypes = (c_void_p, c_char_p) 525lib.eolian_typedecl_enum_field_get.argtypes = (c_void_p, c_char_p)
526lib.eolian_typedecl_enum_field_get.restype = c_void_p 526lib.eolian_typedecl_enum_field_get.restype = c_void_p
527 527
528# EAPI Eina_Stringshare *eolian_typedecl_enum_field_c_name_get(const Eolian_Enum_Type_Field *fl); 528# EAPI Eina_Stringshare *eolian_typedecl_enum_field_c_constant_get(const Eolian_Enum_Type_Field *fl);
529lib.eolian_typedecl_enum_field_c_name_get.argtypes = (c_void_p,) 529lib.eolian_typedecl_enum_field_c_constant_get.argtypes = (c_void_p,)
530lib.eolian_typedecl_enum_field_c_name_get.restype = c_void_p # Stringshare TO BE FREED 530lib.eolian_typedecl_enum_field_c_constant_get.restype = c_void_p # Stringshare TO BE FREED
531 531
532# EAPI const Eolian_Documentation *eolian_typedecl_enum_field_documentation_get(const Eolian_Enum_Type_Field *fl); 532# EAPI const Eolian_Documentation *eolian_typedecl_enum_field_documentation_get(const Eolian_Enum_Type_Field *fl);
533lib.eolian_typedecl_enum_field_documentation_get.argtypes = (c_void_p,) 533lib.eolian_typedecl_enum_field_documentation_get.argtypes = (c_void_p,)
diff --git a/src/scripts/pyolian/test_eolian.py b/src/scripts/pyolian/test_eolian.py
index b394c502cf..0a28cb1010 100755
--- a/src/scripts/pyolian/test_eolian.py
+++ b/src/scripts/pyolian/test_eolian.py
@@ -512,7 +512,7 @@ class TestEolianTypedecl(unittest.TestCase):
512 field = td.enum_field_get('v1_0') 512 field = td.enum_field_get('v1_0')
513 self.assertIsInstance(field, eolian.Enum_Type_Field) 513 self.assertIsInstance(field, eolian.Enum_Type_Field)
514 self.assertEqual(field.name, 'v1_0') 514 self.assertEqual(field.name, 'v1_0')
515 self.assertEqual(field.c_name, 'EFL_NET_HTTP_VERSION_V1_0') 515 self.assertEqual(field.c_constant, 'EFL_NET_HTTP_VERSION_V1_0')
516 self.assertIsInstance(field.documentation, eolian.Documentation) 516 self.assertIsInstance(field.documentation, eolian.Documentation)
517 self.assertIsInstance(field.value, eolian.Expression) 517 self.assertIsInstance(field.value, eolian.Expression)
518 518
diff --git a/src/tests/eolian/eolian_parsing.c b/src/tests/eolian/eolian_parsing.c
index 5ac08b8cd2..8711fdf319 100644
--- a/src/tests/eolian/eolian_parsing.c
+++ b/src/tests/eolian/eolian_parsing.c
@@ -888,7 +888,7 @@ EFL_START_TEST(eolian_enum)
888 fail_if(v.type != EOLIAN_EXPR_INT); 888 fail_if(v.type != EOLIAN_EXPR_INT);
889 fail_if(v.value.i != 15); 889 fail_if(v.value.i != 15);
890 890
891 cname = eolian_typedecl_enum_field_c_name_get(field); 891 cname = eolian_typedecl_enum_field_c_constant_get(field);
892 fail_if(strcmp(cname, "TEST_FOO")); 892 fail_if(strcmp(cname, "TEST_FOO"));
893 eina_stringshare_del(cname); 893 eina_stringshare_del(cname);
894 894
@@ -915,7 +915,7 @@ EFL_START_TEST(eolian_enum)
915 fail_if(!(tdl = eolian_unit_enum_by_name_get(unit, "Name.Spaced"))); 915 fail_if(!(tdl = eolian_unit_enum_by_name_get(unit, "Name.Spaced")));
916 fail_if(!(field = eolian_typedecl_enum_field_get(tdl, "pants"))); 916 fail_if(!(field = eolian_typedecl_enum_field_get(tdl, "pants")));
917 917
918 cname = eolian_typedecl_enum_field_c_name_get(field); 918 cname = eolian_typedecl_enum_field_c_constant_get(field);
919 fail_if(strcmp(cname, "NAME_SPACED_PANTS")); 919 fail_if(strcmp(cname, "NAME_SPACED_PANTS"));
920 eina_stringshare_del(cname); 920 eina_stringshare_del(cname);
921 921