summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2019-08-16 16:32:13 +0200
committerDaniel Kolesa <d.kolesa@samsung.com>2019-08-16 16:33:37 +0200
commit2f147f272596306dc230a5085c5a5b21aae6ba3c (patch)
tree5b5c1f516917898bbd9359e1cf23aa6ce26aa587
parent8a8a833837f7217aea0a33f4f7afbb6edfb103c4 (diff)
eolian: rename is_class api for functions to is_static
Still needs restriction to classes only etc to be done later. Ref https://phab.enlightenment.org/T8118 Ref https://phab.enlightenment.org/T7675
-rw-r--r--src/bin/eolian/docs.c2
-rw-r--r--src/bin/eolian/headers.c4
-rw-r--r--src/bin/eolian/sources.c20
-rw-r--r--src/bindings/luajit/eolian.lua6
-rw-r--r--src/lib/eolian/Eolian.h4
-rw-r--r--src/lib/eolian/database_function_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.c12
11 files changed, 32 insertions, 32 deletions
diff --git a/src/bin/eolian/docs.c b/src/bin/eolian/docs.c
index e497581e83..498278f0e1 100644
--- a/src/bin/eolian/docs.c
+++ b/src/bin/eolian/docs.c
@@ -570,7 +570,7 @@ eo_gen_docs_func_gen(const Eolian_State *state, const Eolian_Function *fid,
570 } 570 }
571 } 571 }
572 572
573 if (!eolian_function_is_class(fid)) 573 if (!eolian_function_is_static(fid))
574 { 574 {
575 _indent_line(buf, indent); 575 _indent_line(buf, indent);
576 eina_strbuf_append(buf, " * @param[in] obj The object.\n"); 576 eina_strbuf_append(buf, " * @param[in] obj The object.\n");
diff --git a/src/bin/eolian/headers.c b/src/bin/eolian/headers.c
index a4a20c495c..3e433b5f29 100644
--- a/src/bin/eolian/headers.c
+++ b/src/bin/eolian/headers.c
@@ -129,13 +129,13 @@ _gen_func(const Eolian_State *state, const Eolian_Function *fid,
129 eina_stringshare_del(fcn); 129 eina_stringshare_del(fcn);
130 130
131 Eina_Strbuf *flagbuf = NULL; 131 Eina_Strbuf *flagbuf = NULL;
132 int nidx = !eolian_function_is_class(fid); 132 int nidx = !eolian_function_is_static(fid);
133 133
134 eina_strbuf_append_char(buf, '('); 134 eina_strbuf_append_char(buf, '(');
135 if (nidx) 135 if (nidx)
136 { 136 {
137 if ((ftype == EOLIAN_PROP_GET) || eolian_function_object_is_const(fid) 137 if ((ftype == EOLIAN_PROP_GET) || eolian_function_object_is_const(fid)
138 || eolian_function_is_class(fid)) 138 || eolian_function_is_static(fid))
139 { 139 {
140 eina_strbuf_append(buf, "const "); 140 eina_strbuf_append(buf, "const ");
141 } 141 }
diff --git a/src/bin/eolian/sources.c b/src/bin/eolian/sources.c
index ccf5cc35e9..93d78ebbd7 100644
--- a/src/bin/eolian/sources.c
+++ b/src/bin/eolian/sources.c
@@ -570,7 +570,7 @@ _gen_func(const Eolian_Class *cl, const Eolian_Function *fid,
570 eina_strbuf_append(params, ", "); 570 eina_strbuf_append(params, ", ");
571 eina_strbuf_append(params, prn); 571 eina_strbuf_append(params, prn);
572 572
573 if (eina_strbuf_length_get(params_full) || !eolian_function_is_class(fid)) 573 if (eina_strbuf_length_get(params_full) || !eolian_function_is_static(fid))
574 { 574 {
575 eina_strbuf_append(params_full, ", "); 575 eina_strbuf_append(params_full, ", ");
576 eina_strbuf_append(params_full_imp, ", "); 576 eina_strbuf_append(params_full_imp, ", ");
@@ -660,7 +660,7 @@ _gen_func(const Eolian_Class *cl, const Eolian_Function *fid,
660 if (eina_strbuf_length_get(params)) 660 if (eina_strbuf_length_get(params))
661 eina_strbuf_append(params, ", "); 661 eina_strbuf_append(params, ", ");
662 662
663 if (eina_strbuf_length_get(params_full_imp) || !eolian_function_is_class(fid)) 663 if (eina_strbuf_length_get(params_full_imp) || !eolian_function_is_static(fid))
664 eina_strbuf_append(params_full_imp, ", "); 664 eina_strbuf_append(params_full_imp, ", ");
665 eina_strbuf_append(params_full_imp, ptn); 665 eina_strbuf_append(params_full_imp, ptn);
666 if (!had_star) 666 if (!had_star)
@@ -671,7 +671,7 @@ _gen_func(const Eolian_Class *cl, const Eolian_Function *fid,
671 eina_strbuf_append(params_full_imp, " EINA_UNUSED"); 671 eina_strbuf_append(params_full_imp, " EINA_UNUSED");
672 eina_strbuf_append(params, prn); 672 eina_strbuf_append(params, prn);
673 673
674 if (eina_strbuf_length_get(params_full) || !eolian_function_is_class(fid)) 674 if (eina_strbuf_length_get(params_full) || !eolian_function_is_static(fid))
675 eina_strbuf_append(params_full, ", "); 675 eina_strbuf_append(params_full, ", ");
676 eina_strbuf_append(params_full, ptn); 676 eina_strbuf_append(params_full, ptn);
677 if (!had_star) 677 if (!had_star)
@@ -729,7 +729,7 @@ _gen_func(const Eolian_Class *cl, const Eolian_Function *fid,
729 { 729 {
730 /* figure out the data type */ 730 /* figure out the data type */
731 Eina_Stringshare *dt = NULL; 731 Eina_Stringshare *dt = NULL;
732 if (eolian_function_is_class(fid)) 732 if (eolian_function_is_static(fid))
733 dt = eina_stringshare_add("void"); 733 dt = eina_stringshare_add("void");
734 else 734 else
735 dt = eolian_class_c_data_type_get(cl); 735 dt = eolian_class_c_data_type_get(cl);
@@ -751,7 +751,7 @@ _gen_func(const Eolian_Class *cl, const Eolian_Function *fid,
751 eina_strbuf_append(buf, func_suffix); 751 eina_strbuf_append(buf, func_suffix);
752 /* ([const ]Eo *obj, Data_Type *pd, impl_full_params); */ 752 /* ([const ]Eo *obj, Data_Type *pd, impl_full_params); */
753 eina_strbuf_append_char(buf, '('); 753 eina_strbuf_append_char(buf, '(');
754 if (!eolian_function_is_class(fid)) 754 if (!eolian_function_is_static(fid))
755 { 755 {
756 if ((ftype == EOLIAN_PROP_GET) || eolian_function_object_is_const(fid)) 756 if ((ftype == EOLIAN_PROP_GET) || eolian_function_object_is_const(fid))
757 eina_strbuf_append(buf, "const "); 757 eina_strbuf_append(buf, "const ");
@@ -760,7 +760,7 @@ _gen_func(const Eolian_Class *cl, const Eolian_Function *fid,
760 eina_strbuf_append(buf, " *pd"); 760 eina_strbuf_append(buf, " *pd");
761 } 761 }
762 eina_strbuf_append(buf, eina_strbuf_string_get(params_full_imp)); 762 eina_strbuf_append(buf, eina_strbuf_string_get(params_full_imp));
763 if (eina_strbuf_length_get(params_full_imp) == 0 && eolian_function_is_class(fid)) 763 if (eina_strbuf_length_get(params_full_imp) == 0 && eolian_function_is_static(fid))
764 eina_strbuf_append(buf, "void"); 764 eina_strbuf_append(buf, "void");
765 eina_strbuf_append(buf, ");\n\n"); 765 eina_strbuf_append(buf, ");\n\n");
766 } 766 }
@@ -832,7 +832,7 @@ _gen_func(const Eolian_Class *cl, const Eolian_Function *fid,
832 eina_stringshare_del(dt); 832 eina_stringshare_del(dt);
833 } 833 }
834 834
835 if (impl_same_class && !eolian_function_is_class(fid)) 835 if (impl_same_class && !eolian_function_is_static(fid))
836 { 836 {
837 /* generate reflection implementation */ 837 /* generate reflection implementation */
838 if (reflect_type) 838 if (reflect_type)
@@ -875,7 +875,7 @@ _gen_func(const Eolian_Class *cl, const Eolian_Function *fid,
875 if (has_params) 875 if (has_params)
876 eina_strbuf_append_char(buf, 'V'); 876 eina_strbuf_append_char(buf, 'V');
877 if ((ftype == EOLIAN_PROP_GET) || eolian_function_object_is_const(fid) 877 if ((ftype == EOLIAN_PROP_GET) || eolian_function_object_is_const(fid)
878 || eolian_function_is_class(fid)) 878 || eolian_function_is_static(fid))
879 { 879 {
880 eina_strbuf_append(buf, "_CONST"); 880 eina_strbuf_append(buf, "_CONST");
881 } 881 }
@@ -909,7 +909,7 @@ _gen_func(const Eolian_Class *cl, const Eolian_Function *fid,
909 909
910 eina_stringshare_del(eofn); 910 eina_stringshare_del(eofn);
911 } 911 }
912 if (impl_same_class && eolian_function_is_class(fid)) 912 if (impl_same_class && eolian_function_is_static(fid))
913 _emit_class_function(buf, fid, rtp, params_full, ocnamel, func_suffix, params, eolian_function_full_c_name_get(fid, ftype)); 913 _emit_class_function(buf, fid, rtp, params_full, ocnamel, func_suffix, params, eolian_function_full_c_name_get(fid, ftype));
914 914
915 free(cname); 915 free(cname);
@@ -1003,7 +1003,7 @@ _gen_initializer(const Eolian_Class *cl, Eina_Strbuf *buf, Eina_Hash *refh)
1003 Eolian_Function_Type ftype; 1003 Eolian_Function_Type ftype;
1004 const Eolian_Function *fid = eolian_implement_function_get(imp, &ftype); 1004 const Eolian_Function *fid = eolian_implement_function_get(imp, &ftype);
1005 1005
1006 if (eolian_function_is_class(fid)) continue; 1006 if (eolian_function_is_static(fid)) continue;
1007 1007
1008 if (!eina_strbuf_length_get(ops)) 1008 if (!eina_strbuf_length_get(ops))
1009 eina_strbuf_append_printf(ops, " EFL_OPS_DEFINE(ops,\n"); 1009 eina_strbuf_append_printf(ops, " EFL_OPS_DEFINE(ops,\n");
diff --git a/src/bindings/luajit/eolian.lua b/src/bindings/luajit/eolian.lua
index 55ae838cd6..352057c184 100644
--- a/src/bindings/luajit/eolian.lua
+++ b/src/bindings/luajit/eolian.lua
@@ -366,7 +366,7 @@ ffi.cdef [[
366 const char *eolian_function_full_c_name_get(const Eolian_Function *function_id, Eolian_Function_Type ftype); 366 const char *eolian_function_full_c_name_get(const Eolian_Function *function_id, Eolian_Function_Type ftype);
367 const Eolian_Function *eolian_class_function_by_name_get(const Eolian_Class *klass, const char *func_name, Eolian_Function_Type f_type); 367 const Eolian_Function *eolian_class_function_by_name_get(const Eolian_Class *klass, const char *func_name, Eolian_Function_Type f_type);
368 const Eolian_Implement *eolian_function_implement_get(const Eolian_Function *function_id); 368 const Eolian_Implement *eolian_function_implement_get(const Eolian_Function *function_id);
369 Eina_Bool eolian_function_is_class(const Eolian_Function *function_id); 369 Eina_Bool eolian_function_is_static(const Eolian_Function *function_id);
370 Eina_Bool eolian_function_is_constructor(const Eolian_Function *function_id, const Eolian_Class *klass); 370 Eina_Bool eolian_function_is_constructor(const Eolian_Function *function_id, const Eolian_Class *klass);
371 Eina_Bool eolian_function_is_function_pointer(const Eolian_Function *function_id); 371 Eina_Bool eolian_function_is_function_pointer(const Eolian_Function *function_id);
372 Eina_Iterator *eolian_property_keys_get(const Eolian_Function *foo_id, Eolian_Function_Type ftype); 372 Eina_Iterator *eolian_property_keys_get(const Eolian_Function *foo_id, Eolian_Function_Type ftype);
@@ -1201,8 +1201,8 @@ M.Function = ffi.metatype("Eolian_Function", {
1201 return v 1201 return v
1202 end, 1202 end,
1203 1203
1204 is_class = function(self) 1204 is_static = function(self)
1205 return eolian.eolian_function_is_class(self) ~= 0 1205 return eolian.eolian_function_is_static(self) ~= 0
1206 end, 1206 end,
1207 1207
1208 is_constructor = function(self, klass) 1208 is_constructor = function(self, klass)
diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h
index 2c23da328e..970cc4c728 100644
--- a/src/lib/eolian/Eolian.h
+++ b/src/lib/eolian/Eolian.h
@@ -1741,14 +1741,14 @@ EAPI const Eolian_Function *eolian_class_function_by_name_get(const Eolian_Class
1741EAPI const Eolian_Implement *eolian_function_implement_get(const Eolian_Function *function_id); 1741EAPI const Eolian_Implement *eolian_function_implement_get(const Eolian_Function *function_id);
1742 1742
1743/* 1743/*
1744 * @brief Get whether a function is a class method/property. 1744 * @brief Get whether a function is a static method/property.
1745 * 1745 *
1746 * @param[in] function_id Id of the function 1746 * @param[in] function_id Id of the function
1747 * @return EINA_TRUE and EINA_FALSE respectively 1747 * @return EINA_TRUE and EINA_FALSE respectively
1748 * 1748 *
1749 * @ingroup Eolian 1749 * @ingroup Eolian
1750 */ 1750 */
1751EAPI Eina_Bool eolian_function_is_class(const Eolian_Function *function_id); 1751EAPI Eina_Bool eolian_function_is_static(const Eolian_Function *function_id);
1752 1752
1753/* 1753/*
1754 * @brief Get whether a function is beta. 1754 * @brief Get whether a function is beta.
diff --git a/src/lib/eolian/database_function_api.c b/src/lib/eolian/database_function_api.c
index 910f2b8462..104ac6e829 100644
--- a/src/lib/eolian/database_function_api.c
+++ b/src/lib/eolian/database_function_api.c
@@ -117,7 +117,7 @@ eolian_function_implement_get(const Eolian_Function *fid)
117} 117}
118 118
119EAPI Eina_Bool 119EAPI Eina_Bool
120eolian_function_is_class(const Eolian_Function *fid) 120eolian_function_is_static(const Eolian_Function *fid)
121{ 121{
122 EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EINA_FALSE); 122 EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EINA_FALSE);
123 return fid->is_static; 123 return fid->is_static;
diff --git a/src/lib/eolian_cxx/grammar/klass_def.hpp b/src/lib/eolian_cxx/grammar/klass_def.hpp
index f96595bdc3..74375159a0 100644
--- a/src/lib/eolian_cxx/grammar/klass_def.hpp
+++ b/src/lib/eolian_cxx/grammar/klass_def.hpp
@@ -811,7 +811,7 @@ struct function_def
811 } 811 }
812 } 812 }
813 is_protected = eolian_function_scope_get(function, type) == EOLIAN_SCOPE_PROTECTED; 813 is_protected = eolian_function_scope_get(function, type) == EOLIAN_SCOPE_PROTECTED;
814 is_static = eolian_function_is_class(function); 814 is_static = eolian_function_is_static(function);
815 815
816 Eolian_Implement const* implement = eolian_function_implement_get(function); 816 Eolian_Implement const* implement = eolian_function_implement_get(function);
817 if (!implement) 817 if (!implement)
diff --git a/src/scripts/pyolian/eolian.py b/src/scripts/pyolian/eolian.py
index c287b57c35..8ec4716a67 100644
--- a/src/scripts/pyolian/eolian.py
+++ b/src/scripts/pyolian/eolian.py
@@ -865,8 +865,8 @@ class Function(Object):
865 return self.scope_get(Eolian_Function_Type.PROP_SET) 865 return self.scope_get(Eolian_Function_Type.PROP_SET)
866 866
867 @cached_property 867 @cached_property
868 def is_class(self): 868 def is_static(self):
869 return bool(lib.eolian_function_is_class(self)) 869 return bool(lib.eolian_function_is_static(self))
870 870
871 @cached_property 871 @cached_property
872 def object_is_const(self): 872 def object_is_const(self):
diff --git a/src/scripts/pyolian/eolian_lib.py b/src/scripts/pyolian/eolian_lib.py
index b9ba5f27fa..b532e98197 100644
--- a/src/scripts/pyolian/eolian_lib.py
+++ b/src/scripts/pyolian/eolian_lib.py
@@ -332,9 +332,9 @@ lib.eolian_function_full_c_name_get.restype = c_void_p # Stringshare TO BE FREE
332lib.eolian_function_implement_get.argtypes = (c_void_p,) 332lib.eolian_function_implement_get.argtypes = (c_void_p,)
333lib.eolian_function_implement_get.restype = c_void_p 333lib.eolian_function_implement_get.restype = c_void_p
334 334
335# EAPI Eina_Bool eolian_function_is_class(const Eolian_Function *function_id); 335# EAPI Eina_Bool eolian_function_is_static(const Eolian_Function *function_id);
336lib.eolian_function_is_class.argtypes = (c_void_p,) 336lib.eolian_function_is_static.argtypes = (c_void_p,)
337lib.eolian_function_is_class.restype = c_bool 337lib.eolian_function_is_static.restype = c_bool
338 338
339# EAPI Eina_Bool eolian_function_is_constructor(const Eolian_Function *function_id, const Eolian_Class *klass); 339# EAPI Eina_Bool eolian_function_is_constructor(const Eolian_Function *function_id, const Eolian_Class *klass);
340lib.eolian_function_is_constructor.argtypes = (c_void_p,c_void_p,) 340lib.eolian_function_is_constructor.argtypes = (c_void_p,c_void_p,)
diff --git a/src/scripts/pyolian/test_eolian.py b/src/scripts/pyolian/test_eolian.py
index b597e812b7..5313e4cbba 100755
--- a/src/scripts/pyolian/test_eolian.py
+++ b/src/scripts/pyolian/test_eolian.py
@@ -374,7 +374,7 @@ class TestEolianFunction(unittest.TestCase):
374 self.assertIsNone(f.method_return_type) # TODO correct ? 374 self.assertIsNone(f.method_return_type) # TODO correct ?
375 self.assertIsNone(f.setter_return_type) # TODO correct ? 375 self.assertIsNone(f.setter_return_type) # TODO correct ?
376 self.assertIsNone(f.getter_return_type) # TODO correct ? 376 self.assertIsNone(f.getter_return_type) # TODO correct ?
377 self.assertFalse(f.is_class) 377 self.assertFalse(f.is_static)
378 self.assertFalse(f.is_beta) 378 self.assertFalse(f.is_beta)
379 self.assertFalse(f.is_constructor(cls)) 379 self.assertFalse(f.is_constructor(cls))
380 # # #assert f.is_function_pointer == False # TODO broken somehow 380 # # #assert f.is_function_pointer == False # TODO broken somehow
diff --git a/src/tests/eolian/eolian_parsing.c b/src/tests/eolian/eolian_parsing.c
index 7d680af4ec..9d6a219655 100644
--- a/src/tests/eolian/eolian_parsing.c
+++ b/src/tests/eolian/eolian_parsing.c
@@ -1005,22 +1005,22 @@ EFL_START_TEST(eolian_class_funcs)
1005 /* Class properties */ 1005 /* Class properties */
1006 fail_if(eolian_class_function_by_name_get(class, "a", EOLIAN_PROPERTY)); 1006 fail_if(eolian_class_function_by_name_get(class, "a", EOLIAN_PROPERTY));
1007 fail_if(!(fid = eolian_class_function_by_name_get(class, "a", EOLIAN_PROP_GET))); 1007 fail_if(!(fid = eolian_class_function_by_name_get(class, "a", EOLIAN_PROP_GET)));
1008 fail_if(!eolian_function_is_class(fid)); 1008 fail_if(!eolian_function_is_static(fid));
1009 fail_if(!(fid = eolian_class_function_by_name_get(class, "b", EOLIAN_PROP_GET))); 1009 fail_if(!(fid = eolian_class_function_by_name_get(class, "b", EOLIAN_PROP_GET)));
1010 fail_if(eolian_function_is_class(fid)); 1010 fail_if(eolian_function_is_static(fid));
1011 1011
1012 /* Class methods */ 1012 /* Class methods */
1013 fail_if(!(fid = eolian_class_function_by_name_get(class, "foo", EOLIAN_METHOD))); 1013 fail_if(!(fid = eolian_class_function_by_name_get(class, "foo", EOLIAN_METHOD)));
1014 fail_if(!eolian_function_is_class(fid)); 1014 fail_if(!eolian_function_is_static(fid));
1015 fail_if(eolian_function_scope_get(fid, EOLIAN_METHOD) != EOLIAN_SCOPE_PUBLIC); 1015 fail_if(eolian_function_scope_get(fid, EOLIAN_METHOD) != EOLIAN_SCOPE_PUBLIC);
1016 fail_if(!(fid = eolian_class_function_by_name_get(class, "bar", EOLIAN_METHOD))); 1016 fail_if(!(fid = eolian_class_function_by_name_get(class, "bar", EOLIAN_METHOD)));
1017 fail_if(eolian_function_is_class(fid)); 1017 fail_if(eolian_function_is_static(fid));
1018 fail_if(eolian_function_scope_get(fid, EOLIAN_METHOD) != EOLIAN_SCOPE_PUBLIC); 1018 fail_if(eolian_function_scope_get(fid, EOLIAN_METHOD) != EOLIAN_SCOPE_PUBLIC);
1019 fail_if(!(fid = eolian_class_function_by_name_get(class, "baz", EOLIAN_METHOD))); 1019 fail_if(!(fid = eolian_class_function_by_name_get(class, "baz", EOLIAN_METHOD)));
1020 fail_if(!eolian_function_is_class(fid)); 1020 fail_if(!eolian_function_is_static(fid));
1021 fail_if(eolian_function_scope_get(fid, EOLIAN_METHOD) != EOLIAN_SCOPE_PROTECTED); 1021 fail_if(eolian_function_scope_get(fid, EOLIAN_METHOD) != EOLIAN_SCOPE_PROTECTED);
1022 fail_if(!(fid = eolian_class_function_by_name_get(class, "bah", EOLIAN_METHOD))); 1022 fail_if(!(fid = eolian_class_function_by_name_get(class, "bah", EOLIAN_METHOD)));
1023 fail_if(eolian_function_is_class(fid)); 1023 fail_if(eolian_function_is_static(fid));
1024 fail_if(eolian_function_scope_get(fid, EOLIAN_METHOD) != EOLIAN_SCOPE_PROTECTED); 1024 fail_if(eolian_function_scope_get(fid, EOLIAN_METHOD) != EOLIAN_SCOPE_PROTECTED);
1025 1025
1026 eolian_state_free(eos); 1026 eolian_state_free(eos);