eolian: remove second parameter for eolian_type_c_type_get
This has been replaced by newer APIs.
This commit is contained in:
parent
165921ec04
commit
267c57d0f1
|
@ -380,7 +380,7 @@ eo_gen_docs_event_gen(const Eolian_State *state, const Eolian_Event *ev,
|
|||
if (rt)
|
||||
{
|
||||
p = buf;
|
||||
Eina_Stringshare *rts = eolian_type_c_type_get(rt, EOLIAN_C_TYPE_DEFAULT);
|
||||
Eina_Stringshare *rts = eolian_type_c_type_get(rt);
|
||||
snprintf(buf, sizeof(buf), "@return %s", rts);
|
||||
eina_stringshare_del(rts);
|
||||
}
|
||||
|
|
|
@ -235,7 +235,7 @@ _generate_iterative_free(Eina_Strbuf **buf, const Eolian_Type *type, const Eolia
|
|||
eina_strbuf_append_printf(iter_param, "%s_iter", eolian_parameter_name_get(parameter));
|
||||
|
||||
//generate the field definition
|
||||
eina_strbuf_append_printf(*buf, " %s", eolian_type_c_type_get(inner_type, EOLIAN_C_TYPE_DEFAULT));
|
||||
eina_strbuf_append_printf(*buf, " %s", eolian_type_c_type_get(inner_type));
|
||||
eina_strbuf_append_buffer(*buf, iter_param);
|
||||
eina_strbuf_append(*buf, ";\n");
|
||||
|
||||
|
|
|
@ -203,7 +203,7 @@ _var_generate(const Eolian_State *state, const Eolian_Variable *vr)
|
|||
}
|
||||
else
|
||||
{
|
||||
Eina_Stringshare *ct = eolian_type_c_type_get(vt, EOLIAN_C_TYPE_DEFAULT);
|
||||
Eina_Stringshare *ct = eolian_type_c_type_get(vt);
|
||||
eina_strbuf_append_printf(buf, "EWAPI extern %s %s;", ct, fn);
|
||||
eina_stringshare_del(ct);
|
||||
}
|
||||
|
@ -394,7 +394,7 @@ _source_gen_var(Eina_Strbuf *buf, const Eolian_Variable *vr)
|
|||
eina_str_toupper(&fn);
|
||||
|
||||
const Eolian_Type *vt = eolian_variable_base_type_get(vr);
|
||||
Eina_Stringshare *ct = eolian_type_c_type_get(vt, EOLIAN_C_TYPE_DEFAULT);
|
||||
Eina_Stringshare *ct = eolian_type_c_type_get(vt);
|
||||
eina_strbuf_append_printf(buf, "EWAPI %s %s = ", ct, fn);
|
||||
eina_stringshare_del(ct);
|
||||
free(fn);
|
||||
|
|
|
@ -172,12 +172,6 @@ ffi.cdef [[
|
|||
EOLIAN_TYPE_BUILTIN_VOID_PTR
|
||||
} Eolian_Type_Builtin_Type;
|
||||
|
||||
typedef enum {
|
||||
EOLIAN_C_TYPE_DEFAULT = 0,
|
||||
EOLIAN_C_TYPE_PARAM,
|
||||
EOLIAN_C_TYPE_RETURN
|
||||
} Eolian_C_Type_Type;
|
||||
|
||||
typedef enum {
|
||||
EOLIAN_EXPR_UNKNOWN = 0,
|
||||
EOLIAN_EXPR_INT,
|
||||
|
@ -453,7 +447,7 @@ ffi.cdef [[
|
|||
|
||||
Eina_Bool eolian_typedecl_is_extern(const Eolian_Typedecl *tp);
|
||||
|
||||
const char *eolian_type_c_type_get(const Eolian_Type *tp, Eolian_C_Type_Type ctype);
|
||||
const char *eolian_type_c_type_get(const Eolian_Type *tp);
|
||||
const char *eolian_typedecl_c_type_get(const Eolian_Typedecl *tp);
|
||||
const char *eolian_typedecl_free_func_get(const Eolian_Typedecl *tp);
|
||||
|
||||
|
@ -989,12 +983,6 @@ M.typedecl_type = {
|
|||
FUNCTION_POINTER = 5
|
||||
}
|
||||
|
||||
M.c_type_type = {
|
||||
DEFAULT = 0,
|
||||
PARAM = 1,
|
||||
RETURN = 2
|
||||
}
|
||||
|
||||
ffi.metatype("Eolian_Struct_Type_Field", {
|
||||
__index = wrap_object {
|
||||
documentation_get = function(self)
|
||||
|
@ -1175,8 +1163,8 @@ M.Type = ffi.metatype("Eolian_Type", {
|
|||
return eolian.eolian_type_is_ptr(self) ~= 0
|
||||
end,
|
||||
|
||||
c_type_get = function(self, ctype)
|
||||
local v = eolian.eolian_type_c_type_get(self, ctype)
|
||||
c_type_get = function(self)
|
||||
local v = eolian.eolian_type_c_type_get(self)
|
||||
if v == nil then return nil end
|
||||
return ffi_stringshare(v)
|
||||
end
|
||||
|
|
|
@ -351,13 +351,6 @@ typedef enum
|
|||
EOLIAN_TYPE_BUILTIN_VOID_PTR
|
||||
} Eolian_Type_Builtin_Type;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
EOLIAN_C_TYPE_DEFAULT = 0,
|
||||
EOLIAN_C_TYPE_PARAM,
|
||||
EOLIAN_C_TYPE_RETURN
|
||||
} Eolian_C_Type_Type;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
EOLIAN_EXPR_UNKNOWN = 0,
|
||||
|
@ -3000,7 +2993,6 @@ EAPI Eina_Bool eolian_type_is_ptr(const Eolian_Type *tp);
|
|||
* @brief Get the full C type name of the given type.
|
||||
*
|
||||
* @param[in] tp the type.
|
||||
* @param[in] ctype the context within which the C type string will be used.
|
||||
* @return The C type name assuming @c tp is not NULL.
|
||||
*
|
||||
* You're responsible for the stringshare.
|
||||
|
@ -3009,7 +3001,7 @@ EAPI Eina_Bool eolian_type_is_ptr(const Eolian_Type *tp);
|
|||
*
|
||||
* @ingroup Eolian
|
||||
*/
|
||||
EAPI Eina_Stringshare *eolian_type_c_type_get(const Eolian_Type *tp, Eolian_C_Type_Type ctype);
|
||||
EAPI Eina_Stringshare *eolian_type_c_type_get(const Eolian_Type *tp);
|
||||
|
||||
/*
|
||||
* @brief A helper function to get the full name of a type.
|
||||
|
|
|
@ -267,13 +267,13 @@ eolian_typedecl_is_extern(const Eolian_Typedecl *tp)
|
|||
}
|
||||
|
||||
EAPI Eina_Stringshare *
|
||||
eolian_type_c_type_get(const Eolian_Type *tp, Eolian_C_Type_Type ctype)
|
||||
eolian_type_c_type_get(const Eolian_Type *tp)
|
||||
{
|
||||
Eina_Stringshare *ret;
|
||||
Eina_Strbuf *buf;
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
|
||||
buf = eina_strbuf_new();
|
||||
database_type_to_str(tp, buf, NULL, ctype, EINA_FALSE);
|
||||
database_type_to_str(tp, buf, NULL, EOLIAN_C_TYPE_DEFAULT, EINA_FALSE);
|
||||
ret = eina_stringshare_add(eina_strbuf_string_get(buf));
|
||||
eina_strbuf_free(buf);
|
||||
return ret;
|
||||
|
|
|
@ -263,6 +263,13 @@ struct _Eolian_Function_Parameter
|
|||
Eina_Bool move :1;
|
||||
};
|
||||
|
||||
typedef enum
|
||||
{
|
||||
EOLIAN_C_TYPE_DEFAULT = 0,
|
||||
EOLIAN_C_TYPE_PARAM,
|
||||
EOLIAN_C_TYPE_RETURN
|
||||
} Eolian_C_Type_Type;
|
||||
|
||||
struct _Eolian_Type
|
||||
{
|
||||
Eolian_Object base;
|
||||
|
|
|
@ -491,7 +491,7 @@ inline void type_def::set(Eolian_Type const* eolian_type, Eolian_Unit const* uni
|
|||
{
|
||||
complex.subtypes.push_back({stp
|
||||
, unit
|
||||
, ::eolian_type_c_type_get(stp, EOLIAN_C_TYPE_DEFAULT)
|
||||
, ::eolian_type_c_type_get(stp)
|
||||
, eolian_type_is_move(stp)
|
||||
, is_by::value});
|
||||
stp = eolian_type_next_type_get(stp);
|
||||
|
@ -554,7 +554,7 @@ struct alias_def
|
|||
auto eolian_type = ::eolian_typedecl_base_type_get(alias_obj);
|
||||
base_type = type_def(eolian_type
|
||||
, unit
|
||||
, ::eolian_type_c_type_get(eolian_type, EOLIAN_C_TYPE_DEFAULT)
|
||||
, ::eolian_type_c_type_get(eolian_type)
|
||||
, value_ownership::unmoved
|
||||
, is_by::value);
|
||||
is_undefined = false;
|
||||
|
@ -1029,7 +1029,7 @@ struct variable_def
|
|||
, full_name(::eolian_variable_name_get(variable))
|
||||
, base_type(::eolian_variable_base_type_get(variable)
|
||||
, unit
|
||||
, ::eolian_type_c_type_get(eolian_variable_base_type_get(variable), ::EOLIAN_C_TYPE_DEFAULT)
|
||||
, ::eolian_type_c_type_get(eolian_variable_base_type_get(variable))
|
||||
, value_ownership::unmoved
|
||||
, is_by::value)
|
||||
, documentation(::eolian_variable_documentation_get(variable))
|
||||
|
@ -1117,7 +1117,7 @@ struct event_def
|
|||
: klass(cls, {attributes::qualifier_info::is_none, std::string()})
|
||||
, type( ::eolian_event_type_get(event) ? eina::optional<type_def>{{::eolian_event_type_get(event)
|
||||
, unit
|
||||
, ::eolian_type_c_type_get(::eolian_event_type_get(event), EOLIAN_C_TYPE_DEFAULT)
|
||||
, ::eolian_type_c_type_get(::eolian_event_type_get(event))
|
||||
, value_ownership::unmoved
|
||||
, is_by::value}
|
||||
} : eina::optional<type_def>{})
|
||||
|
|
|
@ -142,11 +142,6 @@ class Eolian_Type_Builtin_Type(IntEnum):
|
|||
VOID_PTR = 48
|
||||
FREE_CB = 49
|
||||
|
||||
class Eolian_C_Type_Type(IntEnum):
|
||||
DEFAULT = 0
|
||||
PARAM = 1
|
||||
RETURN = 2
|
||||
|
||||
class Eolian_Expression_Type(IntEnum):
|
||||
UNKNOWN = 0
|
||||
INT = 1
|
||||
|
@ -1053,24 +1048,12 @@ class Type(Object):
|
|||
def builtin_type(self):
|
||||
return Eolian_Type_Builtin_Type(lib.eolian_type_builtin_type_get(self))
|
||||
|
||||
def c_type_get(self, ctype):
|
||||
s = lib.eolian_type_c_type_get(self, ctype)
|
||||
def c_type_get(self):
|
||||
s = lib.eolian_type_c_type_get(self)
|
||||
ret = _str_to_py(s)
|
||||
lib.eina_stringshare_del(c_void_p(s))
|
||||
return ret
|
||||
|
||||
@cached_property
|
||||
def c_type_default(self):
|
||||
return self.c_type_get(Eolian_C_Type_Type.DEFAULT)
|
||||
|
||||
@cached_property
|
||||
def c_type_param(self):
|
||||
return self.c_type_get(Eolian_C_Type_Type.PARAM)
|
||||
|
||||
@cached_property
|
||||
def c_type_return(self):
|
||||
return self.c_type_get(Eolian_C_Type_Type.RETURN)
|
||||
|
||||
@cached_property
|
||||
def typedecl(self):
|
||||
c_tdecl = lib.eolian_type_typedecl_get(self)
|
||||
|
|
|
@ -603,8 +603,8 @@ lib.eolian_type_is_const.restype = c_bool
|
|||
lib.eolian_type_is_ptr.argtypes = (c_void_p,)
|
||||
lib.eolian_type_is_ptr.restype = c_bool
|
||||
|
||||
# EAPI Eina_Stringshare *eolian_type_c_type_get(const Eolian_Type *tp, Eolian_C_Type_Type ctype);
|
||||
lib.eolian_type_c_type_get.argtypes = (c_void_p, c_int)
|
||||
# EAPI Eina_Stringshare *eolian_type_c_type_get(const Eolian_Type *tp);
|
||||
lib.eolian_type_c_type_get.argtypes = (c_void_p)
|
||||
lib.eolian_type_c_type_get.restype = c_void_p # Stringshare TO BE FREED
|
||||
|
||||
### Eolian_Expression #######################################################
|
||||
|
|
|
@ -582,10 +582,6 @@ class TestEolianType(unittest.TestCase):
|
|||
self.assertIsNone(t.class_)
|
||||
self.assertEqual(t, t.aliased_base) # TODO find a better test
|
||||
|
||||
self.assertEqual(t.c_type_default, 'double') # TODO find a better test
|
||||
self.assertEqual(t.c_type_param, 'double')
|
||||
self.assertEqual(t.c_type_return, 'double')
|
||||
|
||||
def test_type_regular(self):
|
||||
cls = eolian_db.class_by_name_get('Efl.Gfx.Entity')
|
||||
func = cls.function_by_name_get('geometry')
|
||||
|
@ -601,10 +597,6 @@ class TestEolianType(unittest.TestCase):
|
|||
self.assertIsNone(t.class_)
|
||||
self.assertEqual(t, t.aliased_base)
|
||||
|
||||
self.assertEqual(t.c_type_default, 'Eina_Rect') # TODO find a better test
|
||||
self.assertEqual(t.c_type_param, 'Eina_Rect')
|
||||
self.assertEqual(t.c_type_return, 'Eina_Rect')
|
||||
|
||||
td = t.typedecl
|
||||
self.assertIsInstance(td, eolian.Typedecl)
|
||||
self.assertEqual(td.name, 'Eina.Rect')
|
||||
|
@ -623,10 +615,6 @@ class TestEolianType(unittest.TestCase):
|
|||
self.assertEqual(list(t.namespaces), ['Efl', 'Gfx'])
|
||||
self.assertEqual(t, t.aliased_base)
|
||||
|
||||
self.assertEqual(t.c_type_default, 'Efl_Gfx_Entity *') # TODO find a better test
|
||||
self.assertEqual(t.c_type_param, 'Efl_Gfx_Entity *')
|
||||
self.assertEqual(t.c_type_return, 'Efl_Gfx_Entity *')
|
||||
|
||||
cls = t.class_
|
||||
self.assertIsInstance(cls, eolian.Class)
|
||||
self.assertEqual(cls.name, 'Efl.Gfx.Entity')
|
||||
|
|
|
@ -375,12 +375,12 @@ EFL_START_TEST(eolian_typedef)
|
|||
fail_if(!(type_name = eolian_typedecl_short_name_get(tdl)));
|
||||
fail_if(strcmp(type_name, "List_Objects"));
|
||||
fail_if(!(type = eolian_typedecl_base_type_get(tdl)));
|
||||
fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_DEFAULT)));
|
||||
fail_if(!(type_name = eolian_type_c_type_get(type)));
|
||||
fail_if(strcmp(type_name, "Eina_List *"));
|
||||
eina_stringshare_del(type_name);
|
||||
fail_if(!(type = eolian_type_base_type_get(type)));
|
||||
fail_if(!!eolian_type_next_type_get(type));
|
||||
fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_DEFAULT)));
|
||||
fail_if(!(type_name = eolian_type_c_type_get(type)));
|
||||
fail_if(strcmp(type_name, "Typedef *"));
|
||||
eina_stringshare_del(type_name);
|
||||
|
||||
|
@ -432,14 +432,14 @@ EFL_START_TEST(eolian_complex_type)
|
|||
eina_stringshare_del(type_name);
|
||||
fail_if(!(type = eolian_type_base_type_get(type)));
|
||||
fail_if(!!eolian_type_next_type_get(type));
|
||||
fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_DEFAULT)));
|
||||
fail_if(!(type_name = eolian_type_c_type_get(type)));
|
||||
fail_if(eolian_type_is_move(type));
|
||||
fail_if(eolian_type_builtin_type_get(type) != EOLIAN_TYPE_BUILTIN_ARRAY);
|
||||
fail_if(strcmp(type_name, "Eina_Array *"));
|
||||
eina_stringshare_del(type_name);
|
||||
fail_if(!(type = eolian_type_base_type_get(type)));
|
||||
fail_if(!!eolian_type_next_type_get(type));
|
||||
fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_DEFAULT)));
|
||||
fail_if(!(type_name = eolian_type_c_type_get(type)));
|
||||
fail_if(!eolian_type_is_move(type));
|
||||
fail_if(strcmp(type_name, "Eina_Strbuf *"));
|
||||
eina_stringshare_del(type_name);
|
||||
|
@ -456,7 +456,7 @@ EFL_START_TEST(eolian_complex_type)
|
|||
eina_stringshare_del(type_name);
|
||||
fail_if(!(type = eolian_type_base_type_get(type)));
|
||||
fail_if(!!eolian_type_next_type_get(type));
|
||||
fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_DEFAULT)));
|
||||
fail_if(!(type_name = eolian_type_c_type_get(type)));
|
||||
fail_if(eolian_type_is_move(type));
|
||||
fail_if(strcmp(type_name, "const char *"));
|
||||
eina_stringshare_del(type_name);
|
||||
|
@ -470,7 +470,7 @@ EFL_START_TEST(eolian_complex_type)
|
|||
eina_stringshare_del(type_name);
|
||||
fail_if(!(type = eolian_type_base_type_get(type)));
|
||||
fail_if(!!eolian_type_next_type_get(type));
|
||||
fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_DEFAULT)));
|
||||
fail_if(!(type_name = eolian_type_c_type_get(type)));
|
||||
fail_if(eolian_type_is_move(type));
|
||||
fail_if(eolian_type_builtin_type_get(type) != EOLIAN_TYPE_BUILTIN_STRINGSHARE);
|
||||
fail_if(strcmp(type_name, "Eina_Stringshare *"));
|
||||
|
|
Loading…
Reference in New Issue