summaryrefslogtreecommitdiff
path: root/src/lib/eolian
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2019-05-30 16:20:09 +0200
committerDaniel Kolesa <d.kolesa@samsung.com>2019-05-30 16:29:51 +0200
commit9cba6a4f0e9d76935c7c6875b94aaa0bf790097c (patch)
tree36e7a0bad74b8d9eb768a679caf1a372897dddf8 /src/lib/eolian
parent8113f3f5658f655de1605f188b56db697453d101 (diff)
eolian: allow complete symbol renaming for C
This adds a new unified syntax for giving declarations C names. Classes: class @c_name(Foo) Foo ... Types: type @c_name(Foo) Foo: Bar ... Structs: struct @c_name(Foo) Foo ... and so on. Type instances properly inherit those. This also cleans up some other parts of the source code. Fixes T6716.
Diffstat (limited to 'src/lib/eolian')
-rw-r--r--src/lib/eolian/database_type.c28
-rw-r--r--src/lib/eolian/database_validate.c2
-rw-r--r--src/lib/eolian/eo_parser.c148
3 files changed, 134 insertions, 44 deletions
diff --git a/src/lib/eolian/database_type.c b/src/lib/eolian/database_type.c
index 2523527a2d..a0d9652f9d 100644
--- a/src/lib/eolian/database_type.c
+++ b/src/lib/eolian/database_type.c
@@ -98,20 +98,6 @@ _buf_add_suffix(Eina_Strbuf *buf, const char *suffix)
98 eina_strbuf_append(buf, suffix); 98 eina_strbuf_append(buf, suffix);
99} 99}
100 100
101static void
102_append_name(const Eolian_Object *obj, Eina_Strbuf *buf)
103{
104 Eina_Iterator *itr = eolian_object_namespaces_get(obj);
105 const char *sp;
106 EINA_ITERATOR_FOREACH(itr, sp)
107 {
108 eina_strbuf_append(buf, sp);
109 eina_strbuf_append_char(buf, '_');
110 }
111 eina_strbuf_append(buf, eolian_object_short_name_get(obj));
112 eina_iterator_free(itr);
113}
114
115void 101void
116database_type_to_str(const Eolian_Type *tp, 102database_type_to_str(const Eolian_Type *tp,
117 Eina_Strbuf *buf, const char *name, 103 Eina_Strbuf *buf, const char *name,
@@ -132,7 +118,7 @@ database_type_to_str(const Eolian_Type *tp,
132 if (kw && eo_lexer_is_type_keyword(kw)) 118 if (kw && eo_lexer_is_type_keyword(kw))
133 eina_strbuf_append(buf, eo_lexer_get_c_type(kw)); 119 eina_strbuf_append(buf, eo_lexer_get_c_type(kw));
134 else 120 else
135 _append_name(&tp->base, buf); 121 eina_strbuf_append(buf, tp->base.c_name);
136 } 122 }
137 else if (tp->type == EOLIAN_TYPE_VOID) 123 else if (tp->type == EOLIAN_TYPE_VOID)
138 eina_strbuf_append(buf, "void"); 124 eina_strbuf_append(buf, "void");
@@ -158,7 +144,7 @@ static void
158_stype_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf) 144_stype_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf)
159{ 145{
160 eina_strbuf_append(buf, "struct "); 146 eina_strbuf_append(buf, "struct ");
161 _append_name(&tp->base, buf); 147 eina_strbuf_append(buf, tp->base.c_name);
162 if (tp->type == EOLIAN_TYPEDECL_STRUCT_OPAQUE) 148 if (tp->type == EOLIAN_TYPEDECL_STRUCT_OPAQUE)
163 return; 149 return;
164 eina_strbuf_append(buf, " { "); 150 eina_strbuf_append(buf, " { ");
@@ -177,7 +163,7 @@ static void
177_etype_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf) 163_etype_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf)
178{ 164{
179 eina_strbuf_append(buf, "enum "); 165 eina_strbuf_append(buf, "enum ");
180 _append_name(&tp->base, buf); 166 eina_strbuf_append(buf, tp->base.c_name);
181 eina_strbuf_append(buf, " { "); 167 eina_strbuf_append(buf, " { ");
182 Eina_List *l; 168 Eina_List *l;
183 Eolian_Enum_Type_Field *ef; 169 Eolian_Enum_Type_Field *ef;
@@ -210,17 +196,13 @@ _atype_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf)
210 if (!strcmp(tp->base_type->base.name, "__builtin_free_cb")) 196 if (!strcmp(tp->base_type->base.name, "__builtin_free_cb"))
211 { 197 {
212 eina_strbuf_append(buf, "void (*"); 198 eina_strbuf_append(buf, "void (*");
213 _append_name(&tp->base, buf); 199 eina_strbuf_append(buf, tp->base.c_name);
214 eina_strbuf_append(buf, ")(void *data)"); 200 eina_strbuf_append(buf, ")(void *data)");
215 return; 201 return;
216 } 202 }
217 } 203 }
218 204 database_type_to_str(tp->base_type, buf, tp->base.c_name,
219 Eina_Strbuf *fulln = eina_strbuf_new();
220 _append_name(&tp->base, fulln);
221 database_type_to_str(tp->base_type, buf, eina_strbuf_string_get(fulln),
222 EOLIAN_C_TYPE_DEFAULT); 205 EOLIAN_C_TYPE_DEFAULT);
223 eina_strbuf_free(fulln);
224} 206}
225 207
226void 208void
diff --git a/src/lib/eolian/database_validate.c b/src/lib/eolian/database_validate.c
index 9026f38247..71c05d7d8f 100644
--- a/src/lib/eolian/database_validate.c
+++ b/src/lib/eolian/database_validate.c
@@ -331,6 +331,7 @@ _validate_type(Validate_State *vals, Eolian_Type *tp)
331 return EINA_FALSE; 331 return EINA_FALSE;
332 if (tp->tdecl->freefunc && !tp->freefunc) 332 if (tp->tdecl->freefunc && !tp->freefunc)
333 tp->freefunc = eina_stringshare_ref(tp->tdecl->freefunc); 333 tp->freefunc = eina_stringshare_ref(tp->tdecl->freefunc);
334 tp->base.c_name = eina_stringshare_ref(tp->tdecl->base.c_name);
334 return _validate_ownable(tp); 335 return _validate_ownable(tp);
335 } 336 }
336 case EOLIAN_TYPE_CLASS: 337 case EOLIAN_TYPE_CLASS:
@@ -350,6 +351,7 @@ _validate_type(Validate_State *vals, Eolian_Type *tp)
350 } 351 }
351 if (!tp->freefunc) 352 if (!tp->freefunc)
352 tp->freefunc = eina_stringshare_add(eo_obj_free); 353 tp->freefunc = eina_stringshare_add(eo_obj_free);
354 tp->base.c_name = eina_stringshare_ref(tp->tdecl->base.c_name);
353 return _validate_ownable(tp); 355 return _validate_ownable(tp);
354 } 356 }
355 default: 357 default:
diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c
index cb1c7e4ed9..ee056b7cf5 100644
--- a/src/lib/eolian/eo_parser.c
+++ b/src/lib/eolian/eo_parser.c
@@ -202,6 +202,25 @@ parse_name(Eo_Lexer *ls, Eina_Strbuf *buf)
202 return buf; 202 return buf;
203} 203}
204 204
205static Eina_Stringshare *
206parse_c_name(Eo_Lexer *ls)
207{
208 eo_lexer_get(ls);
209 int pline = ls->line_number, pcol = ls->column;
210 check_next(ls, '(');
211 check(ls, TOK_VALUE);
212 if (eo_lexer_is_type_keyword(ls->t.kw))
213 eo_lexer_syntax_error(ls, "invalid name");
214 Eina_Stringshare *cname = eina_stringshare_add(ls->t.value.s);
215 eo_lexer_get(ls);
216 if (ls->t.token != ')')
217 {
218 eina_stringshare_del(cname);
219 check_match(ls, ')', '(', pline, pcol);
220 }
221 return cname;
222}
223
205static Eolian_Binary_Operator 224static Eolian_Binary_Operator
206get_binop_id(int tok) 225get_binop_id(int tok)
207{ 226{
@@ -445,21 +464,33 @@ _struct_field_free(Eolian_Struct_Type_Field *def)
445 464
446static Eolian_Typedecl * 465static Eolian_Typedecl *
447parse_struct(Eo_Lexer *ls, const char *name, Eina_Bool is_extern, 466parse_struct(Eo_Lexer *ls, const char *name, Eina_Bool is_extern,
448 Eina_Bool is_beta, int line, int column, const char *freefunc) 467 Eina_Bool is_beta, int line, int column, const char *freefunc,
468 const char *cname)
449{ 469{
450 int bline = ls->line_number, bcolumn = ls->column; 470 int bline = ls->line_number, bcolumn = ls->column;
451 Eolian_Typedecl *def = eo_lexer_typedecl_new(ls); 471 Eolian_Typedecl *def = eo_lexer_typedecl_new(ls);
452 def->is_extern = is_extern; 472 def->is_extern = is_extern;
453 def->base.is_beta = is_beta; 473 def->base.is_beta = is_beta;
454 def->base.name = name; 474 def->base.name = name;
455 def->base.c_name = make_c_name(name);
456 def->type = EOLIAN_TYPEDECL_STRUCT; 475 def->type = EOLIAN_TYPEDECL_STRUCT;
457 def->fields = eina_hash_string_small_new(EINA_FREE_CB(_struct_field_free)); 476 def->fields = eina_hash_string_small_new(EINA_FREE_CB(_struct_field_free));
458 if (freefunc) 477 if (freefunc)
478 def->freefunc = eina_stringshare_ref(freefunc);
479 if (cname)
459 { 480 {
460 def->freefunc = eina_stringshare_ref(freefunc); 481 def->base.c_name = cname;
461 eo_lexer_dtor_pop(ls); 482 eo_lexer_dtor_pop(ls);
462 } 483 }
484 else
485 def->base.c_name = make_c_name(name);
486 /* we can't know the order, pop when both are filled */
487 if (freefunc && cname)
488 {
489 eo_lexer_dtor_pop(ls);
490 eo_lexer_dtor_pop(ls);
491 }
492 else if (freefunc || cname)
493 eo_lexer_dtor_pop(ls);
463 check_next(ls, '{'); 494 check_next(ls, '{');
464 FILL_DOC(ls, def, doc); 495 FILL_DOC(ls, def, doc);
465 while (ls->t.token != '}') 496 while (ls->t.token != '}')
@@ -505,14 +536,20 @@ _enum_field_free(Eolian_Enum_Type_Field *def)
505 536
506static Eolian_Typedecl * 537static Eolian_Typedecl *
507parse_enum(Eo_Lexer *ls, const char *name, Eina_Bool is_extern, 538parse_enum(Eo_Lexer *ls, const char *name, Eina_Bool is_extern,
508 Eina_Bool is_beta, int line, int column) 539 Eina_Bool is_beta, int line, int column, const char *cname)
509{ 540{
510 int bline = ls->line_number, bcolumn = ls->column; 541 int bline = ls->line_number, bcolumn = ls->column;
511 Eolian_Typedecl *def = eo_lexer_typedecl_new(ls); 542 Eolian_Typedecl *def = eo_lexer_typedecl_new(ls);
512 def->is_extern = is_extern; 543 def->is_extern = is_extern;
513 def->base.is_beta = is_beta; 544 def->base.is_beta = is_beta;
514 def->base.name = name; 545 def->base.name = name;
515 def->base.c_name = make_c_name(name); 546 if (cname)
547 {
548 def->base.c_name = cname;
549 eo_lexer_dtor_pop(ls);
550 }
551 else
552 def->base.c_name = make_c_name(name);
516 def->type = EOLIAN_TYPEDECL_ENUM; 553 def->type = EOLIAN_TYPEDECL_ENUM;
517 def->fields = eina_hash_string_small_new(EINA_FREE_CB(_enum_field_free)); 554 def->fields = eina_hash_string_small_new(EINA_FREE_CB(_enum_field_free));
518 check_next(ls, '{'); 555 check_next(ls, '{');
@@ -738,7 +775,6 @@ parse_type_void(Eo_Lexer *ls, Eina_Bool allow_ptr)
738 def->type = EOLIAN_TYPE_CLASS; 775 def->type = EOLIAN_TYPE_CLASS;
739 } 776 }
740 def->base.name = eina_stringshare_add(nm); 777 def->base.name = eina_stringshare_add(nm);
741 def->base.c_name = make_c_name(nm);
742 eo_lexer_context_pop(ls); 778 eo_lexer_context_pop(ls);
743 eo_lexer_dtor_pop(ls); 779 eo_lexer_dtor_pop(ls);
744 } 780 }
@@ -752,7 +788,8 @@ parse_typedef(Eo_Lexer *ls)
752 Eolian_Typedecl *def = eo_lexer_typedecl_new(ls); 788 Eolian_Typedecl *def = eo_lexer_typedecl_new(ls);
753 Eina_Strbuf *buf; 789 Eina_Strbuf *buf;
754 eo_lexer_get(ls); 790 eo_lexer_get(ls);
755 Eina_Bool has_extern = EINA_FALSE, has_beta = EINA_FALSE; 791 Eina_Stringshare *cname = NULL;
792 Eina_Bool has_extern = EINA_FALSE, has_beta = EINA_FALSE, has_c_name = EINA_FALSE;
756 for (;;) switch (ls->t.kw) 793 for (;;) switch (ls->t.kw)
757 { 794 {
758 case KW_at_extern: 795 case KW_at_extern:
@@ -765,6 +802,11 @@ parse_typedef(Eo_Lexer *ls)
765 def->base.is_beta = EINA_TRUE; 802 def->base.is_beta = EINA_TRUE;
766 eo_lexer_get(ls); 803 eo_lexer_get(ls);
767 break; 804 break;
805 case KW_at_c_name:
806 CASE_LOCK(ls, c_name, "@c_name specifier");
807 cname = parse_c_name(ls);
808 eo_lexer_dtor_push(ls, EINA_FREE_CB(eina_stringshare_del), (void *)cname);
809 break;
768 default: 810 default:
769 goto tags_done; 811 goto tags_done;
770 } 812 }
@@ -776,7 +818,13 @@ tags_done:
776 FILL_BASE(def->base, ls, ls->line_number, ls->column, TYPEDECL); 818 FILL_BASE(def->base, ls, ls->line_number, ls->column, TYPEDECL);
777 parse_name(ls, buf); 819 parse_name(ls, buf);
778 def->base.name = eina_stringshare_add(eina_strbuf_string_get(buf)); 820 def->base.name = eina_stringshare_add(eina_strbuf_string_get(buf));
779 def->base.c_name = make_c_name(def->base.name); 821 if (cname)
822 {
823 def->base.c_name = cname;
824 eo_lexer_dtor_pop(ls);
825 }
826 else
827 def->base.c_name = make_c_name(def->base.name);
780 Eolian_Object *decl = _eolian_decl_get(ls, def->base.name); 828 Eolian_Object *decl = _eolian_decl_get(ls, def->base.name);
781 if (decl) 829 if (decl)
782 { 830 {
@@ -798,7 +846,8 @@ parse_variable(Eo_Lexer *ls, Eina_Bool global)
798 Eolian_Variable *def = eo_lexer_variable_new(ls); 846 Eolian_Variable *def = eo_lexer_variable_new(ls);
799 Eina_Strbuf *buf; 847 Eina_Strbuf *buf;
800 eo_lexer_get(ls); 848 eo_lexer_get(ls);
801 Eina_Bool has_extern = EINA_FALSE, has_beta = EINA_FALSE; 849 Eina_Stringshare *cname = NULL;
850 Eina_Bool has_extern = EINA_FALSE, has_beta = EINA_FALSE, has_c_name = EINA_FALSE;
802 for (;;) switch (ls->t.kw) 851 for (;;) switch (ls->t.kw)
803 { 852 {
804 case KW_at_extern: 853 case KW_at_extern:
@@ -811,6 +860,11 @@ parse_variable(Eo_Lexer *ls, Eina_Bool global)
811 def->base.is_beta = EINA_TRUE; 860 def->base.is_beta = EINA_TRUE;
812 eo_lexer_get(ls); 861 eo_lexer_get(ls);
813 break; 862 break;
863 case KW_at_c_name:
864 CASE_LOCK(ls, c_name, "@c_name specifier");
865 cname = parse_c_name(ls);
866 eo_lexer_dtor_push(ls, EINA_FREE_CB(eina_stringshare_del), (void *)cname);
867 break;
814 default: 868 default:
815 goto tags_done; 869 goto tags_done;
816 } 870 }
@@ -822,7 +876,13 @@ tags_done:
822 FILL_BASE(def->base, ls, ls->line_number, ls->column, VARIABLE); 876 FILL_BASE(def->base, ls, ls->line_number, ls->column, VARIABLE);
823 parse_name(ls, buf); 877 parse_name(ls, buf);
824 def->base.name = eina_stringshare_add(eina_strbuf_string_get(buf)); 878 def->base.name = eina_stringshare_add(eina_strbuf_string_get(buf));
825 def->base.c_name = make_c_name(def->base.name); 879 if (cname)
880 {
881 def->base.c_name = cname;
882 eo_lexer_dtor_pop(ls);
883 }
884 else
885 def->base.c_name = make_c_name(def->base.name);
826 Eolian_Object *decl = _eolian_decl_get(ls, def->base.name); 886 Eolian_Object *decl = _eolian_decl_get(ls, def->base.name);
827 if (decl) 887 if (decl)
828 { 888 {
@@ -1236,8 +1296,10 @@ parse_function_pointer(Eo_Lexer *ls)
1236 eo_lexer_dtor_push(ls, EINA_FREE_CB(eina_strbuf_free), buf); 1296 eo_lexer_dtor_push(ls, EINA_FREE_CB(eina_strbuf_free), buf);
1237 Eolian_Function *meth = NULL; 1297 Eolian_Function *meth = NULL;
1238 1298
1299 Eina_Stringshare *cname = NULL;
1239 Eina_Bool has_params = EINA_FALSE, 1300 Eina_Bool has_params = EINA_FALSE,
1240 has_return = EINA_FALSE; 1301 has_return = EINA_FALSE,
1302 has_c_name = EINA_FALSE;
1241 1303
1242 eo_lexer_get(ls); 1304 eo_lexer_get(ls);
1243 1305
@@ -1255,13 +1317,24 @@ parse_function_pointer(Eo_Lexer *ls)
1255 def->base.is_beta = EINA_TRUE; 1317 def->base.is_beta = EINA_TRUE;
1256 eo_lexer_get(ls); 1318 eo_lexer_get(ls);
1257 break; 1319 break;
1320 case KW_at_c_name:
1321 CASE_LOCK(ls, c_name, "@c_name specifier");
1322 cname = parse_c_name(ls);
1323 eo_lexer_dtor_push(ls, EINA_FREE_CB(eina_stringshare_del), (void *)cname);
1324 break;
1258 default: 1325 default:
1259 goto tags_done; 1326 goto tags_done;
1260 } 1327 }
1261tags_done: 1328tags_done:
1262 parse_name(ls, buf); 1329 parse_name(ls, buf);
1263 def->base.name = eina_stringshare_add(eina_strbuf_string_get(buf)); 1330 def->base.name = eina_stringshare_add(eina_strbuf_string_get(buf));
1264 def->base.c_name = make_c_name(def->base.name); 1331 if (cname)
1332 {
1333 def->base.c_name = cname;
1334 eo_lexer_dtor_pop(ls);
1335 }
1336 else
1337 def->base.c_name = make_c_name(def->base.name);
1265 eo_lexer_dtor_pop(ls); 1338 eo_lexer_dtor_pop(ls);
1266 1339
1267 meth = calloc(1, sizeof(Eolian_Function)); 1340 meth = calloc(1, sizeof(Eolian_Function));
@@ -2035,11 +2108,24 @@ parse_class(Eo_Lexer *ls, Eolian_Class_Type type)
2035 eo_lexer_get(ls); 2108 eo_lexer_get(ls);
2036 ls->klass->type = type; 2109 ls->klass->type = type;
2037 eo_lexer_context_push(ls); 2110 eo_lexer_context_push(ls);
2038 if (ls->t.kw == KW_at_beta) 2111 Eina_Stringshare *cname = NULL;
2112 Eina_Bool has_beta = EINA_FALSE, has_c_name = EINA_FALSE;
2113 for (;;) switch (ls->t.kw)
2039 { 2114 {
2115 case KW_at_beta:
2116 CASE_LOCK(ls, beta, "beta qualifier");
2040 ls->klass->base.is_beta = EINA_TRUE; 2117 ls->klass->base.is_beta = EINA_TRUE;
2041 eo_lexer_get(ls); 2118 eo_lexer_get(ls);
2119 break;
2120 case KW_at_c_name:
2121 CASE_LOCK(ls, c_name, "@c_name specifier");
2122 cname = parse_c_name(ls);
2123 eo_lexer_dtor_push(ls, EINA_FREE_CB(eina_stringshare_del), (void *)cname);
2124 break;
2125 default:
2126 goto tags_done;
2042 } 2127 }
2128tags_done:
2043 parse_name(ls, buf); 2129 parse_name(ls, buf);
2044 bnm = eina_stringshare_ref(ls->filename); 2130 bnm = eina_stringshare_ref(ls->filename);
2045 fnm = database_class_to_filename(eina_strbuf_string_get(buf)); 2131 fnm = database_class_to_filename(eina_strbuf_string_get(buf));
@@ -2052,7 +2138,13 @@ parse_class(Eo_Lexer *ls, Eolian_Class_Type type)
2052 eo_lexer_syntax_error(ls, "class and file names differ"); 2138 eo_lexer_syntax_error(ls, "class and file names differ");
2053 } 2139 }
2054 ls->klass->base.name = eina_stringshare_add(eina_strbuf_string_get(buf)); 2140 ls->klass->base.name = eina_stringshare_add(eina_strbuf_string_get(buf));
2055 ls->klass->base.c_name = make_c_name(ls->klass->base.name); 2141 if (cname)
2142 {
2143 ls->klass->base.c_name = cname;
2144 eo_lexer_dtor_pop(ls);
2145 }
2146 else
2147 ls->klass->base.c_name = make_c_name(ls->klass->base.name);
2056 Eolian_Object *decl = _eolian_decl_get(ls, ls->klass->base.name); 2148 Eolian_Object *decl = _eolian_decl_get(ls, ls->klass->base.name);
2057 if (decl) 2149 if (decl)
2058 { 2150 {
@@ -2187,10 +2279,11 @@ parse_unit(Eo_Lexer *ls, Eina_Bool eot)
2187 Eina_Bool is_enum = (ls->t.kw == KW_enum); 2279 Eina_Bool is_enum = (ls->t.kw == KW_enum);
2188 const char *name; 2280 const char *name;
2189 int line, col; 2281 int line, col;
2190 const char *freefunc = NULL; 2282 const char *freefunc = NULL, *cname = NULL;
2191 Eina_Strbuf *buf; 2283 Eina_Strbuf *buf;
2192 eo_lexer_get(ls); 2284 eo_lexer_get(ls);
2193 Eina_Bool has_extern = EINA_FALSE, has_free = EINA_FALSE, has_beta = EINA_FALSE; 2285 Eina_Bool has_extern = EINA_FALSE, has_free = EINA_FALSE,
2286 has_beta = EINA_FALSE, has_c_name = EINA_FALSE;
2194 for (;;) switch (ls->t.kw) 2287 for (;;) switch (ls->t.kw)
2195 { 2288 {
2196 case KW_at_extern: 2289 case KW_at_extern:
@@ -2201,6 +2294,11 @@ parse_unit(Eo_Lexer *ls, Eina_Bool eot)
2201 CASE_LOCK(ls, beta, "@beta qualifier") 2294 CASE_LOCK(ls, beta, "@beta qualifier")
2202 eo_lexer_get(ls); 2295 eo_lexer_get(ls);
2203 break; 2296 break;
2297 case KW_at_c_name:
2298 CASE_LOCK(ls, c_name, "@c_name specifier");
2299 cname = parse_c_name(ls);
2300 eo_lexer_dtor_push(ls, EINA_FREE_CB(eina_stringshare_del), (void *)cname);
2301 break;
2204 case KW_at_free: 2302 case KW_at_free:
2205 { 2303 {
2206 CASE_LOCK(ls, free, "@free qualifier") 2304 CASE_LOCK(ls, free, "@free qualifier")
@@ -2247,12 +2345,20 @@ postparams:
2247 def->base.is_beta = has_beta; 2345 def->base.is_beta = has_beta;
2248 def->type = EOLIAN_TYPEDECL_STRUCT_OPAQUE; 2346 def->type = EOLIAN_TYPEDECL_STRUCT_OPAQUE;
2249 if (freefunc) 2347 if (freefunc)
2348 def->freefunc = eina_stringshare_ref(freefunc);
2349 def->base.name = name;
2350 if (cname)
2351 def->base.c_name = cname;
2352 /* we can't know the order, pop when both are filled */
2353 if (freefunc && cname)
2250 { 2354 {
2251 def->freefunc = eina_stringshare_ref(freefunc); 2355 eo_lexer_dtor_pop(ls);
2252 eo_lexer_dtor_pop(ls); 2356 eo_lexer_dtor_pop(ls);
2253 } 2357 }
2254 def->base.name = name; 2358 else if (freefunc || cname)
2255 def->base.c_name = make_c_name(name); 2359 eo_lexer_dtor_pop(ls);
2360 if (!def->base.c_name)
2361 def->base.c_name = make_c_name(name);
2256 eo_lexer_get(ls); 2362 eo_lexer_get(ls);
2257 FILL_DOC(ls, def, doc); 2363 FILL_DOC(ls, def, doc);
2258 FILL_BASE(def->base, ls, line, col, TYPEDECL); 2364 FILL_BASE(def->base, ls, line, col, TYPEDECL);
@@ -2260,9 +2366,9 @@ postparams:
2260 break; 2366 break;
2261 } 2367 }
2262 if (is_enum) 2368 if (is_enum)
2263 parse_enum(ls, name, has_extern, has_beta, line, col); 2369 parse_enum(ls, name, has_extern, has_beta, line, col, cname);
2264 else 2370 else
2265 parse_struct(ls, name, has_extern, has_beta, line, col, freefunc); 2371 parse_struct(ls, name, has_extern, has_beta, line, col, freefunc, cname);
2266 break; 2372 break;
2267 } 2373 }
2268 def: 2374 def: