summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2018-01-12 18:02:32 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2018-01-12 18:05:13 +0100
commitc6436337a466572b5d811234aca445f3e46650a8 (patch)
treeb8960768bad6349ae77c4047417710d9825d11cd
parent19c16b671e3bafd1ea360fbd331b4952391f6ee9 (diff)
eolian: aliased_base_get funcs don't need unit
-rw-r--r--src/bin/eolian/sources.c2
-rw-r--r--src/bindings/luajit/eolian.lua12
-rw-r--r--src/lib/eolian/Eolian.h6
-rw-r--r--src/lib/eolian/database_type_api.c10
-rw-r--r--src/scripts/elua/apps/docgen/doctree.lua9
-rw-r--r--src/scripts/pyolian/eolian.py18
-rw-r--r--src/scripts/pyolian/eolian_lib.py14
-rw-r--r--src/tests/eolian/eolian_parsing.c2
8 files changed, 32 insertions, 41 deletions
diff --git a/src/bin/eolian/sources.c b/src/bin/eolian/sources.c
index eb7f3853e2..e6dff01eb7 100644
--- a/src/bin/eolian/sources.c
+++ b/src/bin/eolian/sources.c
@@ -123,7 +123,7 @@ _append_defval(const Eolian_Unit *src, Eina_Strbuf *buf,
123 else WRN("evaluation of default value failed"); 123 else WRN("evaluation of default value failed");
124 } 124 }
125 /* default value or fallback */ 125 /* default value or fallback */
126 const Eolian_Type *btp = eolian_type_aliased_base_get(src, tp); 126 const Eolian_Type *btp = eolian_type_aliased_base_get(tp);
127 if (eolian_type_is_ptr(btp)) 127 if (eolian_type_is_ptr(btp))
128 { 128 {
129 eina_strbuf_append(buf, "NULL"); 129 eina_strbuf_append(buf, "NULL");
diff --git a/src/bindings/luajit/eolian.lua b/src/bindings/luajit/eolian.lua
index 940ad8367d..1e0f0a8a8e 100644
--- a/src/bindings/luajit/eolian.lua
+++ b/src/bindings/luajit/eolian.lua
@@ -401,8 +401,8 @@ ffi.cdef [[
401 const Eolian_Type *eolian_typedecl_base_type_get(const Eolian_Typedecl *tp); 401 const Eolian_Type *eolian_typedecl_base_type_get(const Eolian_Typedecl *tp);
402 const Eolian_Typedecl *eolian_type_typedecl_get(const Eolian_Type *tp); 402 const Eolian_Typedecl *eolian_type_typedecl_get(const Eolian_Type *tp);
403 403
404 const Eolian_Type *eolian_type_aliased_base_get(const Eolian_Unit *unit, const Eolian_Type *tp); 404 const Eolian_Type *eolian_type_aliased_base_get(const Eolian_Type *tp);
405 const Eolian_Type *eolian_typedecl_aliased_base_get(const Eolian_Unit *unit, const Eolian_Typedecl *tp); 405 const Eolian_Type *eolian_typedecl_aliased_base_get(const Eolian_Typedecl *tp);
406 406
407 const Eolian_Class *eolian_type_class_get(const Eolian_Type *tp); 407 const Eolian_Class *eolian_type_class_get(const Eolian_Type *tp);
408 Eina_Bool eolian_type_is_owned(const Eolian_Type *tp); 408 Eina_Bool eolian_type_is_owned(const Eolian_Type *tp);
@@ -766,8 +766,8 @@ M.Typedecl = ffi.metatype("Eolian_Typedecl", {
766 return v 766 return v
767 end, 767 end,
768 768
769 aliased_base_get = function(self, unit) 769 aliased_base_get = function(self)
770 local v = eolian.eolian_typedecl_aliased_byse_get(unit, self) 770 local v = eolian.eolian_typedecl_aliased_byse_get(self)
771 if v == nil then return nil end 771 if v == nil then return nil end
772 return v 772 return v
773 end, 773 end,
@@ -847,8 +847,8 @@ M.Type = ffi.metatype("Eolian_Type", {
847 return v 847 return v
848 end, 848 end,
849 849
850 aliased_base_get = function(self, unit) 850 aliased_base_get = function(self)
851 local v = eolian.eolian_type_aliased_byse_get(unit, self) 851 local v = eolian.eolian_type_aliased_byse_get(self)
852 if v == nil then return nil end 852 if v == nil then return nil end
853 return v 853 return v
854 end, 854 end,
diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h
index 34b47c5fca..0610ccb7ac 100644
--- a/src/lib/eolian/Eolian.h
+++ b/src/lib/eolian/Eolian.h
@@ -1807,13 +1807,12 @@ EAPI const Eolian_Type *eolian_typedecl_base_type_get(const Eolian_Typedecl *tp)
1807 * If the given typedecl is an alias, it returns the result of 1807 * If the given typedecl is an alias, it returns the result of
1808 * eolian_type_aliased_base_get on its base type. Otherwise this returns NULL. 1808 * eolian_type_aliased_base_get on its base type. Otherwise this returns NULL.
1809 * 1809 *
1810 * @param[in] unit the unit to look in
1811 * @param[in] tp the type declaration. 1810 * @param[in] tp the type declaration.
1812 * @return the lowest alias base or the given type. 1811 * @return the lowest alias base or the given type.
1813 * 1812 *
1814 * @ingroup Eolian 1813 * @ingroup Eolian
1815 */ 1814 */
1816EAPI const Eolian_Type *eolian_typedecl_aliased_base_get(const Eolian_Unit *unit, const Eolian_Typedecl *tp); 1815EAPI const Eolian_Type *eolian_typedecl_aliased_base_get(const Eolian_Typedecl *tp);
1817 1816
1818/* 1817/*
1819 * @brief Check if a struct or alias type declaration is extern. 1818 * @brief Check if a struct or alias type declaration is extern.
@@ -1973,13 +1972,12 @@ EAPI const Eolian_Typedecl *eolian_type_typedecl_get(const Eolian_Type *tp);
1973 * type actually is while still having convenience. Keep in mind that this stops 1972 * type actually is while still having convenience. Keep in mind that this stops
1974 * if the found type is actually a pointer (has a ptr() on it). 1973 * if the found type is actually a pointer (has a ptr() on it).
1975 * 1974 *
1976 * @param[in] unit the unit to look in
1977 * @param[in] tp the type. 1975 * @param[in] tp the type.
1978 * @return the lowest alias base or the given type. 1976 * @return the lowest alias base or the given type.
1979 * 1977 *
1980 * @ingroup Eolian 1978 * @ingroup Eolian
1981 */ 1979 */
1982EAPI const Eolian_Type *eolian_type_aliased_base_get(const Eolian_Unit *unit, const Eolian_Type *tp); 1980EAPI const Eolian_Type *eolian_type_aliased_base_get(const Eolian_Type *tp);
1983 1981
1984/* 1982/*
1985 * @brief Get the class associated with an EOLIAN_TYPE_CLASS type. 1983 * @brief Get the class associated with an EOLIAN_TYPE_CLASS type.
diff --git a/src/lib/eolian/database_type_api.c b/src/lib/eolian/database_type_api.c
index eedb42a828..cb128910c7 100644
--- a/src/lib/eolian/database_type_api.c
+++ b/src/lib/eolian/database_type_api.c
@@ -282,22 +282,22 @@ eolian_typedecl_base_type_get(const Eolian_Typedecl *tp)
282} 282}
283 283
284EAPI const Eolian_Type * 284EAPI const Eolian_Type *
285eolian_type_aliased_base_get(const Eolian_Unit *unit, const Eolian_Type *tp) 285eolian_type_aliased_base_get(const Eolian_Type *tp)
286{ 286{
287 if (!tp || tp->type != EOLIAN_TYPE_REGULAR || tp->is_ptr) 287 if (!tp || tp->type != EOLIAN_TYPE_REGULAR || tp->is_ptr)
288 return tp; 288 return tp;
289 const Eolian_Typedecl *btp = database_type_decl_find(unit, tp); 289 const Eolian_Typedecl *btp = eolian_type_typedecl_get(tp);
290 if (btp && (btp->type == EOLIAN_TYPEDECL_ALIAS)) 290 if (btp && (btp->type == EOLIAN_TYPEDECL_ALIAS))
291 return eolian_typedecl_aliased_base_get(unit, btp); 291 return eolian_typedecl_aliased_base_get(btp);
292 return tp; 292 return tp;
293} 293}
294 294
295EAPI const Eolian_Type * 295EAPI const Eolian_Type *
296eolian_typedecl_aliased_base_get(const Eolian_Unit *unit, const Eolian_Typedecl *tp) 296eolian_typedecl_aliased_base_get(const Eolian_Typedecl *tp)
297{ 297{
298 if (!tp || tp->type != EOLIAN_TYPEDECL_ALIAS) 298 if (!tp || tp->type != EOLIAN_TYPEDECL_ALIAS)
299 return NULL; 299 return NULL;
300 return eolian_type_aliased_base_get(unit, tp->base_type); 300 return eolian_type_aliased_base_get(tp->base_type);
301} 301}
302 302
303EAPI const Eolian_Class * 303EAPI const Eolian_Class *
diff --git a/src/scripts/elua/apps/docgen/doctree.lua b/src/scripts/elua/apps/docgen/doctree.lua
index 479303bdd1..fbe684a488 100644
--- a/src/scripts/elua/apps/docgen/doctree.lua
+++ b/src/scripts/elua/apps/docgen/doctree.lua
@@ -710,8 +710,7 @@ M.Type = Node:clone {
710 end, 710 end,
711 711
712 typedecl_get = function(self) 712 typedecl_get = function(self)
713 -- FIXME: unit 713 local v = self.type:typedecl_get()
714 local v = self.type:typedecl_get(eos:unit_get())
715 if not v then 714 if not v then
716 return nil 715 return nil
717 end 716 end
@@ -719,8 +718,7 @@ M.Type = Node:clone {
719 end, 718 end,
720 719
721 aliased_base_get = function(self) 720 aliased_base_get = function(self)
722 -- FIXME: unit 721 local v = self.type:aliased_base_get()
723 local v = self.type:aliased_base_get(eos:unit_get())
724 if not v then 722 if not v then
725 return nil 723 return nil
726 end 724 end
@@ -896,8 +894,7 @@ M.Typedecl = Node:clone {
896 end, 894 end,
897 895
898 aliased_base_get = function(self) 896 aliased_base_get = function(self)
899 -- FIXME: unit 897 local v = self.typedecl:aliased_base_get()
900 local v = self.typedecl:aliased_base_get(eos:unit_get())
901 if not v then 898 if not v then
902 return nil 899 return nil
903 end 900 end
diff --git a/src/scripts/pyolian/eolian.py b/src/scripts/pyolian/eolian.py
index 60bfdba0c1..cdb269ab80 100644
--- a/src/scripts/pyolian/eolian.py
+++ b/src/scripts/pyolian/eolian.py
@@ -1080,11 +1080,10 @@ class Type(EolianBaseObject): # OK (4 TODO Unit*)
1080 c_type = lib.eolian_type_next_type_get(self._obj) 1080 c_type = lib.eolian_type_next_type_get(self._obj)
1081 return Type(c_type) if c_type else None 1081 return Type(c_type) if c_type else None
1082 1082
1083 # TODO FIXME STRANGE API (need Eolian_Unit*) 1083 @cached_property
1084 # @cached_property 1084 def aliased_base(self):
1085 # def aliased_base(self): 1085 c_type = lib.eolian_type_aliased_base_get(self._obj)
1086 # c_type = lib.eolian_type_aliased_base_get(self._obj) 1086 return Type(c_type) if c_type else None
1087 # return Type(c_type) if c_type else None
1088 1087
1089 @cached_property 1088 @cached_property
1090 def class_(self): 1089 def class_(self):
@@ -1172,11 +1171,10 @@ class Typedecl(EolianBaseObject): # OK (2 TODO Unit*)
1172 c_type = lib.eolian_typedecl_base_type_get(self._obj) 1171 c_type = lib.eolian_typedecl_base_type_get(self._obj)
1173 return Type(c_type) if c_type else None 1172 return Type(c_type) if c_type else None
1174 1173
1175 # TODO FIX THIS, need Eolian_Unit* param ??? 1174 @cached_property
1176 # @cached_property 1175 def aliased_base(self):
1177 # def aliased_base(self): 1176 c_type = lib.eolian_typedecl_aliased_base_get(self._obj)
1178 # c_type = lib.eolian_typedecl_aliased_base_get(self._obj) 1177 return Type(c_type) if c_type else None
1179 # return Type(c_type) if c_type else None
1180 1178
1181 @cached_property 1179 @cached_property
1182 def documentation(self): 1180 def documentation(self):
diff --git a/src/scripts/pyolian/eolian_lib.py b/src/scripts/pyolian/eolian_lib.py
index 2e67cb0563..bd17374d40 100644
--- a/src/scripts/pyolian/eolian_lib.py
+++ b/src/scripts/pyolian/eolian_lib.py
@@ -496,10 +496,9 @@ lib.eolian_typedecl_file_get.restype = c_char_p
496lib.eolian_typedecl_base_type_get.argtypes = [c_void_p,] 496lib.eolian_typedecl_base_type_get.argtypes = [c_void_p,]
497lib.eolian_typedecl_base_type_get.restype = c_void_p 497lib.eolian_typedecl_base_type_get.restype = c_void_p
498 498
499# TODO FIXME STRANGE API (need Eolian_Unit*) 499# EAPI const Eolian_Type *eolian_typedecl_aliased_base_get(const Eolian_Typedecl *tp);
500# EAPI const Eolian_Type *eolian_typedecl_aliased_base_get(const Eolian_Unit *unit, const Eolian_Typedecl *tp); 500lib.eolian_typedecl_aliased_base_get.argtypes = [c_void_p,]
501# lib.eolian_typedecl_aliased_base_get.argtypes = [c_void_p, c_void_p,] 501lib.eolian_typedecl_aliased_base_get.restype = c_void_p
502# lib.eolian_typedecl_aliased_base_get.restype = c_void_p
503 502
504# EAPI Eina_Bool eolian_typedecl_is_extern(const Eolian_Typedecl *tp); 503# EAPI Eina_Bool eolian_typedecl_is_extern(const Eolian_Typedecl *tp);
505lib.eolian_typedecl_is_extern.argtypes = [c_void_p,] 504lib.eolian_typedecl_is_extern.argtypes = [c_void_p,]
@@ -554,10 +553,9 @@ lib.eolian_type_next_type_get.restype = c_void_p
554lib.eolian_type_typedecl_get.argtypes = [c_void_p,] 553lib.eolian_type_typedecl_get.argtypes = [c_void_p,]
555lib.eolian_type_typedecl_get.restype = c_void_p 554lib.eolian_type_typedecl_get.restype = c_void_p
556 555
557# TODO FIXME STRANGE API (need Eolian_Unit*) 556# EAPI const Eolian_Type *eolian_type_aliased_base_get(const Eolian_Type *tp);
558# EAPI const Eolian_Type *eolian_type_aliased_base_get(const Eolian_Unit *unit, const Eolian_Type *tp); 557lib.eolian_type_aliased_base_get.argtypes = [c_void_p,]
559# lib.eolian_type_aliased_base_get.argtypes = [c_void_p,] 558lib.eolian_type_aliased_base_get.restype = c_void_p
560# lib.eolian_type_aliased_base_get.restype = c_void_p
561 559
562# EAPI const Eolian_Class *eolian_type_class_get(const Eolian_Type *tp); 560# EAPI const Eolian_Class *eolian_type_class_get(const Eolian_Type *tp);
563lib.eolian_type_class_get.argtypes = [c_void_p,] 561lib.eolian_type_class_get.argtypes = [c_void_p,]
diff --git a/src/tests/eolian/eolian_parsing.c b/src/tests/eolian/eolian_parsing.c
index 79f611ab41..c30ce6e32e 100644
--- a/src/tests/eolian/eolian_parsing.c
+++ b/src/tests/eolian/eolian_parsing.c
@@ -364,7 +364,7 @@ START_TEST(eolian_typedef)
364 364
365 /* Lowest alias base */ 365 /* Lowest alias base */
366 fail_if(!(tdl = eolian_typedecl_alias_get_by_name(unit, "Evas.Coord3"))); 366 fail_if(!(tdl = eolian_typedecl_alias_get_by_name(unit, "Evas.Coord3")));
367 fail_if(!(type = eolian_typedecl_aliased_base_get(unit, tdl))); 367 fail_if(!(type = eolian_typedecl_aliased_base_get(tdl)));
368 fail_if(strcmp(eolian_type_name_get(type), "int")); 368 fail_if(strcmp(eolian_type_name_get(type), "int"));
369 369
370 /* Complex type */ 370 /* Complex type */