summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2015-06-11 16:52:45 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2015-06-11 16:52:45 +0100
commitcd12f938aff217ab84780104334acea12a27a588 (patch)
tree68cb520b6ae11172f926985f3004c48f3928bb40 /src
parent786f848f67d06bf9c92802c7d11b9253574bb7db (diff)
eolian: remove support for old doc style on types and vars
Diffstat (limited to 'src')
-rw-r--r--src/bin/eolian/types_generator.c37
-rw-r--r--src/lib/eolian/Eolian.h41
-rw-r--r--src/lib/eolian/database_type.c1
-rw-r--r--src/lib/eolian/database_type_api.c25
-rw-r--r--src/lib/eolian/database_var.c1
-rw-r--r--src/lib/eolian/database_var_api.c7
-rw-r--r--src/lib/eolian/eo_parser.c37
-rw-r--r--src/lib/eolian/eolian_database.h4
8 files changed, 5 insertions, 148 deletions
diff --git a/src/bin/eolian/types_generator.c b/src/bin/eolian/types_generator.c
index d43f97b330..1876c4cde6 100644
--- a/src/bin/eolian/types_generator.c
+++ b/src/bin/eolian/types_generator.c
@@ -33,35 +33,12 @@ _concat_name(const Eolian_Type *tp)
33 return str; 33 return str;
34} 34}
35 35
36static void
37_desc_generate(const char *desc, Eina_Strbuf *buf)
38{
39 if (desc)
40 {
41 eina_strbuf_append(buf, "/**\n");
42 eina_strbuf_append(buf, desc);
43 eina_strbuf_replace_all(buf, "\n", "\n * ");
44 eina_strbuf_append(buf, "\n */\n");
45 eina_strbuf_replace_all(buf, " * \n", " *\n"); /* Remove trailing whitespaces */
46 }
47}
48
49static Eina_Strbuf * 36static Eina_Strbuf *
50_type_generate(const Eolian_Type *tp, Eina_Bool full) 37_type_generate(const Eolian_Type *tp, Eina_Bool full)
51{ 38{
52 const char *cdesc = eolian_type_description_get(tp); 39 Eina_Strbuf *buf = docs_generate_full(eolian_type_documentation_get(tp), 0);
53 Eina_Strbuf *buf; 40 if (!buf) buf = eina_strbuf_new();
54 if (cdesc) 41 else eina_strbuf_append_char(buf, '\n');
55 {
56 buf = eina_strbuf_new();
57 _desc_generate(cdesc, buf);
58 }
59 else
60 {
61 buf = docs_generate_full(eolian_type_documentation_get(tp), 0);
62 if (!buf) buf = eina_strbuf_new();
63 else eina_strbuf_append_char(buf, '\n');
64 }
65 Eolian_Type_Type tp_type = eolian_type_type_get(tp); 42 Eolian_Type_Type tp_type = eolian_type_type_get(tp);
66 switch(tp_type) 43 switch(tp_type)
67 { 44 {
@@ -95,11 +72,9 @@ _type_generate(const Eolian_Type *tp, Eina_Bool full)
95 eina_strbuf_append_printf(buf, " %s%s%s;", 72 eina_strbuf_append_printf(buf, " %s%s%s;",
96 c_type, strchr(c_type, '*')?"":" ", 73 c_type, strchr(c_type, '*')?"":" ",
97 eolian_type_struct_field_name_get(member)); 74 eolian_type_struct_field_name_get(member));
98 const char *fdesc = eolian_type_struct_field_description_get(member);
99 const Eolian_Documentation *fdoc 75 const Eolian_Documentation *fdoc
100 = eolian_type_struct_field_documentation_get(member); 76 = eolian_type_struct_field_documentation_get(member);
101 if (fdesc) eina_strbuf_append_printf(buf, " /** %s */", fdesc); 77 if (fdoc)
102 else if (fdoc)
103 { 78 {
104 const char *nl = strrchr(eina_strbuf_string_get(buf), '\n'); 79 const char *nl = strrchr(eina_strbuf_string_get(buf), '\n');
105 if (nl) 80 if (nl)
@@ -160,14 +135,12 @@ _type_generate(const Eolian_Type *tp, Eina_Bool full)
160 } 135 }
161 eina_stringshare_del(lit); 136 eina_stringshare_del(lit);
162 } 137 }
163 const char *fdesc = eolian_type_enum_field_description_get(member);
164 const Eolian_Documentation *fdoc 138 const Eolian_Documentation *fdoc
165 = eolian_type_enum_field_documentation_get(member); 139 = eolian_type_enum_field_documentation_get(member);
166 next = eina_iterator_next(members, (void**)&member); 140 next = eina_iterator_next(members, (void**)&member);
167 if (next) 141 if (next)
168 eina_strbuf_append(buf, ","); 142 eina_strbuf_append(buf, ",");
169 if (fdesc) eina_strbuf_append_printf(buf, " /** %s */", fdesc); 143 if (fdoc)
170 else if (fdoc)
171 { 144 {
172 const char *nl = strrchr(eina_strbuf_string_get(buf), '\n'); 145 const char *nl = strrchr(eina_strbuf_string_get(buf), '\n');
173 if (nl) 146 if (nl)
diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h
index cb6b97eb0f..91dd132dea 100644
--- a/src/lib/eolian/Eolian.h
+++ b/src/lib/eolian/Eolian.h
@@ -1555,16 +1555,6 @@ EAPI const Eolian_Struct_Type_Field *eolian_type_struct_field_get(const Eolian_T
1555EAPI Eina_Stringshare *eolian_type_struct_field_name_get(const Eolian_Struct_Type_Field *fl); 1555EAPI Eina_Stringshare *eolian_type_struct_field_name_get(const Eolian_Struct_Type_Field *fl);
1556 1556
1557/* 1557/*
1558 * @brief Get the description of a field of a struct type.
1559 *
1560 * @param[in] fl the field.
1561 * @return the description.
1562 *
1563 * @ingroup Eolian
1564 */
1565EAPI Eina_Stringshare *eolian_type_struct_field_description_get(const Eolian_Struct_Type_Field *fl);
1566
1567/*
1568 * @brief Get the documentation of a field of a struct type. 1558 * @brief Get the documentation of a field of a struct type.
1569 * 1559 *
1570 * @param[in] fl the field. 1560 * @param[in] fl the field.
@@ -1632,16 +1622,6 @@ EAPI Eina_Stringshare *eolian_type_enum_field_name_get(const Eolian_Enum_Type_Fi
1632EAPI Eina_Stringshare *eolian_type_enum_field_c_name_get(const Eolian_Enum_Type_Field *fl); 1622EAPI Eina_Stringshare *eolian_type_enum_field_c_name_get(const Eolian_Enum_Type_Field *fl);
1633 1623
1634/* 1624/*
1635 * @brief Get the description of a field of an enum type.
1636 *
1637 * @param[in] fl the field.
1638 * @return the description.
1639 *
1640 * @ingroup Eolian
1641 */
1642EAPI Eina_Stringshare *eolian_type_enum_field_description_get(const Eolian_Enum_Type_Field *fl);
1643
1644/*
1645 * @brief Get the documentation of a field of an enum type. 1625 * @brief Get the documentation of a field of an enum type.
1646 * 1626 *
1647 * @param[in] fl the field. 1627 * @param[in] fl the field.
@@ -1678,17 +1658,6 @@ EAPI const Eolian_Expression *eolian_type_enum_field_value_get(const Eolian_Enum
1678EAPI Eina_Stringshare *eolian_type_enum_legacy_prefix_get(const Eolian_Type *tp); 1658EAPI Eina_Stringshare *eolian_type_enum_legacy_prefix_get(const Eolian_Type *tp);
1679 1659
1680/* 1660/*
1681 * @brief Get the description of a struct/alias type.
1682 *
1683 * @param[in] tp the type.
1684 * @return the description when @c tp is EOLIAN_TYPE_STRUCT or
1685 * EOLIAN_TYPE_STRUCT_OPAQUE, NULL otherwise.
1686 *
1687 * @ingroup Eolian
1688 */
1689EAPI Eina_Stringshare *eolian_type_description_get(const Eolian_Type *tp);
1690
1691/*
1692 * @brief Get the documentation of a struct/alias type. 1661 * @brief Get the documentation of a struct/alias type.
1693 * 1662 *
1694 * @param[in] tp the type. 1663 * @param[in] tp the type.
@@ -2058,16 +2027,6 @@ EAPI Eina_Iterator *eolian_variable_constants_get_by_file(const char *fname);
2058EAPI Eolian_Variable_Type eolian_variable_type_get(const Eolian_Variable *var); 2027EAPI Eolian_Variable_Type eolian_variable_type_get(const Eolian_Variable *var);
2059 2028
2060/* 2029/*
2061 * @brief Get the description of a variable.
2062 *
2063 * @param[in] var the variable.
2064 * @return the description or NULL.
2065 *
2066 * @ingroup Eolian
2067 */
2068EAPI Eina_Stringshare *eolian_variable_description_get(const Eolian_Variable *var);
2069
2070/*
2071 * @brief Get the documentation of a variable. 2030 * @brief Get the documentation of a variable.
2072 * 2031 *
2073 * @param[in] var the variable. 2032 * @param[in] var the variable.
diff --git a/src/lib/eolian/database_type.c b/src/lib/eolian/database_type.c
index aab452ded1..f3a3a6f6bf 100644
--- a/src/lib/eolian/database_type.c
+++ b/src/lib/eolian/database_type.c
@@ -22,7 +22,6 @@ database_type_del(Eolian_Type *tp)
22 if (tp->field_list) eina_list_free(tp->field_list); 22 if (tp->field_list) eina_list_free(tp->field_list);
23 if (tp->namespaces) EINA_LIST_FREE(tp->namespaces, sp) 23 if (tp->namespaces) EINA_LIST_FREE(tp->namespaces, sp)
24 eina_stringshare_del(sp); 24 eina_stringshare_del(sp);
25 if (tp->comment) eina_stringshare_del(tp->comment);
26 if (tp->legacy) eina_stringshare_del(tp->legacy); 25 if (tp->legacy) eina_stringshare_del(tp->legacy);
27 if (tp->freefunc) eina_stringshare_del(tp->freefunc); 26 if (tp->freefunc) eina_stringshare_del(tp->freefunc);
28 database_doc_del(tp->doc); 27 database_doc_del(tp->doc);
diff --git a/src/lib/eolian/database_type_api.c b/src/lib/eolian/database_type_api.c
index e1a01bbdbd..6030fa3be8 100644
--- a/src/lib/eolian/database_type_api.c
+++ b/src/lib/eolian/database_type_api.c
@@ -114,13 +114,6 @@ eolian_type_struct_field_name_get(const Eolian_Struct_Type_Field *fl)
114 return fl->name; 114 return fl->name;
115} 115}
116 116
117EAPI Eina_Stringshare *
118eolian_type_struct_field_description_get(const Eolian_Struct_Type_Field *fl)
119{
120 EINA_SAFETY_ON_NULL_RETURN_VAL(fl, NULL);
121 return fl->comment;
122}
123
124EAPI const Eolian_Documentation * 117EAPI const Eolian_Documentation *
125eolian_type_struct_field_documentation_get(const Eolian_Struct_Type_Field *fl) 118eolian_type_struct_field_documentation_get(const Eolian_Struct_Type_Field *fl)
126{ 119{
@@ -185,13 +178,6 @@ eolian_type_enum_field_c_name_get(const Eolian_Enum_Type_Field *fl)
185 return ret; 178 return ret;
186} 179}
187 180
188EAPI Eina_Stringshare *
189eolian_type_enum_field_description_get(const Eolian_Enum_Type_Field *fl)
190{
191 EINA_SAFETY_ON_NULL_RETURN_VAL(fl, NULL);
192 return fl->comment;
193}
194
195EAPI const Eolian_Documentation * 181EAPI const Eolian_Documentation *
196eolian_type_enum_field_documentation_get(const Eolian_Enum_Type_Field *fl) 182eolian_type_enum_field_documentation_get(const Eolian_Enum_Type_Field *fl)
197{ 183{
@@ -215,17 +201,6 @@ eolian_type_enum_legacy_prefix_get(const Eolian_Type *tp)
215 return tp->legacy; 201 return tp->legacy;
216} 202}
217 203
218EAPI Eina_Stringshare *
219eolian_type_description_get(const Eolian_Type *tp)
220{
221 Eolian_Type_Type tpp;
222 EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
223 tpp = eolian_type_type_get(tp);
224 EINA_SAFETY_ON_FALSE_RETURN_VAL(tpp != EOLIAN_TYPE_POINTER
225 && tpp != EOLIAN_TYPE_VOID, NULL);
226 return tp->comment;
227}
228
229EAPI const Eolian_Documentation * 204EAPI const Eolian_Documentation *
230eolian_type_documentation_get(const Eolian_Type *tp) 205eolian_type_documentation_get(const Eolian_Type *tp)
231{ 206{
diff --git a/src/lib/eolian/database_var.c b/src/lib/eolian/database_var.c
index 37130ac006..4ded2873f9 100644
--- a/src/lib/eolian/database_var.c
+++ b/src/lib/eolian/database_var.c
@@ -18,7 +18,6 @@ database_var_del(Eolian_Variable *var)
18 if (var->namespaces) EINA_LIST_FREE(var->namespaces, sp) 18 if (var->namespaces) EINA_LIST_FREE(var->namespaces, sp)
19 eina_stringshare_del(sp); 19 eina_stringshare_del(sp);
20 if (var->value) database_expr_del(var->value); 20 if (var->value) database_expr_del(var->value);
21 if (var->comment) eina_stringshare_del(var->comment);
22 database_doc_del(var->doc); 21 database_doc_del(var->doc);
23 free(var); 22 free(var);
24} 23}
diff --git a/src/lib/eolian/database_var_api.c b/src/lib/eolian/database_var_api.c
index 45400f5c6b..4ac0424306 100644
--- a/src/lib/eolian/database_var_api.c
+++ b/src/lib/eolian/database_var_api.c
@@ -54,13 +54,6 @@ eolian_variable_type_get(const Eolian_Variable *var)
54 return var->type; 54 return var->type;
55} 55}
56 56
57EAPI Eina_Stringshare *
58eolian_variable_description_get(const Eolian_Variable *var)
59{
60 EINA_SAFETY_ON_NULL_RETURN_VAL(var, NULL);
61 return var->comment;
62}
63
64EAPI const Eolian_Documentation * 57EAPI const Eolian_Documentation *
65eolian_variable_documentation_get(const Eolian_Variable *var) 58eolian_variable_documentation_get(const Eolian_Variable *var)
66{ 59{
diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c
index 195ae49e63..71c6d284f7 100644
--- a/src/lib/eolian/eo_parser.c
+++ b/src/lib/eolian/eo_parser.c
@@ -467,7 +467,6 @@ _struct_field_free(Eolian_Struct_Type_Field *def)
467 if (def->base.file) eina_stringshare_del(def->base.file); 467 if (def->base.file) eina_stringshare_del(def->base.file);
468 if (def->name) eina_stringshare_del(def->name); 468 if (def->name) eina_stringshare_del(def->name);
469 database_type_del(def->type); 469 database_type_del(def->type);
470 if (def->comment) eina_stringshare_del(def->comment);
471 database_doc_del(def->doc); 470 database_doc_del(def->doc);
472 free(def); 471 free(def);
473} 472}
@@ -485,11 +484,6 @@ parse_struct(Eo_Lexer *ls, const char *name, Eina_Bool is_extern,
485 def->freefunc = freefunc; 484 def->freefunc = freefunc;
486 pop_str(ls); 485 pop_str(ls);
487 check_next(ls, '{'); 486 check_next(ls, '{');
488 if (ls->t.token == TOK_COMMENT)
489 {
490 def->comment = eina_stringshare_ref(ls->t.value.s);
491 eo_lexer_get(ls);
492 }
493 FILL_DOC(ls, def, doc); 487 FILL_DOC(ls, def, doc);
494 while (ls->t.token != '}') 488 while (ls->t.token != '}')
495 { 489 {
@@ -512,11 +506,6 @@ parse_struct(Eo_Lexer *ls, const char *name, Eina_Bool is_extern,
512 fdef->name = eina_stringshare_ref(fname); 506 fdef->name = eina_stringshare_ref(fname);
513 pop_type(ls); 507 pop_type(ls);
514 check_next(ls, ';'); 508 check_next(ls, ';');
515 if (ls->t.token == TOK_COMMENT)
516 {
517 fdef->comment = eina_stringshare_ref(ls->t.value.s);
518 eo_lexer_get(ls);
519 }
520 FILL_DOC(ls, fdef, doc); 509 FILL_DOC(ls, fdef, doc);
521 } 510 }
522 check_match(ls, '}', '{', bline, bcolumn); 511 check_match(ls, '}', '{', bline, bcolumn);
@@ -531,7 +520,6 @@ _enum_field_free(Eolian_Enum_Type_Field *def)
531 if (def->base.file) eina_stringshare_del(def->base.file); 520 if (def->base.file) eina_stringshare_del(def->base.file);
532 if (def->name) eina_stringshare_del(def->name); 521 if (def->name) eina_stringshare_del(def->name);
533 database_expr_del(def->value); 522 database_expr_del(def->value);
534 if (def->comment) eina_stringshare_del(def->comment);
535 database_doc_del(def->doc); 523 database_doc_del(def->doc);
536 free(def); 524 free(def);
537} 525}
@@ -547,11 +535,6 @@ parse_enum(Eo_Lexer *ls, const char *name, Eina_Bool is_extern,
547 def->type = EOLIAN_TYPE_ENUM; 535 def->type = EOLIAN_TYPE_ENUM;
548 def->fields = eina_hash_string_small_new(EINA_FREE_CB(_enum_field_free)); 536 def->fields = eina_hash_string_small_new(EINA_FREE_CB(_enum_field_free));
549 check_next(ls, '{'); 537 check_next(ls, '{');
550 if (ls->t.token == TOK_COMMENT)
551 {
552 def->comment = eina_stringshare_ref(ls->t.value.s);
553 eo_lexer_get(ls);
554 }
555 FILL_DOC(ls, def, doc); 538 FILL_DOC(ls, def, doc);
556 if (ls->t.token == TOK_VALUE && ls->t.kw == KW_legacy) 539 if (ls->t.token == TOK_VALUE && ls->t.kw == KW_legacy)
557 { 540 {
@@ -632,11 +615,6 @@ parse_enum(Eo_Lexer *ls, const char *name, Eina_Bool is_extern,
632 Eina_Bool want_next = (ls->t.token == ','); 615 Eina_Bool want_next = (ls->t.token == ',');
633 if (want_next) 616 if (want_next)
634 eo_lexer_get(ls); 617 eo_lexer_get(ls);
635 if (ls->t.token == TOK_COMMENT)
636 {
637 fdef->comment = eina_stringshare_ref(ls->t.value.s);
638 eo_lexer_get(ls);
639 }
640 FILL_DOC(ls, fdef, doc); 618 FILL_DOC(ls, fdef, doc);
641 if (!want_next) 619 if (!want_next)
642 break; 620 break;
@@ -891,11 +869,6 @@ parse_typedef(Eo_Lexer *ls)
891 def->base_type = parse_type(ls); 869 def->base_type = parse_type(ls);
892 pop_type(ls); 870 pop_type(ls);
893 check_next(ls, ';'); 871 check_next(ls, ';');
894 if (ls->t.token == TOK_COMMENT)
895 {
896 def->comment = eina_stringshare_ref(ls->t.value.s);
897 eo_lexer_get(ls);
898 }
899 FILL_DOC(ls, def, doc); 872 FILL_DOC(ls, def, doc);
900 return def; 873 return def;
901} 874}
@@ -943,11 +916,6 @@ parse_variable(Eo_Lexer *ls, Eina_Bool global)
943 pop_expr(ls); 916 pop_expr(ls);
944 } 917 }
945 check_next(ls, ';'); 918 check_next(ls, ';');
946 if (ls->t.token == TOK_COMMENT)
947 {
948 def->comment = eina_stringshare_ref(ls->t.value.s);
949 eo_lexer_get(ls);
950 }
951 FILL_DOC(ls, def, doc); 919 FILL_DOC(ls, def, doc);
952 return def; 920 return def;
953} 921}
@@ -1961,11 +1929,6 @@ parse_unit(Eo_Lexer *ls, Eina_Bool eot)
1961 pop_str(ls); 1929 pop_str(ls);
1962 _fill_name(name, &def->full_name, &def->name, &def->namespaces); 1930 _fill_name(name, &def->full_name, &def->name, &def->namespaces);
1963 eo_lexer_get(ls); 1931 eo_lexer_get(ls);
1964 if (ls->t.token == TOK_COMMENT)
1965 {
1966 def->comment = eina_stringshare_ref(ls->t.value.s);
1967 eo_lexer_get(ls);
1968 }
1969 FILL_DOC(ls, def, doc); 1932 FILL_DOC(ls, def, doc);
1970 FILL_BASE(def->base, ls, line, col); 1933 FILL_BASE(def->base, ls, line, col);
1971 database_struct_add(def); 1934 database_struct_add(def);
diff --git a/src/lib/eolian/eolian_database.h b/src/lib/eolian/eolian_database.h
index 91b12f78c1..36864e59c6 100644
--- a/src/lib/eolian/eolian_database.h
+++ b/src/lib/eolian/eolian_database.h
@@ -176,7 +176,6 @@ struct _Eolian_Type
176 Eina_List *namespaces; 176 Eina_List *namespaces;
177 Eina_Hash *fields; 177 Eina_Hash *fields;
178 Eina_List *field_list; 178 Eina_List *field_list;
179 Eina_Stringshare *comment;
180 Eolian_Documentation *doc; 179 Eolian_Documentation *doc;
181 Eina_Stringshare *legacy; 180 Eina_Stringshare *legacy;
182 Eina_Stringshare *freefunc; 181 Eina_Stringshare *freefunc;
@@ -223,7 +222,6 @@ struct _Eolian_Struct_Type_Field
223 Eina_Stringshare *name; 222 Eina_Stringshare *name;
224 Eolian_Object base; 223 Eolian_Object base;
225 Eolian_Type *type; 224 Eolian_Type *type;
226 Eina_Stringshare *comment;
227 Eolian_Documentation *doc; 225 Eolian_Documentation *doc;
228}; 226};
229 227
@@ -233,7 +231,6 @@ struct _Eolian_Enum_Type_Field
233 Eina_Stringshare *name; 231 Eina_Stringshare *name;
234 Eolian_Object base; 232 Eolian_Object base;
235 Eolian_Expression *value; 233 Eolian_Expression *value;
236 Eina_Stringshare *comment;
237 Eolian_Documentation *doc; 234 Eolian_Documentation *doc;
238 Eina_Bool is_public_value :1; 235 Eina_Bool is_public_value :1;
239}; 236};
@@ -270,7 +267,6 @@ struct _Eolian_Variable
270 Eina_List *namespaces; 267 Eina_List *namespaces;
271 Eolian_Type *base_type; 268 Eolian_Type *base_type;
272 Eolian_Expression *value; 269 Eolian_Expression *value;
273 Eina_Stringshare *comment;
274 Eolian_Documentation *doc; 270 Eolian_Documentation *doc;
275 Eina_Bool is_extern :1; 271 Eina_Bool is_extern :1;
276}; 272};