forked from enlightenment/efl
eolian: remove the c_type_named_get APIs
These have inconsistent behavior and are generally unnecessary, so I'm removing them. Use the c_type_get funcs instead.
This commit is contained in:
parent
9752c44a48
commit
7cf7cba88e
|
@ -307,9 +307,6 @@ ffi.cdef [[
|
|||
|
||||
Eina_Bool eolian_typedecl_is_extern(const Eolian_Typedecl *tp);
|
||||
|
||||
const char *eolian_type_c_type_named_get(const Eolian_Type *tp, const char *name);
|
||||
const char *eolian_typedecl_c_type_named_get(const Eolian_Typedecl *tp, const char *name);
|
||||
|
||||
const char *eolian_type_c_type_get(const Eolian_Type *tp);
|
||||
const char *eolian_typedecl_c_type_get(const Eolian_Typedecl *tp);
|
||||
|
||||
|
@ -585,12 +582,6 @@ M.Typedecl = ffi.metatype("Eolian_Typedecl", {
|
|||
return eolian.eolian_typedecl_is_extern(self) ~= 0
|
||||
end,
|
||||
|
||||
c_type_named_get = function(self, name)
|
||||
local v = eolian.eolian_typedecl_c_type_named_get(self, name)
|
||||
if v == nil then return nil end
|
||||
return ffi_stringshare(v)
|
||||
end,
|
||||
|
||||
c_type_get = function(self)
|
||||
local v = eolian.eolian_typedecl_c_type_get(self)
|
||||
if v == nil then return nil end
|
||||
|
@ -671,12 +662,6 @@ M.Type = ffi.metatype("Eolian_Type", {
|
|||
return eolian.eolian_type_is_const(self) ~= 0
|
||||
end,
|
||||
|
||||
c_type_named_get = function(self, name)
|
||||
local v = eolian.eolian_type_c_type_named_get(self, name)
|
||||
if v == nil then return nil end
|
||||
return ffi_stringshare(v)
|
||||
end,
|
||||
|
||||
c_type_get = function(self)
|
||||
local v = eolian.eolian_type_c_type_get(self)
|
||||
if v == nil then return nil end
|
||||
|
|
|
@ -1597,33 +1597,13 @@ EAPI const Eolian_Type *eolian_typedecl_aliased_base_get(const Eolian_Typedecl *
|
|||
EAPI Eina_Bool eolian_typedecl_is_extern(const Eolian_Typedecl *tp);
|
||||
|
||||
/*
|
||||
* @brief Get the full C type name of the given type declaration with a name.
|
||||
*
|
||||
* @param[in] tp the type declaration.
|
||||
* @param[in] name the name.
|
||||
* @return The C type name assuming @c tp is not NULL.
|
||||
*
|
||||
* Name is ignored for alias types and they're turned into C typedefs.
|
||||
*
|
||||
* Keep in mind that if @c name is NULL, the name won't be included.
|
||||
* Also, you're responsible for deleting the stringshare.
|
||||
*
|
||||
* @see eolian_typedecl_c_type_get
|
||||
* @see eolian_type_c_type_named_get
|
||||
*
|
||||
* @ingroup Eolian
|
||||
*/
|
||||
EAPI Eina_Stringshare *eolian_typedecl_c_type_named_get(const Eolian_Typedecl *tp, const char *name);
|
||||
|
||||
/*
|
||||
* @brief Get the full C type name of the given type without a name.
|
||||
* @brief Get the full C type name of the given type.
|
||||
*
|
||||
* @param[in] tp the type declaration.
|
||||
* @return The C type name assuming @c tp is not NULL.
|
||||
*
|
||||
* This behaves exactly like eolian_typedecl_c_type_named_get when name is NULL.
|
||||
* You're responsible for deleting the stringshare.
|
||||
*
|
||||
* @see eolian_typedecl_c_type_named_get
|
||||
* @see eolian_type_c_type_get
|
||||
*
|
||||
* @ingroup Eolian
|
||||
|
@ -1770,31 +1750,13 @@ EAPI Eina_Bool eolian_type_is_own(const Eolian_Type *tp);
|
|||
EAPI Eina_Bool eolian_type_is_const(const Eolian_Type *tp);
|
||||
|
||||
/*
|
||||
* @brief Get the full C type name of the given type with a name.
|
||||
*
|
||||
* @param[in] tp the type.
|
||||
* @param[in] name the name.
|
||||
* @return The C type name assuming @c tp is not NULL.
|
||||
*
|
||||
* Keep in mind that if @c name is NULL, the name won't be included.
|
||||
* Also, you're responsible for deleting the stringshare.
|
||||
*
|
||||
* @see eolian_type_c_type_get
|
||||
* @see eolian_typedecl_c_type_named_get
|
||||
*
|
||||
* @ingroup Eolian
|
||||
*/
|
||||
EAPI Eina_Stringshare *eolian_type_c_type_named_get(const Eolian_Type *tp, const char *name);
|
||||
|
||||
/*
|
||||
* @brief Get the full C type name of the given type without a name.
|
||||
* @brief Get the full C type name of the given type.
|
||||
*
|
||||
* @param[in] tp the type.
|
||||
* @return The C type name assuming @c tp is not NULL.
|
||||
*
|
||||
* This behaves exactly like eolian_type_c_type_named_get when name is NULL.
|
||||
* You're responsible for the stringshare.
|
||||
*
|
||||
* @see eolian_type_c_type_named_get
|
||||
* @see eolian_typedecl_c_type_get
|
||||
*
|
||||
* @ingroup Eolian
|
||||
|
|
|
@ -127,7 +127,7 @@ database_type_to_str(const Eolian_Type *tp, Eina_Strbuf *buf, const char *name,
|
|||
}
|
||||
|
||||
static void
|
||||
_stype_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf, const char *name)
|
||||
_stype_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf)
|
||||
{
|
||||
Eolian_Struct_Type_Field *sf;
|
||||
Eina_List *l;
|
||||
|
@ -145,7 +145,7 @@ _stype_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf, const char *name)
|
|||
eina_strbuf_append_char(buf, ' ');
|
||||
}
|
||||
if (tp->type == EOLIAN_TYPEDECL_STRUCT_OPAQUE)
|
||||
goto append_name;
|
||||
return;
|
||||
eina_strbuf_append(buf, "{ ");
|
||||
EINA_LIST_FOREACH(tp->field_list, l, sf)
|
||||
{
|
||||
|
@ -153,16 +153,10 @@ _stype_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf, const char *name)
|
|||
eina_strbuf_append(buf, "; ");
|
||||
}
|
||||
eina_strbuf_append(buf, "}");
|
||||
append_name:
|
||||
if (name)
|
||||
{
|
||||
eina_strbuf_append_char(buf, ' ');
|
||||
eina_strbuf_append(buf, name);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_etype_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf, const char *name)
|
||||
_etype_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf)
|
||||
{
|
||||
Eolian_Enum_Type_Field *ef;
|
||||
Eina_List *l;
|
||||
|
@ -197,11 +191,6 @@ _etype_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf, const char *name)
|
|||
eina_strbuf_append(buf, ", ");
|
||||
}
|
||||
eina_strbuf_append(buf, " }");
|
||||
if (name)
|
||||
{
|
||||
eina_strbuf_append_char(buf, ' ');
|
||||
eina_strbuf_append(buf, name);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -239,7 +228,7 @@ _atype_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf)
|
|||
}
|
||||
|
||||
void
|
||||
database_typedecl_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf, const char *name)
|
||||
database_typedecl_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf)
|
||||
{
|
||||
switch (tp->type)
|
||||
{
|
||||
|
@ -247,11 +236,11 @@ database_typedecl_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf, const char
|
|||
_atype_to_str(tp, buf);
|
||||
break;
|
||||
case EOLIAN_TYPEDECL_ENUM:
|
||||
_etype_to_str(tp, buf, name);
|
||||
_etype_to_str(tp, buf);
|
||||
break;
|
||||
case EOLIAN_TYPEDECL_STRUCT:
|
||||
case EOLIAN_TYPEDECL_STRUCT_OPAQUE:
|
||||
_stype_to_str(tp, buf, name);
|
||||
_stype_to_str(tp, buf);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -345,42 +345,30 @@ eolian_typedecl_is_extern(const Eolian_Typedecl *tp)
|
|||
return tp->is_extern;
|
||||
}
|
||||
|
||||
EAPI Eina_Stringshare *
|
||||
eolian_type_c_type_named_get(const Eolian_Type *tp, const char *name)
|
||||
{
|
||||
Eina_Stringshare *ret;
|
||||
Eina_Strbuf *buf;
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
|
||||
buf = eina_strbuf_new();
|
||||
database_type_to_str(tp, buf, name, EINA_FALSE);
|
||||
ret = eina_stringshare_add(eina_strbuf_string_get(buf));
|
||||
eina_strbuf_free(buf);
|
||||
return ret;
|
||||
}
|
||||
|
||||
EAPI Eina_Stringshare *
|
||||
eolian_typedecl_c_type_named_get(const Eolian_Typedecl *tp, const char *name)
|
||||
{
|
||||
Eina_Stringshare *ret;
|
||||
Eina_Strbuf *buf;
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
|
||||
buf = eina_strbuf_new();
|
||||
database_typedecl_to_str(tp, buf, name);
|
||||
ret = eina_stringshare_add(eina_strbuf_string_get(buf));
|
||||
eina_strbuf_free(buf);
|
||||
return ret;
|
||||
}
|
||||
|
||||
EAPI Eina_Stringshare *
|
||||
eolian_type_c_type_get(const Eolian_Type *tp)
|
||||
{
|
||||
return eolian_type_c_type_named_get(tp, NULL);
|
||||
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, EINA_FALSE);
|
||||
ret = eina_stringshare_add(eina_strbuf_string_get(buf));
|
||||
eina_strbuf_free(buf);
|
||||
return ret;
|
||||
}
|
||||
|
||||
EAPI Eina_Stringshare *
|
||||
eolian_typedecl_c_type_get(const Eolian_Typedecl *tp)
|
||||
{
|
||||
return eolian_typedecl_c_type_named_get(tp, NULL);
|
||||
Eina_Stringshare *ret;
|
||||
Eina_Strbuf *buf;
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
|
||||
buf = eina_strbuf_new();
|
||||
database_typedecl_to_str(tp, buf);
|
||||
ret = eina_stringshare_add(eina_strbuf_string_get(buf));
|
||||
eina_strbuf_free(buf);
|
||||
return ret;
|
||||
}
|
||||
|
||||
EAPI Eina_Stringshare *
|
||||
|
|
|
@ -302,7 +302,7 @@ void database_type_del(Eolian_Type *tp);
|
|||
void database_typedecl_del(Eolian_Typedecl *tp);
|
||||
|
||||
void database_type_to_str(const Eolian_Type *tp, Eina_Strbuf *buf, const char *name, Eina_Bool is_ref);
|
||||
void database_typedecl_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf, const char *name);
|
||||
void database_typedecl_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf);
|
||||
|
||||
/* expressions */
|
||||
|
||||
|
|
Loading…
Reference in New Issue