summaryrefslogtreecommitdiff
path: root/src/bin/eolian/headers.c
diff options
context:
space:
mode:
authorDaniel Kolesa <daniel@octaforge.org>2019-03-08 09:58:52 -0500
committerMike Blumenkrantz <zmike@samsung.com>2019-03-08 10:12:09 -0500
commitcf200a7d28aada7fff7d01fe3e353bf8359addc0 (patch)
tree2675876e3a1a2765584af59aeda83e7669701c69 /src/bin/eolian/headers.c
parenta007badbed3972f86bdd09dd974fbfbbde5bc20d (diff)
eolian: remove legacy handling API and most of generation
Summary: This removes all Eolian API that deals with handling of legacy code. It also removes the code using it in the generator as well as bindings, but for now keeps generation of .eo.legacy.h types, as there are still instances in our codebase where things are otherwise broken. We can remove the rest once that is resolved. Reviewers: zmike, cedric Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8255
Diffstat (limited to 'src/bin/eolian/headers.c')
-rw-r--r--src/bin/eolian/headers.c198
1 files changed, 91 insertions, 107 deletions
diff --git a/src/bin/eolian/headers.c b/src/bin/eolian/headers.c
index 7fbd576..cc3b0ee 100644
--- a/src/bin/eolian/headers.c
+++ b/src/bin/eolian/headers.c
@@ -67,10 +67,9 @@ eo_gen_params(Eina_Iterator *itr, Eina_Strbuf *buf,
67 67
68static void 68static void
69_gen_func(const Eolian_State *state, const Eolian_Function *fid, 69_gen_func(const Eolian_State *state, const Eolian_Function *fid,
70 Eolian_Function_Type ftype, Eina_Strbuf *buf, char *cname, 70 Eolian_Function_Type ftype, Eina_Strbuf *buf, char *cnameu)
71 char *cnameu, Eina_Bool legacy)
72{ 71{
73 Eina_Stringshare *fcn = eolian_function_full_c_name_get(fid, ftype, legacy); 72 Eina_Stringshare *fcn = eolian_function_full_c_name_get(fid, ftype);
74 if (!fcn) 73 if (!fcn)
75 return; 74 return;
76 75
@@ -90,11 +89,9 @@ _gen_func(const Eolian_State *state, const Eolian_Function *fid,
90 89
91 Eolian_Object_Scope fsc = eolian_function_scope_get(fid, ftype); 90 Eolian_Object_Scope fsc = eolian_function_scope_get(fid, ftype);
92 91
93 /* this one will never be satisfied in legacy */
94 if (eolian_function_is_beta(fid)) 92 if (eolian_function_is_beta(fid))
95 eina_strbuf_append(buf, "#ifdef EFL_BETA_API_SUPPORT\n"); 93 eina_strbuf_append(buf, "#ifdef EFL_BETA_API_SUPPORT\n");
96 /* XXX: is this right? we expose potentially internal stuff into legacy */ 94 if (fsc == EOLIAN_SCOPE_PROTECTED)
97 if (!legacy && (fsc == EOLIAN_SCOPE_PROTECTED))
98 eina_strbuf_append_printf(buf, "#ifdef %s_PROTECTED\n", cnameu); 95 eina_strbuf_append_printf(buf, "#ifdef %s_PROTECTED\n", cnameu);
99 96
100 const Eolian_Implement *fimp = eolian_function_implement_get(fid); 97 const Eolian_Implement *fimp = eolian_function_implement_get(fid);
@@ -104,12 +101,12 @@ _gen_func(const Eolian_State *state, const Eolian_Function *fid,
104 hasdoc = !!eolian_implement_documentation_get(fimp, EOLIAN_PROPERTY); 101 hasdoc = !!eolian_implement_documentation_get(fimp, EOLIAN_PROPERTY);
105 if (hasdoc) 102 if (hasdoc)
106 { 103 {
107 Eina_Strbuf *dbuf = eo_gen_docs_func_gen(state, fid, ftype, 0, legacy); 104 Eina_Strbuf *dbuf = eo_gen_docs_func_gen(state, fid, ftype, 0);
108 eina_strbuf_append(buf, eina_strbuf_string_get(dbuf)); 105 eina_strbuf_append(buf, eina_strbuf_string_get(dbuf));
109 eina_strbuf_append_char(buf, '\n'); 106 eina_strbuf_append_char(buf, '\n');
110 eina_strbuf_free(dbuf); 107 eina_strbuf_free(dbuf);
111 } 108 }
112 eina_strbuf_append(buf, legacy ? "EAPI " : "EOAPI "); 109 eina_strbuf_append(buf, "EOAPI ");
113 if (rtp) 110 if (rtp)
114 { 111 {
115 Eina_Stringshare *rtps = eolian_type_c_type_get(rtp, EOLIAN_C_TYPE_RETURN); 112 Eina_Stringshare *rtps = eolian_type_c_type_get(rtp, EOLIAN_C_TYPE_RETURN);
@@ -135,10 +132,7 @@ _gen_func(const Eolian_State *state, const Eolian_Function *fid,
135 { 132 {
136 eina_strbuf_append(buf, "const "); 133 eina_strbuf_append(buf, "const ");
137 } 134 }
138 if (legacy) 135 eina_strbuf_append(buf, "Eo *obj");
139 eina_strbuf_append_printf(buf, "%s *obj", cname);
140 else
141 eina_strbuf_append(buf, "Eo *obj");
142 } 136 }
143 137
144 eo_gen_params(eolian_property_keys_get(fid, ftype), buf, &flagbuf, &nidx, EOLIAN_PROPERTY); 138 eo_gen_params(eolian_property_keys_get(fid, ftype), buf, &flagbuf, &nidx, EOLIAN_PROPERTY);
@@ -174,7 +168,7 @@ _gen_func(const Eolian_State *state, const Eolian_Function *fid,
174 } 168 }
175 eina_strbuf_append(buf, ";\n"); 169 eina_strbuf_append(buf, ";\n");
176 170
177 if (!legacy && (fsc == EOLIAN_SCOPE_PROTECTED)) 171 if (fsc == EOLIAN_SCOPE_PROTECTED)
178 eina_strbuf_append_printf(buf, "#endif\n"); 172 eina_strbuf_append_printf(buf, "#endif\n");
179 if (eolian_function_is_beta(fid)) 173 if (eolian_function_is_beta(fid))
180 eina_strbuf_append_printf(buf, "#endif /* EFL_BETA_API_SUPPORT */\n"); 174 eina_strbuf_append_printf(buf, "#endif /* EFL_BETA_API_SUPPORT */\n");
@@ -184,129 +178,119 @@ void
184eo_gen_header_gen(const Eolian_State *state, const Eolian_Class *cl, 178eo_gen_header_gen(const Eolian_State *state, const Eolian_Class *cl,
185 Eina_Strbuf *buf, Eina_Bool legacy) 179 Eina_Strbuf *buf, Eina_Bool legacy)
186{ 180{
187 if (!cl) 181 if (!cl || legacy)
188 return; 182 return;
189 183
190 char *cname = NULL, *cnameu = NULL; 184 Eina_Iterator *itr;
191 eo_gen_class_names_get(cl, &cname, &cnameu, NULL); 185 Eolian_Event *ev;
186 char *cnameu = NULL;
187 eo_gen_class_names_get(cl, NULL, &cnameu, NULL);
192 188
193 /* class definition */ 189 /* class definition */
194 190
195 if (!legacy && eolian_class_is_beta(cl)) 191 if (eolian_class_is_beta(cl))
196 { 192 {
197 eina_strbuf_append(buf, "#ifdef EFL_BETA_API_SUPPORT\n"); 193 eina_strbuf_append(buf, "#ifdef EFL_BETA_API_SUPPORT\n");
198 } 194 }
199 if (!legacy) 195 const Eolian_Documentation *doc = eolian_class_documentation_get(cl);
196 if (doc)
200 { 197 {
201 const Eolian_Documentation *doc = eolian_class_documentation_get(cl); 198 Eina_Strbuf *cdoc = eo_gen_docs_full_gen(state, doc,
202 if (doc) 199 eolian_class_name_get(cl), 0, EINA_FALSE);
200 if (cdoc)
203 { 201 {
204 Eina_Strbuf *cdoc = eo_gen_docs_full_gen(state, doc, 202 eina_strbuf_append(buf, eina_strbuf_string_get(cdoc));
205 eolian_class_name_get(cl), 0, EINA_FALSE); 203 eina_strbuf_append_char(buf, '\n');
206 if (cdoc) 204 eina_strbuf_free(cdoc);
207 {
208 eina_strbuf_append(buf, eina_strbuf_string_get(cdoc));
209 eina_strbuf_append_char(buf, '\n');
210 eina_strbuf_free(cdoc);
211 }
212 } 205 }
206 }
213 207
214 Eina_Stringshare *mname = eolian_class_c_name_get(cl); 208 Eina_Stringshare *mname = eolian_class_c_name_get(cl);
215 Eina_Stringshare *gname = eolian_class_c_get_function_name_get(cl); 209 Eina_Stringshare *gname = eolian_class_c_get_function_name_get(cl);
216 eina_strbuf_append_printf(buf, "#define %s %s()\n\n", mname, gname); 210 eina_strbuf_append_printf(buf, "#define %s %s()\n\n", mname, gname);
217 eina_stringshare_del(mname); 211 eina_stringshare_del(mname);
218 212
219 eina_strbuf_append_printf(buf, "EWAPI const Efl_Class *%s(void);\n", gname); 213 eina_strbuf_append_printf(buf, "EWAPI const Efl_Class *%s(void);\n", gname);
220 eina_stringshare_del(gname); 214 eina_stringshare_del(gname);
221 }
222 215
223 /* method section */ 216 /* method section */
224 { 217 itr = eolian_class_implements_get(cl);
225 Eina_Iterator *itr = eolian_class_implements_get(cl); 218 if (!itr)
226 if (!itr) 219 goto events;
227 goto events; 220
228 221 const Eolian_Implement *imp;
229 const Eolian_Implement *imp; 222 EINA_ITERATOR_FOREACH(itr, imp)
230 EINA_ITERATOR_FOREACH(itr, imp) 223 {
231 { 224 if (eolian_implement_class_get(imp) != cl)
232 if (eolian_implement_class_get(imp) != cl) 225 continue;
233 continue; 226 Eolian_Function_Type ftype = EOLIAN_UNRESOLVED;
234 Eolian_Function_Type ftype = EOLIAN_UNRESOLVED; 227 const Eolian_Function *fid = eolian_implement_function_get(imp, &ftype);
235 const Eolian_Function *fid = eolian_implement_function_get(imp, &ftype); 228 eina_strbuf_append_char(buf, '\n');
236 /* beta can only exist for eo api */ 229 switch (ftype)
237 if (legacy && eolian_function_is_beta(fid)) 230 {
238 continue; 231 case EOLIAN_PROP_GET:
239 eina_strbuf_append_char(buf, '\n'); 232 case EOLIAN_PROP_SET:
240 switch (ftype) 233 _gen_func(state, fid, ftype, buf, cnameu);
241 { 234 break;
242 case EOLIAN_PROP_GET: 235 case EOLIAN_PROPERTY:
243 case EOLIAN_PROP_SET: 236 _gen_func(state, fid, EOLIAN_PROP_SET, buf, cnameu);
244 _gen_func(state, fid, ftype, buf, cname, cnameu, legacy); 237 eina_strbuf_append_char(buf, '\n');
245 break; 238 _gen_func(state, fid, EOLIAN_PROP_GET, buf, cnameu);
246 case EOLIAN_PROPERTY: 239 break;
247 _gen_func(state, fid, EOLIAN_PROP_SET, buf, cname, cnameu, legacy); 240 default:
248 eina_strbuf_append_char(buf, '\n'); 241 _gen_func(state, fid, EOLIAN_METHOD, buf, cnameu);
249 _gen_func(state, fid, EOLIAN_PROP_GET, buf, cname, cnameu, legacy); 242 }
250 break; 243 }
251 default: 244 eina_iterator_free(itr);
252 _gen_func(state, fid, EOLIAN_METHOD, buf, cname, cnameu, legacy);
253 }
254 }
255 eina_iterator_free(itr);
256 }
257 245
258events: 246events:
259 /* event section */ 247 /* event section */
260 if (!legacy) 248 itr = eolian_class_events_get(cl);
249 EINA_ITERATOR_FOREACH(itr, ev)
261 { 250 {
262 Eina_Iterator *itr = eolian_class_events_get(cl); 251 Eina_Stringshare *evn = eolian_event_c_name_get(ev);
263 Eolian_Event *ev; 252 Eolian_Object_Scope evs = eolian_event_scope_get(ev);
264 EINA_ITERATOR_FOREACH(itr, ev) 253
254 if (evs == EOLIAN_SCOPE_PRIVATE)
255 continue;
256
257 if (eolian_event_is_beta(ev))
265 { 258 {
266 Eina_Stringshare *evn = eolian_event_c_name_get(ev); 259 eina_strbuf_append(buf, "#ifdef EFL_BETA_API_SUPPORT\n");
267 Eolian_Object_Scope evs = eolian_event_scope_get(ev); 260 }
268 261 if (evs == EOLIAN_SCOPE_PROTECTED)
269 if (evs == EOLIAN_SCOPE_PRIVATE) 262 {
270 continue; 263 if (!eolian_event_is_beta(ev))
271
272 if (eolian_event_is_beta(ev))
273 {
274 eina_strbuf_append(buf, "#ifdef EFL_BETA_API_SUPPORT\n");
275 }
276 if (evs == EOLIAN_SCOPE_PROTECTED)
277 {
278 if (!eolian_event_is_beta(ev))
279 eina_strbuf_append_char(buf, '\n');
280 eina_strbuf_append_printf(buf, "#ifdef %s_PROTECTED\n", cnameu);
281 }
282
283 if (!eolian_event_is_beta(ev) && evs == EOLIAN_SCOPE_PUBLIC)
284 eina_strbuf_append_char(buf, '\n'); 264 eina_strbuf_append_char(buf, '\n');
265 eina_strbuf_append_printf(buf, "#ifdef %s_PROTECTED\n", cnameu);
266 }
285 267
286 eina_strbuf_append_printf(buf, "EWAPI extern const " 268 if (!eolian_event_is_beta(ev) && evs == EOLIAN_SCOPE_PUBLIC)
287 "Efl_Event_Description _%s;\n\n", evn); 269 eina_strbuf_append_char(buf, '\n');
288 270
289 Eina_Strbuf *evdbuf = eo_gen_docs_event_gen(state, ev, 271 eina_strbuf_append_printf(buf, "EWAPI extern const "
290 eolian_class_name_get(cl)); 272 "Efl_Event_Description _%s;\n\n", evn);
291 eina_strbuf_append(buf, eina_strbuf_string_get(evdbuf));
292 eina_strbuf_append_char(buf, '\n');
293 eina_strbuf_free(evdbuf);
294 eina_strbuf_append_printf(buf, "#define %s (&(_%s))\n", evn, evn);
295 273
296 if (evs == EOLIAN_SCOPE_PROTECTED) 274 Eina_Strbuf *evdbuf = eo_gen_docs_event_gen(state, ev,
297 eina_strbuf_append(buf, "#endif\n"); 275 eolian_class_name_get(cl));
298 if (eolian_event_is_beta(ev)) 276 eina_strbuf_append(buf, eina_strbuf_string_get(evdbuf));
299 eina_strbuf_append(buf, "#endif /* EFL_BETA_API_SUPPORT */\n"); 277 eina_strbuf_append_char(buf, '\n');
278 eina_strbuf_free(evdbuf);
279 eina_strbuf_append_printf(buf, "#define %s (&(_%s))\n", evn, evn);
300 280
301 eina_stringshare_del(evn); 281 if (evs == EOLIAN_SCOPE_PROTECTED)
302 } 282 eina_strbuf_append(buf, "#endif\n");
303 eina_iterator_free(itr); 283 if (eolian_event_is_beta(ev))
284 eina_strbuf_append(buf, "#endif /* EFL_BETA_API_SUPPORT */\n");
285
286 eina_stringshare_del(evn);
304 } 287 }
305 if (!legacy && eolian_class_is_beta(cl)) 288 eina_iterator_free(itr);
289
290 if (eolian_class_is_beta(cl))
306 { 291 {
307 eina_strbuf_append(buf, "#endif /* EFL_BETA_API_SUPPORT */\n"); 292 eina_strbuf_append(buf, "#endif /* EFL_BETA_API_SUPPORT */\n");
308 } 293 }
309 294
310 free(cname);
311 free(cnameu); 295 free(cnameu);
312} 296}