eolian: remove support for old doc style on types and vars

This commit is contained in:
Daniel Kolesa 2015-06-11 16:52:45 +01:00
parent 786f848f67
commit cd12f938af
8 changed files with 5 additions and 148 deletions

View File

@ -33,35 +33,12 @@ _concat_name(const Eolian_Type *tp)
return str;
}
static void
_desc_generate(const char *desc, Eina_Strbuf *buf)
{
if (desc)
{
eina_strbuf_append(buf, "/**\n");
eina_strbuf_append(buf, desc);
eina_strbuf_replace_all(buf, "\n", "\n * ");
eina_strbuf_append(buf, "\n */\n");
eina_strbuf_replace_all(buf, " * \n", " *\n"); /* Remove trailing whitespaces */
}
}
static Eina_Strbuf *
_type_generate(const Eolian_Type *tp, Eina_Bool full)
{
const char *cdesc = eolian_type_description_get(tp);
Eina_Strbuf *buf;
if (cdesc)
{
buf = eina_strbuf_new();
_desc_generate(cdesc, buf);
}
else
{
buf = docs_generate_full(eolian_type_documentation_get(tp), 0);
if (!buf) buf = eina_strbuf_new();
else eina_strbuf_append_char(buf, '\n');
}
Eina_Strbuf *buf = docs_generate_full(eolian_type_documentation_get(tp), 0);
if (!buf) buf = eina_strbuf_new();
else eina_strbuf_append_char(buf, '\n');
Eolian_Type_Type tp_type = eolian_type_type_get(tp);
switch(tp_type)
{
@ -95,11 +72,9 @@ _type_generate(const Eolian_Type *tp, Eina_Bool full)
eina_strbuf_append_printf(buf, " %s%s%s;",
c_type, strchr(c_type, '*')?"":" ",
eolian_type_struct_field_name_get(member));
const char *fdesc = eolian_type_struct_field_description_get(member);
const Eolian_Documentation *fdoc
= eolian_type_struct_field_documentation_get(member);
if (fdesc) eina_strbuf_append_printf(buf, " /** %s */", fdesc);
else if (fdoc)
if (fdoc)
{
const char *nl = strrchr(eina_strbuf_string_get(buf), '\n');
if (nl)
@ -160,14 +135,12 @@ _type_generate(const Eolian_Type *tp, Eina_Bool full)
}
eina_stringshare_del(lit);
}
const char *fdesc = eolian_type_enum_field_description_get(member);
const Eolian_Documentation *fdoc
= eolian_type_enum_field_documentation_get(member);
next = eina_iterator_next(members, (void**)&member);
if (next)
eina_strbuf_append(buf, ",");
if (fdesc) eina_strbuf_append_printf(buf, " /** %s */", fdesc);
else if (fdoc)
if (fdoc)
{
const char *nl = strrchr(eina_strbuf_string_get(buf), '\n');
if (nl)

View File

@ -1554,16 +1554,6 @@ EAPI const Eolian_Struct_Type_Field *eolian_type_struct_field_get(const Eolian_T
*/
EAPI Eina_Stringshare *eolian_type_struct_field_name_get(const Eolian_Struct_Type_Field *fl);
/*
* @brief Get the description of a field of a struct type.
*
* @param[in] fl the field.
* @return the description.
*
* @ingroup Eolian
*/
EAPI Eina_Stringshare *eolian_type_struct_field_description_get(const Eolian_Struct_Type_Field *fl);
/*
* @brief Get the documentation of a field of a struct type.
*
@ -1631,16 +1621,6 @@ EAPI Eina_Stringshare *eolian_type_enum_field_name_get(const Eolian_Enum_Type_Fi
*/
EAPI Eina_Stringshare *eolian_type_enum_field_c_name_get(const Eolian_Enum_Type_Field *fl);
/*
* @brief Get the description of a field of an enum type.
*
* @param[in] fl the field.
* @return the description.
*
* @ingroup Eolian
*/
EAPI Eina_Stringshare *eolian_type_enum_field_description_get(const Eolian_Enum_Type_Field *fl);
/*
* @brief Get the documentation of a field of an enum type.
*
@ -1677,17 +1657,6 @@ EAPI const Eolian_Expression *eolian_type_enum_field_value_get(const Eolian_Enum
*/
EAPI Eina_Stringshare *eolian_type_enum_legacy_prefix_get(const Eolian_Type *tp);
/*
* @brief Get the description of a struct/alias type.
*
* @param[in] tp the type.
* @return the description when @c tp is EOLIAN_TYPE_STRUCT or
* EOLIAN_TYPE_STRUCT_OPAQUE, NULL otherwise.
*
* @ingroup Eolian
*/
EAPI Eina_Stringshare *eolian_type_description_get(const Eolian_Type *tp);
/*
* @brief Get the documentation of a struct/alias type.
*
@ -2057,16 +2026,6 @@ EAPI Eina_Iterator *eolian_variable_constants_get_by_file(const char *fname);
*/
EAPI Eolian_Variable_Type eolian_variable_type_get(const Eolian_Variable *var);
/*
* @brief Get the description of a variable.
*
* @param[in] var the variable.
* @return the description or NULL.
*
* @ingroup Eolian
*/
EAPI Eina_Stringshare *eolian_variable_description_get(const Eolian_Variable *var);
/*
* @brief Get the documentation of a variable.
*

View File

@ -22,7 +22,6 @@ database_type_del(Eolian_Type *tp)
if (tp->field_list) eina_list_free(tp->field_list);
if (tp->namespaces) EINA_LIST_FREE(tp->namespaces, sp)
eina_stringshare_del(sp);
if (tp->comment) eina_stringshare_del(tp->comment);
if (tp->legacy) eina_stringshare_del(tp->legacy);
if (tp->freefunc) eina_stringshare_del(tp->freefunc);
database_doc_del(tp->doc);

View File

@ -114,13 +114,6 @@ eolian_type_struct_field_name_get(const Eolian_Struct_Type_Field *fl)
return fl->name;
}
EAPI Eina_Stringshare *
eolian_type_struct_field_description_get(const Eolian_Struct_Type_Field *fl)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(fl, NULL);
return fl->comment;
}
EAPI const Eolian_Documentation *
eolian_type_struct_field_documentation_get(const Eolian_Struct_Type_Field *fl)
{
@ -185,13 +178,6 @@ eolian_type_enum_field_c_name_get(const Eolian_Enum_Type_Field *fl)
return ret;
}
EAPI Eina_Stringshare *
eolian_type_enum_field_description_get(const Eolian_Enum_Type_Field *fl)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(fl, NULL);
return fl->comment;
}
EAPI const Eolian_Documentation *
eolian_type_enum_field_documentation_get(const Eolian_Enum_Type_Field *fl)
{
@ -215,17 +201,6 @@ eolian_type_enum_legacy_prefix_get(const Eolian_Type *tp)
return tp->legacy;
}
EAPI Eina_Stringshare *
eolian_type_description_get(const Eolian_Type *tp)
{
Eolian_Type_Type tpp;
EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
tpp = eolian_type_type_get(tp);
EINA_SAFETY_ON_FALSE_RETURN_VAL(tpp != EOLIAN_TYPE_POINTER
&& tpp != EOLIAN_TYPE_VOID, NULL);
return tp->comment;
}
EAPI const Eolian_Documentation *
eolian_type_documentation_get(const Eolian_Type *tp)
{

View File

@ -18,7 +18,6 @@ database_var_del(Eolian_Variable *var)
if (var->namespaces) EINA_LIST_FREE(var->namespaces, sp)
eina_stringshare_del(sp);
if (var->value) database_expr_del(var->value);
if (var->comment) eina_stringshare_del(var->comment);
database_doc_del(var->doc);
free(var);
}

View File

@ -54,13 +54,6 @@ eolian_variable_type_get(const Eolian_Variable *var)
return var->type;
}
EAPI Eina_Stringshare *
eolian_variable_description_get(const Eolian_Variable *var)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(var, NULL);
return var->comment;
}
EAPI const Eolian_Documentation *
eolian_variable_documentation_get(const Eolian_Variable *var)
{

View File

@ -467,7 +467,6 @@ _struct_field_free(Eolian_Struct_Type_Field *def)
if (def->base.file) eina_stringshare_del(def->base.file);
if (def->name) eina_stringshare_del(def->name);
database_type_del(def->type);
if (def->comment) eina_stringshare_del(def->comment);
database_doc_del(def->doc);
free(def);
}
@ -485,11 +484,6 @@ parse_struct(Eo_Lexer *ls, const char *name, Eina_Bool is_extern,
def->freefunc = freefunc;
pop_str(ls);
check_next(ls, '{');
if (ls->t.token == TOK_COMMENT)
{
def->comment = eina_stringshare_ref(ls->t.value.s);
eo_lexer_get(ls);
}
FILL_DOC(ls, def, doc);
while (ls->t.token != '}')
{
@ -512,11 +506,6 @@ parse_struct(Eo_Lexer *ls, const char *name, Eina_Bool is_extern,
fdef->name = eina_stringshare_ref(fname);
pop_type(ls);
check_next(ls, ';');
if (ls->t.token == TOK_COMMENT)
{
fdef->comment = eina_stringshare_ref(ls->t.value.s);
eo_lexer_get(ls);
}
FILL_DOC(ls, fdef, doc);
}
check_match(ls, '}', '{', bline, bcolumn);
@ -531,7 +520,6 @@ _enum_field_free(Eolian_Enum_Type_Field *def)
if (def->base.file) eina_stringshare_del(def->base.file);
if (def->name) eina_stringshare_del(def->name);
database_expr_del(def->value);
if (def->comment) eina_stringshare_del(def->comment);
database_doc_del(def->doc);
free(def);
}
@ -547,11 +535,6 @@ parse_enum(Eo_Lexer *ls, const char *name, Eina_Bool is_extern,
def->type = EOLIAN_TYPE_ENUM;
def->fields = eina_hash_string_small_new(EINA_FREE_CB(_enum_field_free));
check_next(ls, '{');
if (ls->t.token == TOK_COMMENT)
{
def->comment = eina_stringshare_ref(ls->t.value.s);
eo_lexer_get(ls);
}
FILL_DOC(ls, def, doc);
if (ls->t.token == TOK_VALUE && ls->t.kw == KW_legacy)
{
@ -632,11 +615,6 @@ parse_enum(Eo_Lexer *ls, const char *name, Eina_Bool is_extern,
Eina_Bool want_next = (ls->t.token == ',');
if (want_next)
eo_lexer_get(ls);
if (ls->t.token == TOK_COMMENT)
{
fdef->comment = eina_stringshare_ref(ls->t.value.s);
eo_lexer_get(ls);
}
FILL_DOC(ls, fdef, doc);
if (!want_next)
break;
@ -891,11 +869,6 @@ parse_typedef(Eo_Lexer *ls)
def->base_type = parse_type(ls);
pop_type(ls);
check_next(ls, ';');
if (ls->t.token == TOK_COMMENT)
{
def->comment = eina_stringshare_ref(ls->t.value.s);
eo_lexer_get(ls);
}
FILL_DOC(ls, def, doc);
return def;
}
@ -943,11 +916,6 @@ parse_variable(Eo_Lexer *ls, Eina_Bool global)
pop_expr(ls);
}
check_next(ls, ';');
if (ls->t.token == TOK_COMMENT)
{
def->comment = eina_stringshare_ref(ls->t.value.s);
eo_lexer_get(ls);
}
FILL_DOC(ls, def, doc);
return def;
}
@ -1961,11 +1929,6 @@ parse_unit(Eo_Lexer *ls, Eina_Bool eot)
pop_str(ls);
_fill_name(name, &def->full_name, &def->name, &def->namespaces);
eo_lexer_get(ls);
if (ls->t.token == TOK_COMMENT)
{
def->comment = eina_stringshare_ref(ls->t.value.s);
eo_lexer_get(ls);
}
FILL_DOC(ls, def, doc);
FILL_BASE(def->base, ls, line, col);
database_struct_add(def);

View File

@ -176,7 +176,6 @@ struct _Eolian_Type
Eina_List *namespaces;
Eina_Hash *fields;
Eina_List *field_list;
Eina_Stringshare *comment;
Eolian_Documentation *doc;
Eina_Stringshare *legacy;
Eina_Stringshare *freefunc;
@ -223,7 +222,6 @@ struct _Eolian_Struct_Type_Field
Eina_Stringshare *name;
Eolian_Object base;
Eolian_Type *type;
Eina_Stringshare *comment;
Eolian_Documentation *doc;
};
@ -233,7 +231,6 @@ struct _Eolian_Enum_Type_Field
Eina_Stringshare *name;
Eolian_Object base;
Eolian_Expression *value;
Eina_Stringshare *comment;
Eolian_Documentation *doc;
Eina_Bool is_public_value :1;
};
@ -270,7 +267,6 @@ struct _Eolian_Variable
Eina_List *namespaces;
Eolian_Type *base_type;
Eolian_Expression *value;
Eina_Stringshare *comment;
Eolian_Documentation *doc;
Eina_Bool is_extern :1;
};