diff options
author | Daniel Kolesa <d.kolesa@osg.samsung.com> | 2015-05-20 18:05:45 +0100 |
---|---|---|
committer | Daniel Kolesa <d.kolesa@osg.samsung.com> | 2015-05-20 18:05:45 +0100 |
commit | 54974b074b4031c25947576bcf4809c66d93d858 (patch) | |
tree | 4bcaf5012b7b401909c2d3753c8f77b6f54cbb7f | |
parent | 378e161cd3e3c9d35ec67842ce878d7e981ad678 (diff) |
eolian: remove const_get/const_set support
This was made obsolete by per-accessor values. It was
also hacky and i've wanted to remove it for a while.
-rw-r--r-- | src/bin/eolian/eo_generator.c | 32 | ||||
-rw-r--r-- | src/bin/eolian/impl_generator.c | 18 | ||||
-rw-r--r-- | src/bin/eolian/legacy_generator.c | 27 | ||||
-rw-r--r-- | src/bindings/luajit/eolian.lua | 5 | ||||
-rw-r--r-- | src/lib/eolian/Eolian.h | 14 | ||||
-rw-r--r-- | src/lib/eolian/database_function_parameter_api.c | 10 | ||||
-rw-r--r-- | src/lib/eolian/eo_lexer.h | 9 | ||||
-rw-r--r-- | src/lib/eolian/eo_parser.c | 14 | ||||
-rw-r--r-- | src/lib/eolian/eolian_database.h | 2 |
9 files changed, 28 insertions, 103 deletions
diff --git a/src/bin/eolian/eo_generator.c b/src/bin/eolian/eo_generator.c index 90dfbc99c5..573fe1febb 100644 --- a/src/bin/eolian/eo_generator.c +++ b/src/bin/eolian/eo_generator.c | |||
@@ -87,7 +87,6 @@ eo_fundef_generate(const Eolian_Class *class, const Eolian_Function *func, Eolia | |||
87 | Eina_Bool var_as_ret = EINA_FALSE; | 87 | Eina_Bool var_as_ret = EINA_FALSE; |
88 | const Eolian_Type *rettypet = NULL; | 88 | const Eolian_Type *rettypet = NULL; |
89 | const char *rettype = NULL; | 89 | const char *rettype = NULL; |
90 | Eina_Bool ret_const = EINA_FALSE; | ||
91 | Eolian_Object_Scope scope = eolian_function_scope_get(func); | 90 | Eolian_Object_Scope scope = eolian_function_scope_get(func); |
92 | Eina_Bool is_prop = (ftype == EOLIAN_PROP_GET || ftype == EOLIAN_PROP_SET); | 91 | Eina_Bool is_prop = (ftype == EOLIAN_PROP_GET || ftype == EOLIAN_PROP_SET); |
93 | 92 | ||
@@ -101,7 +100,6 @@ eo_fundef_generate(const Eolian_Class *class, const Eolian_Function *func, Eolia | |||
101 | { | 100 | { |
102 | rettypet = eolian_parameter_type_get((Eolian_Function_Parameter*)data); | 101 | rettypet = eolian_parameter_type_get((Eolian_Function_Parameter*)data); |
103 | var_as_ret = EINA_TRUE; | 102 | var_as_ret = EINA_TRUE; |
104 | ret_const = eolian_parameter_const_attribute_get(data, EINA_TRUE); | ||
105 | } | 103 | } |
106 | eina_iterator_free(itr); | 104 | eina_iterator_free(itr); |
107 | } | 105 | } |
@@ -176,7 +174,6 @@ eo_fundef_generate(const Eolian_Class *class, const Eolian_Function *func, Eolia | |||
176 | Eina_Bool add_star = EINA_FALSE; | 174 | Eina_Bool add_star = EINA_FALSE; |
177 | Eolian_Parameter_Dir pdir = eolian_parameter_direction_get(param); | 175 | Eolian_Parameter_Dir pdir = eolian_parameter_direction_get(param); |
178 | 176 | ||
179 | Eina_Bool is_const = eolian_parameter_const_attribute_get(data, ftype == EOLIAN_PROP_GET); | ||
180 | if (ftype == EOLIAN_PROP_GET) { | 177 | if (ftype == EOLIAN_PROP_GET) { |
181 | add_star = EINA_TRUE; | 178 | add_star = EINA_TRUE; |
182 | pdir = EOLIAN_OUT_PARAM; | 179 | pdir = EOLIAN_OUT_PARAM; |
@@ -190,8 +187,7 @@ eo_fundef_generate(const Eolian_Class *class, const Eolian_Function *func, Eolia | |||
190 | eina_strbuf_append_printf(str_pardesc, tmpl_eo_pardesc, dir_str, pname, pdesc?pdesc:"No description supplied."); | 187 | eina_strbuf_append_printf(str_pardesc, tmpl_eo_pardesc, dir_str, pname, pdesc?pdesc:"No description supplied."); |
191 | 188 | ||
192 | if (eina_strbuf_length_get(str_par)) eina_strbuf_append(str_par, ", "); | 189 | if (eina_strbuf_length_get(str_par)) eina_strbuf_append(str_par, ", "); |
193 | eina_strbuf_append_printf(str_par, "%s%s%s%s%s", | 190 | eina_strbuf_append_printf(str_par, "%s%s%s%s", |
194 | is_const?"const ":"", | ||
195 | ptype, had_star?"":" ", add_star?"*":"", pname); | 191 | ptype, had_star?"":" ", add_star?"*":"", pname); |
196 | 192 | ||
197 | eina_stringshare_del(ptype); | 193 | eina_stringshare_del(ptype); |
@@ -202,8 +198,7 @@ eo_fundef_generate(const Eolian_Class *class, const Eolian_Function *func, Eolia | |||
202 | if (rettypet) rettype = eolian_type_c_type_get(rettypet); | 198 | if (rettypet) rettype = eolian_type_c_type_get(rettypet); |
203 | 199 | ||
204 | tmpstr[0] = '\0'; | 200 | tmpstr[0] = '\0'; |
205 | sprintf(tmpstr, "%s%s%s", | 201 | sprintf(tmpstr, "%s%s", |
206 | ret_const ? "const " : "", | ||
207 | rettype ? rettype : "void", | 202 | rettype ? rettype : "void", |
208 | rettype && strchr(rettype, '*')?"":" "); | 203 | rettype && strchr(rettype, '*')?"":" "); |
209 | eina_strbuf_replace_all(str_func, "@#rettype", tmpstr); | 204 | eina_strbuf_replace_all(str_func, "@#rettype", tmpstr); |
@@ -359,7 +354,6 @@ eo_bind_func_generate(const Eolian_Class *class, const Eolian_Function *funcid, | |||
359 | Eina_Bool var_as_ret = EINA_FALSE; | 354 | Eina_Bool var_as_ret = EINA_FALSE; |
360 | const Eolian_Type *rettypet = NULL; | 355 | const Eolian_Type *rettypet = NULL; |
361 | const char *rettype = NULL; | 356 | const char *rettype = NULL; |
362 | Eina_Bool ret_const = EINA_FALSE; | ||
363 | Eina_Bool add_star = EINA_FALSE; | 357 | Eina_Bool add_star = EINA_FALSE; |
364 | Eina_Iterator *itr; | 358 | Eina_Iterator *itr; |
365 | void *data, *data2; | 359 | void *data, *data2; |
@@ -397,7 +391,6 @@ eo_bind_func_generate(const Eolian_Class *class, const Eolian_Function *funcid, | |||
397 | Eolian_Function_Parameter *param = data; | 391 | Eolian_Function_Parameter *param = data; |
398 | rettypet = eolian_parameter_type_get(param); | 392 | rettypet = eolian_parameter_type_get(param); |
399 | var_as_ret = EINA_TRUE; | 393 | var_as_ret = EINA_TRUE; |
400 | ret_const = eolian_parameter_const_attribute_get(data, EINA_TRUE); | ||
401 | default_ret_val = eolian_parameter_default_value_get(param); | 394 | default_ret_val = eolian_parameter_default_value_get(param); |
402 | } | 395 | } |
403 | eina_iterator_free(itr); | 396 | eina_iterator_free(itr); |
@@ -415,11 +408,9 @@ eo_bind_func_generate(const Eolian_Class *class, const Eolian_Function *funcid, | |||
415 | const Eolian_Type *ptypet = eolian_parameter_type_get(param); | 408 | const Eolian_Type *ptypet = eolian_parameter_type_get(param); |
416 | const char *pname = eolian_parameter_name_get(param); | 409 | const char *pname = eolian_parameter_name_get(param); |
417 | const char *ptype = eolian_type_c_type_get(ptypet); | 410 | const char *ptype = eolian_type_c_type_get(ptypet); |
418 | Eina_Bool is_const = eolian_parameter_const_attribute_get(data, ftype == EOLIAN_PROP_GET); | ||
419 | if (eina_strbuf_length_get(params)) eina_strbuf_append(params, ", "); | 411 | if (eina_strbuf_length_get(params)) eina_strbuf_append(params, ", "); |
420 | eina_strbuf_append_printf(params, "%s", pname); | 412 | eina_strbuf_append_printf(params, "%s", pname); |
421 | eina_strbuf_append_printf(full_params, ", %s%s %s%s", | 413 | eina_strbuf_append_printf(full_params, ", %s %s%s", |
422 | is_const?"const ":"", | ||
423 | ptype, pname, is_empty || is_auto?" EINA_UNUSED":""); | 414 | ptype, pname, is_empty || is_auto?" EINA_UNUSED":""); |
424 | eina_stringshare_del(ptype); | 415 | eina_stringshare_del(ptype); |
425 | } | 416 | } |
@@ -435,13 +426,11 @@ eo_bind_func_generate(const Eolian_Class *class, const Eolian_Function *funcid, | |||
435 | const char *pname = eolian_parameter_name_get(param); | 426 | const char *pname = eolian_parameter_name_get(param); |
436 | const char *ptype = eolian_type_c_type_get(ptypet); | 427 | const char *ptype = eolian_type_c_type_get(ptypet); |
437 | Eolian_Parameter_Dir pdir = eolian_parameter_direction_get(param); | 428 | Eolian_Parameter_Dir pdir = eolian_parameter_direction_get(param); |
438 | Eina_Bool is_const = eolian_parameter_const_attribute_get(data, ftype == EOLIAN_PROP_GET); | ||
439 | Eina_Bool had_star = !!strchr(ptype, '*'); | 429 | Eina_Bool had_star = !!strchr(ptype, '*'); |
440 | if (ftype == EOLIAN_UNRESOLVED || ftype == EOLIAN_METHOD) add_star = (pdir == EOLIAN_OUT_PARAM || pdir == EOLIAN_INOUT_PARAM); | 430 | if (ftype == EOLIAN_UNRESOLVED || ftype == EOLIAN_METHOD) add_star = (pdir == EOLIAN_OUT_PARAM || pdir == EOLIAN_INOUT_PARAM); |
441 | if (eina_strbuf_length_get(params)) eina_strbuf_append(params, ", "); | 431 | if (eina_strbuf_length_get(params)) eina_strbuf_append(params, ", "); |
442 | eina_strbuf_append_printf(params, "%s", pname); | 432 | eina_strbuf_append_printf(params, "%s", pname); |
443 | eina_strbuf_append_printf(full_params, ", %s%s%s%s%s%s", | 433 | eina_strbuf_append_printf(full_params, ", %s%s%s%s%s", |
444 | is_const?"const ":"", | ||
445 | ptype, had_star?"":" ", add_star?"*":"", pname, is_empty && !dflt_value ?" EINA_UNUSED":""); | 434 | ptype, had_star?"":" ", add_star?"*":"", pname, is_empty && !dflt_value ?" EINA_UNUSED":""); |
446 | if (is_auto) | 435 | if (is_auto) |
447 | { | 436 | { |
@@ -495,8 +484,8 @@ eo_bind_func_generate(const Eolian_Class *class, const Eolian_Function *funcid, | |||
495 | /* Generation of the user function prototype declaration - not needed when @auto and @empty are indicated */ | 484 | /* Generation of the user function prototype declaration - not needed when @auto and @empty are indicated */ |
496 | if (!is_empty && !is_auto) | 485 | if (!is_empty && !is_auto) |
497 | { | 486 | { |
498 | eina_strbuf_append_printf(fbody, "%s%s _%s%s%s_%s%s(Eo *obj, @#Datatype_Data *pd%s);\n\n", | 487 | eina_strbuf_append_printf(fbody, "%s _%s%s%s_%s%s(Eo *obj, @#Datatype_Data *pd%s);\n\n", |
499 | ret_const?"const ":"", rettype?rettype:"void", | 488 | rettype?rettype:"void", |
500 | class_env.lower_classname, | 489 | class_env.lower_classname, |
501 | impl_env?"_":"", | 490 | impl_env?"_":"", |
502 | impl_env?impl_env->lower_classname:"", | 491 | impl_env?impl_env->lower_classname:"", |
@@ -510,8 +499,8 @@ eo_bind_func_generate(const Eolian_Class *class, const Eolian_Function *funcid, | |||
510 | eina_hash_add(_funcs_params_init, | 499 | eina_hash_add(_funcs_params_init, |
511 | eina_stringshare_add(eolian_function_name_get(funcid)), (void *)ftype); | 500 | eina_stringshare_add(eolian_function_name_get(funcid)), (void *)ftype); |
512 | /* Generation of the intermediate function __eolian_... */ | 501 | /* Generation of the intermediate function __eolian_... */ |
513 | eina_strbuf_append_printf(fbody, "static %s%s __eolian_%s%s%s_%s%s(Eo *obj%s, @#Datatype_Data *pd%s%s)\n{\n", | 502 | eina_strbuf_append_printf(fbody, "static %s __eolian_%s%s%s_%s%s(Eo *obj%s, @#Datatype_Data *pd%s%s)\n{\n", |
514 | ret_const?"const ":"", rettype?rettype:"void", | 503 | rettype?rettype:"void", |
515 | class_env.lower_classname, | 504 | class_env.lower_classname, |
516 | impl_env?"_":"", | 505 | impl_env?"_":"", |
517 | impl_env?impl_env->lower_classname:"", | 506 | impl_env?impl_env->lower_classname:"", |
@@ -585,9 +574,8 @@ eo_bind_func_generate(const Eolian_Class *class, const Eolian_Function *funcid, | |||
585 | if (val.type) | 574 | if (val.type) |
586 | val_str = eolian_expression_value_to_literal(&val); | 575 | val_str = eolian_expression_value_to_literal(&val); |
587 | } | 576 | } |
588 | eina_strbuf_append_printf(eo_func_decl, ", %s%s, %s", | 577 | eina_strbuf_append_printf(eo_func_decl, ", %s, %s", |
589 | ret_const ? "const " : "", rettype, | 578 | rettype, val_str?val_str:"0"); |
590 | val_str?val_str:"0"); | ||
591 | if (val_str && eolian_expression_type_get(default_ret_val) == EOLIAN_EXPR_NAME) | 579 | if (val_str && eolian_expression_type_get(default_ret_val) == EOLIAN_EXPR_NAME) |
592 | { | 580 | { |
593 | Eina_Stringshare *string = eolian_expression_serialize(default_ret_val); | 581 | Eina_Stringshare *string = eolian_expression_serialize(default_ret_val); |
diff --git a/src/bin/eolian/impl_generator.c b/src/bin/eolian/impl_generator.c index 5891ae0161..36fa2bc2d7 100644 --- a/src/bin/eolian/impl_generator.c +++ b/src/bin/eolian/impl_generator.c | |||
@@ -26,16 +26,13 @@ _params_generate(const Eolian_Function *foo, Eolian_Function_Type ftype, Eina_Bo | |||
26 | const char *pname = eolian_parameter_name_get(param); | 26 | const char *pname = eolian_parameter_name_get(param); |
27 | const char *ptype = eolian_type_c_type_get(ptypet); | 27 | const char *ptype = eolian_type_c_type_get(ptypet); |
28 | Eina_Bool had_star = !!strchr(ptype, '*'); | 28 | Eina_Bool had_star = !!strchr(ptype, '*'); |
29 | Eina_Bool is_const = eolian_parameter_const_attribute_get(param, ftype == EOLIAN_PROP_GET); | ||
30 | if (eina_strbuf_length_get(params)) | 29 | if (eina_strbuf_length_get(params)) |
31 | { | 30 | { |
32 | eina_strbuf_append(params, ", "); | 31 | eina_strbuf_append(params, ", "); |
33 | eina_strbuf_append(short_params, ", "); | 32 | eina_strbuf_append(short_params, ", "); |
34 | } | 33 | } |
35 | eina_strbuf_append_printf(params, "%s%s%s%s", | 34 | eina_strbuf_append_printf(params, "%s%s%s", |
36 | is_const?"const ":"", ptype, | 35 | ptype, had_star?"":" ", pname); |
37 | had_star?"":" ", | ||
38 | pname); | ||
39 | eina_strbuf_append_printf(short_params, "%s", pname); | 36 | eina_strbuf_append_printf(short_params, "%s", pname); |
40 | eina_stringshare_del(ptype); | 37 | eina_stringshare_del(ptype); |
41 | } | 38 | } |
@@ -50,7 +47,6 @@ _params_generate(const Eolian_Function *foo, Eolian_Function_Type ftype, Eina_Bo | |||
50 | const char *pname = eolian_parameter_name_get(param); | 47 | const char *pname = eolian_parameter_name_get(param); |
51 | const char *ptype = eolian_type_c_type_get(ptypet); | 48 | const char *ptype = eolian_type_c_type_get(ptypet); |
52 | Eolian_Parameter_Dir pdir = eolian_parameter_direction_get(param); | 49 | Eolian_Parameter_Dir pdir = eolian_parameter_direction_get(param); |
53 | Eina_Bool is_const = eolian_parameter_const_attribute_get(param, ftype == EOLIAN_PROP_GET); | ||
54 | Eina_Bool had_star = !!strchr(ptype, '*'); | 50 | Eina_Bool had_star = !!strchr(ptype, '*'); |
55 | if (ftype == EOLIAN_UNRESOLVED || ftype == EOLIAN_METHOD) add_star = (pdir == EOLIAN_OUT_PARAM || pdir == EOLIAN_INOUT_PARAM); | 51 | if (ftype == EOLIAN_UNRESOLVED || ftype == EOLIAN_METHOD) add_star = (pdir == EOLIAN_OUT_PARAM || pdir == EOLIAN_INOUT_PARAM); |
56 | if (eina_strbuf_length_get(params)) | 52 | if (eina_strbuf_length_get(params)) |
@@ -58,8 +54,7 @@ _params_generate(const Eolian_Function *foo, Eolian_Function_Type ftype, Eina_Bo | |||
58 | eina_strbuf_append(params, ", "); | 54 | eina_strbuf_append(params, ", "); |
59 | eina_strbuf_append(short_params, ", "); | 55 | eina_strbuf_append(short_params, ", "); |
60 | } | 56 | } |
61 | eina_strbuf_append_printf(params, "%s%s%s%s%s", | 57 | eina_strbuf_append_printf(params, "%s%s%s%s", |
62 | is_const?"const ":"", | ||
63 | ptype, had_star?"":" ", add_star?"*":"", pname); | 58 | ptype, had_star?"":" ", add_star?"*":"", pname); |
64 | eina_strbuf_append_printf(short_params, "%s", pname); | 59 | eina_strbuf_append_printf(short_params, "%s", pname); |
65 | eina_stringshare_del(ptype); | 60 | eina_stringshare_del(ptype); |
@@ -119,7 +114,7 @@ _type_exists(const char* type_name, Eina_Strbuf *buffer) | |||
119 | static Eina_Bool | 114 | static Eina_Bool |
120 | _prototype_generate(const Eolian_Function *foo, Eolian_Function_Type ftype, Eina_Strbuf *data_type_buf, Eolian_Implement *impl_desc, Eina_Strbuf *buffer) | 115 | _prototype_generate(const Eolian_Function *foo, Eolian_Function_Type ftype, Eina_Strbuf *data_type_buf, Eolian_Implement *impl_desc, Eina_Strbuf *buffer) |
121 | { | 116 | { |
122 | Eina_Bool var_as_ret = EINA_FALSE, ret_const = EINA_FALSE; | 117 | Eina_Bool var_as_ret = EINA_FALSE; |
123 | Eina_Strbuf *params = NULL, *short_params = NULL, *super_invok = NULL; | 118 | Eina_Strbuf *params = NULL, *short_params = NULL, *super_invok = NULL; |
124 | char func_name[PATH_MAX]; | 119 | char func_name[PATH_MAX]; |
125 | char impl_name[PATH_MAX]; | 120 | char impl_name[PATH_MAX]; |
@@ -156,7 +151,6 @@ _prototype_generate(const Eolian_Function *foo, Eolian_Function_Type ftype, Eina | |||
156 | Eolian_Function_Parameter *param = data; | 151 | Eolian_Function_Parameter *param = data; |
157 | rettypet = eolian_parameter_type_get(param); | 152 | rettypet = eolian_parameter_type_get(param); |
158 | var_as_ret = EINA_TRUE; | 153 | var_as_ret = EINA_TRUE; |
159 | ret_const = eolian_parameter_const_attribute_get(param, EINA_TRUE); | ||
160 | } | 154 | } |
161 | eina_iterator_free(itr); | 155 | eina_iterator_free(itr); |
162 | } | 156 | } |
@@ -190,8 +184,8 @@ _prototype_generate(const Eolian_Function *foo, Eolian_Function_Type ftype, Eina | |||
190 | if (rettypet) rettype = eolian_type_c_type_get(rettypet); | 184 | if (rettypet) rettype = eolian_type_c_type_get(rettypet); |
191 | 185 | ||
192 | eina_strbuf_append_printf(buffer, | 186 | eina_strbuf_append_printf(buffer, |
193 | "EOLIAN static %s%s\n%s(%sEo *obj, %s *pd%s%s)\n{\n%s\n}\n\n", | 187 | "EOLIAN static %s\n%s(%sEo *obj, %s *pd%s%s)\n{\n%s\n}\n\n", |
194 | ret_const?"const ":"", !rettype?"void":rettype, | 188 | !rettype?"void":rettype, |
195 | func_name, | 189 | func_name, |
196 | eolian_function_object_is_const(foo)?"const ":"", | 190 | eolian_function_object_is_const(foo)?"const ":"", |
197 | !eina_strbuf_length_get(data_type_buf) ? "void" : eina_strbuf_string_get(data_type_buf), | 191 | !eina_strbuf_length_get(data_type_buf) ? "void" : eina_strbuf_string_get(data_type_buf), |
diff --git a/src/bin/eolian/legacy_generator.c b/src/bin/eolian/legacy_generator.c index b4f31f1270..c65103d816 100644 --- a/src/bin/eolian/legacy_generator.c +++ b/src/bin/eolian/legacy_generator.c | |||
@@ -54,7 +54,6 @@ _eapi_decl_func_generate(const Eolian_Class *class, const Eolian_Function *funci | |||
54 | const char *rettype = NULL; | 54 | const char *rettype = NULL; |
55 | Eina_Bool var_as_ret = EINA_FALSE; | 55 | Eina_Bool var_as_ret = EINA_FALSE; |
56 | Eina_Bool add_star = EINA_FALSE; | 56 | Eina_Bool add_star = EINA_FALSE; |
57 | Eina_Bool ret_const = EINA_FALSE; | ||
58 | Eina_Bool is_prop = (ftype == EOLIAN_PROP_GET || ftype == EOLIAN_PROP_SET); | 57 | Eina_Bool is_prop = (ftype == EOLIAN_PROP_GET || ftype == EOLIAN_PROP_SET); |
59 | Eina_Iterator *itr; | 58 | Eina_Iterator *itr; |
60 | void *data, *data2; | 59 | void *data, *data2; |
@@ -78,7 +77,6 @@ _eapi_decl_func_generate(const Eolian_Class *class, const Eolian_Function *funci | |||
78 | { | 77 | { |
79 | rettypet = eolian_parameter_type_get((Eolian_Function_Parameter*)data); | 78 | rettypet = eolian_parameter_type_get((Eolian_Function_Parameter*)data); |
80 | var_as_ret = EINA_TRUE; | 79 | var_as_ret = EINA_TRUE; |
81 | ret_const = eolian_parameter_const_attribute_get(data, EINA_TRUE); | ||
82 | } | 80 | } |
83 | eina_iterator_free(itr); | 81 | eina_iterator_free(itr); |
84 | } | 82 | } |
@@ -124,9 +122,7 @@ _eapi_decl_func_generate(const Eolian_Class *class, const Eolian_Function *funci | |||
124 | const char *pdesc = eolian_parameter_description_get(param); | 122 | const char *pdesc = eolian_parameter_description_get(param); |
125 | leg_param_idx++; | 123 | leg_param_idx++; |
126 | if (eina_strbuf_length_get(fparam)) eina_strbuf_append(fparam, ", "); | 124 | if (eina_strbuf_length_get(fparam)) eina_strbuf_append(fparam, ", "); |
127 | eina_strbuf_append_printf(fparam, "%s%s %s", | 125 | eina_strbuf_append_printf(fparam, "%s %s", ptype, pname); |
128 | eolian_parameter_const_attribute_get(data, ftype == EOLIAN_PROP_GET)?"const":"", | ||
129 | ptype, pname); | ||
130 | eina_stringshare_del(ptype); | 126 | eina_stringshare_del(ptype); |
131 | eina_strbuf_append_printf(descparam, " * @param[in] %s %s\n", pname, pdesc?pdesc:"No description supplied."); | 127 | eina_strbuf_append_printf(descparam, " * @param[in] %s %s\n", pname, pdesc?pdesc:"No description supplied."); |
132 | if (eolian_parameter_is_nonull((Eolian_Function_Parameter*)data)) | 128 | if (eolian_parameter_is_nonull((Eolian_Function_Parameter*)data)) |
@@ -159,8 +155,7 @@ _eapi_decl_func_generate(const Eolian_Class *class, const Eolian_Function *funci | |||
159 | if (ftype == EOLIAN_PROP_SET) pdir = EOLIAN_IN_PARAM; | 155 | if (ftype == EOLIAN_PROP_SET) pdir = EOLIAN_IN_PARAM; |
160 | leg_param_idx++; | 156 | leg_param_idx++; |
161 | if (eina_strbuf_length_get(fparam)) eina_strbuf_append(fparam, ", "); | 157 | if (eina_strbuf_length_get(fparam)) eina_strbuf_append(fparam, ", "); |
162 | eina_strbuf_append_printf(fparam, "%s%s%s%s%s", | 158 | eina_strbuf_append_printf(fparam, "%s%s%s%s", |
163 | eolian_parameter_const_attribute_get(data, ftype == EOLIAN_PROP_GET)?"const ":"", | ||
164 | ptype, had_star?"":" ", add_star?"*":"", pname); | 159 | ptype, had_star?"":" ", add_star?"*":"", pname); |
165 | eina_stringshare_del(ptype); | 160 | eina_stringshare_del(ptype); |
166 | const char *dir_str = str_dir[(int)pdir]; | 161 | const char *dir_str = str_dir[(int)pdir]; |
@@ -186,8 +181,7 @@ _eapi_decl_func_generate(const Eolian_Class *class, const Eolian_Function *funci | |||
186 | eina_strbuf_replace_all(fbody, "@#params", eina_strbuf_string_get(fparam)); | 181 | eina_strbuf_replace_all(fbody, "@#params", eina_strbuf_string_get(fparam)); |
187 | eina_strbuf_replace_all(fbody, "@#list_desc_param", eina_strbuf_string_get(descparam)); | 182 | eina_strbuf_replace_all(fbody, "@#list_desc_param", eina_strbuf_string_get(descparam)); |
188 | eina_strbuf_reset(fparam); | 183 | eina_strbuf_reset(fparam); |
189 | eina_strbuf_append_printf(fparam, "%s%s%s", | 184 | eina_strbuf_append_printf(fparam, "%s%s", |
190 | ret_const ? "const " : "", | ||
191 | rettype ? rettype : "void", | 185 | rettype ? rettype : "void", |
192 | rettype && strchr(rettype, '*')?"":" "); | 186 | rettype && strchr(rettype, '*')?"":" "); |
193 | eina_strbuf_replace_all(fbody, "@#type_return", eina_strbuf_string_get(fparam)); | 187 | eina_strbuf_replace_all(fbody, "@#type_return", eina_strbuf_string_get(fparam)); |
@@ -220,7 +214,6 @@ _eapi_func_generate(const Eolian_Class *class, const Eolian_Function *funcid, Eo | |||
220 | const Eolian_Type *rettypet = NULL; | 214 | const Eolian_Type *rettypet = NULL; |
221 | const char *rettype = NULL; | 215 | const char *rettype = NULL; |
222 | const char *retname = NULL; | 216 | const char *retname = NULL; |
223 | Eina_Bool ret_const = EINA_FALSE; | ||
224 | Eina_Bool add_star = EINA_FALSE; | 217 | Eina_Bool add_star = EINA_FALSE; |
225 | Eina_Bool ret_is_void = EINA_FALSE; | 218 | Eina_Bool ret_is_void = EINA_FALSE; |
226 | Eina_Bool is_prop = (ftype == EOLIAN_PROP_GET || ftype == EOLIAN_PROP_SET); | 219 | Eina_Bool is_prop = (ftype == EOLIAN_PROP_GET || ftype == EOLIAN_PROP_SET); |
@@ -250,7 +243,6 @@ _eapi_func_generate(const Eolian_Class *class, const Eolian_Function *funcid, Eo | |||
250 | rettypet = eolian_parameter_type_get(param); | 243 | rettypet = eolian_parameter_type_get(param); |
251 | retname = eolian_parameter_name_get(param); | 244 | retname = eolian_parameter_name_get(param); |
252 | var_as_ret = EINA_TRUE; | 245 | var_as_ret = EINA_TRUE; |
253 | ret_const = eolian_parameter_const_attribute_get(data, EINA_TRUE); | ||
254 | } | 246 | } |
255 | eina_iterator_free(itr); | 247 | eina_iterator_free(itr); |
256 | } | 248 | } |
@@ -294,9 +286,7 @@ _eapi_func_generate(const Eolian_Class *class, const Eolian_Function *funcid, Eo | |||
294 | const char *pname = eolian_parameter_name_get(param); | 286 | const char *pname = eolian_parameter_name_get(param); |
295 | const char *ptype = eolian_type_c_type_get(ptypet); | 287 | const char *ptype = eolian_type_c_type_get(ptypet); |
296 | if (eina_strbuf_length_get(fparam)) eina_strbuf_append(fparam, ", "); | 288 | if (eina_strbuf_length_get(fparam)) eina_strbuf_append(fparam, ", "); |
297 | eina_strbuf_append_printf(fparam, "%s%s %s", | 289 | eina_strbuf_append_printf(fparam, "%s %s", ptype, pname); |
298 | eolian_parameter_const_attribute_get(data, ftype == EOLIAN_PROP_GET)?"const ":"", | ||
299 | ptype, pname); | ||
300 | eina_stringshare_del(ptype); | 290 | eina_stringshare_del(ptype); |
301 | if (eina_strbuf_length_get(eoparam)) eina_strbuf_append(eoparam, ", "); | 291 | if (eina_strbuf_length_get(eoparam)) eina_strbuf_append(eoparam, ", "); |
302 | eina_strbuf_append_printf(eoparam, "%s", pname); | 292 | eina_strbuf_append_printf(eoparam, "%s", pname); |
@@ -315,8 +305,7 @@ _eapi_func_generate(const Eolian_Class *class, const Eolian_Function *funcid, Eo | |||
315 | Eina_Bool had_star = !!strchr(ptype, '*'); | 305 | Eina_Bool had_star = !!strchr(ptype, '*'); |
316 | if (ftype == EOLIAN_UNRESOLVED || ftype == EOLIAN_METHOD) add_star = (pdir == EOLIAN_OUT_PARAM || pdir == EOLIAN_INOUT_PARAM); | 306 | if (ftype == EOLIAN_UNRESOLVED || ftype == EOLIAN_METHOD) add_star = (pdir == EOLIAN_OUT_PARAM || pdir == EOLIAN_INOUT_PARAM); |
317 | if (eina_strbuf_length_get(fparam)) eina_strbuf_append(fparam, ", "); | 307 | if (eina_strbuf_length_get(fparam)) eina_strbuf_append(fparam, ", "); |
318 | eina_strbuf_append_printf(fparam, "%s%s%s%s%s", | 308 | eina_strbuf_append_printf(fparam, "%s%s%s%s", |
319 | eolian_parameter_const_attribute_get(data, ftype == EOLIAN_PROP_GET)?"const ":"", | ||
320 | ptype, had_star?"":" ", add_star?"*":"", pname); | 309 | ptype, had_star?"":" ", add_star?"*":"", pname); |
321 | eina_stringshare_del(ptype); | 310 | eina_stringshare_del(ptype); |
322 | if (eina_strbuf_length_get(eoparam)) eina_strbuf_append(eoparam, ", "); | 311 | if (eina_strbuf_length_get(eoparam)) eina_strbuf_append(eoparam, ", "); |
@@ -329,7 +318,7 @@ _eapi_func_generate(const Eolian_Class *class, const Eolian_Function *funcid, Eo | |||
329 | if (rettype && (!ret_is_void)) | 318 | if (rettype && (!ret_is_void)) |
330 | { | 319 | { |
331 | char tmp_ret_str[0xFF]; | 320 | char tmp_ret_str[0xFF]; |
332 | sprintf (tmp_ret_str, "%s%s", ret_const?"const ":"", rettype); | 321 | sprintf (tmp_ret_str, "%s", rettype); |
333 | const Eolian_Expression *default_ret_val = | 322 | const Eolian_Expression *default_ret_val = |
334 | eolian_function_return_default_value_get(funcid, ftype); | 323 | eolian_function_return_default_value_get(funcid, ftype); |
335 | const char *val_str = NULL; | 324 | const char *val_str = NULL; |
@@ -341,8 +330,8 @@ _eapi_func_generate(const Eolian_Class *class, const Eolian_Function *funcid, Eo | |||
341 | val_str = eolian_expression_value_to_literal(&val); | 330 | val_str = eolian_expression_value_to_literal(&val); |
342 | } | 331 | } |
343 | Eina_Bool had_star = !!strchr(rettype, '*'); | 332 | Eina_Bool had_star = !!strchr(rettype, '*'); |
344 | sprintf (tmpstr, " %s%s%s%s = %s;\n", | 333 | sprintf (tmpstr, " %s%s%s = %s;\n", |
345 | ret_const?"const ":"", rettype, had_star?"":" ", retname, | 334 | rettype, had_star?"":" ", retname, |
346 | val_str?val_str:"0"); | 335 | val_str?val_str:"0"); |
347 | 336 | ||
348 | eina_strbuf_replace_all(fbody, "@#ret_type", tmp_ret_str); | 337 | eina_strbuf_replace_all(fbody, "@#ret_type", tmp_ret_str); |
diff --git a/src/bindings/luajit/eolian.lua b/src/bindings/luajit/eolian.lua index 67ff24a54a..8775759546 100644 --- a/src/bindings/luajit/eolian.lua +++ b/src/bindings/luajit/eolian.lua | |||
@@ -221,7 +221,6 @@ ffi.cdef [[ | |||
221 | const Eolian_Expression *eolian_parameter_default_value_get(const Eolian_Function_Parameter *param); | 221 | const Eolian_Expression *eolian_parameter_default_value_get(const Eolian_Function_Parameter *param); |
222 | const char *eolian_parameter_name_get(const Eolian_Function_Parameter *param); | 222 | const char *eolian_parameter_name_get(const Eolian_Function_Parameter *param); |
223 | const char *eolian_parameter_description_get(const Eolian_Function_Parameter *param); | 223 | const char *eolian_parameter_description_get(const Eolian_Function_Parameter *param); |
224 | Eina_Bool eolian_parameter_const_attribute_get(const Eolian_Function_Parameter *param_desc, Eina_Bool is_get); | ||
225 | Eina_Bool eolian_parameter_is_nonull(const Eolian_Function_Parameter *param_desc); | 224 | Eina_Bool eolian_parameter_is_nonull(const Eolian_Function_Parameter *param_desc); |
226 | Eina_Bool eolian_parameter_is_nullable(const Eolian_Function_Parameter *param_desc); | 225 | Eina_Bool eolian_parameter_is_nullable(const Eolian_Function_Parameter *param_desc); |
227 | Eina_Bool eolian_parameter_is_optional(const Eolian_Function_Parameter *param_desc); | 226 | Eina_Bool eolian_parameter_is_optional(const Eolian_Function_Parameter *param_desc); |
@@ -750,10 +749,6 @@ ffi.metatype("Eolian_Function_Parameter", { | |||
750 | return ffi.string(v) | 749 | return ffi.string(v) |
751 | end, | 750 | end, |
752 | 751 | ||
753 | const_attribute_get = function(self, get) | ||
754 | return eolian.eolian_parameter_const_attribute_get(self, get) ~= 0 | ||
755 | end, | ||
756 | |||
757 | is_nonull = function(self) | 752 | is_nonull = function(self) |
758 | return eolian.eolian_parameter_is_nonull(self) ~= 0 | 753 | return eolian.eolian_parameter_is_nonull(self) ~= 0 |
759 | end, | 754 | end, |
diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h index 531be96727..bbe8415c17 100644 --- a/src/lib/eolian/Eolian.h +++ b/src/lib/eolian/Eolian.h | |||
@@ -995,20 +995,6 @@ EAPI Eina_Stringshare *eolian_parameter_name_get(const Eolian_Function_Parameter | |||
995 | EAPI Eina_Stringshare *eolian_parameter_description_get(const Eolian_Function_Parameter *param); | 995 | EAPI Eina_Stringshare *eolian_parameter_description_get(const Eolian_Function_Parameter *param); |
996 | 996 | ||
997 | /* | 997 | /* |
998 | * @brief Indicates if a parameter has a const attribute. | ||
999 | * | ||
1000 | * This function is relevant for properties, to know if a parameter is a const | ||
1001 | * parameter in the get operation. | ||
1002 | * | ||
1003 | * @param[in] param_desc parameter handle | ||
1004 | * @param[in] is_get indicates if the information needed is for get or set. | ||
1005 | * @return EINA_TRUE if const in get, EINA_FALSE otherwise | ||
1006 | * | ||
1007 | * @ingroup Eolian | ||
1008 | */ | ||
1009 | EAPI Eina_Bool eolian_parameter_const_attribute_get(const Eolian_Function_Parameter *param_desc, Eina_Bool is_get); | ||
1010 | |||
1011 | /* | ||
1012 | * @brief Indicates if a parameter cannot be NULL. | 998 | * @brief Indicates if a parameter cannot be NULL. |
1013 | * | 999 | * |
1014 | * @param[in] param_desc parameter handle | 1000 | * @param[in] param_desc parameter handle |
diff --git a/src/lib/eolian/database_function_parameter_api.c b/src/lib/eolian/database_function_parameter_api.c index 6d7ad81d0c..9a566f826d 100644 --- a/src/lib/eolian/database_function_parameter_api.c +++ b/src/lib/eolian/database_function_parameter_api.c | |||
@@ -41,16 +41,6 @@ eolian_parameter_description_get(const Eolian_Function_Parameter *param) | |||
41 | } | 41 | } |
42 | 42 | ||
43 | EAPI Eina_Bool | 43 | EAPI Eina_Bool |
44 | eolian_parameter_const_attribute_get(const Eolian_Function_Parameter *param, Eina_Bool is_get) | ||
45 | { | ||
46 | EINA_SAFETY_ON_NULL_RETURN_VAL(param, EINA_FALSE); | ||
47 | if (is_get) | ||
48 | return param->is_const_on_get; | ||
49 | else | ||
50 | return param->is_const_on_set; | ||
51 | } | ||
52 | |||
53 | EAPI Eina_Bool | ||
54 | eolian_parameter_is_nonull(const Eolian_Function_Parameter *param) | 44 | eolian_parameter_is_nonull(const Eolian_Function_Parameter *param) |
55 | { | 45 | { |
56 | EINA_SAFETY_ON_NULL_RETURN_VAL(param, EINA_FALSE); | 46 | EINA_SAFETY_ON_NULL_RETURN_VAL(param, EINA_FALSE); |
diff --git a/src/lib/eolian/eo_lexer.h b/src/lib/eolian/eo_lexer.h index 5f9c571448..60c13a651f 100644 --- a/src/lib/eolian/eo_lexer.h +++ b/src/lib/eolian/eo_lexer.h | |||
@@ -29,11 +29,10 @@ enum Tokens | |||
29 | KW(get), KW(implements), KW(import), KW(interface), KW(keys), KW(legacy), \ | 29 | KW(get), KW(implements), KW(import), KW(interface), KW(keys), KW(legacy), \ |
30 | KW(legacy_prefix), KW(methods), KW(mixin), KW(own), KW(params), \ | 30 | KW(legacy_prefix), KW(methods), KW(mixin), KW(own), KW(params), \ |
31 | KW(set), KW(type), KW(values), KW(var), KWAT(auto), KWAT(beta), \ | 31 | KW(set), KW(type), KW(values), KW(var), KWAT(auto), KWAT(beta), \ |
32 | KWAT(c_only), KWAT(class), KWAT(const), KWAT(const_get), \ | 32 | KWAT(c_only), KWAT(class), KWAT(const), KWAT(empty), KWAT(extern), \ |
33 | KWAT(const_set), KWAT(empty), KWAT(extern), KWAT(free), KWAT(in), \ | 33 | KWAT(free), KWAT(in), KWAT(inout), KWAT(nonull), KWAT(nullable), \ |
34 | KWAT(inout), KWAT(nonull), KWAT(nullable), KWAT(optional), KWAT(out), \ | 34 | KWAT(optional), KWAT(out), KWAT(private), KWAT(property), \ |
35 | KWAT(private), KWAT(property), KWAT(protected), KWAT(virtual), \ | 35 | KWAT(protected), KWAT(virtual), KWAT(warn_unused), \ |
36 | KWAT(warn_unused), \ | ||
37 | \ | 36 | \ |
38 | KW(byte), KW(ubyte), KW(char), KW(short), KW(ushort), KW(int), KW(uint), \ | 37 | KW(byte), KW(ubyte), KW(char), KW(short), KW(ushort), KW(int), KW(uint), \ |
39 | KW(long), KW(ulong), KW(llong), KW(ullong), \ | 38 | KW(long), KW(ulong), KW(llong), KW(ullong), \ |
diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c index 435079b24b..0941c87ac7 100644 --- a/src/lib/eolian/eo_parser.c +++ b/src/lib/eolian/eo_parser.c | |||
@@ -1024,20 +1024,6 @@ parse_param(Eo_Lexer *ls, Eina_List **params, Eina_Bool allow_inout, | |||
1024 | pop_expr(ls); | 1024 | pop_expr(ls); |
1025 | check_match(ls, ')', '(', line, col); | 1025 | check_match(ls, ')', '(', line, col); |
1026 | } | 1026 | } |
1027 | /* XXX: remove this fugly bit - temporary */ | ||
1028 | if (is_vals) | ||
1029 | { | ||
1030 | if (ls->t.kw == KW_at_const_get) | ||
1031 | { | ||
1032 | par->is_const_on_get = EINA_TRUE; | ||
1033 | eo_lexer_get(ls); | ||
1034 | } | ||
1035 | else if (ls->t.kw == KW_at_const_set) | ||
1036 | { | ||
1037 | par->is_const_on_set = EINA_TRUE; | ||
1038 | eo_lexer_get(ls); | ||
1039 | } | ||
1040 | } | ||
1041 | for (;;) switch (ls->t.kw) | 1027 | for (;;) switch (ls->t.kw) |
1042 | { | 1028 | { |
1043 | case KW_at_nonull: | 1029 | case KW_at_nonull: |
diff --git a/src/lib/eolian/eolian_database.h b/src/lib/eolian/eolian_database.h index 0fccf5d4a4..8cd8cec282 100644 --- a/src/lib/eolian/eolian_database.h +++ b/src/lib/eolian/eolian_database.h | |||
@@ -163,8 +163,6 @@ struct _Eolian_Function_Parameter | |||
163 | Eolian_Expression *value; | 163 | Eolian_Expression *value; |
164 | Eina_Stringshare *description; | 164 | Eina_Stringshare *description; |
165 | Eolian_Parameter_Dir param_dir; | 165 | Eolian_Parameter_Dir param_dir; |
166 | Eina_Bool is_const_on_get :1; /* True if const in this the get property */ | ||
167 | Eina_Bool is_const_on_set :1; /* True if const in this the set property */ | ||
168 | Eina_Bool nonull :1; /* True if this argument cannot be NULL - deprecated */ | 166 | Eina_Bool nonull :1; /* True if this argument cannot be NULL - deprecated */ |
169 | Eina_Bool nullable :1; /* True if this argument is nullable */ | 167 | Eina_Bool nullable :1; /* True if this argument is nullable */ |
170 | Eina_Bool optional :1; /* True if this argument is optional */ | 168 | Eina_Bool optional :1; /* True if this argument is optional */ |