diff options
author | Daniel Kolesa <d.kolesa@osg.samsung.com> | 2018-01-12 17:33:28 +0100 |
---|---|---|
committer | Daniel Kolesa <d.kolesa@osg.samsung.com> | 2018-01-12 18:05:13 +0100 |
commit | 707ed05d58b2dd46f7617073ab516a862e2a029a (patch) | |
tree | 75780247a8772af532b4d8fd48eb49cb02edee6e /src | |
parent | db417349545efeb8e54f2281192bd3480c78e1a4 (diff) |
eolian: do not require unit for type_class_get
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/eolian_js/eolian/class.hh | 2 | ||||
-rw-r--r-- | src/bindings/luajit/eolian.lua | 6 | ||||
-rw-r--r-- | src/lib/eolian/Eolian.h | 3 | ||||
-rw-r--r-- | src/lib/eolian/database_type_api.c | 4 | ||||
-rw-r--r-- | src/lib/eolian/database_validate.c | 2 | ||||
-rw-r--r-- | src/lib/eolian_cxx/grammar/klass_def.hpp | 2 | ||||
-rw-r--r-- | src/scripts/pyolian/eolian.py | 9 | ||||
-rw-r--r-- | src/scripts/pyolian/eolian_lib.py | 7 |
8 files changed, 16 insertions, 19 deletions
diff --git a/src/bin/eolian_js/eolian/class.hh b/src/bin/eolian_js/eolian/class.hh index c9f027d532..633d6c4e72 100644 --- a/src/bin/eolian_js/eolian/class.hh +++ b/src/bin/eolian_js/eolian/class.hh | |||
@@ -44,7 +44,7 @@ inline std::string type_class_name(Eolian_Type const* tp) | |||
44 | tpt = ::eolian_type_type_get(tp); | 44 | tpt = ::eolian_type_type_get(tp); |
45 | if (tpt == EOLIAN_TYPE_CLASS) | 45 | if (tpt == EOLIAN_TYPE_CLASS) |
46 | { | 46 | { |
47 | Eolian_Class const* klass = ::eolian_type_class_get(NULL, tp); | 47 | Eolian_Class const* klass = ::eolian_type_class_get(tp); |
48 | if (klass) | 48 | if (klass) |
49 | { | 49 | { |
50 | Eina_Stringshare* klass_name = ::eolian_class_full_name_get(klass); | 50 | Eina_Stringshare* klass_name = ::eolian_class_full_name_get(klass); |
diff --git a/src/bindings/luajit/eolian.lua b/src/bindings/luajit/eolian.lua index 080e06bde2..5ce81a0aa3 100644 --- a/src/bindings/luajit/eolian.lua +++ b/src/bindings/luajit/eolian.lua | |||
@@ -404,7 +404,7 @@ ffi.cdef [[ | |||
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_Unit *unit, 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_Unit *unit, const Eolian_Typedecl *tp); |
406 | 406 | ||
407 | const Eolian_Class *eolian_type_class_get(const Eolian_Unit *unit, 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); |
409 | Eina_Bool eolian_type_is_const(const Eolian_Type *tp); | 409 | Eina_Bool eolian_type_is_const(const Eolian_Type *tp); |
410 | Eina_Bool eolian_type_is_ptr(const Eolian_Type *tp); | 410 | Eina_Bool eolian_type_is_ptr(const Eolian_Type *tp); |
@@ -853,8 +853,8 @@ M.Type = ffi.metatype("Eolian_Type", { | |||
853 | return v | 853 | return v |
854 | end, | 854 | end, |
855 | 855 | ||
856 | class_get = function(self, unit) | 856 | class_get = function(self) |
857 | local v = eolian.eolian_type_class_get(unit, self) | 857 | local v = eolian.eolian_type_class_get(self) |
858 | if v == nil then return nil end | 858 | if v == nil then return nil end |
859 | return v | 859 | return v |
860 | end, | 860 | end, |
diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h index 2f6336664e..8e9017b778 100644 --- a/src/lib/eolian/Eolian.h +++ b/src/lib/eolian/Eolian.h | |||
@@ -1985,13 +1985,12 @@ EAPI const Eolian_Type *eolian_type_aliased_base_get(const Eolian_Unit *unit, co | |||
1985 | /* | 1985 | /* |
1986 | * @brief Get the class associated with an EOLIAN_TYPE_CLASS type. | 1986 | * @brief Get the class associated with an EOLIAN_TYPE_CLASS type. |
1987 | * | 1987 | * |
1988 | * @param[in] unit the unit to look in | ||
1989 | * @param[in] tp the type. | 1988 | * @param[in] tp the type. |
1990 | * @return the class or NULL. | 1989 | * @return the class or NULL. |
1991 | * | 1990 | * |
1992 | * @ingroup Eolian | 1991 | * @ingroup Eolian |
1993 | */ | 1992 | */ |
1994 | EAPI const Eolian_Class *eolian_type_class_get(const Eolian_Unit *unit, const Eolian_Type *tp); | 1993 | EAPI const Eolian_Class *eolian_type_class_get(const Eolian_Type *tp); |
1995 | 1994 | ||
1996 | /* | 1995 | /* |
1997 | * @brief Get whether the given type is owned. | 1996 | * @brief Get whether the given type is owned. |
diff --git a/src/lib/eolian/database_type_api.c b/src/lib/eolian/database_type_api.c index d733a93ed3..4528b7c9ed 100644 --- a/src/lib/eolian/database_type_api.c +++ b/src/lib/eolian/database_type_api.c | |||
@@ -312,12 +312,12 @@ eolian_typedecl_aliased_base_get(const Eolian_Unit *unit, const Eolian_Typedecl | |||
312 | } | 312 | } |
313 | 313 | ||
314 | EAPI const Eolian_Class * | 314 | EAPI const Eolian_Class * |
315 | eolian_type_class_get(const Eolian_Unit *unit, const Eolian_Type *tp) | 315 | eolian_type_class_get(const Eolian_Type *tp) |
316 | { | 316 | { |
317 | EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL); | 317 | EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL); |
318 | if (eolian_type_type_get(tp) != EOLIAN_TYPE_CLASS) | 318 | if (eolian_type_type_get(tp) != EOLIAN_TYPE_CLASS) |
319 | return NULL; | 319 | return NULL; |
320 | return eolian_class_get_by_name(unit, tp->full_name); | 320 | return tp->klass; |
321 | } | 321 | } |
322 | 322 | ||
323 | EAPI Eina_Bool | 323 | EAPI Eina_Bool |
diff --git a/src/lib/eolian/database_validate.c b/src/lib/eolian/database_validate.c index b6e40b690a..fbbf26e03d 100644 --- a/src/lib/eolian/database_validate.c +++ b/src/lib/eolian/database_validate.c | |||
@@ -266,7 +266,7 @@ _validate_type(const Eolian_Unit *src, Eolian_Type *tp) | |||
266 | } | 266 | } |
267 | case EOLIAN_TYPE_CLASS: | 267 | case EOLIAN_TYPE_CLASS: |
268 | { | 268 | { |
269 | tp->klass = (Eolian_Class *)eolian_type_class_get(src, tp); | 269 | tp->klass = (Eolian_Class *)eolian_class_get_by_name(src, tp->full_name); |
270 | if (!tp->klass) | 270 | if (!tp->klass) |
271 | { | 271 | { |
272 | snprintf(buf, sizeof(buf), "undefined class %s " | 272 | snprintf(buf, sizeof(buf), "undefined class %s " |
diff --git a/src/lib/eolian_cxx/grammar/klass_def.hpp b/src/lib/eolian_cxx/grammar/klass_def.hpp index baaa61382e..e7e6018872 100644 --- a/src/lib/eolian_cxx/grammar/klass_def.hpp +++ b/src/lib/eolian_cxx/grammar/klass_def.hpp | |||
@@ -385,7 +385,7 @@ inline void type_def::set(Eolian_Type const* eolian_type, Eolian_Unit const* uni | |||
385 | break; | 385 | break; |
386 | case EOLIAN_TYPE_CLASS: | 386 | case EOLIAN_TYPE_CLASS: |
387 | { | 387 | { |
388 | Eolian_Class const* klass = eolian_type_class_get(unit, eolian_type); | 388 | Eolian_Class const* klass = eolian_type_class_get(eolian_type); |
389 | original_type = klass_name(klass, {qualifiers(eolian_type), {}}); | 389 | original_type = klass_name(klass, {qualifiers(eolian_type), {}}); |
390 | } | 390 | } |
391 | break; | 391 | break; |
diff --git a/src/scripts/pyolian/eolian.py b/src/scripts/pyolian/eolian.py index c15f167433..9146f5245b 100644 --- a/src/scripts/pyolian/eolian.py +++ b/src/scripts/pyolian/eolian.py | |||
@@ -1087,11 +1087,10 @@ class Type(EolianBaseObject): # OK (4 TODO Unit*) | |||
1087 | # c_type = lib.eolian_type_aliased_base_get(self._obj) | 1087 | # c_type = lib.eolian_type_aliased_base_get(self._obj) |
1088 | # return Type(c_type) if c_type else None | 1088 | # return Type(c_type) if c_type else None |
1089 | 1089 | ||
1090 | # TODO FIXME STRANGE API (need Eolian_Unit*) | 1090 | @cached_property |
1091 | # @cached_property | 1091 | def class_(self): |
1092 | # def class_(self): | 1092 | c_cls = lib.eolian_type_class_get(self._obj) |
1093 | # c_cls = lib.eolian_type_class_get(self._obj) | 1093 | return Class(c_cls) if c_cls else None |
1094 | # return Class(c_cls) if c_cls else None | ||
1095 | 1094 | ||
1096 | @cached_property | 1095 | @cached_property |
1097 | def file(self): | 1096 | def file(self): |
diff --git a/src/scripts/pyolian/eolian_lib.py b/src/scripts/pyolian/eolian_lib.py index 66b1556b5b..945f15d4c2 100644 --- a/src/scripts/pyolian/eolian_lib.py +++ b/src/scripts/pyolian/eolian_lib.py | |||
@@ -560,10 +560,9 @@ lib.eolian_type_next_type_get.restype = c_void_p | |||
560 | # lib.eolian_type_aliased_base_get.argtypes = [c_void_p,] | 560 | # lib.eolian_type_aliased_base_get.argtypes = [c_void_p,] |
561 | # lib.eolian_type_aliased_base_get.restype = c_void_p | 561 | # lib.eolian_type_aliased_base_get.restype = c_void_p |
562 | 562 | ||
563 | # TODO FIXME STRANGE API (need Eolian_Unit*) | 563 | # EAPI const Eolian_Class *eolian_type_class_get(const Eolian_Type *tp); |
564 | # EAPI const Eolian_Class *eolian_type_class_get(const Eolian_Unit *unit, const Eolian_Type *tp); | 564 | lib.eolian_type_class_get.argtypes = [c_void_p,] |
565 | # lib.eolian_type_class_get.argtypes = [c_void_p,] | 565 | lib.eolian_type_class_get.restype = c_void_p |
566 | # lib.eolian_type_class_get.restype = c_void_p | ||
567 | 566 | ||
568 | # EAPI Eina_Bool eolian_type_is_owned(const Eolian_Type *tp); | 567 | # EAPI Eina_Bool eolian_type_is_owned(const Eolian_Type *tp); |
569 | lib.eolian_type_is_owned.argtypes = [c_void_p,] | 568 | lib.eolian_type_is_owned.argtypes = [c_void_p,] |