summaryrefslogtreecommitdiff
path: root/src/bin/eolian/legacy_generator.c
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2015-09-03 15:35:53 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2015-09-03 15:42:01 +0100
commit3f1d29f1ec7a94eddb7cd72cd7758a8d468d81d3 (patch)
tree18749097a490eb5b7d1e229c67ea2fa18924bbc6 /src/bin/eolian/legacy_generator.c
parent7ae67814518942814e3cc44b7f272d4144ed7a96 (diff)
eolian: remove support for old style docs completely
Diffstat (limited to '')
-rw-r--r--src/bin/eolian/legacy_generator.c64
1 files changed, 2 insertions, 62 deletions
diff --git a/src/bin/eolian/legacy_generator.c b/src/bin/eolian/legacy_generator.c
index 1a0f0a9bd6..18b4506ab2 100644
--- a/src/bin/eolian/legacy_generator.c
+++ b/src/bin/eolian/legacy_generator.c
@@ -14,13 +14,6 @@
14static _eolian_class_vars class_env; 14static _eolian_class_vars class_env;
15 15
16static const char 16static const char
17tmpl_eapi_funcdef_doxygen[] = "\n\
18/**\n\
19@#desc\n\
20@#list_desc_param\
21 */\n";
22
23static const char
24tmpl_eapi_funcdef[] = "EAPI @#type_return%s(@#params)@#flags;\n"; 17tmpl_eapi_funcdef[] = "EAPI @#type_return%s(@#params)@#flags;\n";
25 18
26/*@#CLASS_CHECK(obj) @#check_ret;\n\*/ 19/*@#CLASS_CHECK(obj) @#check_ret;\n\*/
@@ -62,7 +55,6 @@ _eapi_decl_func_generate(const Eolian_Class *class, const Eolian_Function *funci
62 55
63 Eina_Strbuf *fbody = eina_strbuf_new(); 56 Eina_Strbuf *fbody = eina_strbuf_new();
64 Eina_Strbuf *fparam = eina_strbuf_new(); 57 Eina_Strbuf *fparam = eina_strbuf_new();
65 Eina_Strbuf *descparam = eina_strbuf_new();
66 58
67 _class_func_env_create(class, funcname, ftype, &func_env); 59 _class_func_env_create(class, funcname, ftype, &func_env);
68 rettypet = eolian_function_return_type_get(funcid, ftype); 60 rettypet = eolian_function_return_type_get(funcid, ftype);
@@ -86,16 +78,7 @@ _eapi_decl_func_generate(const Eolian_Class *class, const Eolian_Function *funci
86 78
87 Eina_Bool hasnewdocs = eolian_function_documentation_get(funcid, EOLIAN_UNRESOLVED) || 79 Eina_Bool hasnewdocs = eolian_function_documentation_get(funcid, EOLIAN_UNRESOLVED) ||
88 eolian_function_documentation_get(funcid, ftype); 80 eolian_function_documentation_get(funcid, ftype);
89 81 if (hasnewdocs)
90 if (!hasnewdocs)
91 {
92 /* it will still try to generate, but it'll have nothing to replace
93 * this is ugly, but i CBA to find a better way (it wouldn't make a
94 * difference anyway) and it'll be removed asap (when docs are replaced)
95 */
96 eina_strbuf_append(fbody, tmpl_eapi_funcdef_doxygen);
97 }
98 else
99 { 82 {
100 Eina_Strbuf *dbuf = docs_generate_function(funcid, ftype, 0, EINA_TRUE); 83 Eina_Strbuf *dbuf = docs_generate_function(funcid, ftype, 0, EINA_TRUE);
101 eina_strbuf_append_char(fbody, '\n'); 84 eina_strbuf_append_char(fbody, '\n');
@@ -112,26 +95,6 @@ _eapi_decl_func_generate(const Eolian_Class *class, const Eolian_Function *funci
112 eina_strbuf_append(fparam, "const "); 95 eina_strbuf_append(fparam, "const ");
113 eina_strbuf_append_printf(fparam, "%s *obj", class_env.full_classname); 96 eina_strbuf_append_printf(fparam, "%s *obj", class_env.full_classname);
114 } 97 }
115 Eina_Strbuf *linedesc = eina_strbuf_new();
116 const char *common_desc = eolian_function_description_get(funcid, EOLIAN_UNRESOLVED);
117 const char *specific_desc = (ftype == EOLIAN_PROP_SET || ftype == EOLIAN_PROP_GET) ?
118 eolian_function_description_get(funcid, ftype) : NULL;
119 if (!common_desc && !specific_desc) eina_strbuf_append(linedesc, "No description supplied.");
120 if (common_desc) eina_strbuf_append_printf(linedesc, "%s\n", common_desc);
121 if (specific_desc) eina_strbuf_append(linedesc, specific_desc);
122 if (eina_strbuf_length_get(linedesc))
123 {
124 eina_strbuf_replace_all(linedesc, "\n", "\n * ");
125 eina_strbuf_replace_all(linedesc, " * \n", " *\n");
126 eina_strbuf_prepend(linedesc," * ");
127 }
128 else
129 {
130 eina_strbuf_append(linedesc," *");
131 }
132
133 eina_strbuf_replace_all(fbody, "@#desc", eina_strbuf_string_get(linedesc));
134 eina_strbuf_free(linedesc);
135 98
136 itr = eolian_property_keys_get(funcid, ftype); 99 itr = eolian_property_keys_get(funcid, ftype);
137 EINA_ITERATOR_FOREACH(itr, data) 100 EINA_ITERATOR_FOREACH(itr, data)
@@ -140,14 +103,11 @@ _eapi_decl_func_generate(const Eolian_Class *class, const Eolian_Function *funci
140 const Eolian_Type *ptypet = eolian_parameter_type_get(param); 103 const Eolian_Type *ptypet = eolian_parameter_type_get(param);
141 const char *pname = eolian_parameter_name_get(param); 104 const char *pname = eolian_parameter_name_get(param);
142 const char *ptype = eolian_type_c_type_get(ptypet); 105 const char *ptype = eolian_type_c_type_get(ptypet);
143 const char *pdesc = eolian_parameter_description_get(param);
144 leg_param_idx++; 106 leg_param_idx++;
145 if (eina_strbuf_length_get(fparam)) eina_strbuf_append(fparam, ", "); 107 if (eina_strbuf_length_get(fparam)) eina_strbuf_append(fparam, ", ");
146 eina_strbuf_append_printf(fparam, "%s %s", ptype, pname); 108 eina_strbuf_append_printf(fparam, "%s %s", ptype, pname);
147 eina_stringshare_del(ptype); 109 eina_stringshare_del(ptype);
148 if (!eina_strbuf_length_get(descparam)) 110
149 eina_strbuf_append(descparam, " *\n");
150 eina_strbuf_append_printf(descparam, " * @param[in] %s %s\n", pname, pdesc?pdesc:"No description supplied.");
151 if (eolian_parameter_is_nonull((Eolian_Function_Parameter*)data)) 111 if (eolian_parameter_is_nonull((Eolian_Function_Parameter*)data))
152 { 112 {
153 if (!flags) 113 if (!flags)
@@ -169,9 +129,7 @@ _eapi_decl_func_generate(const Eolian_Class *class, const Eolian_Function *funci
169 const Eolian_Type *ptypet = eolian_parameter_type_get(param); 129 const Eolian_Type *ptypet = eolian_parameter_type_get(param);
170 const char *pname = eolian_parameter_name_get(param); 130 const char *pname = eolian_parameter_name_get(param);
171 const char *ptype = eolian_type_c_type_get(ptypet); 131 const char *ptype = eolian_type_c_type_get(ptypet);
172 const char *pdesc = eolian_parameter_description_get(param);
173 Eolian_Parameter_Dir pdir = eolian_parameter_direction_get(param); 132 Eolian_Parameter_Dir pdir = eolian_parameter_direction_get(param);
174 const char *str_dir[] = {"in", "out", "inout"};
175 Eina_Bool had_star = !!strchr(ptype, '*'); 133 Eina_Bool had_star = !!strchr(ptype, '*');
176 if (ftype == EOLIAN_UNRESOLVED || ftype == EOLIAN_METHOD) add_star = (pdir == EOLIAN_OUT_PARAM || pdir == EOLIAN_INOUT_PARAM); 134 if (ftype == EOLIAN_UNRESOLVED || ftype == EOLIAN_METHOD) add_star = (pdir == EOLIAN_OUT_PARAM || pdir == EOLIAN_INOUT_PARAM);
177 if (ftype == EOLIAN_PROP_GET) pdir = EOLIAN_OUT_PARAM; 135 if (ftype == EOLIAN_PROP_GET) pdir = EOLIAN_OUT_PARAM;
@@ -181,10 +139,6 @@ _eapi_decl_func_generate(const Eolian_Class *class, const Eolian_Function *funci
181 eina_strbuf_append_printf(fparam, "%s%s%s%s", 139 eina_strbuf_append_printf(fparam, "%s%s%s%s",
182 ptype, had_star?"":" ", add_star?"*":"", pname); 140 ptype, had_star?"":" ", add_star?"*":"", pname);
183 eina_stringshare_del(ptype); 141 eina_stringshare_del(ptype);
184 const char *dir_str = str_dir[(int)pdir];
185 if (!eina_strbuf_length_get(descparam))
186 eina_strbuf_append(descparam, " *\n");
187 eina_strbuf_append_printf(descparam, " * @param[%s] %s %s\n", dir_str, pname, pdesc?pdesc:"No description supplied.");
188 if (eolian_parameter_is_nonull((Eolian_Function_Parameter*)data)) 142 if (eolian_parameter_is_nonull((Eolian_Function_Parameter*)data))
189 { 143 {
190 if (!flags) 144 if (!flags)
@@ -204,7 +158,6 @@ _eapi_decl_func_generate(const Eolian_Class *class, const Eolian_Function *funci
204 if (rettypet) rettype = eolian_type_c_type_get(rettypet); 158 if (rettypet) rettype = eolian_type_c_type_get(rettypet);
205 159
206 eina_strbuf_replace_all(fbody, "@#params", eina_strbuf_string_get(fparam)); 160 eina_strbuf_replace_all(fbody, "@#params", eina_strbuf_string_get(fparam));
207 eina_strbuf_replace_all(fbody, "@#list_desc_param", eina_strbuf_string_get(descparam));
208 eina_strbuf_reset(fparam); 161 eina_strbuf_reset(fparam);
209 eina_strbuf_append_printf(fparam, "%s%s", 162 eina_strbuf_append_printf(fparam, "%s%s",
210 rettype ? rettype : "void", 163 rettype ? rettype : "void",
@@ -227,7 +180,6 @@ end:
227 eina_strbuf_free(flags); 180 eina_strbuf_free(flags);
228 eina_strbuf_free(fbody); 181 eina_strbuf_free(fbody);
229 eina_strbuf_free(fparam); 182 eina_strbuf_free(fparam);
230 eina_strbuf_free(descparam);
231} 183}
232 184
233static void 185static void
@@ -383,7 +335,6 @@ legacy_header_generate(const Eolian_Class *class, Eina_Strbuf *buf)
383{ 335{
384 _class_env_create(class, NULL, &class_env); 336 _class_env_create(class, NULL, &class_env);
385 337
386 const char *desc = eolian_class_description_get(class);
387 const Eolian_Documentation *doc = eolian_class_documentation_get(class); 338 const Eolian_Documentation *doc = eolian_class_documentation_get(class);
388 if (doc) 339 if (doc)
389 { 340 {
@@ -395,17 +346,6 @@ legacy_header_generate(const Eolian_Class *class, Eina_Strbuf *buf)
395 eina_strbuf_free(cdoc); 346 eina_strbuf_free(cdoc);
396 } 347 }
397 } 348 }
398 else if (desc)
399 {
400 Eina_Strbuf *linedesc = eina_strbuf_new();
401 eina_strbuf_append(linedesc, "/**\n");
402 eina_strbuf_append(linedesc, desc);
403 eina_strbuf_replace_all(linedesc, "\n", "\n * ");
404 eina_strbuf_append(linedesc, "\n */\n");
405 eina_strbuf_replace_all(linedesc, " * \n", " *\n"); /* Remove trailing whitespaces */
406 eina_strbuf_append(buf, eina_strbuf_string_get(linedesc));
407 eina_strbuf_free(linedesc);
408 }
409 349
410 Eina_Iterator *itr = eolian_class_implements_get(class); 350 Eina_Iterator *itr = eolian_class_implements_get(class);
411 if (itr) 351 if (itr)