summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2016-09-21 15:49:22 +0200
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2016-10-07 11:54:23 +0200
commitdcda40215cdccf09d1c1ee30bcbda3b5e21cc865 (patch)
tree69be7b3f5f56af28256872e9c4620495ba06f0b1
parentb105feebb327a44a4a3e6283bd52cd63e9a26aec (diff)
eolian gen2: generate docs for types
-rw-r--r--src/bin/eolian2/types.c40
1 files changed, 39 insertions, 1 deletions
diff --git a/src/bin/eolian2/types.c b/src/bin/eolian2/types.c
index 5b59733222..0f2f8ad036 100644
--- a/src/bin/eolian2/types.c
+++ b/src/bin/eolian2/types.c
@@ -1,10 +1,18 @@
1#include "main.h" 1#include "main.h"
2#include "docs.h"
2 3
3static Eina_Strbuf * 4static Eina_Strbuf *
4_type_generate(const Eolian_Typedecl *tp, Eina_Bool full, Eina_Bool legacy) 5_type_generate(const Eolian_Typedecl *tp, Eina_Bool full, Eina_Bool legacy)
5{ 6{
7 char *grp = strdup(eolian_typedecl_full_name_get(tp));
8 char *p = strrchr(grp, '.');
9 if (p) *p = '\0';
10 Eina_Strbuf *buf = eo_gen_docs_full_gen(eolian_typedecl_documentation_get(tp),
11 grp, 0, legacy);
12 free(grp);
13 if (!buf) buf = eina_strbuf_new();
14 else eina_strbuf_append_char(buf, '\n');
6 Eolian_Typedecl_Type tpt = eolian_typedecl_type_get(tp); 15 Eolian_Typedecl_Type tpt = eolian_typedecl_type_get(tp);
7 Eina_Strbuf *buf = eina_strbuf_new();
8 switch (tpt) 16 switch (tpt)
9 { 17 {
10 case EOLIAN_TYPEDECL_ALIAS: 18 case EOLIAN_TYPEDECL_ALIAS:
@@ -47,6 +55,21 @@ _type_generate(const Eolian_Typedecl *tp, Eina_Bool full, Eina_Bool legacy)
47 eolian_typedecl_struct_field_name_get(memb)); 55 eolian_typedecl_struct_field_name_get(memb));
48 } 56 }
49 eina_stringshare_del(ct); 57 eina_stringshare_del(ct);
58 const Eolian_Documentation *fdoc
59 = eolian_typedecl_struct_field_documentation_get(memb);
60 if (fdoc)
61 {
62 const char *nl = strrchr(eina_strbuf_string_get(buf), '\n');
63 if (nl)
64 {
65 Eina_Strbuf *fbuf = eo_gen_docs_full_gen(fdoc, NULL,
66 strlen(nl), legacy);
67 if (fbuf)
68 eina_strbuf_append_printf(buf, " %s",
69 eina_strbuf_string_get(fbuf));
70 eina_strbuf_free(fbuf);
71 }
72 }
50 eina_strbuf_append(buf, "\n"); 73 eina_strbuf_append(buf, "\n");
51 } 74 }
52 eina_iterator_free(membs); 75 eina_iterator_free(membs);
@@ -83,9 +106,24 @@ _type_generate(const Eolian_Typedecl *tp, Eina_Bool full, Eina_Bool legacy)
83 eina_stringshare_del(lit); 106 eina_stringshare_del(lit);
84 } 107 }
85 eina_stringshare_del(membn); 108 eina_stringshare_del(membn);
109 const Eolian_Documentation *fdoc
110 = eolian_typedecl_enum_field_documentation_get(memb);
86 next = eina_iterator_next(membs, (void **)&memb); 111 next = eina_iterator_next(membs, (void **)&memb);
87 if (next) 112 if (next)
88 eina_strbuf_append(buf, ","); 113 eina_strbuf_append(buf, ",");
114 if (fdoc)
115 {
116 const char *nl = strrchr(eina_strbuf_string_get(buf), '\n');
117 if (nl)
118 {
119 Eina_Strbuf *fbuf = eo_gen_docs_full_gen(fdoc, NULL,
120 strlen(nl), legacy);
121 if (fbuf)
122 eina_strbuf_append_printf(buf, " %s",
123 eina_strbuf_string_get(fbuf));
124 eina_strbuf_free(fbuf);
125 }
126 }
89 eina_strbuf_append(buf, "\n"); 127 eina_strbuf_append(buf, "\n");
90 } 128 }
91 eina_iterator_free(membs); 129 eina_iterator_free(membs);