summaryrefslogtreecommitdiff
path: root/src/bin/eolian
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2014-08-13 14:08:00 +0100
committerDaniel Kolesa <d.kolesa@samsung.com>2014-08-21 09:26:04 +0100
commit93726c86a3ff0d541d901ea7e0b5a033583b9d9d (patch)
tree64e04ece97a966d029c86a3023eacc06fbe5977c /src/bin/eolian
parentad3dbe834b01ecb4381a8c26548be418600dbbb6 (diff)
eolian: get rid of eolian_parameter_information_get
Diffstat (limited to 'src/bin/eolian')
-rw-r--r--src/bin/eolian/eo_generator.c57
-rw-r--r--src/bin/eolian/impl_generator.c20
-rw-r--r--src/bin/eolian/legacy_generator.c60
3 files changed, 60 insertions, 77 deletions
diff --git a/src/bin/eolian/eo_generator.c b/src/bin/eolian/eo_generator.c
index 438c0f878f..cb47c21bf1 100644
--- a/src/bin/eolian/eo_generator.c
+++ b/src/bin/eolian/eo_generator.c
@@ -106,7 +106,7 @@ eo_fundef_generate(const Eolian_Class *class, Eolian_Function *func, Eolian_Func
106 /* We want to check if there is only one parameter */ 106 /* We want to check if there is only one parameter */
107 if (eina_iterator_next(itr, &data) && !eina_iterator_next(itr, &data2)) 107 if (eina_iterator_next(itr, &data) && !eina_iterator_next(itr, &data2))
108 { 108 {
109 eolian_parameter_information_get((Eolian_Function_Parameter*)data, NULL, &rettypet, NULL, NULL); 109 rettypet = eolian_parameter_type_get((Eolian_Function_Parameter*)data);
110 var_as_ret = EINA_TRUE; 110 var_as_ret = EINA_TRUE;
111 ret_const = eolian_parameter_const_attribute_get(data, EINA_TRUE); 111 ret_const = eolian_parameter_const_attribute_get(data, EINA_TRUE);
112 } 112 }
@@ -154,13 +154,11 @@ eo_fundef_generate(const Eolian_Class *class, Eolian_Function *func, Eolian_Func
154 itr = eolian_property_keys_get(func); 154 itr = eolian_property_keys_get(func);
155 EINA_ITERATOR_FOREACH(itr, data) 155 EINA_ITERATOR_FOREACH(itr, data)
156 { 156 {
157 const Eolian_Type *ptypet; 157 Eolian_Function_Parameter *param = data;
158 const char *pname; 158 const Eolian_Type *ptypet = eolian_parameter_type_get(param);
159 const char *ptype; 159 const char *pname = eolian_parameter_name_get(param);
160 const char *pdesc = NULL; 160 const char *ptype = eolian_type_c_type_get(ptypet);
161 eolian_parameter_information_get((Eolian_Function_Parameter*)data, NULL, &ptypet, &pname, &pdesc); 161 const char *pdesc = eolian_parameter_description_get(param);
162
163 ptype = eolian_type_c_type_get(ptypet);
164 162
165 eina_strbuf_append_printf(str_pardesc, tmpl_eo_pardesc, "in", pname, pdesc?pdesc:"No description supplied."); 163 eina_strbuf_append_printf(str_pardesc, tmpl_eo_pardesc, "in", pname, pdesc?pdesc:"No description supplied.");
166 164
@@ -175,15 +173,13 @@ eo_fundef_generate(const Eolian_Class *class, Eolian_Function *func, Eolian_Func
175 itr = eolian_function_parameters_get(func); 173 itr = eolian_function_parameters_get(func);
176 EINA_ITERATOR_FOREACH(itr, data) 174 EINA_ITERATOR_FOREACH(itr, data)
177 { 175 {
178 const Eolian_Type *ptypet; 176 Eolian_Function_Parameter *param = data;
179 const char *pname; 177 const Eolian_Type *ptypet = eolian_parameter_type_get(param);
180 const char *ptype; 178 const char *pname = eolian_parameter_name_get(param);
181 const char *pdesc; 179 const char *ptype = eolian_type_c_type_get(ptypet);
180 const char *pdesc = eolian_parameter_description_get(param);
182 Eina_Bool add_star = EINA_FALSE; 181 Eina_Bool add_star = EINA_FALSE;
183 Eolian_Parameter_Dir pdir; 182 Eolian_Parameter_Dir pdir = eolian_parameter_direction_get(param);
184 eolian_parameter_information_get((Eolian_Function_Parameter*)data, &pdir, &ptypet, &pname, &pdesc);
185
186 ptype = eolian_type_c_type_get(ptypet);
187 183
188 Eina_Bool is_const = eolian_parameter_const_attribute_get(data, ftype == EOLIAN_PROP_GET); 184 Eina_Bool is_const = eolian_parameter_const_attribute_get(data, ftype == EOLIAN_PROP_GET);
189 if (ftype == EOLIAN_PROP_GET) { 185 if (ftype == EOLIAN_PROP_GET) {
@@ -342,7 +338,6 @@ eo_bind_func_generate(const Eolian_Class *class, const Eolian_Function *funcid,
342 Eina_Bool var_as_ret = EINA_FALSE; 338 Eina_Bool var_as_ret = EINA_FALSE;
343 const Eolian_Type *rettypet = NULL; 339 const Eolian_Type *rettypet = NULL;
344 const char *rettype = NULL; 340 const char *rettype = NULL;
345 const char *retname = NULL;
346 Eina_Bool ret_const = EINA_FALSE; 341 Eina_Bool ret_const = EINA_FALSE;
347 Eina_Bool add_star = EINA_FALSE; 342 Eina_Bool add_star = EINA_FALSE;
348 Eina_Iterator *itr; 343 Eina_Iterator *itr;
@@ -357,7 +352,6 @@ eo_bind_func_generate(const Eolian_Class *class, const Eolian_Function *funcid,
357 Eina_Strbuf *full_params = eina_strbuf_new(); /* variables types + names */ 352 Eina_Strbuf *full_params = eina_strbuf_new(); /* variables types + names */
358 353
359 rettypet = eolian_function_return_type_get(funcid, ftype); 354 rettypet = eolian_function_return_type_get(funcid, ftype);
360 retname = "ret";
361 if (ftype == EOLIAN_PROP_GET) 355 if (ftype == EOLIAN_PROP_GET)
362 { 356 {
363 suffix = "_get"; 357 suffix = "_get";
@@ -368,7 +362,8 @@ eo_bind_func_generate(const Eolian_Class *class, const Eolian_Function *funcid,
368 /* We want to check if there is only one parameter */ 362 /* We want to check if there is only one parameter */
369 if (eina_iterator_next(itr, &data) && !eina_iterator_next(itr, &data2)) 363 if (eina_iterator_next(itr, &data) && !eina_iterator_next(itr, &data2))
370 { 364 {
371 eolian_parameter_information_get((Eolian_Function_Parameter*)data, NULL, &rettypet, &retname, NULL); 365 Eolian_Function_Parameter *param = data;
366 rettypet = eolian_parameter_type_get(param);
372 var_as_ret = EINA_TRUE; 367 var_as_ret = EINA_TRUE;
373 ret_const = eolian_parameter_const_attribute_get(data, EINA_TRUE); 368 ret_const = eolian_parameter_const_attribute_get(data, EINA_TRUE);
374 } 369 }
@@ -383,13 +378,10 @@ eo_bind_func_generate(const Eolian_Class *class, const Eolian_Function *funcid,
383 itr = eolian_property_keys_get(funcid); 378 itr = eolian_property_keys_get(funcid);
384 EINA_ITERATOR_FOREACH(itr, data) 379 EINA_ITERATOR_FOREACH(itr, data)
385 { 380 {
386 const Eolian_Type *ptypet; 381 Eolian_Function_Parameter *param = data;
387 const char *pname; 382 const Eolian_Type *ptypet = eolian_parameter_type_get(param);
388 const char *ptype; 383 const char *pname = eolian_parameter_name_get(param);
389 eolian_parameter_information_get((Eolian_Function_Parameter*)data, NULL, &ptypet, &pname, NULL); 384 const char *ptype = eolian_type_c_type_get(ptypet);
390
391 ptype = eolian_type_c_type_get(ptypet);
392
393 Eina_Bool is_const = eolian_parameter_const_attribute_get(data, ftype == EOLIAN_PROP_GET); 385 Eina_Bool is_const = eolian_parameter_const_attribute_get(data, ftype == EOLIAN_PROP_GET);
394 if (eina_strbuf_length_get(params)) eina_strbuf_append(params, ", "); 386 if (eina_strbuf_length_get(params)) eina_strbuf_append(params, ", ");
395 eina_strbuf_append_printf(params, "%s", pname); 387 eina_strbuf_append_printf(params, "%s", pname);
@@ -404,14 +396,11 @@ eo_bind_func_generate(const Eolian_Class *class, const Eolian_Function *funcid,
404 itr = eolian_function_parameters_get(funcid); 396 itr = eolian_function_parameters_get(funcid);
405 EINA_ITERATOR_FOREACH(itr, data) 397 EINA_ITERATOR_FOREACH(itr, data)
406 { 398 {
407 const Eolian_Type *ptypet; 399 Eolian_Function_Parameter *param = data;
408 const char *pname; 400 const Eolian_Type *ptypet = eolian_parameter_type_get(param);
409 const char *ptype; 401 const char *pname = eolian_parameter_name_get(param);
410 Eolian_Parameter_Dir pdir; 402 const char *ptype = eolian_type_c_type_get(ptypet);
411 eolian_parameter_information_get((Eolian_Function_Parameter*)data, &pdir, &ptypet, &pname, NULL); 403 Eolian_Parameter_Dir pdir = eolian_parameter_direction_get(param);
412
413 ptype = eolian_type_c_type_get(ptypet);
414
415 Eina_Bool is_const = eolian_parameter_const_attribute_get(data, ftype == EOLIAN_PROP_GET); 404 Eina_Bool is_const = eolian_parameter_const_attribute_get(data, ftype == EOLIAN_PROP_GET);
416 Eina_Bool had_star = !!strchr(ptype, '*'); 405 Eina_Bool had_star = !!strchr(ptype, '*');
417 if (ftype == EOLIAN_UNRESOLVED || ftype == EOLIAN_METHOD) add_star = (pdir == EOLIAN_OUT_PARAM || pdir == EOLIAN_INOUT_PARAM); 406 if (ftype == EOLIAN_UNRESOLVED || ftype == EOLIAN_METHOD) add_star = (pdir == EOLIAN_OUT_PARAM || pdir == EOLIAN_INOUT_PARAM);
diff --git a/src/bin/eolian/impl_generator.c b/src/bin/eolian/impl_generator.c
index 3e5f1f99db..069797e443 100644
--- a/src/bin/eolian/impl_generator.c
+++ b/src/bin/eolian/impl_generator.c
@@ -17,11 +17,9 @@ _params_generate(const Eolian_Function *foo, Eolian_Function_Type ftype, Eina_Bo
17 itr = eolian_property_keys_get(foo); 17 itr = eolian_property_keys_get(foo);
18 EINA_ITERATOR_FOREACH(itr, param) 18 EINA_ITERATOR_FOREACH(itr, param)
19 { 19 {
20 const Eolian_Type *ptypet; 20 const Eolian_Type *ptypet = eolian_parameter_type_get(param);
21 const char *pname; 21 const char *pname = eolian_parameter_name_get(param);
22 const char *ptype; 22 const char *ptype = eolian_type_c_type_get(ptypet);
23 eolian_parameter_information_get(param, NULL, &ptypet, &pname, NULL);
24 ptype = eolian_type_c_type_get(ptypet);
25 Eina_Bool had_star = !!strchr(ptype, '*'); 23 Eina_Bool had_star = !!strchr(ptype, '*');
26 Eina_Bool is_const = eolian_parameter_const_attribute_get(param, ftype == EOLIAN_PROP_GET); 24 Eina_Bool is_const = eolian_parameter_const_attribute_get(param, ftype == EOLIAN_PROP_GET);
27 if (eina_strbuf_length_get(params)) 25 if (eina_strbuf_length_get(params))
@@ -43,12 +41,10 @@ _params_generate(const Eolian_Function *foo, Eolian_Function_Type ftype, Eina_Bo
43 itr = eolian_function_parameters_get(foo); 41 itr = eolian_function_parameters_get(foo);
44 EINA_ITERATOR_FOREACH(itr, param) 42 EINA_ITERATOR_FOREACH(itr, param)
45 { 43 {
46 const Eolian_Type *ptypet; 44 const Eolian_Type *ptypet = eolian_parameter_type_get(param);
47 const char *pname; 45 const char *pname = eolian_parameter_name_get(param);
48 const char *ptype; 46 const char *ptype = eolian_type_c_type_get(ptypet);
49 Eolian_Parameter_Dir pdir; 47 Eolian_Parameter_Dir pdir = eolian_parameter_direction_get(param);
50 eolian_parameter_information_get(param, &pdir, &ptypet, &pname, NULL);
51 ptype = eolian_type_c_type_get(ptypet);
52 Eina_Bool is_const = eolian_parameter_const_attribute_get(param, ftype == EOLIAN_PROP_GET); 48 Eina_Bool is_const = eolian_parameter_const_attribute_get(param, ftype == EOLIAN_PROP_GET);
53 Eina_Bool had_star = !!strchr(ptype, '*'); 49 Eina_Bool had_star = !!strchr(ptype, '*');
54 if (ftype == EOLIAN_UNRESOLVED || ftype == EOLIAN_METHOD) add_star = (pdir == EOLIAN_OUT_PARAM || pdir == EOLIAN_INOUT_PARAM); 50 if (ftype == EOLIAN_UNRESOLVED || ftype == EOLIAN_METHOD) add_star = (pdir == EOLIAN_OUT_PARAM || pdir == EOLIAN_INOUT_PARAM);
@@ -153,7 +149,7 @@ _prototype_generate(const Eolian_Function *foo, Eolian_Function_Type ftype, Eina
153 if (eina_iterator_next(itr, &data) && !eina_iterator_next(itr, &data2)) 149 if (eina_iterator_next(itr, &data) && !eina_iterator_next(itr, &data2))
154 { 150 {
155 Eolian_Function_Parameter *param = data; 151 Eolian_Function_Parameter *param = data;
156 eolian_parameter_information_get(param, NULL, &rettypet, NULL, NULL); 152 rettypet = eolian_parameter_type_get(param);
157 var_as_ret = EINA_TRUE; 153 var_as_ret = EINA_TRUE;
158 ret_const = eolian_parameter_const_attribute_get(param, EINA_TRUE); 154 ret_const = eolian_parameter_const_attribute_get(param, EINA_TRUE);
159 } 155 }
diff --git a/src/bin/eolian/legacy_generator.c b/src/bin/eolian/legacy_generator.c
index e32e444f0f..42046a261b 100644
--- a/src/bin/eolian/legacy_generator.c
+++ b/src/bin/eolian/legacy_generator.c
@@ -72,7 +72,7 @@ _eapi_decl_func_generate(const Eolian_Class *class, const Eolian_Function *funci
72 /* We want to check if there is only one parameter */ 72 /* We want to check if there is only one parameter */
73 if (eina_iterator_next(itr, &data) && !eina_iterator_next(itr, &data2)) 73 if (eina_iterator_next(itr, &data) && !eina_iterator_next(itr, &data2))
74 { 74 {
75 eolian_parameter_information_get((Eolian_Function_Parameter*)data, NULL, &rettypet, NULL, NULL); 75 rettypet = eolian_parameter_type_get((Eolian_Function_Parameter*)data);
76 var_as_ret = EINA_TRUE; 76 var_as_ret = EINA_TRUE;
77 ret_const = eolian_parameter_const_attribute_get(data, EINA_TRUE); 77 ret_const = eolian_parameter_const_attribute_get(data, EINA_TRUE);
78 } 78 }
@@ -112,12 +112,11 @@ _eapi_decl_func_generate(const Eolian_Class *class, const Eolian_Function *funci
112 itr = eolian_property_keys_get(funcid); 112 itr = eolian_property_keys_get(funcid);
113 EINA_ITERATOR_FOREACH(itr, data) 113 EINA_ITERATOR_FOREACH(itr, data)
114 { 114 {
115 const Eolian_Type *ptypet; 115 Eolian_Function_Parameter *param = data;
116 const char *pname; 116 const Eolian_Type *ptypet = eolian_parameter_type_get(param);
117 const char *pdesc; 117 const char *pname = eolian_parameter_name_get(param);
118 const char *ptype; 118 const char *ptype = eolian_type_c_type_get(ptypet);
119 eolian_parameter_information_get((Eolian_Function_Parameter*)data, NULL, &ptypet, &pname, &pdesc); 119 const char *pdesc = eolian_parameter_description_get(param);
120 ptype = eolian_type_c_type_get(ptypet);
121 leg_param_idx++; 120 leg_param_idx++;
122 if (eina_strbuf_length_get(fparam)) eina_strbuf_append(fparam, ", "); 121 if (eina_strbuf_length_get(fparam)) eina_strbuf_append(fparam, ", ");
123 eina_strbuf_append_printf(fparam, "%s%s %s", 122 eina_strbuf_append_printf(fparam, "%s%s %s",
@@ -142,14 +141,13 @@ _eapi_decl_func_generate(const Eolian_Class *class, const Eolian_Function *funci
142 itr = eolian_function_parameters_get(funcid); 141 itr = eolian_function_parameters_get(funcid);
143 EINA_ITERATOR_FOREACH(itr, data) 142 EINA_ITERATOR_FOREACH(itr, data)
144 { 143 {
145 const Eolian_Type *ptypet; 144 Eolian_Function_Parameter *param = data;
146 const char *pname; 145 const Eolian_Type *ptypet = eolian_parameter_type_get(param);
147 const char *pdesc; 146 const char *pname = eolian_parameter_name_get(param);
148 const char *ptype; 147 const char *ptype = eolian_type_c_type_get(ptypet);
149 Eolian_Parameter_Dir pdir; 148 const char *pdesc = eolian_parameter_description_get(param);
149 Eolian_Parameter_Dir pdir = eolian_parameter_direction_get(param);
150 const char *str_dir[] = {"in", "out", "inout"}; 150 const char *str_dir[] = {"in", "out", "inout"};
151 eolian_parameter_information_get((Eolian_Function_Parameter*)data, &pdir, &ptypet, &pname, &pdesc);
152 ptype = eolian_type_c_type_get(ptypet);
153 Eina_Bool had_star = !!strchr(ptype, '*'); 151 Eina_Bool had_star = !!strchr(ptype, '*');
154 if (ftype == EOLIAN_UNRESOLVED || ftype == EOLIAN_METHOD) add_star = (pdir == EOLIAN_OUT_PARAM || pdir == EOLIAN_INOUT_PARAM); 152 if (ftype == EOLIAN_UNRESOLVED || ftype == EOLIAN_METHOD) add_star = (pdir == EOLIAN_OUT_PARAM || pdir == EOLIAN_INOUT_PARAM);
155 if (ftype == EOLIAN_PROP_GET) pdir = EOLIAN_OUT_PARAM; 153 if (ftype == EOLIAN_PROP_GET) pdir = EOLIAN_OUT_PARAM;
@@ -242,7 +240,9 @@ _eapi_func_generate(const Eolian_Class *class, const Eolian_Function *funcid, Eo
242 /* We want to check if there is only one parameter */ 240 /* We want to check if there is only one parameter */
243 if (eina_iterator_next(itr, &data) && !eina_iterator_next(itr, &data2)) 241 if (eina_iterator_next(itr, &data) && !eina_iterator_next(itr, &data2))
244 { 242 {
245 eolian_parameter_information_get((Eolian_Function_Parameter*)data, NULL, &rettypet, &retname, NULL); 243 Eolian_Function_Parameter *param = data;
244 rettypet = eolian_parameter_type_get(param);
245 retname = eolian_parameter_name_get(param);
246 var_as_ret = EINA_TRUE; 246 var_as_ret = EINA_TRUE;
247 ret_const = eolian_parameter_const_attribute_get(data, EINA_TRUE); 247 ret_const = eolian_parameter_const_attribute_get(data, EINA_TRUE);
248 } 248 }
@@ -283,11 +283,10 @@ _eapi_func_generate(const Eolian_Class *class, const Eolian_Function *funcid, Eo
283 itr = eolian_property_keys_get(funcid); 283 itr = eolian_property_keys_get(funcid);
284 EINA_ITERATOR_FOREACH(itr, data) 284 EINA_ITERATOR_FOREACH(itr, data)
285 { 285 {
286 const Eolian_Type *ptypet; 286 Eolian_Function_Parameter *param = data;
287 const char *pname; 287 const Eolian_Type *ptypet = eolian_parameter_type_get(param);
288 const char *ptype; 288 const char *pname = eolian_parameter_name_get(param);
289 eolian_parameter_information_get((Eolian_Function_Parameter*)data, NULL, &ptypet, &pname, NULL); 289 const char *ptype = eolian_type_c_type_get(ptypet);
290 ptype = eolian_type_c_type_get(ptypet);
291 if (eina_strbuf_length_get(fparam)) eina_strbuf_append(fparam, ", "); 290 if (eina_strbuf_length_get(fparam)) eina_strbuf_append(fparam, ", ");
292 eina_strbuf_append_printf(fparam, "%s%s %s", 291 eina_strbuf_append_printf(fparam, "%s%s %s",
293 eolian_parameter_const_attribute_get(data, ftype == EOLIAN_PROP_GET)?"const ":"", 292 eolian_parameter_const_attribute_get(data, ftype == EOLIAN_PROP_GET)?"const ":"",
@@ -299,15 +298,14 @@ _eapi_func_generate(const Eolian_Class *class, const Eolian_Function *funcid, Eo
299 eina_iterator_free(itr); 298 eina_iterator_free(itr);
300 if (!var_as_ret) 299 if (!var_as_ret)
301 { 300 {
302 itr = eolian_function_parameters_get(funcid); 301 itr = eolian_function_parameters_get(funcid);
303 EINA_ITERATOR_FOREACH(itr, data) 302 EINA_ITERATOR_FOREACH(itr, data)
304 { 303 {
305 const Eolian_Type *ptypet; 304 Eolian_Function_Parameter *param = data;
306 const char *pname; 305 const Eolian_Type *ptypet = eolian_parameter_type_get(param);
307 const char *ptype; 306 const char *pname = eolian_parameter_name_get(param);
308 Eolian_Parameter_Dir pdir; 307 const char *ptype = eolian_type_c_type_get(ptypet);
309 eolian_parameter_information_get((Eolian_Function_Parameter*)data, &pdir, &ptypet, &pname, NULL); 308 Eolian_Parameter_Dir pdir = eolian_parameter_direction_get(param);
310 ptype = eolian_type_c_type_get(ptypet);
311 Eina_Bool had_star = !!strchr(ptype, '*'); 309 Eina_Bool had_star = !!strchr(ptype, '*');
312 if (ftype == EOLIAN_UNRESOLVED || ftype == EOLIAN_METHOD) add_star = (pdir == EOLIAN_OUT_PARAM || pdir == EOLIAN_INOUT_PARAM); 310 if (ftype == EOLIAN_UNRESOLVED || ftype == EOLIAN_METHOD) add_star = (pdir == EOLIAN_OUT_PARAM || pdir == EOLIAN_INOUT_PARAM);
313 if (eina_strbuf_length_get(fparam)) eina_strbuf_append(fparam, ", "); 311 if (eina_strbuf_length_get(fparam)) eina_strbuf_append(fparam, ", ");
@@ -317,8 +315,8 @@ _eapi_func_generate(const Eolian_Class *class, const Eolian_Function *funcid, Eo
317 eina_stringshare_del(ptype); 315 eina_stringshare_del(ptype);
318 if (eina_strbuf_length_get(eoparam)) eina_strbuf_append(eoparam, ", "); 316 if (eina_strbuf_length_get(eoparam)) eina_strbuf_append(eoparam, ", ");
319 eina_strbuf_append_printf(eoparam, "%s", pname); 317 eina_strbuf_append_printf(eoparam, "%s", pname);
320 } 318 }
321 eina_iterator_free(itr); 319 eina_iterator_free(itr);
322 } 320 }
323 if (!eina_strbuf_length_get(fparam)) eina_strbuf_append(fparam, "void"); 321 if (!eina_strbuf_length_get(fparam)) eina_strbuf_append(fparam, "void");
324 322