summaryrefslogtreecommitdiff
path: root/src/bin/eolian/docs_generator.c
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2015-06-08 16:16:15 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2015-06-08 16:17:00 +0100
commit555c664ed2f7571ed9ed76712b40e4548cbdef6d (patch)
tree9505c5bb9a79aa1433a08f8c9de78f56ec79f06c /src/bin/eolian/docs_generator.c
parentd50cebbd4f8300b44ee7656804a103a4d38f6d1d (diff)
eolian/generator: support for since tag in doc gen
Diffstat (limited to '')
-rw-r--r--src/bin/eolian/docs_generator.c59
1 files changed, 48 insertions, 11 deletions
diff --git a/src/bin/eolian/docs_generator.c b/src/bin/eolian/docs_generator.c
index 9c7a482fa1..623545b914 100644
--- a/src/bin/eolian/docs_generator.c
+++ b/src/bin/eolian/docs_generator.c
@@ -78,14 +78,32 @@ _append_section(const char *desc, int ind, int curl, Eina_Strbuf *buf,
78 return curl; 78 return curl;
79} 79}
80 80
81int
82_append_since(const char *since, int indent, int curl, Eina_Strbuf *buf)
83{
84 if (since)
85 {
86 eina_strbuf_append_char(buf, '\n');
87 _indent_line(buf, indent);
88 eina_strbuf_append(buf, " *\n");
89 curl = _indent_line(buf, indent);
90 eina_strbuf_append(buf, " * @since ");
91 eina_strbuf_append(buf, since);
92 curl += strlen(since) + sizeof(" * @since ") - 1;
93 }
94 return curl;
95}
96
81void 97void
82_gen_doc_brief(const char *summary, int indent, Eina_Strbuf *buf) 98_gen_doc_brief(const char *summary, const char *since, int indent,
99 Eina_Strbuf *buf)
83{ 100{
84 int curl = 4 + indent; 101 int curl = 4 + indent;
85 Eina_Strbuf *wbuf = eina_strbuf_new(); 102 Eina_Strbuf *wbuf = eina_strbuf_new();
86 eina_strbuf_append(buf, "/** "); 103 eina_strbuf_append(buf, "/** ");
87 curl = _append_section(summary, indent, curl, buf, wbuf); 104 curl = _append_section(summary, indent, curl, buf, wbuf);
88 eina_strbuf_free(wbuf); 105 eina_strbuf_free(wbuf);
106 curl = _append_since(since, indent, curl, buf);
89 if ((curl + 3) > DOC_LIMIT(indent)) 107 if ((curl + 3) > DOC_LIMIT(indent))
90 { 108 {
91 eina_strbuf_append_char(buf, '\n'); 109 eina_strbuf_append_char(buf, '\n');
@@ -97,8 +115,8 @@ _gen_doc_brief(const char *summary, int indent, Eina_Strbuf *buf)
97} 115}
98 116
99void 117void
100_gen_doc_full(const char *summary, const char *description, int indent, 118_gen_doc_full(const char *summary, const char *description, const char *since,
101 Eina_Strbuf *buf) 119 int indent, Eina_Strbuf *buf)
102{ 120{
103 int curl = 0; 121 int curl = 0;
104 Eina_Strbuf *wbuf = eina_strbuf_new(); 122 Eina_Strbuf *wbuf = eina_strbuf_new();
@@ -113,6 +131,7 @@ _gen_doc_full(const char *summary, const char *description, int indent,
113 curl = _indent_line(buf, indent); 131 curl = _indent_line(buf, indent);
114 eina_strbuf_append(buf, " * "); 132 eina_strbuf_append(buf, " * ");
115 _append_section(description, indent, curl + 3, buf, wbuf); 133 _append_section(description, indent, curl + 3, buf, wbuf);
134 curl = _append_since(since, indent, curl, buf);
116 eina_strbuf_append_char(buf, '\n'); 135 eina_strbuf_append_char(buf, '\n');
117 _indent_line(buf, indent); 136 _indent_line(buf, indent);
118 eina_strbuf_append(buf, " */"); 137 eina_strbuf_append(buf, " */");
@@ -126,12 +145,13 @@ docs_generate_full(const Eolian_Documentation *doc, int indent)
126 145
127 const char *sum = eolian_documentation_summary_get(doc); 146 const char *sum = eolian_documentation_summary_get(doc);
128 const char *desc = eolian_documentation_description_get(doc); 147 const char *desc = eolian_documentation_description_get(doc);
148 const char *since = eolian_documentation_since_get(doc);
129 149
130 Eina_Strbuf *buf = eina_strbuf_new(); 150 Eina_Strbuf *buf = eina_strbuf_new();
131 if (!desc) 151 if (!desc)
132 _gen_doc_brief(sum, indent, buf); 152 _gen_doc_brief(sum, since, indent, buf);
133 else 153 else
134 _gen_doc_full(sum, desc, indent, buf); 154 _gen_doc_full(sum, desc, since, indent, buf);
135 return buf; 155 return buf;
136} 156}
137 157
@@ -150,7 +170,7 @@ docs_generate_function(const Eolian_Function *fid, Eolian_Function_Type ftype, i
150 Eina_Strbuf *buf = eina_strbuf_new(); 170 Eina_Strbuf *buf = eina_strbuf_new();
151 Eina_Strbuf *wbuf = NULL; 171 Eina_Strbuf *wbuf = NULL;
152 172
153 const char *sum = NULL, *desc = NULL; 173 const char *sum = NULL, *desc = NULL, *since = NULL;
154 174
155 int curl = 0; 175 int curl = 0;
156 176
@@ -166,6 +186,7 @@ docs_generate_function(const Eolian_Function *fid, Eolian_Function_Type ftype, i
166 { 186 {
167 doc = eolian_function_documentation_get(fid, EOLIAN_PROPERTY); 187 doc = eolian_function_documentation_get(fid, EOLIAN_PROPERTY);
168 pdoc = eolian_function_documentation_get(fid, ftype); 188 pdoc = eolian_function_documentation_get(fid, ftype);
189 if (pdoc == doc) pdoc = NULL;
169 } 190 }
170 191
171 rdoc = eolian_function_return_documentation_get(fid, ftype); 192 rdoc = eolian_function_return_documentation_get(fid, ftype);
@@ -174,6 +195,9 @@ docs_generate_function(const Eolian_Function *fid, Eolian_Function_Type ftype, i
174 { 195 {
175 sum = eolian_documentation_summary_get(doc); 196 sum = eolian_documentation_summary_get(doc);
176 desc = eolian_documentation_description_get(doc); 197 desc = eolian_documentation_description_get(doc);
198 since = eolian_documentation_since_get(doc);
199 if (pdoc && eolian_documentation_since_get(pdoc))
200 since = eolian_documentation_since_get(pdoc);
177 } 201 }
178 202
179 if (ftype == EOLIAN_METHOD) 203 if (ftype == EOLIAN_METHOD)
@@ -243,7 +267,7 @@ docs_generate_function(const Eolian_Function *fid, Eolian_Function_Type ftype, i
243 /* only summary, nothing else; generate standard brief doc */ 267 /* only summary, nothing else; generate standard brief doc */
244 if (!desc && !par && !vpar && !rdoc && (ftype == EOLIAN_METHOD || !pdoc)) 268 if (!desc && !par && !vpar && !rdoc && (ftype == EOLIAN_METHOD || !pdoc))
245 { 269 {
246 _gen_doc_brief(sum ? sum : "No description supplied.", indent, buf); 270 _gen_doc_brief(sum ? sum : "No description supplied.", since, indent, buf);
247 return buf; 271 return buf;
248 } 272 }
249 273
@@ -257,7 +281,7 @@ docs_generate_function(const Eolian_Function *fid, Eolian_Function_Type ftype, i
257 indent, curl, buf, wbuf); 281 indent, curl, buf, wbuf);
258 282
259 eina_strbuf_append_char(buf, '\n'); 283 eina_strbuf_append_char(buf, '\n');
260 if (desc || par || rdoc || pdoc) 284 if (desc || since || par || rdoc || pdoc)
261 { 285 {
262 _indent_line(buf, indent); 286 _indent_line(buf, indent);
263 eina_strbuf_append(buf, " *\n"); 287 eina_strbuf_append(buf, " *\n");
@@ -269,7 +293,7 @@ docs_generate_function(const Eolian_Function *fid, Eolian_Function_Type ftype, i
269 eina_strbuf_append(buf, " * "); 293 eina_strbuf_append(buf, " * ");
270 _append_section(desc, indent, curl + 3, buf, wbuf); 294 _append_section(desc, indent, curl + 3, buf, wbuf);
271 eina_strbuf_append_char(buf, '\n'); 295 eina_strbuf_append_char(buf, '\n');
272 if (par || rdoc || pdoc) 296 if (par || rdoc || pdoc || since)
273 { 297 {
274 _indent_line(buf, indent); 298 _indent_line(buf, indent);
275 eina_strbuf_append(buf, " *\n"); 299 eina_strbuf_append(buf, " *\n");
@@ -293,7 +317,7 @@ docs_generate_function(const Eolian_Function *fid, Eolian_Function_Type ftype, i
293 _append_section(pdesc, indent, curl + 3, buf, wbuf); 317 _append_section(pdesc, indent, curl + 3, buf, wbuf);
294 eina_strbuf_append_char(buf, '\n'); 318 eina_strbuf_append_char(buf, '\n');
295 } 319 }
296 if (par || rdoc) 320 if (par || rdoc || since)
297 { 321 {
298 _indent_line(buf, indent); 322 _indent_line(buf, indent);
299 eina_strbuf_append(buf, " *\n"); 323 eina_strbuf_append(buf, " *\n");
@@ -353,7 +377,7 @@ docs_generate_function(const Eolian_Function *fid, Eolian_Function_Type ftype, i
353 } 377 }
354 } 378 }
355 379
356 if (!par && rdoc) 380 if (!par && (rdoc || since))
357 { 381 {
358 _indent_line(buf, indent); 382 _indent_line(buf, indent);
359 eina_strbuf_append(buf, " *\n"); 383 eina_strbuf_append(buf, " *\n");
@@ -369,6 +393,19 @@ docs_generate_function(const Eolian_Function *fid, Eolian_Function_Type ftype, i
369 _append_section(eolian_documentation_summary_get(rdoc), indent, curl, 393 _append_section(eolian_documentation_summary_get(rdoc), indent, curl,
370 buf, wbuf); 394 buf, wbuf);
371 eina_strbuf_append_char(buf, '\n'); 395 eina_strbuf_append_char(buf, '\n');
396 if (since)
397 {
398 _indent_line(buf, indent);
399 eina_strbuf_append(buf, " *\n");
400 }
401 }
402
403 if (since)
404 {
405 curl = _indent_line(buf, indent);
406 eina_strbuf_append(buf, " * @since ");
407 eina_strbuf_append(buf, since);
408 eina_strbuf_append_char(buf, '\n');
372 } 409 }
373 410
374 _indent_line(buf, indent); 411 _indent_line(buf, indent);