diff options
author | Daniel Zaoui <daniel.zaoui@samsung.com> | 2014-03-30 16:22:14 +0300 |
---|---|---|
committer | Daniel Zaoui <daniel.zaoui@samsung.com> | 2014-04-10 04:20:02 +0300 |
commit | bbba6a20b4e321165f9efb6878ac3247869d4ebe (patch) | |
tree | 1bafe02e759f554c8e6e743dc4d4c65f76637b29 /src/bin/eolian/eo1_generator.c | |
parent | eeb53222d0f97be6d914cde53f4195b258955793 (diff) |
Eolian: generation of Eo2.
The generation of Eo2 can be enabled by defining EO flag in
common_funcs.h.
Diffstat (limited to 'src/bin/eolian/eo1_generator.c')
-rw-r--r-- | src/bin/eolian/eo1_generator.c | 369 |
1 files changed, 299 insertions, 70 deletions
diff --git a/src/bin/eolian/eo1_generator.c b/src/bin/eolian/eo1_generator.c index 0a9aeb9c97..a4d95685e5 100644 --- a/src/bin/eolian/eo1_generator.c +++ b/src/bin/eolian/eo1_generator.c | |||
@@ -34,6 +34,12 @@ static const Eo_Op_Description _@#class_op_desc[] = {@#list_op\n\ | |||
34 | };\n\n"; | 34 | };\n\n"; |
35 | 35 | ||
36 | static const char | 36 | static const char |
37 | tmpl_eo_ops_desc[] = "\ | ||
38 | static Eo_Op_Description _@#class_op_desc[] = {@#list_op\n\ | ||
39 | EO_OP_SENTINEL\n\ | ||
40 | };\n\n"; | ||
41 | |||
42 | static const char | ||
37 | tmpl_events_desc[] = "\ | 43 | tmpl_events_desc[] = "\ |
38 | static const Eo_Event_Description *_@#class_event_desc[] = {@#list_evdesc\n\ | 44 | static const Eo_Event_Description *_@#class_event_desc[] = {@#list_evdesc\n\ |
39 | NULL\n\ | 45 | NULL\n\ |
@@ -48,13 +54,13 @@ tmpl_eo_src[] = "\ | |||
48 | @#ops_desc\ | 54 | @#ops_desc\ |
49 | @#events_desc\ | 55 | @#events_desc\ |
50 | static const Eo_Class_Description _@#class_class_desc = {\n\ | 56 | static const Eo_Class_Description _@#class_class_desc = {\n\ |
51 | EO_VERSION,\n\ | 57 | @#EO_VERSION,\n\ |
52 | \"@#Class\",\n\ | 58 | \"@#Class\",\n\ |
53 | @#type_class,\n\ | 59 | @#type_class,\n\ |
54 | @#eo_class_desc_ops,\n\ | 60 | @#eo_class_desc_ops,\n\ |
55 | @#Events_Desc,\n\ | 61 | @#Events_Desc,\n\ |
56 | @#SizeOfData,\n\ | 62 | @#SizeOfData,\n\ |
57 | _gen_@#class_class_constructor,\n\ | 63 | @#ctor_name,\n\ |
58 | @#dtor_name\n\ | 64 | @#dtor_name\n\ |
59 | };\n\ | 65 | };\n\ |
60 | \n\ | 66 | \n\ |
@@ -62,13 +68,19 @@ EO_DEFINE_CLASS(@#eoprefix_class_get, &_@#class_class_desc, @#list_inheritNULL); | |||
62 | "; | 68 | "; |
63 | 69 | ||
64 | static const char | 70 | static const char |
65 | tmpl_eo_op_desc[] = "\n EO_OP_DESCRIPTION(@#EOPREFIX_SUB_ID_@#FUNC, \"@#desc\"),"; | 71 | tmpl_eo1_op_desc[] = "\n EO_OP_DESCRIPTION(@#EOPREFIX_SUB_ID_@#FUNC, \"@#desc\"),"; |
72 | |||
73 | static const char | ||
74 | tmpl_eo1_func_desc[] = "\n EO_OP_FUNC(@#EOPREFIX_ID(@#EOPREFIX_SUB_ID_@#FUNC), _eo_obj_@#class_@#func),"; | ||
75 | |||
76 | static const char | ||
77 | tmpl_eo_func_desc[] = "\n EO_OP_FUNC_OVERRIDE(@#eoprefix_@#func, _@#class_@#func),"; | ||
66 | 78 | ||
67 | static const char | 79 | static const char |
68 | tmpl_eo_func_desc[] = "\n EO_OP_FUNC(@#EOPREFIX_ID(@#EOPREFIX_SUB_ID_@#FUNC), _eo_obj_@#class_@#func),"; | 80 | tmpl_eo1base_func_desc[] = "\n EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_@#FUNC), _eo_obj_@#class_@#func),"; |
69 | 81 | ||
70 | static const char | 82 | static const char |
71 | tmpl_eobase_func_desc[] = "\n EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_@#FUNC), _eo_obj_@#class_@#func),"; | 83 | tmpl_eo_op_desc[] = "\n EO_OP_FUNC(@#eoprefix_@#func, _@#class_@#func, \"@#desc\"),"; |
72 | 84 | ||
73 | static const char | 85 | static const char |
74 | tmpl_eo_obj_header[] = "\ | 86 | tmpl_eo_obj_header[] = "\ |
@@ -101,30 +113,40 @@ static const char | |||
101 | tmpl_eo_subid_apnd[] = " @#EOPREFIX_SUB_ID_@#FUNC,\n"; | 113 | tmpl_eo_subid_apnd[] = " @#EOPREFIX_SUB_ID_@#FUNC,\n"; |
102 | 114 | ||
103 | static const char | 115 | static const char |
104 | tmpl_eo_funcdef[] = "\n\ | 116 | tmpl_eo_funcdef_doxygen[] = "\n\ |
105 | /**\n\ | 117 | /**\n\ |
106 | * @def @#eoprefix_@#func\n\ | 118 | * @def @#eoprefix_@#func\n\ |
107 | *\n\ | 119 | *\n\ |
108 | @#desc\n\ | 120 | @#desc\n\ |
109 | *\n\ | 121 | *\n\ |
110 | @#list_desc_param\ | 122 | @#list_desc_param\ |
123 | @#ret_desc\ | ||
111 | *\n\ | 124 | *\n\ |
112 | */\n\ | 125 | */\n"; |
113 | #define @#eoprefix_@#func(@#list_param) @#EOPREFIX_ID(@#EOPREFIX_SUB_ID_@#FUNC)@#list_typecheck\n\ | 126 | |
114 | "; | 127 | static const char |
128 | tmpl_eo1_funcdef[] = "#define @#eoprefix_@#func(@#list_param) @#EOPREFIX_ID(@#EOPREFIX_SUB_ID_@#FUNC)@#list_typecheck\n"; | ||
129 | |||
130 | static const char | ||
131 | tmpl_eo_funcdef[] = "EAPI @#rettype @#eoprefix_@#func(@#full_params);\n"; | ||
115 | 132 | ||
116 | static const char | 133 | static const char |
117 | tmpl_eo_pardesc[] =" * @param[%s] %s %s\n"; | 134 | tmpl_eo_pardesc[] =" * @param[%s] %s %s\n"; |
118 | 135 | ||
136 | #if 0 | ||
119 | static const char | 137 | static const char |
120 | tmpl_eobind_body[] ="\ | 138 | tmpl_eo_retdesc[] =" * @return %s\n"; |
139 | #endif | ||
140 | |||
141 | static const char | ||
142 | tmpl_eo1bind_body[] ="\ | ||
121 | \n\ | 143 | \n\ |
122 | @#ret_type _@#class_@#func(Eo *obj, @#Datatype_Data *pd@#full_params);\n\n\ | 144 | @#ret_type _@#class_@#func(Eo *obj, @#Datatype_Data *pd@#full_params);\n\n\ |
123 | static void\n\ | 145 | static void\n\ |
124 | _eo_obj_@#class_@#func(Eo *obj, void *_pd, va_list *list@#list_unused)\n\ | 146 | _eo_obj_@#class_@#func(Eo *obj, void *_pd, va_list *list@#list_unused)\n\ |
125 | {\n\ | 147 | {\n\ |
126 | @#list_vars\ | 148 | @#list_vars\ |
127 | @#ret_param_@#class_@#func(obj, _pd@#list_params);\n\ | 149 | @#ret_param_@#class_@#func(obj, _pd, @#list_params);\n\ |
128 | @#return_ret\ | 150 | @#return_ret\ |
129 | }\n\ | 151 | }\n\ |
130 | "; | 152 | "; |
@@ -138,9 +160,28 @@ eo1_fundef_generate(const char *classname, Eolian_Function func, Eolian_Function | |||
138 | char funcname[0xFF]; | 160 | char funcname[0xFF]; |
139 | char descname[0xFF]; | 161 | char descname[0xFF]; |
140 | char *tmpstr = malloc(0x1FF); | 162 | char *tmpstr = malloc(0x1FF); |
163 | Eina_Bool var_as_ret = EINA_FALSE; | ||
164 | const char *rettype = NULL; | ||
165 | Eina_Bool ret_const = EINA_FALSE; | ||
141 | 166 | ||
142 | char *fsuffix = ""; | 167 | char *fsuffix = ""; |
143 | if (ftype == EOLIAN_PROP_GET) fsuffix = "_get"; | 168 | rettype = eolian_function_return_type_get(func, ftype); |
169 | if (rettype && !strcmp(rettype, "void")) rettype = NULL; | ||
170 | if (ftype == EOLIAN_PROP_GET) | ||
171 | { | ||
172 | fsuffix = "_get"; | ||
173 | if (!rettype) | ||
174 | { | ||
175 | l = eolian_parameters_list_get(func); | ||
176 | if (eina_list_count(l) == 1) | ||
177 | { | ||
178 | data = eina_list_data_get(l); | ||
179 | eolian_parameter_information_get((Eolian_Function_Parameter)data, NULL, &rettype, NULL, NULL); | ||
180 | var_as_ret = EINA_TRUE; | ||
181 | ret_const = eolian_parameter_const_attribute_get(data, EINA_TRUE); | ||
182 | } | ||
183 | } | ||
184 | } | ||
144 | if (ftype == EOLIAN_PROP_SET) fsuffix = "_set"; | 185 | if (ftype == EOLIAN_PROP_SET) fsuffix = "_set"; |
145 | 186 | ||
146 | sprintf (funcname, "%s%s", eolian_function_name_get(func), fsuffix); | 187 | sprintf (funcname, "%s%s", eolian_function_name_get(func), fsuffix); |
@@ -148,7 +189,12 @@ eo1_fundef_generate(const char *classname, Eolian_Function func, Eolian_Function | |||
148 | const char *funcdesc = eolian_function_description_get(func, descname); | 189 | const char *funcdesc = eolian_function_description_get(func, descname); |
149 | 190 | ||
150 | Eina_Strbuf *str_func = eina_strbuf_new(); | 191 | Eina_Strbuf *str_func = eina_strbuf_new(); |
151 | _template_fill(str_func, tmpl_eo_funcdef, classname, funcname, EINA_TRUE); | 192 | _template_fill(str_func, tmpl_eo_funcdef_doxygen, classname, funcname, EINA_TRUE); |
193 | #ifndef EO | ||
194 | _template_fill(str_func, tmpl_eo1_funcdef, classname, funcname, EINA_FALSE); | ||
195 | #else | ||
196 | _template_fill(str_func, tmpl_eo_funcdef, classname, funcname, EINA_FALSE); | ||
197 | #endif | ||
152 | 198 | ||
153 | eina_strbuf_replace_all(str_func, "@#EOPREFIX", current_eo_prefix_upper); | 199 | eina_strbuf_replace_all(str_func, "@#EOPREFIX", current_eo_prefix_upper); |
154 | eina_strbuf_replace_all(str_func, "@#eoprefix", current_eo_prefix_lower); | 200 | eina_strbuf_replace_all(str_func, "@#eoprefix", current_eo_prefix_lower); |
@@ -171,6 +217,7 @@ eo1_fundef_generate(const char *classname, Eolian_Function func, Eolian_Function | |||
171 | 217 | ||
172 | Eina_Strbuf *str_par = eina_strbuf_new(); | 218 | Eina_Strbuf *str_par = eina_strbuf_new(); |
173 | Eina_Strbuf *str_pardesc = eina_strbuf_new(); | 219 | Eina_Strbuf *str_pardesc = eina_strbuf_new(); |
220 | Eina_Strbuf *str_retdesc = eina_strbuf_new(); | ||
174 | Eina_Strbuf *str_typecheck = eina_strbuf_new(); | 221 | Eina_Strbuf *str_typecheck = eina_strbuf_new(); |
175 | 222 | ||
176 | EINA_LIST_FOREACH(eolian_property_keys_list_get(func), l, data) | 223 | EINA_LIST_FOREACH(eolian_property_keys_list_get(func), l, data) |
@@ -183,57 +230,88 @@ eo1_fundef_generate(const char *classname, Eolian_Function func, Eolian_Function | |||
183 | eina_strbuf_append_printf(str_pardesc, tmpl_eo_pardesc, "in", pname, pdesc?pdesc:"No description supplied."); | 230 | eina_strbuf_append_printf(str_pardesc, tmpl_eo_pardesc, "in", pname, pdesc?pdesc:"No description supplied."); |
184 | 231 | ||
185 | if (eina_strbuf_length_get(str_par)) eina_strbuf_append(str_par, ", "); | 232 | if (eina_strbuf_length_get(str_par)) eina_strbuf_append(str_par, ", "); |
233 | #ifdef EO | ||
234 | eina_strbuf_append_printf(str_par, "%s %s", ptype, pname); | ||
235 | #else | ||
186 | eina_strbuf_append(str_par, pname); | 236 | eina_strbuf_append(str_par, pname); |
187 | 237 | ||
188 | eina_strbuf_append_printf(str_typecheck, ", EO_TYPECHECK(%s, %s)", ptype, pname); | 238 | eina_strbuf_append_printf(str_typecheck, ", EO_TYPECHECK(%s, %s)", ptype, pname); |
239 | #endif | ||
189 | } | 240 | } |
190 | 241 | ||
191 | EINA_LIST_FOREACH(eolian_parameters_list_get(func), l, data) | 242 | if (!var_as_ret) |
192 | { | 243 | { |
193 | const char *pname; | 244 | EINA_LIST_FOREACH(eolian_parameters_list_get(func), l, data) |
194 | const char *ptype; | 245 | { |
195 | const char *pdesc; | 246 | const char *pname; |
196 | Eina_Bool add_star = EINA_FALSE; | 247 | const char *ptype; |
197 | Eolian_Parameter_Dir pdir; | 248 | const char *pdesc; |
198 | eolian_parameter_information_get((Eolian_Function_Parameter)data, &pdir, &ptype, &pname, &pdesc); | 249 | Eina_Bool add_star = EINA_FALSE; |
199 | Eina_Bool is_const = eolian_parameter_const_attribute_get(data, ftype == EOLIAN_PROP_GET); | 250 | Eolian_Parameter_Dir pdir; |
200 | if (ftype == EOLIAN_PROP_GET) { | 251 | eolian_parameter_information_get((Eolian_Function_Parameter)data, &pdir, &ptype, &pname, &pdesc); |
201 | add_star = EINA_TRUE; | 252 | Eina_Bool is_const = eolian_parameter_const_attribute_get(data, ftype == EOLIAN_PROP_GET); |
202 | pdir = EOLIAN_OUT_PARAM; | 253 | if (ftype == EOLIAN_PROP_GET) { |
203 | } | 254 | add_star = EINA_TRUE; |
204 | if (ftype == EOLIAN_PROP_SET) pdir = EOLIAN_IN_PARAM; | 255 | pdir = EOLIAN_OUT_PARAM; |
205 | if (ftype == EOLIAN_UNRESOLVED || ftype == EOLIAN_METHOD) add_star = (pdir == EOLIAN_OUT_PARAM); | 256 | } |
206 | Eina_Bool had_star = !!strchr(ptype, '*'); | 257 | if (ftype == EOLIAN_PROP_SET) pdir = EOLIAN_IN_PARAM; |
258 | if (ftype == EOLIAN_UNRESOLVED || ftype == EOLIAN_METHOD) add_star = (pdir == EOLIAN_OUT_PARAM); | ||
259 | Eina_Bool had_star = !!strchr(ptype, '*'); | ||
207 | 260 | ||
208 | const char *dir_str = str_dir[(int)pdir]; | 261 | const char *dir_str = str_dir[(int)pdir]; |
209 | 262 | ||
210 | eina_strbuf_append_printf(str_pardesc, tmpl_eo_pardesc, dir_str, pname, pdesc?pdesc:"No description supplied."); | 263 | eina_strbuf_append_printf(str_pardesc, tmpl_eo_pardesc, dir_str, pname, pdesc?pdesc:"No description supplied."); |
211 | 264 | ||
212 | if (eina_strbuf_length_get(str_par)) eina_strbuf_append(str_par, ", "); | 265 | if (eina_strbuf_length_get(str_par)) eina_strbuf_append(str_par, ", "); |
213 | eina_strbuf_append(str_par, pname); | 266 | #ifdef EO |
267 | eina_strbuf_append_printf(str_par, "%s%s%s%s%s", | ||
268 | is_const?"const ":"", | ||
269 | ptype, had_star?"":" ", add_star?"*":"", pname); | ||
270 | #else | ||
271 | eina_strbuf_append(str_par, pname); | ||
214 | 272 | ||
215 | eina_strbuf_append_printf(str_typecheck, ", EO_TYPECHECK(%s%s%s%s, %s)", | 273 | eina_strbuf_append_printf(str_typecheck, ", EO_TYPECHECK(%s%s%s%s, %s)", |
216 | is_const?"const ":"", | 274 | is_const?"const ":"", |
217 | ptype, had_star?"":" ", add_star?"*":"", pname); | 275 | ptype, had_star?"":" ", add_star?"*":"", pname); |
276 | #endif | ||
277 | |||
278 | } | ||
218 | } | 279 | } |
219 | 280 | ||
220 | const char* rettype = eolian_function_return_type_get(func, ftype); | ||
221 | if (rettype && strcmp(rettype, "void")) | 281 | if (rettype && strcmp(rettype, "void")) |
222 | { | 282 | { |
283 | #ifndef EO | ||
223 | const char *ret_desc = eolian_function_return_comment_get(func, ftype); | 284 | const char *ret_desc = eolian_function_return_comment_get(func, ftype); |
224 | eina_strbuf_append_printf(str_pardesc, tmpl_eo_pardesc, "out", "ret", ret_desc); | 285 | eina_strbuf_append_printf(str_pardesc, tmpl_eo_pardesc, "out", "ret", ret_desc); |
225 | if (eina_strbuf_length_get(str_par)) eina_strbuf_append(str_par, ", "); | 286 | if (eina_strbuf_length_get(str_par)) eina_strbuf_append(str_par, ", "); |
226 | eina_strbuf_append(str_par, "ret"); | 287 | eina_strbuf_append(str_par, "ret"); |
227 | Eina_Bool had_star = !!strchr(rettype, '*'); | 288 | Eina_Bool had_star = !!strchr(rettype, '*'); |
228 | eina_strbuf_append_printf(str_typecheck, ", EO_TYPECHECK(%s%s*, ret)", rettype, had_star?"":" "); | 289 | eina_strbuf_append_printf(str_typecheck, ", EO_TYPECHECK(%s%s%s*, ret)", |
290 | ret_const ? "const " : "", rettype, had_star?"":" "); | ||
291 | |||
292 | #else | ||
293 | /* eina_strbuf_append_printf(str_retdesc, tmpl_eo_retdesc, ret_desc); */ | ||
294 | #endif | ||
229 | } | 295 | } |
296 | #ifdef EO | ||
297 | tmpstr[0] = '\0'; | ||
298 | sprintf(tmpstr, "%s%s%s", | ||
299 | ret_const ? "const " : "", | ||
300 | rettype ? rettype : "void", | ||
301 | rettype && strchr(rettype, '*')?"":" "); | ||
302 | eina_strbuf_replace_all(str_func, "@#rettype", tmpstr); | ||
303 | #endif | ||
230 | 304 | ||
231 | eina_strbuf_replace_all(str_func, "@#list_param", eina_strbuf_string_get(str_par)); | 305 | eina_strbuf_replace_all(str_func, "@#list_param", eina_strbuf_string_get(str_par)); |
306 | if (!eina_strbuf_length_get(str_par)) eina_strbuf_append(str_par, "void"); | ||
307 | eina_strbuf_replace_all(str_func, "@#full_params", eina_strbuf_string_get(str_par)); | ||
232 | eina_strbuf_replace_all(str_func, "@#list_desc_param", eina_strbuf_string_get(str_pardesc)); | 308 | eina_strbuf_replace_all(str_func, "@#list_desc_param", eina_strbuf_string_get(str_pardesc)); |
309 | eina_strbuf_replace_all(str_func, "@#ret_desc", eina_strbuf_string_get(str_retdesc)); | ||
233 | eina_strbuf_replace_all(str_func, "@#list_typecheck", eina_strbuf_string_get(str_typecheck)); | 310 | eina_strbuf_replace_all(str_func, "@#list_typecheck", eina_strbuf_string_get(str_typecheck)); |
234 | 311 | ||
235 | free(tmpstr); | 312 | free(tmpstr); |
236 | eina_strbuf_free(str_par); | 313 | eina_strbuf_free(str_par); |
314 | eina_strbuf_free(str_retdesc); | ||
237 | eina_strbuf_free(str_pardesc); | 315 | eina_strbuf_free(str_pardesc); |
238 | eina_strbuf_free(str_typecheck); | 316 | eina_strbuf_free(str_typecheck); |
239 | 317 | ||
@@ -250,7 +328,7 @@ eo1_header_generate(const char *classname, Eina_Strbuf *buf) | |||
250 | const Eina_List *l; | 328 | const Eina_List *l; |
251 | void *data; | 329 | void *data; |
252 | char *tmpstr = malloc(0x1FF); | 330 | char *tmpstr = malloc(0x1FF); |
253 | Eina_Bool no_ids = EINA_TRUE; | 331 | Eina_Strbuf * str_hdr = eina_strbuf_new(); |
254 | 332 | ||
255 | if (!eolian_class_exists(classname)) | 333 | if (!eolian_class_exists(classname)) |
256 | { | 334 | { |
@@ -259,19 +337,19 @@ eo1_header_generate(const char *classname, Eina_Strbuf *buf) | |||
259 | return EINA_FALSE; | 337 | return EINA_FALSE; |
260 | } | 338 | } |
261 | 339 | ||
340 | #ifndef EO | ||
262 | if (eolian_class_functions_list_get(classname, EOLIAN_CTOR) || | 341 | if (eolian_class_functions_list_get(classname, EOLIAN_CTOR) || |
263 | eolian_class_functions_list_get(classname, EOLIAN_DTOR) || | 342 | eolian_class_functions_list_get(classname, EOLIAN_DTOR) || |
264 | eolian_class_functions_list_get(classname, EOLIAN_PROPERTY) || | 343 | eolian_class_functions_list_get(classname, EOLIAN_PROPERTY) || |
265 | eolian_class_functions_list_get(classname, EOLIAN_METHOD)) | 344 | eolian_class_functions_list_get(classname, EOLIAN_METHOD)) |
266 | { | 345 | { |
267 | no_ids = EINA_FALSE; | 346 | _template_fill(str_hdr, tmpl_eo_obj_header, classname, "", EINA_TRUE); |
268 | } | 347 | } |
269 | |||
270 | Eina_Strbuf * str_hdr = eina_strbuf_new(); | ||
271 | if (no_ids) | ||
272 | _template_fill(str_hdr, tmpl_eo_obj_header_no_ids, classname, "", EINA_TRUE); | ||
273 | else | 348 | else |
274 | _template_fill(str_hdr, tmpl_eo_obj_header, classname, "", EINA_TRUE); | 349 | #endif |
350 | { | ||
351 | _template_fill(str_hdr, tmpl_eo_obj_header_no_ids, classname, "", EINA_TRUE); | ||
352 | } | ||
275 | 353 | ||
276 | eina_strbuf_replace_all(str_hdr, "@#EOPREFIX", current_eo_prefix_upper); | 354 | eina_strbuf_replace_all(str_hdr, "@#EOPREFIX", current_eo_prefix_upper); |
277 | eina_strbuf_replace_all(str_hdr, "@#eoprefix", current_eo_prefix_lower); | 355 | eina_strbuf_replace_all(str_hdr, "@#eoprefix", current_eo_prefix_lower); |
@@ -347,6 +425,7 @@ eo1_header_generate(const char *classname, Eina_Strbuf *buf) | |||
347 | return EINA_TRUE; | 425 | return EINA_TRUE; |
348 | } | 426 | } |
349 | 427 | ||
428 | #ifndef EO | ||
350 | static const char* | 429 | static const char* |
351 | _varg_upgr(const char *stype) | 430 | _varg_upgr(const char *stype) |
352 | { | 431 | { |
@@ -358,6 +437,7 @@ _varg_upgr(const char *stype) | |||
358 | 437 | ||
359 | return stype; | 438 | return stype; |
360 | } | 439 | } |
440 | #endif | ||
361 | 441 | ||
362 | static Eina_Bool | 442 | static Eina_Bool |
363 | eo1_bind_func_generate(const char *classname, Eolian_Function funcid, Eolian_Function_Type ftype, Eina_Strbuf *buf, const char *impl_name) | 443 | eo1_bind_func_generate(const char *classname, Eolian_Function funcid, Eolian_Function_Type ftype, Eina_Strbuf *buf, const char *impl_name) |
@@ -369,7 +449,13 @@ eo1_bind_func_generate(const char *classname, Eolian_Function funcid, Eolian_Fun | |||
369 | Eina_Bool ret_const = EINA_FALSE; | 449 | Eina_Bool ret_const = EINA_FALSE; |
370 | Eina_Bool add_star = EINA_FALSE; | 450 | Eina_Bool add_star = EINA_FALSE; |
371 | 451 | ||
452 | Eina_Bool need_implementation = EINA_TRUE; | ||
453 | #ifndef EO | ||
372 | if (!impl_name && eolian_function_is_virtual_pure(funcid, ftype)) return EINA_TRUE; | 454 | if (!impl_name && eolian_function_is_virtual_pure(funcid, ftype)) return EINA_TRUE; |
455 | #else | ||
456 | if (!impl_name && eolian_function_is_virtual_pure(funcid, ftype)) need_implementation = EINA_FALSE; | ||
457 | #endif | ||
458 | |||
373 | Eina_Strbuf *fbody = eina_strbuf_new(); | 459 | Eina_Strbuf *fbody = eina_strbuf_new(); |
374 | Eina_Strbuf *va_args = eina_strbuf_new(); | 460 | Eina_Strbuf *va_args = eina_strbuf_new(); |
375 | Eina_Strbuf *params = eina_strbuf_new(); /* only variables names */ | 461 | Eina_Strbuf *params = eina_strbuf_new(); /* only variables names */ |
@@ -403,7 +489,11 @@ eo1_bind_func_generate(const char *classname, Eolian_Function funcid, Eolian_Fun | |||
403 | sprintf (tmpstr, "%s%s", eolian_function_name_get(funcid), suffix); | 489 | sprintf (tmpstr, "%s%s", eolian_function_name_get(funcid), suffix); |
404 | char tmpstr2[0xFF]; | 490 | char tmpstr2[0xFF]; |
405 | sprintf (tmpstr2, "%s_%s", classname, impl_name); | 491 | sprintf (tmpstr2, "%s_%s", classname, impl_name); |
406 | _template_fill(fbody, tmpl_eobind_body, impl_name?tmpstr2:classname, tmpstr, EINA_FALSE); | 492 | #ifndef EO |
493 | _template_fill(fbody, tmpl_eo1bind_body, impl_name?tmpstr2:classname, tmpstr, EINA_FALSE); | ||
494 | #else | ||
495 | _class_func_names_fill(impl_name?tmpstr2:classname, tmpstr); | ||
496 | #endif | ||
407 | 497 | ||
408 | const Eina_List *l; | 498 | const Eina_List *l; |
409 | void *data; | 499 | void *data; |
@@ -414,12 +504,14 @@ eo1_bind_func_generate(const char *classname, Eolian_Function funcid, Eolian_Fun | |||
414 | const char *ptype; | 504 | const char *ptype; |
415 | eolian_parameter_information_get((Eolian_Function_Parameter)data, NULL, &ptype, &pname, NULL); | 505 | eolian_parameter_information_get((Eolian_Function_Parameter)data, NULL, &ptype, &pname, NULL); |
416 | Eina_Bool is_const = eolian_parameter_const_attribute_get(data, ftype == EOLIAN_PROP_GET); | 506 | Eina_Bool is_const = eolian_parameter_const_attribute_get(data, ftype == EOLIAN_PROP_GET); |
507 | #ifndef EO | ||
417 | eina_strbuf_append_printf(va_args, " %s%s %s = va_arg(*list, %s%s);\n", | 508 | eina_strbuf_append_printf(va_args, " %s%s %s = va_arg(*list, %s%s);\n", |
418 | ftype == EOLIAN_PROP_GET && is_const?"const ":"", ptype, pname, | 509 | is_const?"const ":"", ptype, pname, |
419 | ftype == EOLIAN_PROP_GET && is_const?"const ":"", _varg_upgr(ptype)); | 510 | is_const?"const ":"", _varg_upgr(ptype)); |
511 | #endif | ||
420 | eina_strbuf_append_printf(params, ", %s", pname); | 512 | eina_strbuf_append_printf(params, ", %s", pname); |
421 | eina_strbuf_append_printf(full_params, ", %s%s %s", | 513 | eina_strbuf_append_printf(full_params, ", %s%s %s", |
422 | ftype == EOLIAN_PROP_GET && eolian_parameter_const_attribute_get(data, ftype == EOLIAN_PROP_GET)?"const ":"", | 514 | is_const?"const ":"", |
423 | ptype, pname); | 515 | ptype, pname); |
424 | } | 516 | } |
425 | if (!var_as_ret) | 517 | if (!var_as_ret) |
@@ -433,16 +525,20 @@ eo1_bind_func_generate(const char *classname, Eolian_Function funcid, Eolian_Fun | |||
433 | Eina_Bool is_const = eolian_parameter_const_attribute_get(data, ftype == EOLIAN_PROP_GET); | 525 | Eina_Bool is_const = eolian_parameter_const_attribute_get(data, ftype == EOLIAN_PROP_GET); |
434 | Eina_Bool had_star = !!strchr(ptype, '*'); | 526 | Eina_Bool had_star = !!strchr(ptype, '*'); |
435 | if (ftype == EOLIAN_UNRESOLVED || ftype == EOLIAN_METHOD) add_star = (pdir == EOLIAN_OUT_PARAM); | 527 | if (ftype == EOLIAN_UNRESOLVED || ftype == EOLIAN_METHOD) add_star = (pdir == EOLIAN_OUT_PARAM); |
528 | #ifndef EO | ||
436 | eina_strbuf_append_printf(va_args, " %s%s%s%s%s = va_arg(*list, %s%s%s%s);\n", | 529 | eina_strbuf_append_printf(va_args, " %s%s%s%s%s = va_arg(*list, %s%s%s%s);\n", |
437 | is_const?"const ":"", ptype, had_star?"":" ", add_star?"*":"", pname, | 530 | is_const?"const ":"", ptype, had_star?"":" ", add_star?"*":"", pname, |
438 | is_const?"const ":"", add_star ? ptype : _varg_upgr(ptype), !had_star && add_star?" ":"", add_star?"*":""); | 531 | is_const?"const ":"", add_star ? ptype : _varg_upgr(ptype), !had_star && add_star?" ":"", add_star?"*":""); |
439 | eina_strbuf_append_printf(params, ", %s", pname); | 532 | #endif |
533 | if (eina_strbuf_length_get(params)) eina_strbuf_append(params, ", "); | ||
534 | eina_strbuf_append_printf(params, "%s", pname); | ||
440 | eina_strbuf_append_printf(full_params, ", %s%s%s%s%s", | 535 | eina_strbuf_append_printf(full_params, ", %s%s%s%s%s", |
441 | is_const?"const ":"", | 536 | is_const?"const ":"", |
442 | ptype, had_star?"":" ", add_star?"*":"", pname); | 537 | ptype, had_star?"":" ", add_star?"*":"", pname); |
443 | } | 538 | } |
444 | } | 539 | } |
445 | 540 | ||
541 | #ifndef EO | ||
446 | if (rettype && strcmp(rettype, "void")) | 542 | if (rettype && strcmp(rettype, "void")) |
447 | { | 543 | { |
448 | Eina_Bool had_star = !!strchr(rettype, '*'); | 544 | Eina_Bool had_star = !!strchr(rettype, '*'); |
@@ -476,22 +572,72 @@ eo1_bind_func_generate(const char *classname, Eolian_Function funcid, Eolian_Fun | |||
476 | { | 572 | { |
477 | eina_strbuf_replace_all(fbody, "@#list_unused", ""); | 573 | eina_strbuf_replace_all(fbody, "@#list_unused", ""); |
478 | } | 574 | } |
575 | if (!eina_strbuf_length_get(params)) eina_strbuf_replace_all(fbody, ", @#list_params", ""); | ||
479 | eina_strbuf_replace_all(fbody, "@#list_vars", eina_strbuf_string_get(va_args)); | 576 | eina_strbuf_replace_all(fbody, "@#list_vars", eina_strbuf_string_get(va_args)); |
480 | eina_strbuf_replace_all(fbody, "@#full_params", eina_strbuf_string_get(full_params)); | ||
481 | eina_strbuf_replace_all(fbody, "@#list_params", eina_strbuf_string_get(params)); | 577 | eina_strbuf_replace_all(fbody, "@#list_params", eina_strbuf_string_get(params)); |
482 | const char *data_type = eolian_class_data_type_get(classname); | 578 | #else |
483 | if (data_type && !strcmp(data_type, "null")) | 579 | if (need_implementation) |
484 | eina_strbuf_replace_all(fbody, "@#Datatype_Data", "void"); | ||
485 | else | ||
486 | { | 580 | { |
487 | if (data_type) eina_strbuf_replace_all(fbody, "@#Datatype_Data", data_type); | 581 | Eina_Strbuf *ret_param = eina_strbuf_new(); |
488 | else eina_strbuf_replace_all(fbody, "@#Datatype", classname); | 582 | eina_strbuf_append_printf(fbody, "\n"); |
583 | eina_strbuf_append_printf(fbody, "%s%s _%s_%s%s(Eo *obj, @#Datatype_Data *pd@#full_params);\n\n", | ||
584 | ret_const?"const ":"", rettype?rettype:"void", | ||
585 | lowclass, | ||
586 | eolian_function_name_get(funcid), suffix?suffix:""); | ||
587 | |||
588 | eina_strbuf_replace_all(fbody, "@#return_ret", tmpstr); | ||
589 | eina_strbuf_free(ret_param); | ||
489 | } | 590 | } |
591 | if (!impl_name) | ||
592 | { | ||
593 | Eina_Strbuf *eo_func_decl = eina_strbuf_new(); | ||
594 | Eina_Bool has_params = | ||
595 | !var_as_ret && | ||
596 | (eina_list_count(eolian_parameters_list_get(funcid)) != 0 || | ||
597 | eina_list_count(eolian_property_keys_list_get(funcid))); | ||
598 | Eina_Bool ret_is_void = (!rettype || !strcmp(rettype, "void")); | ||
599 | eina_strbuf_append_printf(eo_func_decl, | ||
600 | "EAPI EO_%sFUNC_BODY%s(%s_%s%s", | ||
601 | ret_is_void?"VOID_":"", has_params?"V":"", | ||
602 | current_eo_prefix_lower, eolian_function_name_get(funcid), | ||
603 | suffix?suffix:""); | ||
604 | if (!ret_is_void) | ||
605 | { | ||
606 | const char *dflt_ret_val = | ||
607 | eolian_function_return_dflt_value_get(funcid, ftype); | ||
608 | eina_strbuf_append_printf(eo_func_decl, ", %s%s, %s", | ||
609 | ret_const ? "const " : "", rettype, | ||
610 | dflt_ret_val?dflt_ret_val:"0"); | ||
490 | 611 | ||
491 | if (!data_type || !strcmp(data_type, "null")) | 612 | } |
492 | eina_strbuf_replace_all(fbody, "@#Datatype", classname); | 613 | if (has_params) |
493 | else | 614 | { |
494 | eina_strbuf_replace_all(fbody, "@#Datatype_Data", data_type); | 615 | eina_strbuf_append_printf(eo_func_decl, ", EO_FUNC_CALL(%s)%s", |
616 | eina_strbuf_string_get(params), | ||
617 | eina_strbuf_string_get(full_params)); | ||
618 | } | ||
619 | eina_strbuf_append_printf(eo_func_decl, ");"); | ||
620 | eina_strbuf_append_printf(fbody, "%s\n", eina_strbuf_string_get(eo_func_decl)); | ||
621 | eina_strbuf_free(eo_func_decl); | ||
622 | } | ||
623 | #endif | ||
624 | if (need_implementation) | ||
625 | { | ||
626 | eina_strbuf_replace_all(fbody, "@#full_params", eina_strbuf_string_get(full_params)); | ||
627 | const char *data_type = eolian_class_data_type_get(classname); | ||
628 | if (data_type && !strcmp(data_type, "null")) | ||
629 | eina_strbuf_replace_all(fbody, "@#Datatype_Data", "void"); | ||
630 | else | ||
631 | { | ||
632 | if (data_type) eina_strbuf_replace_all(fbody, "@#Datatype_Data", data_type); | ||
633 | else eina_strbuf_replace_all(fbody, "@#Datatype", classname); | ||
634 | } | ||
635 | |||
636 | if (!data_type || !strcmp(data_type, "null")) | ||
637 | eina_strbuf_replace_all(fbody, "@#Datatype", classname); | ||
638 | else | ||
639 | eina_strbuf_replace_all(fbody, "@#Datatype_Data", data_type); | ||
640 | } | ||
495 | eina_strbuf_append(buf, eina_strbuf_string_get(fbody)); | 641 | eina_strbuf_append(buf, eina_strbuf_string_get(fbody)); |
496 | 642 | ||
497 | eina_strbuf_free(va_args); | 643 | eina_strbuf_free(va_args); |
@@ -518,12 +664,29 @@ eo1_eo_func_desc_generate(const char *class_name, const char *impl_name, const c | |||
518 | } | 664 | } |
519 | 665 | ||
520 | static Eina_Bool | 666 | static Eina_Bool |
521 | eo1_eo_op_desc_generate(const char *classname, const char *funcname, | 667 | eo_op_desc_generate(const char *classname, Eolian_Function fid, Eolian_Function_Type ftype, |
522 | const char *desc, Eina_Strbuf *buf) | 668 | const char *desc, Eina_Strbuf *buf) |
523 | { | 669 | { |
524 | _template_fill(buf, tmpl_eo_op_desc, classname, funcname, EINA_TRUE); | 670 | const char *funcname = eolian_function_name_get(fid); |
525 | eina_strbuf_replace_all(buf, "@#EOPREFIX", current_eo_prefix_upper); | 671 | const char *suffix = ""; |
526 | eina_strbuf_replace_all(buf, "@#desc", desc); | 672 | |
673 | eina_strbuf_reset(buf); | ||
674 | _class_func_names_fill(classname, funcname); | ||
675 | #ifndef EO | ||
676 | if (ftype == EOLIAN_PROP_GET) suffix = "_GET"; | ||
677 | if (ftype == EOLIAN_PROP_SET) suffix = "_SET"; | ||
678 | eina_strbuf_append_printf(buf, "\n EO_OP_DESCRIPTION(%s_SUB_ID_%s%s, \"%s\"),", | ||
679 | current_eo_prefix_upper, capfunc, suffix, desc); | ||
680 | #else | ||
681 | if (ftype == EOLIAN_PROP_GET) suffix = "_get"; | ||
682 | if (ftype == EOLIAN_PROP_SET) suffix = "_set"; | ||
683 | Eina_Bool is_virtual_pure = eolian_function_is_virtual_pure(fid, ftype); | ||
684 | eina_strbuf_append_printf(buf, "\n EO_OP_FUNC(%s_%s%s, ", current_eo_prefix_lower, funcname, suffix); | ||
685 | if (!is_virtual_pure) | ||
686 | eina_strbuf_append_printf(buf, "_%s_%s%s, \"%s\"),", lowclass, funcname, suffix, desc); | ||
687 | else | ||
688 | eina_strbuf_append_printf(buf, "NULL, \"%s\"),", desc); | ||
689 | #endif | ||
527 | 690 | ||
528 | return EINA_TRUE; | 691 | return EINA_TRUE; |
529 | } | 692 | } |
@@ -536,6 +699,7 @@ eo1_source_beginning_generate(const char *classname, Eina_Strbuf *buf) | |||
536 | Eina_Strbuf *tmpbuf = eina_strbuf_new(); | 699 | Eina_Strbuf *tmpbuf = eina_strbuf_new(); |
537 | Eina_Strbuf *str_ev = eina_strbuf_new(); | 700 | Eina_Strbuf *str_ev = eina_strbuf_new(); |
538 | 701 | ||
702 | #ifndef EO | ||
539 | if (eolian_class_functions_list_get(classname, EOLIAN_CTOR) || | 703 | if (eolian_class_functions_list_get(classname, EOLIAN_CTOR) || |
540 | eolian_class_functions_list_get(classname, EOLIAN_DTOR) || | 704 | eolian_class_functions_list_get(classname, EOLIAN_DTOR) || |
541 | eolian_class_functions_list_get(classname, EOLIAN_PROPERTY) || | 705 | eolian_class_functions_list_get(classname, EOLIAN_PROPERTY) || |
@@ -545,6 +709,7 @@ eo1_source_beginning_generate(const char *classname, Eina_Strbuf *buf) | |||
545 | eina_strbuf_append_printf(buf, "EAPI Eo_Op @#EOPREFIX_BASE_ID = EO_NOOP;\n"); | 709 | eina_strbuf_append_printf(buf, "EAPI Eo_Op @#EOPREFIX_BASE_ID = EO_NOOP;\n"); |
546 | eina_strbuf_replace_all(buf, "@#EOPREFIX", current_eo_prefix_upper); | 710 | eina_strbuf_replace_all(buf, "@#EOPREFIX", current_eo_prefix_upper); |
547 | } | 711 | } |
712 | #endif | ||
548 | 713 | ||
549 | Eolian_Event event; | 714 | Eolian_Event event; |
550 | EINA_LIST_FOREACH(eolian_class_events_list_get(classname), itr, event) | 715 | EINA_LIST_FOREACH(eolian_class_events_list_get(classname), itr, event) |
@@ -613,22 +778,54 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf) | |||
613 | 778 | ||
614 | _template_fill(str_end, tmpl_eo_src, classname, NULL, EINA_TRUE); | 779 | _template_fill(str_end, tmpl_eo_src, classname, NULL, EINA_TRUE); |
615 | 780 | ||
781 | eina_strbuf_replace_all(str_end, "@#EO_VERSION", | ||
782 | #ifdef EO | ||
783 | "EO_VERSION" | ||
784 | #else | ||
785 | "EO_VERSION" | ||
786 | #endif | ||
787 | ); | ||
788 | |||
789 | |||
616 | eina_strbuf_replace_all(str_end, "@#type_class", str_classtype); | 790 | eina_strbuf_replace_all(str_end, "@#type_class", str_classtype); |
617 | eina_strbuf_replace_all(str_end, "@#EOPREFIX", current_eo_prefix_upper); | 791 | eina_strbuf_replace_all(str_end, "@#EOPREFIX", current_eo_prefix_upper); |
618 | eina_strbuf_replace_all(str_end, "@#eoprefix", current_eo_prefix_lower); | 792 | eina_strbuf_replace_all(str_end, "@#eoprefix", current_eo_prefix_lower); |
619 | 793 | ||
794 | eina_strbuf_reset(tmpbuf); | ||
795 | #ifndef EO | ||
620 | _template_fill(tmpbuf, tmpl_eo1_class_ctor, classname, "", EINA_TRUE); | 796 | _template_fill(tmpbuf, tmpl_eo1_class_ctor, classname, "", EINA_TRUE); |
797 | #endif | ||
621 | eina_strbuf_replace_all(str_end, "@#ctor_func", eina_strbuf_string_get(tmpbuf)); | 798 | eina_strbuf_replace_all(str_end, "@#ctor_func", eina_strbuf_string_get(tmpbuf)); |
799 | |||
800 | eina_strbuf_reset(tmpbuf); | ||
801 | #ifndef EO | ||
802 | _template_fill(tmpbuf, "_gen_@#class_class_constructor", classname, "", EINA_TRUE); | ||
803 | eina_strbuf_replace_all(str_end, "@#ctor_name", eina_strbuf_string_get(tmpbuf)); | ||
622 | eina_strbuf_reset(tmpbuf); | 804 | eina_strbuf_reset(tmpbuf); |
623 | if (eolian_class_ctor_enable_get(classname)) | 805 | if (eolian_class_ctor_enable_get(classname)) |
624 | _template_fill(tmpbuf, " _@#class_class_constructor(klass);\n", classname, "", EINA_TRUE); | 806 | _template_fill(tmpbuf, " _@#class_class_constructor(klass);\n", classname, "", EINA_TRUE); |
625 | eina_strbuf_replace_all(str_end, "@#user_ctor_func", eina_strbuf_string_get(tmpbuf)); | 807 | eina_strbuf_replace_all(str_end, "@#user_ctor_func", eina_strbuf_string_get(tmpbuf)); |
808 | #else | ||
809 | if (eolian_class_ctor_enable_get(classname)) | ||
810 | _template_fill(tmpbuf, "_@#class_class_constructor", classname, "", EINA_TRUE); | ||
811 | else | ||
812 | eina_strbuf_append_printf(tmpbuf, "NULL"); | ||
813 | eina_strbuf_replace_all(str_end, "@#ctor_name", eina_strbuf_string_get(tmpbuf)); | ||
814 | #endif | ||
626 | 815 | ||
816 | eina_strbuf_reset(tmpbuf); | ||
627 | if (eolian_class_dtor_enable_get(classname)) | 817 | if (eolian_class_dtor_enable_get(classname)) |
628 | { | 818 | { |
819 | #ifndef EO | ||
629 | _template_fill(tmpbuf, tmpl_dtor, classname, "", EINA_TRUE); | 820 | _template_fill(tmpbuf, tmpl_dtor, classname, "", EINA_TRUE); |
821 | #endif | ||
630 | eina_strbuf_replace_all(str_end, "@#dtor_func", eina_strbuf_string_get(tmpbuf)); | 822 | eina_strbuf_replace_all(str_end, "@#dtor_func", eina_strbuf_string_get(tmpbuf)); |
823 | eina_strbuf_reset(tmpbuf); | ||
824 | #ifndef EO | ||
631 | _template_fill(tmpbuf, "_gen_@#class_class_destructor", classname, "", EINA_TRUE); | 825 | _template_fill(tmpbuf, "_gen_@#class_class_destructor", classname, "", EINA_TRUE); |
826 | #else | ||
827 | _template_fill(tmpbuf, "_@#class_class_destructor", classname, "", EINA_TRUE); | ||
828 | #endif | ||
632 | eina_strbuf_replace_all(str_end, "@#dtor_name", eina_strbuf_string_get(tmpbuf)); | 829 | eina_strbuf_replace_all(str_end, "@#dtor_name", eina_strbuf_string_get(tmpbuf)); |
633 | } | 830 | } |
634 | else | 831 | else |
@@ -643,14 +840,14 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf) | |||
643 | Eolian_Function ctor_fn = eolian_class_default_constructor_get(classname); | 840 | Eolian_Function ctor_fn = eolian_class_default_constructor_get(classname); |
644 | if (ctor_fn) | 841 | if (ctor_fn) |
645 | { | 842 | { |
646 | _template_fill(str_func, tmpl_eobase_func_desc, classname, "constructor", EINA_FALSE); | 843 | _template_fill(str_func, tmpl_eo1base_func_desc, classname, "constructor", EINA_FALSE); |
647 | eo1_bind_func_generate(classname, ctor_fn, EOLIAN_UNRESOLVED, str_bodyf, NULL); | 844 | eo1_bind_func_generate(classname, ctor_fn, EOLIAN_UNRESOLVED, str_bodyf, NULL); |
648 | } | 845 | } |
649 | // default destructor | 846 | // default destructor |
650 | Eolian_Function dtor_fn = eolian_class_default_destructor_get(classname); | 847 | Eolian_Function dtor_fn = eolian_class_default_destructor_get(classname); |
651 | if (dtor_fn) | 848 | if (dtor_fn) |
652 | { | 849 | { |
653 | _template_fill(str_func, tmpl_eobase_func_desc, classname, "destructor", EINA_FALSE); | 850 | _template_fill(str_func, tmpl_eo1base_func_desc, classname, "destructor", EINA_FALSE); |
654 | eo1_bind_func_generate(classname, dtor_fn, EOLIAN_UNRESOLVED, str_bodyf, NULL); | 851 | eo1_bind_func_generate(classname, dtor_fn, EOLIAN_UNRESOLVED, str_bodyf, NULL); |
655 | } | 852 | } |
656 | 853 | ||
@@ -666,8 +863,13 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf) | |||
666 | 863 | ||
667 | eina_strbuf_reset(tmpl_impl); | 864 | eina_strbuf_reset(tmpl_impl); |
668 | _template_fill(str_func, NULL, impl_class, NULL, EINA_FALSE); /* Invoked to set the variables */ | 865 | _template_fill(str_func, NULL, impl_class, NULL, EINA_FALSE); /* Invoked to set the variables */ |
866 | #ifndef EO | ||
867 | eina_strbuf_append(tmpl_impl, tmpl_eo1_func_desc); | ||
868 | #else | ||
669 | eina_strbuf_append(tmpl_impl, tmpl_eo_func_desc); | 869 | eina_strbuf_append(tmpl_impl, tmpl_eo_func_desc); |
870 | #endif | ||
670 | eina_strbuf_replace_all(tmpl_impl, "@#EOPREFIX", current_eo_prefix_upper); | 871 | eina_strbuf_replace_all(tmpl_impl, "@#EOPREFIX", current_eo_prefix_upper); |
872 | eina_strbuf_replace_all(tmpl_impl, "@#eoprefix", current_eo_prefix_lower); | ||
671 | 873 | ||
672 | char implname[0xFF]; | 874 | char implname[0xFF]; |
673 | char *tp = implname; | 875 | char *tp = implname; |
@@ -701,7 +903,11 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf) | |||
701 | 903 | ||
702 | if (in_meth) | 904 | if (in_meth) |
703 | { | 905 | { |
906 | #ifndef EO | ||
704 | _template_fill(str_func, tmpl_impl_str, impl_class, funcname, EINA_FALSE); | 907 | _template_fill(str_func, tmpl_impl_str, impl_class, funcname, EINA_FALSE); |
908 | #else | ||
909 | _template_fill(str_op, tmpl_impl_str, impl_class, funcname, EINA_FALSE); | ||
910 | #endif | ||
705 | eo1_bind_func_generate(classname, in_meth, EOLIAN_UNRESOLVED, str_bodyf, impl_class); | 911 | eo1_bind_func_generate(classname, in_meth, EOLIAN_UNRESOLVED, str_bodyf, impl_class); |
706 | continue; | 912 | continue; |
707 | } | 913 | } |
@@ -718,17 +924,26 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf) | |||
718 | if (prop_write) | 924 | if (prop_write) |
719 | { | 925 | { |
720 | sprintf(tmpstr, "%s_set", funcname); | 926 | sprintf(tmpstr, "%s_set", funcname); |
927 | #ifndef EO | ||
721 | _template_fill(str_func, tmpl_impl_str, impl_class, tmpstr, EINA_FALSE); | 928 | _template_fill(str_func, tmpl_impl_str, impl_class, tmpstr, EINA_FALSE); |
929 | #else | ||
930 | _template_fill(str_op, tmpl_impl_str, impl_class, tmpstr, EINA_FALSE); | ||
931 | #endif | ||
722 | eo1_bind_func_generate(classname, in_prop, EOLIAN_PROP_SET, str_bodyf, impl_class); | 932 | eo1_bind_func_generate(classname, in_prop, EOLIAN_PROP_SET, str_bodyf, impl_class); |
723 | } | 933 | } |
724 | 934 | ||
725 | if (prop_read) | 935 | if (prop_read) |
726 | { | 936 | { |
727 | sprintf(tmpstr, "%s_get", funcname); | 937 | sprintf(tmpstr, "%s_get", funcname); |
938 | #ifndef EO | ||
728 | _template_fill(str_func, tmpl_impl_str, impl_class, tmpstr, EINA_FALSE); | 939 | _template_fill(str_func, tmpl_impl_str, impl_class, tmpstr, EINA_FALSE); |
940 | #else | ||
941 | _template_fill(str_op, tmpl_impl_str, impl_class, tmpstr, EINA_FALSE); | ||
942 | #endif | ||
729 | eo1_bind_func_generate(classname, in_prop, EOLIAN_PROP_GET, str_bodyf, impl_class); | 943 | eo1_bind_func_generate(classname, in_prop, EOLIAN_PROP_GET, str_bodyf, impl_class); |
730 | } | 944 | } |
731 | } | 945 | } |
946 | eina_strbuf_append(str_op, eina_strbuf_string_get(tmpbuf)); | ||
732 | } | 947 | } |
733 | 948 | ||
734 | //Constructors | 949 | //Constructors |
@@ -736,7 +951,7 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf) | |||
736 | { | 951 | { |
737 | const char *funcname = eolian_function_name_get(fn); | 952 | const char *funcname = eolian_function_name_get(fn); |
738 | char *desc = _source_desc_get(eolian_function_description_get(fn, "comment")); | 953 | char *desc = _source_desc_get(eolian_function_description_get(fn, "comment")); |
739 | eo1_eo_op_desc_generate(classname, funcname, desc, tmpbuf); | 954 | eo_op_desc_generate(classname, fn, EOLIAN_CTOR, desc, tmpbuf); |
740 | eina_strbuf_append(str_op, eina_strbuf_string_get(tmpbuf)); | 955 | eina_strbuf_append(str_op, eina_strbuf_string_get(tmpbuf)); |
741 | free(desc); | 956 | free(desc); |
742 | 957 | ||
@@ -761,7 +976,7 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf) | |||
761 | char *desc = _source_desc_get(eolian_function_description_get(fn, "comment_set")); | 976 | char *desc = _source_desc_get(eolian_function_description_get(fn, "comment_set")); |
762 | 977 | ||
763 | sprintf(tmpstr, "%s_set", funcname); | 978 | sprintf(tmpstr, "%s_set", funcname); |
764 | eo1_eo_op_desc_generate(classname, tmpstr, desc, tmpbuf); | 979 | eo_op_desc_generate(classname, fn, EOLIAN_PROP_SET, desc, tmpbuf); |
765 | eina_strbuf_append(str_op, eina_strbuf_string_get(tmpbuf)); | 980 | eina_strbuf_append(str_op, eina_strbuf_string_get(tmpbuf)); |
766 | free(desc); | 981 | free(desc); |
767 | 982 | ||
@@ -776,7 +991,7 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf) | |||
776 | char *desc = _source_desc_get(eolian_function_description_get(fn, "comment_get")); | 991 | char *desc = _source_desc_get(eolian_function_description_get(fn, "comment_get")); |
777 | 992 | ||
778 | sprintf(tmpstr, "%s_get", funcname); | 993 | sprintf(tmpstr, "%s_get", funcname); |
779 | eo1_eo_op_desc_generate(classname, tmpstr, desc, tmpbuf); | 994 | eo_op_desc_generate(classname, fn, EOLIAN_PROP_GET, desc, tmpbuf); |
780 | free(desc); | 995 | free(desc); |
781 | eina_strbuf_append(str_op, eina_strbuf_string_get(tmpbuf)); | 996 | eina_strbuf_append(str_op, eina_strbuf_string_get(tmpbuf)); |
782 | 997 | ||
@@ -794,7 +1009,7 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf) | |||
794 | const char *funcname = eolian_function_name_get(fn); | 1009 | const char *funcname = eolian_function_name_get(fn); |
795 | 1010 | ||
796 | char *desc = _source_desc_get(eolian_function_description_get(fn, "comment")); | 1011 | char *desc = _source_desc_get(eolian_function_description_get(fn, "comment")); |
797 | eo1_eo_op_desc_generate(classname, funcname, desc, tmpbuf); | 1012 | eo_op_desc_generate(classname, fn, EOLIAN_METHOD, desc, tmpbuf); |
798 | free(desc); | 1013 | free(desc); |
799 | eina_strbuf_append(str_op, eina_strbuf_string_get(tmpbuf)); | 1014 | eina_strbuf_append(str_op, eina_strbuf_string_get(tmpbuf)); |
800 | 1015 | ||
@@ -852,19 +1067,33 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf) | |||
852 | if (eina_strbuf_length_get(str_op)) | 1067 | if (eina_strbuf_length_get(str_op)) |
853 | { | 1068 | { |
854 | Eina_Strbuf *ops_desc = eina_strbuf_new(); | 1069 | Eina_Strbuf *ops_desc = eina_strbuf_new(); |
1070 | #ifndef EO | ||
855 | _template_fill(ops_desc, tmpl_eo1_ops_desc, classname, "", EINA_TRUE); | 1071 | _template_fill(ops_desc, tmpl_eo1_ops_desc, classname, "", EINA_TRUE); |
1072 | #else | ||
1073 | _template_fill(ops_desc, tmpl_eo_ops_desc, classname, "", EINA_TRUE); | ||
1074 | #endif | ||
856 | eina_strbuf_replace_all(ops_desc, "@#list_op", eina_strbuf_string_get(str_op)); | 1075 | eina_strbuf_replace_all(ops_desc, "@#list_op", eina_strbuf_string_get(str_op)); |
857 | eina_strbuf_replace_all(str_end, "@#ops_desc", eina_strbuf_string_get(ops_desc)); | 1076 | eina_strbuf_replace_all(str_end, "@#ops_desc", eina_strbuf_string_get(ops_desc)); |
858 | eina_strbuf_free(ops_desc); | 1077 | eina_strbuf_free(ops_desc); |
1078 | #ifndef EO | ||
859 | _template_fill(tmpbuf, | 1079 | _template_fill(tmpbuf, |
860 | "EO_CLASS_DESCRIPTION_OPS(&@#EOPREFIX_BASE_ID, _@#class_op_desc, @#EOPREFIX_SUB_ID_LAST)", | 1080 | "EO_CLASS_DESCRIPTION_OPS(&@#EOPREFIX_BASE_ID, _@#class_op_desc, @#EOPREFIX_SUB_ID_LAST)", |
861 | classname, NULL, EINA_TRUE); | 1081 | classname, NULL, EINA_TRUE); |
862 | eina_strbuf_replace_all(tmpbuf, "@#EOPREFIX", current_eo_prefix_upper); | 1082 | eina_strbuf_replace_all(tmpbuf, "@#EOPREFIX", current_eo_prefix_upper); |
1083 | #else | ||
1084 | _template_fill(tmpbuf, | ||
1085 | "EO_CLASS_DESCRIPTION_OPS(_@#class_op_desc)", | ||
1086 | classname, NULL, EINA_TRUE); | ||
1087 | #endif | ||
863 | } | 1088 | } |
864 | else | 1089 | else |
865 | { | 1090 | { |
866 | eina_strbuf_replace_all(str_end, "@#ops_desc", ""); | 1091 | eina_strbuf_replace_all(str_end, "@#ops_desc", ""); |
1092 | #ifndef EO | ||
867 | eina_strbuf_append_printf(tmpbuf, "EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0)"); | 1093 | eina_strbuf_append_printf(tmpbuf, "EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0)"); |
1094 | #else | ||
1095 | eina_strbuf_append_printf(tmpbuf, "EO_CLASS_DESCRIPTION_NOOPS()"); | ||
1096 | #endif | ||
868 | } | 1097 | } |
869 | 1098 | ||
870 | eina_strbuf_replace_all(str_end, "@#functions_body", eina_strbuf_string_get(str_bodyf)); | 1099 | eina_strbuf_replace_all(str_end, "@#functions_body", eina_strbuf_string_get(str_bodyf)); |