summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bin/eolian/docs.c2
-rw-r--r--src/bin/eolian/headers.c18
-rw-r--r--src/bin/eolian/headers.h2
-rw-r--r--src/bin/eolian/sources.c51
-rw-r--r--src/bin/eolian/types.c10
-rw-r--r--src/bindings/luajit/eolian.lua24
-rw-r--r--src/lib/eolian/Eolian.h12
-rw-r--r--src/lib/eolian/database_expr.c2
-rw-r--r--src/lib/eolian/database_expr_api.c4
-rw-r--r--src/lib/eolian/database_type.c35
-rw-r--r--src/lib/eolian/database_type_api.c19
-rw-r--r--src/lib/eolian/database_validate.c8
-rw-r--r--src/lib/eolian/database_var.c4
-rw-r--r--src/lib/eolian/eo_parser.c10
-rw-r--r--src/lib/eolian/eolian_database.c39
-rw-r--r--src/lib/eolian/eolian_database.h13
-rw-r--r--src/lib/eolian_cxx/grammar/klass_def.hpp4
-rw-r--r--src/scripts/elua/apps/docgen/doctree.lua9
-rw-r--r--src/scripts/elua/modules/lualian.lua16
-rw-r--r--src/tests/eolian/eolian_parsing.c48
20 files changed, 170 insertions, 160 deletions
diff --git a/src/bin/eolian/docs.c b/src/bin/eolian/docs.c
index 09e63bf..a38ac19 100644
--- a/src/bin/eolian/docs.c
+++ b/src/bin/eolian/docs.c
@@ -377,7 +377,7 @@ eo_gen_docs_event_gen(const Eolian_Unit *src, const Eolian_Event *ev,
377 if (rt) 377 if (rt)
378 { 378 {
379 p = buf; 379 p = buf;
380 Eina_Stringshare *rts = eolian_type_c_type_get(rt, EOLIAN_C_TYPE_DEFAULT); 380 Eina_Stringshare *rts = eolian_type_c_type_get(src, rt, EOLIAN_C_TYPE_DEFAULT);
381 snprintf(buf, sizeof(buf), "@return %s", rts); 381 snprintf(buf, sizeof(buf), "@return %s", rts);
382 eina_stringshare_del(rts); 382 eina_stringshare_del(rts);
383 } 383 }
diff --git a/src/bin/eolian/headers.c b/src/bin/eolian/headers.c
index 90fc1ea..b2fe73a 100644
--- a/src/bin/eolian/headers.c
+++ b/src/bin/eolian/headers.c
@@ -12,12 +12,13 @@ _get_add_star(Eolian_Function_Type ftype, Eolian_Parameter_Dir pdir)
12} 12}
13 13
14static int 14static int
15_gen_param(Eina_Strbuf *buf, Eolian_Function_Parameter *pr, Eolian_Function_Type ftype, int *rpid) 15_gen_param(const Eolian_Unit *src, Eina_Strbuf *buf,
16 Eolian_Function_Parameter *pr, Eolian_Function_Type ftype, int *rpid)
16{ 17{
17 const Eolian_Type *prt = eolian_parameter_type_get(pr); 18 const Eolian_Type *prt = eolian_parameter_type_get(pr);
18 const Eolian_Typedecl *ptd = eolian_type_typedecl_get(prt); 19 const Eolian_Typedecl *ptd = eolian_type_typedecl_get(src, prt);
19 const char *prn = eolian_parameter_name_get(pr); 20 const char *prn = eolian_parameter_name_get(pr);
20 Eina_Stringshare *prtn = eolian_type_c_type_get(prt, EOLIAN_C_TYPE_PARAM); 21 Eina_Stringshare *prtn = eolian_type_c_type_get(src, prt, EOLIAN_C_TYPE_PARAM);
21 22
22 if (ptd && (eolian_typedecl_type_get(ptd) == EOLIAN_TYPEDECL_FUNCTION_POINTER)) 23 if (ptd && (eolian_typedecl_type_get(ptd) == EOLIAN_TYPEDECL_FUNCTION_POINTER))
23 { 24 {
@@ -39,7 +40,8 @@ _gen_param(Eina_Strbuf *buf, Eolian_Function_Parameter *pr, Eolian_Function_Type
39} 40}
40 41
41void 42void
42eo_gen_params(Eina_Iterator *itr, Eina_Strbuf *buf, Eina_Strbuf **flagbuf, int *nidx, Eolian_Function_Type ftype) 43eo_gen_params(const Eolian_Unit *src, Eina_Iterator *itr, Eina_Strbuf *buf,
44 Eina_Strbuf **flagbuf, int *nidx, Eolian_Function_Type ftype)
43{ 45{
44 Eolian_Function_Parameter *pr; 46 Eolian_Function_Parameter *pr;
45 EINA_ITERATOR_FOREACH(itr, pr) 47 EINA_ITERATOR_FOREACH(itr, pr)
@@ -47,7 +49,7 @@ eo_gen_params(Eina_Iterator *itr, Eina_Strbuf *buf, Eina_Strbuf **flagbuf, int *
47 int rpid = 0; 49 int rpid = 0;
48 if (*nidx) 50 if (*nidx)
49 eina_strbuf_append(buf, ", "); 51 eina_strbuf_append(buf, ", ");
50 *nidx += _gen_param(buf, pr, ftype, &rpid); 52 *nidx += _gen_param(src, buf, pr, ftype, &rpid);
51 53
52 if (!eolian_parameter_is_nonull(pr) || !flagbuf) 54 if (!eolian_parameter_is_nonull(pr) || !flagbuf)
53 continue; 55 continue;
@@ -110,7 +112,7 @@ _gen_func(const Eolian_Unit *src, const Eolian_Function *fid,
110 eina_strbuf_append(buf, legacy ? "EAPI " : "EOAPI "); 112 eina_strbuf_append(buf, legacy ? "EAPI " : "EOAPI ");
111 if (rtp) 113 if (rtp)
112 { 114 {
113 Eina_Stringshare *rtps = eolian_type_c_type_get(rtp, EOLIAN_C_TYPE_RETURN); 115 Eina_Stringshare *rtps = eolian_type_c_type_get(src, rtp, EOLIAN_C_TYPE_RETURN);
114 eina_strbuf_append(buf, rtps); 116 eina_strbuf_append(buf, rtps);
115 if (rtps[strlen(rtps) - 1] != '*') 117 if (rtps[strlen(rtps) - 1] != '*')
116 eina_strbuf_append_char(buf, ' '); 118 eina_strbuf_append_char(buf, ' ');
@@ -139,7 +141,7 @@ _gen_func(const Eolian_Unit *src, const Eolian_Function *fid,
139 eina_strbuf_append(buf, "Eo *obj"); 141 eina_strbuf_append(buf, "Eo *obj");
140 } 142 }
141 143
142 eo_gen_params(eolian_property_keys_get(fid, ftype), buf, &flagbuf, &nidx, EOLIAN_PROPERTY); 144 eo_gen_params(src, eolian_property_keys_get(fid, ftype), buf, &flagbuf, &nidx, EOLIAN_PROPERTY);
143 145
144 if (!var_as_ret) 146 if (!var_as_ret)
145 { 147 {
@@ -148,7 +150,7 @@ _gen_func(const Eolian_Unit *src, const Eolian_Function *fid,
148 itr = eolian_property_values_get(fid, ftype); 150 itr = eolian_property_values_get(fid, ftype);
149 else 151 else
150 itr = eolian_function_parameters_get(fid); 152 itr = eolian_function_parameters_get(fid);
151 eo_gen_params(itr, buf, &flagbuf, &nidx, ftype); 153 eo_gen_params(src, itr, buf, &flagbuf, &nidx, ftype);
152 } 154 }
153 155
154 if (flagbuf) 156 if (flagbuf)
diff --git a/src/bin/eolian/headers.h b/src/bin/eolian/headers.h
index 56e4b4f..41c7658 100644
--- a/src/bin/eolian/headers.h
+++ b/src/bin/eolian/headers.h
@@ -3,7 +3,7 @@
3 3
4#include "main.h" 4#include "main.h"
5 5
6void eo_gen_params(Eina_Iterator *itr, Eina_Strbuf *buf, Eina_Strbuf **flagbuf, int *nidx, Eolian_Function_Type ftype); 6void eo_gen_params(const Eolian_Unit *src, Eina_Iterator *itr, Eina_Strbuf *buf, Eina_Strbuf **flagbuf, int *nidx, Eolian_Function_Type ftype);
7void eo_gen_header_gen(const Eolian_Unit *src, const Eolian_Class *cl, Eina_Strbuf *buf, Eina_Bool legacy); 7void eo_gen_header_gen(const Eolian_Unit *src, const Eolian_Class *cl, Eina_Strbuf *buf, Eina_Bool legacy);
8 8
9#endif 9#endif
diff --git a/src/bin/eolian/sources.c b/src/bin/eolian/sources.c
index a8a349f..a012e8c 100644
--- a/src/bin/eolian/sources.c
+++ b/src/bin/eolian/sources.c
@@ -123,13 +123,13 @@ _append_defval(const Eolian_Unit *src, Eina_Strbuf *buf,
123 else WRN("evaluation of default value failed"); 123 else WRN("evaluation of default value failed");
124 } 124 }
125 /* default value or fallback */ 125 /* default value or fallback */
126 const Eolian_Type *btp = eolian_type_aliased_base_get(tp); 126 const Eolian_Type *btp = eolian_type_aliased_base_get(src, tp);
127 if (eolian_type_is_ptr(btp)) 127 if (eolian_type_is_ptr(btp))
128 { 128 {
129 eina_strbuf_append(buf, "NULL"); 129 eina_strbuf_append(buf, "NULL");
130 return; 130 return;
131 } 131 }
132 const Eolian_Typedecl *tdcl = eolian_type_typedecl_get(btp); 132 const Eolian_Typedecl *tdcl = eolian_type_typedecl_get(src, btp);
133 if (tdcl && (eolian_typedecl_type_get(tdcl) == EOLIAN_TYPEDECL_STRUCT)) 133 if (tdcl && (eolian_typedecl_type_get(tdcl) == EOLIAN_TYPEDECL_STRUCT))
134 { 134 {
135 char *sn = eo_gen_c_full_name_get(eolian_typedecl_full_name_get(tdcl)); 135 char *sn = eo_gen_c_full_name_get(eolian_typedecl_full_name_get(tdcl));
@@ -140,7 +140,7 @@ _append_defval(const Eolian_Unit *src, Eina_Strbuf *buf,
140 free(sn); 140 free(sn);
141 return; 141 return;
142 } 142 }
143 Eina_Stringshare *ctp = eolian_type_c_type_get(btp, EOLIAN_C_TYPE_DEFAULT); 143 Eina_Stringshare *ctp = eolian_type_c_type_get(src, btp, EOLIAN_C_TYPE_DEFAULT);
144 if (strchr(ctp, '*')) 144 if (strchr(ctp, '*'))
145 { 145 {
146 eina_strbuf_append(buf, "NULL"); 146 eina_strbuf_append(buf, "NULL");
@@ -182,7 +182,7 @@ _generate_loop_content(Eina_Strbuf **buf, const Eolian_Type *inner_type, const E
182} 182}
183 183
184static void 184static void
185_generate_iterative_free(Eina_Strbuf **buf, const Eolian_Type *type, const Eolian_Type *inner_type, Eolian_Function_Parameter *parameter, Eina_Strbuf *param) 185_generate_iterative_free(const Eolian_Unit *src, Eina_Strbuf **buf, const Eolian_Type *type, const Eolian_Type *inner_type, Eolian_Function_Parameter *parameter, Eina_Strbuf *param)
186{ 186{
187 Eina_Strbuf *iterator_header, *iter_param; 187 Eina_Strbuf *iterator_header, *iter_param;
188 188
@@ -194,7 +194,7 @@ _generate_iterative_free(Eina_Strbuf **buf, const Eolian_Type *type, const Eolia
194 eina_strbuf_append_printf(iter_param, "%s_iter", eolian_parameter_name_get(parameter)); 194 eina_strbuf_append_printf(iter_param, "%s_iter", eolian_parameter_name_get(parameter));
195 195
196 //generate the field definition 196 //generate the field definition
197 eina_strbuf_append_printf(*buf, " %s", eolian_type_c_type_get(inner_type, EOLIAN_C_TYPE_DEFAULT)); 197 eina_strbuf_append_printf(*buf, " %s", eolian_type_c_type_get(src, inner_type, EOLIAN_C_TYPE_DEFAULT));
198 if(t == EOLIAN_TYPE_BUILTIN_INARRAY 198 if(t == EOLIAN_TYPE_BUILTIN_INARRAY
199 || t == EOLIAN_TYPE_BUILTIN_INLIST) 199 || t == EOLIAN_TYPE_BUILTIN_INLIST)
200 { 200 {
@@ -328,7 +328,7 @@ _gen_func(const Eolian_Unit *src, const Eolian_Class *cl,
328 { 328 {
329 const char *prn = eolian_parameter_name_get(pr); 329 const char *prn = eolian_parameter_name_get(pr);
330 const Eolian_Type *pt = eolian_parameter_type_get(pr); 330 const Eolian_Type *pt = eolian_parameter_type_get(pr);
331 Eina_Stringshare *ptn = eolian_type_c_type_get(pt, EOLIAN_C_TYPE_PARAM); 331 Eina_Stringshare *ptn = eolian_type_c_type_get(src, pt, EOLIAN_C_TYPE_PARAM);
332 332
333 if (eina_strbuf_length_get(params)) 333 if (eina_strbuf_length_get(params))
334 eina_strbuf_append(params, ", "); 334 eina_strbuf_append(params, ", ");
@@ -400,7 +400,7 @@ _gen_func(const Eolian_Unit *src, const Eolian_Class *cl,
400 } 400 }
401 else if (inner_type && eolian_type_is_owned(inner_type)) 401 else if (inner_type && eolian_type_is_owned(inner_type))
402 { 402 {
403 _generate_iterative_free(&fallback_free_ownership, type, inner_type, pr, param_call); 403 _generate_iterative_free(src, &fallback_free_ownership, type, inner_type, pr, param_call);
404 } 404 }
405 } 405 }
406 eina_iterator_free(itr); 406 eina_iterator_free(itr);
@@ -429,8 +429,8 @@ _gen_func(const Eolian_Unit *src, const Eolian_Class *cl,
429 const Eolian_Expression *dfv = eolian_parameter_default_value_get(pr); 429 const Eolian_Expression *dfv = eolian_parameter_default_value_get(pr);
430 const char *prn = eolian_parameter_name_get(pr); 430 const char *prn = eolian_parameter_name_get(pr);
431 const Eolian_Type *pt = eolian_parameter_type_get(pr); 431 const Eolian_Type *pt = eolian_parameter_type_get(pr);
432 Eina_Stringshare *ptn = eolian_type_c_type_get(pt, EOLIAN_C_TYPE_PARAM); 432 Eina_Stringshare *ptn = eolian_type_c_type_get(src, pt, EOLIAN_C_TYPE_PARAM);
433 const Eolian_Typedecl *ptd = eolian_type_typedecl_get(pt); 433 const Eolian_Typedecl *ptd = eolian_type_typedecl_get(src, pt);
434 434
435 Eina_Bool had_star = ptn[strlen(ptn) - 1] == '*'; 435 Eina_Bool had_star = ptn[strlen(ptn) - 1] == '*';
436 const char *add_star = _get_add_star(ftype, pd); 436 const char *add_star = _get_add_star(ftype, pd);
@@ -501,7 +501,7 @@ _gen_func(const Eolian_Unit *src, const Eolian_Class *cl,
501 if (impl_same_class && eolian_implement_is_pure_virtual(impl, ftype)) 501 if (impl_same_class && eolian_implement_is_pure_virtual(impl, ftype))
502 impl_need = EINA_FALSE; 502 impl_need = EINA_FALSE;
503 503
504 Eina_Stringshare *rtpn = rtp ? eolian_type_c_type_get(rtp, EOLIAN_C_TYPE_RETURN) 504 Eina_Stringshare *rtpn = rtp ? eolian_type_c_type_get(src, rtp, EOLIAN_C_TYPE_RETURN)
505 : eina_stringshare_add("void"); 505 : eina_stringshare_add("void");
506 506
507 char *cname = NULL, *cnamel = NULL, *ocnamel = NULL; 507 char *cname = NULL, *cnamel = NULL, *ocnamel = NULL;
@@ -1018,8 +1018,9 @@ eo_gen_source_gen(const Eolian_Unit *src,
1018} 1018}
1019 1019
1020static void 1020static void
1021_gen_params(const Eolian_Function *fid, Eolian_Function_Type ftype, 1021_gen_params(const Eolian_Unit *src, const Eolian_Function *fid,
1022 Eina_Bool var_as_ret, Eina_Strbuf *params, Eina_Strbuf *params_full) 1022 Eolian_Function_Type ftype, Eina_Bool var_as_ret,
1023 Eina_Strbuf *params, Eina_Strbuf *params_full)
1023{ 1024{
1024 Eina_Bool is_prop = (ftype == EOLIAN_PROP_GET || ftype == EOLIAN_PROP_SET); 1025 Eina_Bool is_prop = (ftype == EOLIAN_PROP_GET || ftype == EOLIAN_PROP_SET);
1025 1026
@@ -1031,7 +1032,7 @@ _gen_params(const Eolian_Function *fid, Eolian_Function_Type ftype,
1031 { 1032 {
1032 const char *prn = eolian_parameter_name_get(pr); 1033 const char *prn = eolian_parameter_name_get(pr);
1033 const Eolian_Type *pt = eolian_parameter_type_get(pr); 1034 const Eolian_Type *pt = eolian_parameter_type_get(pr);
1034 Eina_Stringshare *ptn = eolian_type_c_type_get(pt, EOLIAN_C_TYPE_PARAM); 1035 Eina_Stringshare *ptn = eolian_type_c_type_get(src, pt, EOLIAN_C_TYPE_PARAM);
1035 1036
1036 eina_strbuf_append(params, ", "); 1037 eina_strbuf_append(params, ", ");
1037 eina_strbuf_append(params, prn); 1038 eina_strbuf_append(params, prn);
@@ -1060,8 +1061,8 @@ _gen_params(const Eolian_Function *fid, Eolian_Function_Type ftype,
1060 Eolian_Parameter_Dir pd = eolian_parameter_direction_get(pr); 1061 Eolian_Parameter_Dir pd = eolian_parameter_direction_get(pr);
1061 const char *prn = eolian_parameter_name_get(pr); 1062 const char *prn = eolian_parameter_name_get(pr);
1062 const Eolian_Type *pt = eolian_parameter_type_get(pr); 1063 const Eolian_Type *pt = eolian_parameter_type_get(pr);
1063 const Eolian_Typedecl *ptd = eolian_type_typedecl_get(pt); 1064 const Eolian_Typedecl *ptd = eolian_type_typedecl_get(src, pt);
1064 Eina_Stringshare *ptn = eolian_type_c_type_get(pt, EOLIAN_C_TYPE_PARAM); 1065 Eina_Stringshare *ptn = eolian_type_c_type_get(src, pt, EOLIAN_C_TYPE_PARAM);
1065 1066
1066 if (ptd && eolian_typedecl_type_get(ptd) == EOLIAN_TYPEDECL_FUNCTION_POINTER) 1067 if (ptd && eolian_typedecl_type_get(ptd) == EOLIAN_TYPEDECL_FUNCTION_POINTER)
1067 { 1068 {
@@ -1092,9 +1093,9 @@ _gen_params(const Eolian_Function *fid, Eolian_Function_Type ftype,
1092} 1093}
1093 1094
1094static void 1095static void
1095_gen_proto(const Eolian_Class *cl, const Eolian_Function *fid, 1096_gen_proto(const Eolian_Unit *src, const Eolian_Class *cl,
1096 Eolian_Function_Type ftype, Eina_Strbuf *buf, 1097 const Eolian_Function *fid, Eolian_Function_Type ftype,
1097 const Eolian_Implement *impl, const char *dtype, 1098 Eina_Strbuf *buf, const Eolian_Implement *impl, const char *dtype,
1098 const char *cnamel) 1099 const char *cnamel)
1099{ 1100{
1100 Eina_Bool impl_same_class = (eolian_implement_class_get(impl) == cl); 1101 Eina_Bool impl_same_class = (eolian_implement_class_get(impl) == cl);
@@ -1141,7 +1142,7 @@ _gen_proto(const Eolian_Class *cl, const Eolian_Function *fid,
1141 eina_strbuf_append(buf, "EOLIAN static "); 1142 eina_strbuf_append(buf, "EOLIAN static ");
1142 if (rtp) 1143 if (rtp)
1143 { 1144 {
1144 Eina_Stringshare *rtpn = eolian_type_c_type_get(rtp, EOLIAN_C_TYPE_RETURN); 1145 Eina_Stringshare *rtpn = eolian_type_c_type_get(src, rtp, EOLIAN_C_TYPE_RETURN);
1145 eina_strbuf_append(buf, rtpn); 1146 eina_strbuf_append(buf, rtpn);
1146 eina_stringshare_del(rtpn); 1147 eina_stringshare_del(rtpn);
1147 } 1148 }
@@ -1162,7 +1163,7 @@ _gen_proto(const Eolian_Class *cl, const Eolian_Function *fid,
1162 /* gen params here */ 1163 /* gen params here */
1163 Eina_Strbuf *params = eina_strbuf_new(); 1164 Eina_Strbuf *params = eina_strbuf_new();
1164 Eina_Strbuf *params_full = eina_strbuf_new(); 1165 Eina_Strbuf *params_full = eina_strbuf_new();
1165 _gen_params(fid, ftype, var_as_ret, params, params_full); 1166 _gen_params(src, fid, ftype, var_as_ret, params, params_full);
1166 1167
1167 if (eina_strbuf_length_get(params_full)) 1168 if (eina_strbuf_length_get(params_full))
1168 eina_strbuf_append(buf, eina_strbuf_string_get(params_full)); 1169 eina_strbuf_append(buf, eina_strbuf_string_get(params_full));
@@ -1192,7 +1193,7 @@ _gen_proto(const Eolian_Class *cl, const Eolian_Function *fid,
1192} 1193}
1193 1194
1194void 1195void
1195eo_gen_impl_gen(const Eolian_Unit *src EINA_UNUSED, 1196eo_gen_impl_gen(const Eolian_Unit *src,
1196 const Eolian_Class *cl, Eina_Strbuf *buf) 1197 const Eolian_Class *cl, Eina_Strbuf *buf)
1197{ 1198{
1198 if (!cl) 1199 if (!cl)
@@ -1243,14 +1244,14 @@ eo_gen_impl_gen(const Eolian_Unit *src EINA_UNUSED,
1243 { 1244 {
1244 case EOLIAN_PROP_GET: 1245 case EOLIAN_PROP_GET:
1245 case EOLIAN_PROP_SET: 1246 case EOLIAN_PROP_SET:
1246 _gen_proto(cl, fid, ftype, buf, imp, dt, cnamel); 1247 _gen_proto(src, cl, fid, ftype, buf, imp, dt, cnamel);
1247 break; 1248 break;
1248 case EOLIAN_PROPERTY: 1249 case EOLIAN_PROPERTY:
1249 _gen_proto(cl, fid, EOLIAN_PROP_SET, buf, imp, dt, cnamel); 1250 _gen_proto(src, cl, fid, EOLIAN_PROP_SET, buf, imp, dt, cnamel);
1250 _gen_proto(cl, fid, EOLIAN_PROP_GET, buf, imp, dt, cnamel); 1251 _gen_proto(src, cl, fid, EOLIAN_PROP_GET, buf, imp, dt, cnamel);
1251 break; 1252 break;
1252 default: 1253 default:
1253 _gen_proto(cl, fid, EOLIAN_METHOD, buf, imp, dt, cnamel); 1254 _gen_proto(src, cl, fid, EOLIAN_METHOD, buf, imp, dt, cnamel);
1254 } 1255 }
1255 } 1256 }
1256 eina_iterator_free(itr); 1257 eina_iterator_free(itr);
diff --git a/src/bin/eolian/types.c b/src/bin/eolian/types.c
index c98791e..d8285fb 100644
--- a/src/bin/eolian/types.c
+++ b/src/bin/eolian/types.c
@@ -41,7 +41,7 @@ _type_generate(const Eolian_Unit *src, const Eolian_Typedecl *tp,
41 { 41 {
42 const Eolian_Type *mtp = eolian_typedecl_struct_field_type_get(memb); 42 const Eolian_Type *mtp = eolian_typedecl_struct_field_type_get(memb);
43 Eina_Stringshare *ct = NULL; 43 Eina_Stringshare *ct = NULL;
44 ct = eolian_type_c_type_get(mtp, EOLIAN_C_TYPE_DEFAULT); 44 ct = eolian_type_c_type_get(src, mtp, EOLIAN_C_TYPE_DEFAULT);
45 eina_strbuf_append_printf(buf, " %s%s%s;", 45 eina_strbuf_append_printf(buf, " %s%s%s;",
46 ct, strchr(ct, '*') ? "" : " ", 46 ct, strchr(ct, '*') ? "" : " ",
47 eolian_typedecl_struct_field_name_get(memb)); 47 eolian_typedecl_struct_field_name_get(memb));
@@ -135,7 +135,7 @@ _type_generate(const Eolian_Unit *src, const Eolian_Typedecl *tp,
135 eina_strbuf_append(buf, "void "); 135 eina_strbuf_append(buf, "void ");
136 else 136 else
137 { 137 {
138 Eina_Stringshare *ct = eolian_type_c_type_get(rtp, EOLIAN_C_TYPE_RETURN); 138 Eina_Stringshare *ct = eolian_type_c_type_get(src, rtp, EOLIAN_C_TYPE_RETURN);
139 eina_strbuf_append_printf(buf, "%s ", ct); 139 eina_strbuf_append_printf(buf, "%s ", ct);
140 } 140 }
141 141
@@ -147,7 +147,7 @@ _type_generate(const Eolian_Unit *src, const Eolian_Typedecl *tp,
147 /* Parameters */ 147 /* Parameters */
148 eina_strbuf_append(buf, "(void *data"); 148 eina_strbuf_append(buf, "(void *data");
149 int nidx = 1; 149 int nidx = 1;
150 eo_gen_params(eolian_function_parameters_get(fid), buf, NULL, &nidx, EOLIAN_FUNCTION_POINTER); 150 eo_gen_params(src, eolian_function_parameters_get(fid), buf, NULL, &nidx, EOLIAN_FUNCTION_POINTER);
151 eina_strbuf_append(buf, ")"); 151 eina_strbuf_append(buf, ")");
152 152
153 break; 153 break;
@@ -195,7 +195,7 @@ _var_generate(const Eolian_Unit *src, const Eolian_Variable *vr, Eina_Bool legac
195 } 195 }
196 else 196 else
197 { 197 {
198 Eina_Stringshare *ct = eolian_type_c_type_get(vt, EOLIAN_C_TYPE_DEFAULT); 198 Eina_Stringshare *ct = eolian_type_c_type_get(src, vt, EOLIAN_C_TYPE_DEFAULT);
199 eina_strbuf_append_printf(buf, "EWAPI extern %s %s;", ct, fn); 199 eina_strbuf_append_printf(buf, "EWAPI extern %s %s;", ct, fn);
200 eina_stringshare_del(ct); 200 eina_stringshare_del(ct);
201 } 201 }
@@ -285,7 +285,7 @@ void eo_gen_types_source_gen(const Eolian_Unit *src,
285 eina_str_toupper(&fn); 285 eina_str_toupper(&fn);
286 286
287 const Eolian_Type *vt = eolian_variable_base_type_get(vr); 287 const Eolian_Type *vt = eolian_variable_base_type_get(vr);
288 Eina_Stringshare *ct = eolian_type_c_type_get(vt, EOLIAN_C_TYPE_DEFAULT); 288 Eina_Stringshare *ct = eolian_type_c_type_get(src, vt, EOLIAN_C_TYPE_DEFAULT);
289 eina_strbuf_append_printf(buf, "EWAPI %s %s = ", ct, fn); 289 eina_strbuf_append_printf(buf, "EWAPI %s %s = ", ct, fn);
290 eina_stringshare_del(ct); 290 eina_stringshare_del(ct);
291 free(fn); 291 free(fn);
diff --git a/src/bindings/luajit/eolian.lua b/src/bindings/luajit/eolian.lua
index 2851df0..080e06b 100644
--- a/src/bindings/luajit/eolian.lua
+++ b/src/bindings/luajit/eolian.lua
@@ -399,10 +399,10 @@ ffi.cdef [[
399 const Eolian_Type *eolian_type_base_type_get(const Eolian_Type *tp); 399 const Eolian_Type *eolian_type_base_type_get(const Eolian_Type *tp);
400 const Eolian_Type *eolian_type_next_type_get(const Eolian_Type *tp); 400 const Eolian_Type *eolian_type_next_type_get(const Eolian_Type *tp);
401 const Eolian_Type *eolian_typedecl_base_type_get(const Eolian_Typedecl *tp); 401 const Eolian_Type *eolian_typedecl_base_type_get(const Eolian_Typedecl *tp);
402 const Eolian_Typedecl *eolian_type_typedecl_get(const Eolian_Type *tp); 402 const Eolian_Typedecl *eolian_type_typedecl_get(const Eolian_Unit *unit, const Eolian_Type *tp);
403 403
404 const Eolian_Type *eolian_type_aliased_base_get(const Eolian_Type *tp); 404 const Eolian_Type *eolian_type_aliased_base_get(const Eolian_Unit *unit, const Eolian_Type *tp);
405 const Eolian_Type *eolian_typedecl_aliased_base_get(const Eolian_Typedecl *tp); 405 const Eolian_Type *eolian_typedecl_aliased_base_get(const Eolian_Unit *unit, const Eolian_Typedecl *tp);
406 406
407 const Eolian_Class *eolian_type_class_get(const Eolian_Unit *unit, const Eolian_Type *tp); 407 const Eolian_Class *eolian_type_class_get(const Eolian_Unit *unit, const Eolian_Type *tp);
408 Eina_Bool eolian_type_is_owned(const Eolian_Type *tp); 408 Eina_Bool eolian_type_is_owned(const Eolian_Type *tp);
@@ -411,7 +411,7 @@ ffi.cdef [[
411 411
412 Eina_Bool eolian_typedecl_is_extern(const Eolian_Typedecl *tp); 412 Eina_Bool eolian_typedecl_is_extern(const Eolian_Typedecl *tp);
413 413
414 const char *eolian_type_c_type_get(const Eolian_Type *tp, Eolian_C_Type_Type ctype); 414 const char *eolian_type_c_type_get(const Eolian_Unit *unit, const Eolian_Type *tp, Eolian_C_Type_Type ctype);
415 const char *eolian_typedecl_c_type_get(const Eolian_Unit *unit, const Eolian_Typedecl *tp); 415 const char *eolian_typedecl_c_type_get(const Eolian_Unit *unit, const Eolian_Typedecl *tp);
416 416
417 const char *eolian_type_name_get(const Eolian_Type *tp); 417 const char *eolian_type_name_get(const Eolian_Type *tp);
@@ -766,8 +766,8 @@ M.Typedecl = ffi.metatype("Eolian_Typedecl", {
766 return v 766 return v
767 end, 767 end,
768 768
769 aliased_base_get = function(self) 769 aliased_base_get = function(self, unit)
770 local v = eolian.eolian_typedecl_aliased_byse_get(self) 770 local v = eolian.eolian_typedecl_aliased_byse_get(unit, self)
771 if v == nil then return nil end 771 if v == nil then return nil end
772 return v 772 return v
773 end, 773 end,
@@ -841,14 +841,14 @@ M.Type = ffi.metatype("Eolian_Type", {
841 return v 841 return v
842 end, 842 end,
843 843
844 typedecl_get = function(self) 844 typedecl_get = function(self, unit)
845 local v = eolian.eolian_type_typedecl_get(self) 845 local v = eolian.eolian_type_typedecl_get(unit, self)
846 if v == nil then return nil end 846 if v == nil then return nil end
847 return v 847 return v
848 end, 848 end,
849 849
850 aliased_base_get = function(self) 850 aliased_base_get = function(self, unit)
851 local v = eolian.eolian_type_aliased_byse_get(self) 851 local v = eolian.eolian_type_aliased_byse_get(unit, self)
852 if v == nil then return nil end 852 if v == nil then return nil end
853 return v 853 return v
854 end, 854 end,
@@ -871,8 +871,8 @@ M.Type = ffi.metatype("Eolian_Type", {
871 return eolian.eolian_type_is_ptr(self) ~= 0 871 return eolian.eolian_type_is_ptr(self) ~= 0
872 end, 872 end,
873 873
874 c_type_get = function(self, ctype) 874 c_type_get = function(self, unit, ctype)
875 local v = eolian.eolian_type_c_type_get(self, ctype) 875 local v = eolian.eolian_type_c_type_get(unit, self, ctype)
876 if v == nil then return nil end 876 if v == nil then return nil end
877 return ffi_stringshare(v) 877 return ffi_stringshare(v)
878 end, 878 end,
diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h
index ad35d16..2f63366 100644
--- a/src/lib/eolian/Eolian.h
+++ b/src/lib/eolian/Eolian.h
@@ -1807,12 +1807,13 @@ EAPI const Eolian_Type *eolian_typedecl_base_type_get(const Eolian_Typedecl *tp)
1807 * If the given typedecl is an alias, it returns the result of 1807 * If the given typedecl is an alias, it returns the result of
1808 * eolian_type_aliased_base_get on its base type. Otherwise this returns NULL. 1808 * eolian_type_aliased_base_get on its base type. Otherwise this returns NULL.
1809 * 1809 *
1810 * @param[in] unit the unit to look in
1810 * @param[in] tp the type declaration. 1811 * @param[in] tp the type declaration.
1811 * @return the lowest alias base or the given type. 1812 * @return the lowest alias base or the given type.
1812 * 1813 *
1813 * @ingroup Eolian 1814 * @ingroup Eolian
1814 */ 1815 */
1815EAPI const Eolian_Type *eolian_typedecl_aliased_base_get(const Eolian_Typedecl *tp); 1816EAPI const Eolian_Type *eolian_typedecl_aliased_base_get(const Eolian_Unit *unit, const Eolian_Typedecl *tp);
1816 1817
1817/* 1818/*
1818 * @brief Check if a struct or alias type declaration is extern. 1819 * @brief Check if a struct or alias type declaration is extern.
@@ -1955,12 +1956,13 @@ EAPI const Eolian_Type *eolian_type_next_type_get(const Eolian_Type *tp);
1955 * 1956 *
1956 * This tries to look up alias, struct and enum in that order. 1957 * This tries to look up alias, struct and enum in that order.
1957 * 1958 *
1959 * @param[in] unit the unit to look in
1958 * @param[in] tp the type. 1960 * @param[in] tp the type.
1959 * @return the pointed to type decalration or NULL. 1961 * @return the pointed to type decalration or NULL.
1960 * 1962 *
1961 * @ingroup Eolian 1963 * @ingroup Eolian
1962 */ 1964 */
1963EAPI const Eolian_Typedecl *eolian_type_typedecl_get(const Eolian_Type *tp); 1965EAPI const Eolian_Typedecl *eolian_type_typedecl_get(const Eolian_Unit *unit, const Eolian_Type *tp);
1964 1966
1965/* 1967/*
1966 * @brief Get the lowest base type of an alias stack. 1968 * @brief Get the lowest base type of an alias stack.
@@ -1972,12 +1974,13 @@ EAPI const Eolian_Typedecl *eolian_type_typedecl_get(const Eolian_Type *tp);
1972 * type actually is while still having convenience. Keep in mind that this stops 1974 * type actually is while still having convenience. Keep in mind that this stops
1973 * if the found type is actually a pointer (has a ptr() on it). 1975 * if the found type is actually a pointer (has a ptr() on it).
1974 * 1976 *
1977 * @param[in] unit the unit to look in
1975 * @param[in] tp the type. 1978 * @param[in] tp the type.
1976 * @return the lowest alias base or the given type. 1979 * @return the lowest alias base or the given type.
1977 * 1980 *
1978 * @ingroup Eolian 1981 * @ingroup Eolian
1979 */ 1982 */
1980EAPI const Eolian_Type *eolian_type_aliased_base_get(const Eolian_Type *tp); 1983EAPI const Eolian_Type *eolian_type_aliased_base_get(const Eolian_Unit *unit, const Eolian_Type *tp);
1981 1984
1982/* 1985/*
1983 * @brief Get the class associated with an EOLIAN_TYPE_CLASS type. 1986 * @brief Get the class associated with an EOLIAN_TYPE_CLASS type.
@@ -2025,6 +2028,7 @@ EAPI Eina_Bool eolian_type_is_ptr(const Eolian_Type *tp);
2025/* 2028/*
2026 * @brief Get the full C type name of the given type. 2029 * @brief Get the full C type name of the given type.
2027 * 2030 *
2031 * @param[in] unit the unit to look in
2028 * @param[in] tp the type. 2032 * @param[in] tp the type.
2029 * @param[in] ctype the context within which the C type string will be used. 2033 * @param[in] ctype the context within which the C type string will be used.
2030 * @return The C type name assuming @c tp is not NULL. 2034 * @return The C type name assuming @c tp is not NULL.
@@ -2035,7 +2039,7 @@ EAPI Eina_Bool eolian_type_is_ptr(const Eolian_Type *tp);
2035 * 2039 *
2036 * @ingroup Eolian 2040 * @ingroup Eolian
2037 */ 2041 */
2038EAPI Eina_Stringshare *eolian_type_c_type_get(const Eolian_Type *tp, Eolian_C_Type_Type ctype); 2042EAPI Eina_Stringshare *eolian_type_c_type_get(const Eolian_Unit *unit, const Eolian_Type *tp, Eolian_C_Type_Type ctype);
2039 2043
2040/* 2044/*
2041 * @brief Get the name of the given type. For regular types, this is for 2045 * @brief Get the name of the given type. For regular types, this is for
diff --git a/src/lib/eolian/database_expr.c b/src/lib/eolian/database_expr.c
index 6a3b1d5..1b0a6d1 100644
--- a/src/lib/eolian/database_expr.c
+++ b/src/lib/eolian/database_expr.c
@@ -522,7 +522,7 @@ eval_exp(const Eolian_Unit *unit, const Eolian_Expression *expr,
522 const Eolian_Type *etp = eolian_typedecl_base_type_get(etpd); 522 const Eolian_Type *etp = eolian_typedecl_base_type_get(etpd);
523 if (!etp || etp->type != EOLIAN_TYPE_REGULAR) 523 if (!etp || etp->type != EOLIAN_TYPE_REGULAR)
524 break; 524 break;
525 etpd = eolian_type_typedecl_get(etp); 525 etpd = eolian_type_typedecl_get(unit, etp);
526 } 526 }
527 527
528 if (!etpd) etpd = eolian_typedecl_enum_get_by_name(unit, fulln); 528 if (!etpd) etpd = eolian_typedecl_enum_get_by_name(unit, fulln);
diff --git a/src/lib/eolian/database_expr_api.c b/src/lib/eolian/database_expr_api.c
index 9e8e1f6..adf5734 100644
--- a/src/lib/eolian/database_expr_api.c
+++ b/src/lib/eolian/database_expr_api.c
@@ -29,12 +29,12 @@ _eval_type(const Eolian_Unit *unit, const Eolian_Expression *expr,
29 return database_expr_eval(unit, expr, EOLIAN_MASK_NULL); 29 return database_expr_eval(unit, expr, EOLIAN_MASK_NULL);
30 case EOLIAN_TYPE_REGULAR: 30 case EOLIAN_TYPE_REGULAR:
31 { 31 {
32 if (database_type_is_ownable(type)) 32 if (database_type_is_ownable(unit, type))
33 return database_expr_eval(unit, expr, EOLIAN_MASK_NULL); 33 return database_expr_eval(unit, expr, EOLIAN_MASK_NULL);
34 int kw = eo_lexer_keyword_str_to_id(type->name); 34 int kw = eo_lexer_keyword_str_to_id(type->name);
35 if (!kw || kw < KW_byte || kw >= KW_void) 35 if (!kw || kw < KW_byte || kw >= KW_void)
36 { 36 {
37 const Eolian_Typedecl *base = eolian_type_typedecl_get(type); 37 const Eolian_Typedecl *base = eolian_type_typedecl_get(unit, type);
38 if (!base) 38 if (!base)
39 return err; 39 return err;
40 if (base->type == EOLIAN_TYPEDECL_ALIAS) 40 if (base->type == EOLIAN_TYPEDECL_ALIAS)
diff --git a/src/lib/eolian/database_type.c b/src/lib/eolian/database_type.c
index 5258709..1400aa0 100644
--- a/src/lib/eolian/database_type.c
+++ b/src/lib/eolian/database_type.c
@@ -47,7 +47,7 @@ database_type_add(Eolian *state, Eolian_Typedecl *def)
47 eina_hash_set(state->aliases_f, def->base.file, eina_list_append 47 eina_hash_set(state->aliases_f, def->base.file, eina_list_append
48 ((Eina_List*)eina_hash_find(state->aliases_f, def->base.file), 48 ((Eina_List*)eina_hash_find(state->aliases_f, def->base.file),
49 def)); 49 def));
50 database_decl_add(def->full_name, EOLIAN_DECL_ALIAS, def->base.file, def); 50 database_decl_add(state, def->full_name, EOLIAN_DECL_ALIAS, def->base.file, def);
51} 51}
52 52
53void 53void
@@ -56,7 +56,7 @@ database_struct_add(Eolian *state, Eolian_Typedecl *tp)
56 eina_hash_set(state->unit.structs, tp->full_name, tp); 56 eina_hash_set(state->unit.structs, tp->full_name, tp);
57 eina_hash_set(state->structs_f, tp->base.file, eina_list_append 57 eina_hash_set(state->structs_f, tp->base.file, eina_list_append
58 ((Eina_List*)eina_hash_find(state->structs_f, tp->base.file), tp)); 58 ((Eina_List*)eina_hash_find(state->structs_f, tp->base.file), tp));
59 database_decl_add(tp->full_name, EOLIAN_DECL_STRUCT, tp->base.file, tp); 59 database_decl_add(state, tp->full_name, EOLIAN_DECL_STRUCT, tp->base.file, tp);
60} 60}
61 61
62void 62void
@@ -65,11 +65,11 @@ database_enum_add(Eolian *state, Eolian_Typedecl *tp)
65 eina_hash_set(state->unit.enums, tp->full_name, tp); 65 eina_hash_set(state->unit.enums, tp->full_name, tp);
66 eina_hash_set(state->enums_f, tp->base.file, eina_list_append 66 eina_hash_set(state->enums_f, tp->base.file, eina_list_append
67 ((Eina_List*)eina_hash_find(state->enums_f, tp->base.file), tp)); 67 ((Eina_List*)eina_hash_find(state->enums_f, tp->base.file), tp));
68 database_decl_add(tp->full_name, EOLIAN_DECL_ENUM, tp->base.file, tp); 68 database_decl_add(state, tp->full_name, EOLIAN_DECL_ENUM, tp->base.file, tp);
69} 69}
70 70
71Eina_Bool 71Eina_Bool
72database_type_is_ownable(const Eolian_Type *tp) 72database_type_is_ownable(const Eolian_Unit *unit, const Eolian_Type *tp)
73{ 73{
74 if (tp->is_ptr) 74 if (tp->is_ptr)
75 return EINA_TRUE; 75 return EINA_TRUE;
@@ -79,13 +79,13 @@ database_type_is_ownable(const Eolian_Type *tp)
79 const char *ct = eo_lexer_get_c_type(kw); 79 const char *ct = eo_lexer_get_c_type(kw);
80 if (!ct) 80 if (!ct)
81 { 81 {
82 const Eolian_Typedecl *tpp = eolian_type_typedecl_get(tp); 82 const Eolian_Typedecl *tpp = eolian_type_typedecl_get(unit, tp);
83 if (!tpp) 83 if (!tpp)
84 return EINA_FALSE; 84 return EINA_FALSE;
85 if (tpp->type == EOLIAN_TYPEDECL_FUNCTION_POINTER) 85 if (tpp->type == EOLIAN_TYPEDECL_FUNCTION_POINTER)
86 return EINA_TRUE; 86 return EINA_TRUE;
87 if (tpp->type == EOLIAN_TYPEDECL_ALIAS) 87 if (tpp->type == EOLIAN_TYPEDECL_ALIAS)
88 return database_type_is_ownable(tpp->base_type); 88 return database_type_is_ownable(unit, tpp->base_type);
89 return EINA_FALSE; 89 return EINA_FALSE;
90 } 90 }
91 return (ct[strlen(ct) - 1] == '*'); 91 return (ct[strlen(ct) - 1] == '*');
@@ -103,14 +103,15 @@ _buf_add_suffix(Eina_Strbuf *buf, const char *suffix)
103} 103}
104 104
105void 105void
106database_type_to_str(const Eolian_Type *tp, Eina_Strbuf *buf, const char *name, 106database_type_to_str(const Eolian_Unit *src, const Eolian_Type *tp,
107 Eina_Strbuf *buf, const char *name,
107 Eolian_C_Type_Type ctype) 108 Eolian_C_Type_Type ctype)
108{ 109{
109 if ((tp->type == EOLIAN_TYPE_REGULAR 110 if ((tp->type == EOLIAN_TYPE_REGULAR
110 || tp->type == EOLIAN_TYPE_CLASS 111 || tp->type == EOLIAN_TYPE_CLASS
111 || tp->type == EOLIAN_TYPE_VOID) 112 || tp->type == EOLIAN_TYPE_VOID)
112 && tp->is_const 113 && tp->is_const
113 && ((ctype != EOLIAN_C_TYPE_RETURN) || database_type_is_ownable(tp))) 114 && ((ctype != EOLIAN_C_TYPE_RETURN) || database_type_is_ownable(src, tp)))
114 { 115 {
115 eina_strbuf_append(buf, "const "); 116 eina_strbuf_append(buf, "const ");
116 } 117 }
@@ -137,7 +138,8 @@ database_type_to_str(const Eolian_Type *tp, Eina_Strbuf *buf, const char *name,
137 else 138 else
138 { 139 {
139 /* handles arrays and pointers as they all serialize to pointers */ 140 /* handles arrays and pointers as they all serialize to pointers */
140 database_type_to_str(tp->base_type, buf, NULL, EOLIAN_C_TYPE_DEFAULT); 141 database_type_to_str(src, tp->base_type, buf, NULL,
142 EOLIAN_C_TYPE_DEFAULT);
141 _buf_add_suffix(buf, "*"); 143 _buf_add_suffix(buf, "*");
142 if (tp->is_const && (ctype != EOLIAN_C_TYPE_RETURN)) 144 if (tp->is_const && (ctype != EOLIAN_C_TYPE_RETURN))
143 eina_strbuf_append(buf, " const"); 145 eina_strbuf_append(buf, " const");
@@ -150,7 +152,8 @@ database_type_to_str(const Eolian_Type *tp, Eina_Strbuf *buf, const char *name,
150} 152}
151 153
152static void 154static void
153_stype_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf) 155_stype_to_str(const Eolian_Unit *src, const Eolian_Typedecl *tp,
156 Eina_Strbuf *buf)
154{ 157{
155 Eolian_Struct_Type_Field *sf; 158 Eolian_Struct_Type_Field *sf;
156 Eina_List *l; 159 Eina_List *l;
@@ -167,7 +170,8 @@ _stype_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf)
167 eina_strbuf_append(buf, " { "); 170 eina_strbuf_append(buf, " { ");
168 EINA_LIST_FOREACH(tp->field_list, l, sf) 171 EINA_LIST_FOREACH(tp->field_list, l, sf)
169 { 172 {
170 database_type_to_str(sf->type, buf, sf->name, EOLIAN_C_TYPE_DEFAULT); 173 database_type_to_str(src, sf->type, buf, sf->name,
174 EOLIAN_C_TYPE_DEFAULT);
171 eina_strbuf_append(buf, "; "); 175 eina_strbuf_append(buf, "; ");
172 } 176 }
173 eina_strbuf_append(buf, "}"); 177 eina_strbuf_append(buf, "}");
@@ -222,7 +226,8 @@ _append_name(const Eolian_Typedecl *tp, Eina_Strbuf *buf)
222} 226}
223 227
224static void 228static void
225_atype_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf) 229_atype_to_str(const Eolian_Unit *src, const Eolian_Typedecl *tp,
230 Eina_Strbuf *buf)
226{ 231{
227 eina_strbuf_append(buf, "typedef "); 232 eina_strbuf_append(buf, "typedef ");
228 233
@@ -239,7 +244,7 @@ _atype_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf)
239 244
240 Eina_Strbuf *fulln = eina_strbuf_new(); 245 Eina_Strbuf *fulln = eina_strbuf_new();
241 _append_name(tp, fulln); 246 _append_name(tp, fulln);
242 database_type_to_str(tp->base_type, buf, eina_strbuf_string_get(fulln), 247 database_type_to_str(src, tp->base_type, buf, eina_strbuf_string_get(fulln),
243 EOLIAN_C_TYPE_DEFAULT); 248 EOLIAN_C_TYPE_DEFAULT);
244 eina_strbuf_free(fulln); 249 eina_strbuf_free(fulln);
245} 250}
@@ -251,14 +256,14 @@ database_typedecl_to_str(const Eolian_Unit *src, const Eolian_Typedecl *tp,
251 switch (tp->type) 256 switch (tp->type)
252 { 257 {
253 case EOLIAN_TYPEDECL_ALIAS: 258 case EOLIAN_TYPEDECL_ALIAS:
254 _atype_to_str(tp, buf); 259 _atype_to_str(src, tp, buf);
255 break; 260 break;
256 case EOLIAN_TYPEDECL_ENUM: 261 case EOLIAN_TYPEDECL_ENUM:
257 _etype_to_str(src, tp, buf); 262 _etype_to_str(src, tp, buf);
258 break; 263 break;
259 case EOLIAN_TYPEDECL_STRUCT: 264 case EOLIAN_TYPEDECL_STRUCT:
260 case EOLIAN_TYPEDECL_STRUCT_OPAQUE: 265 case EOLIAN_TYPEDECL_STRUCT_OPAQUE:
261 _stype_to_str(tp, buf); 266 _stype_to_str(src, tp, buf);
262 break; 267 break;
263 default: 268 default:
264 break; 269 break;
diff --git a/src/lib/eolian/database_type_api.c b/src/lib/eolian/database_type_api.c
index 5edaed9..d733a93 100644
--- a/src/lib/eolian/database_type_api.c
+++ b/src/lib/eolian/database_type_api.c
@@ -266,7 +266,7 @@ eolian_type_next_type_get(const Eolian_Type *tp)
266} 266}
267 267
268EAPI const Eolian_Typedecl * 268EAPI const Eolian_Typedecl *
269eolian_type_typedecl_get(const Eolian_Type *tp) 269eolian_type_typedecl_get(const Eolian_Unit *unit, const Eolian_Type *tp)
270{ 270{
271 EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL); 271 EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
272 if (eolian_type_type_get(tp) != EOLIAN_TYPE_REGULAR) 272 if (eolian_type_type_get(tp) != EOLIAN_TYPE_REGULAR)
@@ -277,7 +277,7 @@ eolian_type_typedecl_get(const Eolian_Type *tp)
277 int kw = eo_lexer_keyword_str_to_id(tp->full_name); 277 int kw = eo_lexer_keyword_str_to_id(tp->full_name);
278 if (!kw || kw < KW_byte || kw >= KW_true) 278 if (!kw || kw < KW_byte || kw >= KW_true)
279 { 279 {
280 Eolian_Declaration *decl = eina_hash_find(_decls, tp->full_name); 280 Eolian_Declaration *decl = eina_hash_find(unit->state->unit.decls, tp->full_name);
281 if (decl && decl->type != EOLIAN_DECL_CLASS 281 if (decl && decl->type != EOLIAN_DECL_CLASS
282 && decl->type != EOLIAN_DECL_VAR) 282 && decl->type != EOLIAN_DECL_VAR)
283 return decl->data; 283 return decl->data;
@@ -293,22 +293,22 @@ eolian_typedecl_base_type_get(const Eolian_Typedecl *tp)
293} 293}
294 294
295EAPI const Eolian_Type * 295EAPI const Eolian_Type *
296eolian_type_aliased_base_get(const Eolian_Type *tp) 296eolian_type_aliased_base_get(const Eolian_Unit *unit, const Eolian_Type *tp)
297{ 297{
298 if (!tp || tp->type != EOLIAN_TYPE_REGULAR || tp->is_ptr) 298 if (!tp || tp->type != EOLIAN_TYPE_REGULAR || tp->is_ptr)
299 return tp; 299 return tp;
300 const Eolian_Typedecl *btp = eolian_type_typedecl_get(tp); 300 const Eolian_Typedecl *btp = eolian_type_typedecl_get(unit, tp);
301 if (btp && (btp->type == EOLIAN_TYPEDECL_ALIAS)) 301 if (btp && (btp->type == EOLIAN_TYPEDECL_ALIAS))
302 return eolian_typedecl_aliased_base_get(btp); 302 return eolian_typedecl_aliased_base_get(unit, btp);
303 return tp; 303 return tp;
304} 304}
305 305
306EAPI const Eolian_Type * 306EAPI const Eolian_Type *
307eolian_typedecl_aliased_base_get(const Eolian_Typedecl *tp) 307eolian_typedecl_aliased_base_get(const Eolian_Unit *unit, const Eolian_Typedecl *tp)
308{ 308{
309 if (!tp || tp->type != EOLIAN_TYPEDECL_ALIAS) 309 if (!tp || tp->type != EOLIAN_TYPEDECL_ALIAS)
310 return NULL; 310 return NULL;
311 return eolian_type_aliased_base_get(tp->base_type); 311 return eolian_type_aliased_base_get(unit, tp->base_type);
312} 312}
313 313
314EAPI const Eolian_Class * 314EAPI const Eolian_Class *
@@ -349,13 +349,14 @@ eolian_typedecl_is_extern(const Eolian_Typedecl *tp)
349} 349}
350 350
351EAPI Eina_Stringshare * 351EAPI Eina_Stringshare *
352eolian_type_c_type_get(const Eolian_Type *tp, Eolian_C_Type_Type ctype) 352eolian_type_c_type_get(const Eolian_Unit *unit, const Eolian_Type *tp,
353 Eolian_C_Type_Type ctype)
353{ 354{
354 Eina_Stringshare *ret; 355 Eina_Stringshare *ret;
355 Eina_Strbuf *buf; 356 Eina_Strbuf *buf;
356 EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL); 357 EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
357 buf = eina_strbuf_new(); 358 buf = eina_strbuf_new();
358 database_type_to_str(tp, buf, NULL, ctype); 359 database_type_to_str(unit, tp, buf, NULL, ctype);
359 ret = eina_stringshare_add(eina_strbuf_string_get(buf)); 360 ret = eina_stringshare_add(eina_strbuf_string_get(buf));
360 eina_strbuf_free(buf); 361 eina_strbuf_free(buf);
361 return ret; 362 return ret;
diff --git a/src/lib/eolian/database_validate.c b/src/lib/eolian/database_validate.c
index e4cf4ca..6706464 100644
--- a/src/lib/eolian/database_validate.c
+++ b/src/lib/eolian/database_validate.c
@@ -173,7 +173,7 @@ _validate_type(const Eolian_Unit *src, Eolian_Type *tp)
173{ 173{
174 char buf[256]; 174 char buf[256];
175 175
176 if (tp->owned && !database_type_is_ownable(tp)) 176 if (tp->owned && !database_type_is_ownable(src, tp))
177 { 177 {
178 snprintf(buf, sizeof(buf), "type '%s' is not ownable", tp->full_name); 178 snprintf(buf, sizeof(buf), "type '%s' is not ownable", tp->full_name);
179 return _obj_error(&tp->base, buf); 179 return _obj_error(&tp->base, buf);
@@ -182,7 +182,7 @@ _validate_type(const Eolian_Unit *src, Eolian_Type *tp)
182 if (tp->is_ptr && !tp->legacy) 182 if (tp->is_ptr && !tp->legacy)
183 { 183 {
184 tp->is_ptr = EINA_FALSE; 184 tp->is_ptr = EINA_FALSE;
185 Eina_Bool still_ownable = database_type_is_ownable(tp); 185 Eina_Bool still_ownable = database_type_is_ownable(src, tp);
186 tp->is_ptr = EINA_TRUE; 186 tp->is_ptr = EINA_TRUE;
187 if (still_ownable) 187 if (still_ownable)
188 { 188 {
@@ -213,7 +213,7 @@ _validate_type(const Eolian_Unit *src, Eolian_Type *tp)
213 return EINA_FALSE; 213 return EINA_FALSE;
214 if ((kwid >= KW_accessor) && (kwid <= KW_list)) 214 if ((kwid >= KW_accessor) && (kwid <= KW_list))
215 { 215 {
216 if (!database_type_is_ownable(itp)) 216 if (!database_type_is_ownable(src, itp))
217 { 217 {
218 snprintf(buf, sizeof(buf), 218 snprintf(buf, sizeof(buf),
219 "%s cannot contain value types (%s)", 219 "%s cannot contain value types (%s)",
@@ -253,7 +253,7 @@ _validate_type(const Eolian_Unit *src, Eolian_Type *tp)
253 return _validate(&tp->base); 253 return _validate(&tp->base);
254 } 254 }
255 /* user defined */ 255 /* user defined */
256 tpp = (Eolian_Typedecl *)eolian_type_typedecl_get(tp); 256 tpp = (Eolian_Typedecl *)eolian_type_typedecl_get(src, tp);
257 if (!tpp) 257 if (!tpp)
258 { 258 {
259 snprintf(buf, sizeof(buf), "undefined type %s", tp->full_name); 259 snprintf(buf, sizeof(buf), "undefined type %s", tp->full_name);
diff --git a/src/lib/eolian/database_var.c b/src/lib/eolian/database_var.c
index b14a99a..d0870c3 100644
--- a/src/lib/eolian/database_var.c
+++ b/src/lib/eolian/database_var.c
@@ -28,7 +28,7 @@ database_var_global_add(Eolian *state, Eolian_Variable *var)
28 eina_hash_set(state->unit.globals, var->full_name, var); 28 eina_hash_set(state->unit.globals, var->full_name, var);
29 eina_hash_set(state->globals_f, var->base.file, eina_list_append 29 eina_hash_set(state->globals_f, var->base.file, eina_list_append
30 ((Eina_List*)eina_hash_find(state->globals_f, var->base.file), var)); 30 ((Eina_List*)eina_hash_find(state->globals_f, var->base.file), var));
31 database_decl_add(var->full_name, EOLIAN_DECL_VAR, var->base.file, var); 31 database_decl_add(state, var->full_name, EOLIAN_DECL_VAR, var->base.file, var);
32} 32}
33 33
34static void 34static void
@@ -37,7 +37,7 @@ database_var_constant_add(Eolian *state, Eolian_Variable *var)
37 eina_hash_set(state->unit.constants, var->full_name, var); 37 eina_hash_set(state->unit.constants, var->full_name, var);
38 eina_hash_set(state->constants_f, var->base.file, eina_list_append 38 eina_hash_set(state->constants_f, var->base.file, eina_list_append
39 ((Eina_List*)eina_hash_find(state->constants_f, var->base.file), var)); 39 ((Eina_List*)eina_hash_find(state->constants_f, var->base.file), var));
40 database_decl_add(var->full_name, EOLIAN_DECL_VAR, var->base.file, var); 40 database_decl_add(state, var->full_name, EOLIAN_DECL_VAR, var->base.file, var);
41} 41}
42 42
43void 43void
diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c
index 71e1d7e..b8e721a 100644
--- a/src/lib/eolian/eo_parser.c
+++ b/src/lib/eolian/eo_parser.c
@@ -866,7 +866,7 @@ parse_typedef(Eo_Lexer *ls)
866 parse_name(ls, buf); 866 parse_name(ls, buf);
867 _fill_name(eina_stringshare_add(eina_strbuf_string_get(buf)), 867 _fill_name(eina_stringshare_add(eina_strbuf_string_get(buf)),
868 &def->full_name, &def->name, &def->namespaces); 868 &def->full_name, &def->name, &def->namespaces);
869 decl = (Eolian_Declaration *)eina_hash_find(_decls, def->full_name); 869 decl = (Eolian_Declaration *)eina_hash_find(ls->state->unit.decls, def->full_name);
870 if (decl) 870 if (decl)
871 { 871 {
872 eo_lexer_context_restore(ls); 872 eo_lexer_context_restore(ls);
@@ -902,7 +902,7 @@ parse_variable(Eo_Lexer *ls, Eina_Bool global)
902 parse_name(ls, buf); 902 parse_name(ls, buf);
903 _fill_name(eina_stringshare_add(eina_strbuf_string_get(buf)), 903 _fill_name(eina_stringshare_add(eina_strbuf_string_get(buf)),
904 &def->full_name, &def->name, &def->namespaces); 904 &def->full_name, &def->name, &def->namespaces);
905 decl = (Eolian_Declaration *)eina_hash_find(_decls, def->full_name); 905 decl = (Eolian_Declaration *)eina_hash_find(ls->state->unit.decls, def->full_name);
906 if (decl) 906 if (decl)
907 { 907 {
908 eo_lexer_context_restore(ls); 908 eo_lexer_context_restore(ls);
@@ -2117,7 +2117,7 @@ parse_class(Eo_Lexer *ls, Eolian_Class_Type type)
2117 _fill_name(eina_stringshare_add(eina_strbuf_string_get(buf)), 2117 _fill_name(eina_stringshare_add(eina_strbuf_string_get(buf)),
2118 &ls->tmp.kls->full_name, &ls->tmp.kls->name, 2118 &ls->tmp.kls->full_name, &ls->tmp.kls->name,
2119 &ls->tmp.kls->namespaces); 2119 &ls->tmp.kls->namespaces);
2120 decl = (Eolian_Declaration *)eina_hash_find(_decls, ls->tmp.kls->full_name); 2120 decl = (Eolian_Declaration *)eina_hash_find(ls->state->unit.decls, ls->tmp.kls->full_name);
2121 if (decl) 2121 if (decl)
2122 { 2122 {
2123 eo_lexer_context_restore(ls); 2123 eo_lexer_context_restore(ls);
@@ -2233,7 +2233,7 @@ parse_unit(Eo_Lexer *ls, Eina_Bool eot)
2233 col = ls->column; 2233 col = ls->column;
2234 parse_name(ls, buf); 2234 parse_name(ls, buf);
2235 name = eina_stringshare_add(eina_strbuf_string_get(buf)); 2235 name = eina_stringshare_add(eina_strbuf_string_get(buf));
2236 decl = (Eolian_Declaration *)eina_hash_find(_decls, name); 2236 decl = (Eolian_Declaration *)eina_hash_find(ls->state->unit.decls, name);
2237 if (decl) 2237 if (decl)
2238 { 2238 {
2239 eina_stringshare_del(name); 2239 eina_stringshare_del(name);
@@ -2271,7 +2271,7 @@ parse_unit(Eo_Lexer *ls, Eina_Bool eot)
2271 } 2271 }
2272 return EINA_FALSE; 2272 return EINA_FALSE;
2273found_class: 2273found_class:
2274 database_decl_add(ls->tmp.kls->full_name, EOLIAN_DECL_CLASS, 2274 database_decl_add(ls->state, ls->tmp.kls->full_name, EOLIAN_DECL_CLASS,
2275 ls->tmp.kls->base.file, ls->tmp.kls); 2275 ls->tmp.kls->base.file, ls->tmp.kls);
2276 return EINA_TRUE; 2276 return EINA_TRUE;
2277} 2277}
diff --git a/src/lib/eolian/eolian_database.c b/src/lib/eolian/eolian_database.c
index bf8f17f..fdba068 100644
--- a/src/lib/eolian/eolian_database.c
+++ b/src/lib/eolian/eolian_database.c
@@ -8,9 +8,6 @@
8#include "eolian_database.h" 8#include "eolian_database.h"
9#include "eolian_priv.h" 9#include "eolian_priv.h"
10 10
11Eina_Hash *_decls = NULL;
12Eina_Hash *_declsf = NULL;
13
14static int _database_init_count = 0; 11static int _database_init_count = 0;
15 12
16static void 13static void
@@ -23,8 +20,6 @@ int
23database_init() 20database_init()
24{ 21{
25 if (_database_init_count > 0) return ++_database_init_count; 22 if (_database_init_count > 0) return ++_database_init_count;
26 _decls = eina_hash_stringshared_new(free);
27 _declsf = eina_hash_stringshared_new(_hashlist_free);
28 return ++_database_init_count; 23 return ++_database_init_count;
29} 24}
30 25
@@ -38,52 +33,48 @@ database_shutdown()
38 } 33 }
39 _database_init_count--; 34 _database_init_count--;
40 35
41 if (_database_init_count == 0)
42 {
43 eina_hash_free(_decls ); _decls = NULL;
44 eina_hash_free(_declsf ); _declsf = NULL;
45 }
46 return _database_init_count; 36 return _database_init_count;
47} 37}
48 38
49void 39void
50database_decl_add(Eina_Stringshare *name, Eolian_Declaration_Type type, 40database_decl_add(Eolian *state, Eina_Stringshare *name,
41 Eolian_Declaration_Type type,
51 Eina_Stringshare *file, void *ptr) 42 Eina_Stringshare *file, void *ptr)
52{ 43{
53 Eolian_Declaration *decl = calloc(1, sizeof(Eolian_Declaration)); 44 Eolian_Declaration *decl = calloc(1, sizeof(Eolian_Declaration));
54 decl->type = type; 45 decl->type = type;
55 decl->name = name; 46 decl->name = name;
56 decl->data = ptr; 47 decl->data = ptr;
57 eina_hash_set(_decls, name, decl); 48 eina_hash_set(state->unit.decls, name, decl);
58 eina_hash_set(_declsf, file, eina_list_append 49 eina_hash_set(state->decls_f, file, eina_list_append
59 ((Eina_List*)eina_hash_find(_declsf, file), decl)); 50 ((Eina_List*)eina_hash_find(state->decls_f, file), decl));
60} 51}
61 52
62EAPI const Eolian_Declaration * 53EAPI const Eolian_Declaration *
63eolian_declaration_get_by_name(const Eolian_Unit *unit EINA_UNUSED, const char *name) 54eolian_declaration_get_by_name(const Eolian_Unit *unit, const char *name)
64{ 55{
65 if (!_decls) return NULL; 56 if (!unit) return NULL;
66 Eina_Stringshare *shr = eina_stringshare_add(name); 57 Eina_Stringshare *shr = eina_stringshare_add(name);
67 const Eolian_Declaration *decl = eina_hash_find(_decls, shr); 58 const Eolian_Declaration *decl = eina_hash_find(unit->state->unit.decls, shr);
68 eina_stringshare_del(shr); 59 eina_stringshare_del(shr);
69 return decl; 60 return decl;
70} 61}
71 62
72EAPI Eina_Iterator * 63EAPI Eina_Iterator *
73eolian_declarations_get_by_file(const Eolian *state EINA_UNUSED, const char *fname) 64eolian_declarations_get_by_file(const Eolian *state, const char *fname)
74{ 65{
75 if (!_declsf) return NULL; 66 if (!state) return NULL;
76 Eina_Stringshare *shr = eina_stringshare_add(fname); 67 Eina_Stringshare *shr = eina_stringshare_add(fname);
77 Eina_List *l = eina_hash_find(_declsf, shr); 68 Eina_List *l = eina_hash_find(state->decls_f, shr);
78 eina_stringshare_del(shr); 69 eina_stringshare_del(shr);
79 if (!l) return NULL; 70 if (!l) return NULL;
80 return eina_list_iterator_new(l); 71 return eina_list_iterator_new(l);
81} 72}
82 73
83EAPI Eina_Iterator * 74EAPI Eina_Iterator *
84eolian_all_declarations_get(const Eolian_Unit *unit EINA_UNUSED) 75eolian_all_declarations_get(const Eolian_Unit *unit)
85{ 76{
86 return (_decls ? eina_hash_iterator_data_new(_decls) : NULL); 77 return (unit ? eina_hash_iterator_data_new(unit->state->unit.decls) : NULL);
87} 78}
88 79
89EAPI Eolian_Declaration_Type 80EAPI Eolian_Declaration_Type
@@ -551,6 +542,7 @@ database_unit_init(Eolian *state, Eolian_Unit *unit)
551 unit->aliases = eina_hash_stringshared_new(EINA_FREE_CB(database_typedecl_del)); 542 unit->aliases = eina_hash_stringshared_new(EINA_FREE_CB(database_typedecl_del));
552 unit->structs = eina_hash_stringshared_new(EINA_FREE_CB(database_typedecl_del)); 543 unit->structs = eina_hash_stringshared_new(EINA_FREE_CB(database_typedecl_del));
553 unit->enums = eina_hash_stringshared_new(EINA_FREE_CB(database_typedecl_del)); 544 unit->enums = eina_hash_stringshared_new(EINA_FREE_CB(database_typedecl_del));
545 unit->decls = eina_hash_stringshared_new(free);
554} 546}
555 547
556void 548void
@@ -565,6 +557,7 @@ database_unit_del(Eolian_Unit *unit)
565 eina_hash_free(unit->aliases); 557 eina_hash_free(unit->aliases);
566 eina_hash_free(unit->structs); 558 eina_hash_free(unit->structs);
567 eina_hash_free(unit->enums); 559 eina_hash_free(unit->enums);
560 eina_hash_free(unit->decls);
568} 561}
569 562
570EAPI Eolian * 563EAPI Eolian *
@@ -591,6 +584,7 @@ eolian_new(void)
591 state->enums_f = eina_hash_stringshared_new(_hashlist_free); 584 state->enums_f = eina_hash_stringshared_new(_hashlist_free);
592 state->globals_f = eina_hash_stringshared_new(_hashlist_free); 585 state->globals_f = eina_hash_stringshared_new(_hashlist_free);
593 state->constants_f = eina_hash_stringshared_new(_hashlist_free); 586 state->constants_f = eina_hash_stringshared_new(_hashlist_free);
587 state->decls_f = eina_hash_stringshared_new(_hashlist_free);
594 588
595 return state; 589 return state;
596} 590}
@@ -618,6 +612,7 @@ eolian_free(Eolian *state)
618 eina_hash_free(state->enums_f); 612 eina_hash_free(state->enums_f);
619 eina_hash_free(state->globals_f); 613 eina_hash_free(state->globals_f);
620 eina_hash_free(state->constants_f); 614 eina_hash_free(state->constants_f);
615 eina_hash_free(state->decls_f);
621 616
622 free(state); 617 free(state);
623} 618}
diff --git a/src/lib/eolian/eolian_database.h b/src/lib/eolian/eolian_database.h
index b2e7290..edef41e 100644
--- a/src/lib/eolian/eolian_database.h
+++ b/src/lib/eolian/eolian_database.h
@@ -31,10 +31,6 @@ extern Eina_Prefix *_eolian_prefix;
31#endif 31#endif
32#define DBG(...) EINA_LOG_DOM_DBG(_eolian_log_dom, __VA_ARGS__) 32#define DBG(...) EINA_LOG_DOM_DBG(_eolian_log_dom, __VA_ARGS__)
33 33
34/* a hash holding all declarations, for redef checking etc */
35extern Eina_Hash *_decls;
36extern Eina_Hash *_declsf;
37
38struct _Eolian_Unit 34struct _Eolian_Unit
39{ 35{
40 Eolian *state; 36 Eolian *state;
@@ -45,6 +41,7 @@ struct _Eolian_Unit
45 Eina_Hash *aliases; 41 Eina_Hash *aliases;
46 Eina_Hash *structs; 42 Eina_Hash *structs;
47 Eina_Hash *enums; 43 Eina_Hash *enums;
44 Eina_Hash *decls;
48}; 45};
49 46
50struct _Eolian 47struct _Eolian
@@ -66,6 +63,7 @@ struct _Eolian
66 Eina_Hash *enums_f; 63 Eina_Hash *enums_f;
67 Eina_Hash *globals_f; 64 Eina_Hash *globals_f;
68 Eina_Hash *constants_f; 65 Eina_Hash *constants_f;
66 Eina_Hash *decls_f;
69}; 67};
70 68
71typedef struct _Eolian_Object 69typedef struct _Eolian_Object
@@ -322,7 +320,8 @@ int database_shutdown(void);
322char *database_class_to_filename(const char *cname); 320char *database_class_to_filename(const char *cname);
323Eina_Bool database_validate(Eolian *state, const Eolian_Unit *src); 321Eina_Bool database_validate(Eolian *state, const Eolian_Unit *src);
324 322
325void database_decl_add(Eina_Stringshare *name, Eolian_Declaration_Type type, 323void database_decl_add(Eolian *state, Eina_Stringshare *name,
324 Eolian_Declaration_Type type,
326 Eina_Stringshare *file, void *ptr); 325 Eina_Stringshare *file, void *ptr);
327 326
328void database_doc_del(Eolian_Documentation *doc); 327void database_doc_del(Eolian_Documentation *doc);
@@ -338,10 +337,10 @@ void database_enum_add(Eolian *state, Eolian_Typedecl *tp);
338void database_type_del(Eolian_Type *tp); 337void database_type_del(Eolian_Type *tp);
339void database_typedecl_del(Eolian_Typedecl *tp); 338void database_typedecl_del(Eolian_Typedecl *tp);
340 339
341void database_type_to_str(const Eolian_Type *tp, Eina_Strbuf *buf, const char *name, Eolian_C_Type_Type ctype); 340void database_type_to_str(const Eolian_Unit *src, const Eolian_Type *tp, Eina_Strbuf *buf, const char *name, Eolian_C_Type_Type ctype);
342void database_typedecl_to_str(const Eolian_Unit *src, const Eolian_Typedecl *tp, Eina_Strbuf *buf); 341void database_typedecl_to_str(const Eolian_Unit *src, const Eolian_Typedecl *tp, Eina_Strbuf *buf);
343 342
344Eina_Bool database_type_is_ownable(const Eolian_Type *tp); 343Eina_Bool database_type_is_ownable(const Eolian_Unit *unit, const Eolian_Type *tp);
345 344
346/* expressions */ 345/* expressions */
347 346
diff --git a/src/lib/eolian_cxx/grammar/klass_def.hpp b/src/lib/eolian_cxx/grammar/klass_def.hpp
index e7a32ad..d1fce8f 100644
--- a/src/lib/eolian_cxx/grammar/klass_def.hpp
+++ b/src/lib/eolian_cxx/grammar/klass_def.hpp
@@ -259,7 +259,7 @@ type_def const void_ {attributes::regular_type_def{"void", {qualifier_info::is_n
259 259
260inline void type_def::set(Eolian_Type const* eolian_type, Eolian_Unit const* unit, Eolian_C_Type_Type ctype) 260inline void type_def::set(Eolian_Type const* eolian_type, Eolian_Unit const* unit, Eolian_C_Type_Type ctype)
261{ 261{
262 c_type = ::eolian_type_c_type_get(eolian_type, ctype); 262 c_type = ::eolian_type_c_type_get(unit, eolian_type, ctype);
263 // ::eina_stringshare_del(stringshare); // this crashes 263 // ::eina_stringshare_del(stringshare); // this crashes
264 Eolian_Type const* stp = eolian_type_base_type_get(eolian_type); 264 Eolian_Type const* stp = eolian_type_base_type_get(eolian_type);
265 has_own = !!::eolian_type_is_owned(eolian_type); 265 has_own = !!::eolian_type_is_owned(eolian_type);
@@ -273,7 +273,7 @@ inline void type_def::set(Eolian_Type const* eolian_type, Eolian_Unit const* uni
273 if (!stp) 273 if (!stp)
274 { 274 {
275 bool is_undefined = false; 275 bool is_undefined = false;
276 Eolian_Typedecl const* decl = eolian_type_typedecl_get(eolian_type); 276 Eolian_Typedecl const* decl = eolian_type_typedecl_get(unit, eolian_type);
277 bool is_function_ptr = decl && eolian_typedecl_type_get(decl) == EOLIAN_TYPEDECL_FUNCTION_POINTER; 277 bool is_function_ptr = decl && eolian_typedecl_type_get(decl) == EOLIAN_TYPEDECL_FUNCTION_POINTER;
278 if(decl && eolian_typedecl_type_get(decl) == EOLIAN_TYPEDECL_ALIAS) 278 if(decl && eolian_typedecl_type_get(decl) == EOLIAN_TYPEDECL_ALIAS)
279 { 279 {
diff --git a/src/scripts/elua/apps/docgen/doctree.lua b/src/scripts/elua/apps/docgen/doctree.lua
index 2cc16cf..cd24b0a 100644
--- a/src/scripts/elua/apps/docgen/doctree.lua
+++ b/src/scripts/elua/apps/docgen/doctree.lua
@@ -710,7 +710,8 @@ M.Type = Node:clone {
710 end, 710 end,
711 711
712 typedecl_get = function(self) 712 typedecl_get = function(self)
713 local v = self.type:typedecl_get() 713 -- FIXME: unit
714 local v = self.type:typedecl_get(eos:unit_get())
714 if not v then 715 if not v then
715 return nil 716 return nil
716 end 717 end
@@ -718,7 +719,8 @@ M.Type = Node:clone {
718 end, 719 end,
719 720
720 aliased_base_get = function(self) 721 aliased_base_get = function(self)
721 local v = self.type:aliased_base_get() 722 -- FIXME: unit
723 local v = self.type:aliased_base_get(eos:unit_get())
722 if not v then 724 if not v then
723 return nil 725 return nil
724 end 726 end
@@ -894,7 +896,8 @@ M.Typedecl = Node:clone {
894 end, 896 end,
895 897
896 aliased_base_get = function(self) 898 aliased_base_get = function(self)
897 local v = self.typedecl:aliased_base_get() 899 -- FIXME: unit
900 local v = self.typedecl:aliased_base_get(eos:unit_get())
898 if not v then 901 if not v then
899 return nil 902 return nil
900 end 903 end
diff --git a/src/scripts/elua/modules/lualian.lua b/src/scripts/elua/modules/lualian.lua
index 3864bd1..b8b32a8 100644
--- a/src/scripts/elua/modules/lualian.lua
+++ b/src/scripts/elua/modules/lualian.lua
@@ -102,7 +102,7 @@ end
102local typeconv = function(tps, expr, isin) 102local typeconv = function(tps, expr, isin)
103 if tps:type_get() == type_type.POINTER then 103 if tps:type_get() == type_type.POINTER then
104 local base = tps:base_type_get() 104 local base = tps:base_type_get()
105 local f = (isin and known_ptr_in or known_ptr_out)[base:c_type_get(eolian.c_type_type.DEFAULT)] 105 local f = (isin and known_ptr_in or known_ptr_out)[base:c_type_get(gen_unit, eolian.c_type_type.DEFAULT)]
106 if f then return f(expr) end 106 if f then return f(expr) end
107 return build_calln(tps, expr, isin) 107 return build_calln(tps, expr, isin)
108 end 108 end
@@ -188,7 +188,7 @@ local Method = Node:clone {
188 local proto = { 188 local proto = {
189 name = meth:name_get() 189 name = meth:name_get()
190 } 190 }
191 proto.ret_type = rett and rett:c_type_get(eolian.c_type_type.RETURN) or "void" 191 proto.ret_type = rett and rett:c_type_get(gen_unit, eolian.c_type_type.RETURN) or "void"
192 local args, cargs, vargs = { "self" }, {}, {} 192 local args, cargs, vargs = { "self" }, {}, {}
193 proto.args, proto.cargs, proto.vargs = args, cargs, vargs 193 proto.args, proto.cargs, proto.vargs = args, cargs, vargs
194 local rets = {} 194 local rets = {}
@@ -206,7 +206,7 @@ local Method = Node:clone {
206 206
207 for v in pars do 207 for v in pars do
208 local dir, tps, nm = v:direction_get(), v:type_get(), kw_t(v:name_get()) 208 local dir, tps, nm = v:direction_get(), v:type_get(), kw_t(v:name_get())
209 local tp = tps:c_type_get(eolian.c_type_type.PARAM) 209 local tp = tps:c_type_get(gen_unit, eolian.c_type_type.PARAM)
210 if dir == param_dir.OUT or dir == param_dir.INOUT then 210 if dir == param_dir.OUT or dir == param_dir.INOUT then
211 if dir == param_dir.INOUT then 211 if dir == param_dir.INOUT then
212 args[#args + 1] = nm 212 args[#args + 1] = nm
@@ -283,7 +283,7 @@ local Property = Method:clone {
283 nkeys = #keys, 283 nkeys = #keys,
284 nvals = #vals 284 nvals = #vals
285 } 285 }
286 proto.ret_type = rett and rett:c_type_get(eolian.c_type_type.RETURN) or "void" 286 proto.ret_type = rett and rett:c_type_get(gen_unit, eolian.c_type_type.RETURN) or "void"
287 local args, cargs, vargs = { "self" }, {}, {} 287 local args, cargs, vargs = { "self" }, {}, {}
288 proto.args, proto.cargs, proto.vargs = args, cargs, vargs 288 proto.args, proto.cargs, proto.vargs = args, cargs, vargs
289 local rets = {} 289 local rets = {}
@@ -298,7 +298,7 @@ local Property = Method:clone {
298 for i, v in ipairs(keys) do 298 for i, v in ipairs(keys) do
299 local nm = kw_t(v:name_get()) 299 local nm = kw_t(v:name_get())
300 local tps = v:type_get() 300 local tps = v:type_get()
301 local tp = tps:c_type_get(eolian.c_type_type.PARAM) 301 local tp = tps:c_type_get(gen_unit, eolian.c_type_type.PARAM)
302 args [#args + 1] = nm 302 args [#args + 1] = nm
303 cargs[#cargs + 1] = tp .. " " .. nm 303 cargs[#cargs + 1] = tp .. " " .. nm
304 vargs[#vargs + 1] = typeconv(tps, nm, true) 304 vargs[#vargs + 1] = typeconv(tps, nm, true)
@@ -310,13 +310,13 @@ local Property = Method:clone {
310 if self.isget then 310 if self.isget then
311 if #vals == 1 and not rett then 311 if #vals == 1 and not rett then
312 local tps = vals[1]:type_get() 312 local tps = vals[1]:type_get()
313 proto.ret_type = tps:c_type_get(eolian.c_type_type.PARAM) 313 proto.ret_type = tps:c_type_get(gen_unit, eolian.c_type_type.PARAM)
314 rets[#rets + 1] = typeconv(tps, "v", false) 314 rets[#rets + 1] = typeconv(tps, "v", false)
315 else 315 else
316 for i, v in ipairs(vals) do 316 for i, v in ipairs(vals) do
317 local dir, tps, nm = v:direction_get(), v:type_get(), 317 local dir, tps, nm = v:direction_get(), v:type_get(),
318 kw_t(v:name_get()) 318 kw_t(v:name_get())
319 local tp = tps:c_type_get(eolian.c_type_type.PARAM) 319 local tp = tps:c_type_get(gen_unit, eolian.c_type_type.PARAM)
320 cargs [#cargs + 1] = tp .. " *" .. nm 320 cargs [#cargs + 1] = tp .. " *" .. nm
321 vargs [#vargs + 1] = nm 321 vargs [#vargs + 1] = nm
322 allocs[#allocs + 1] = { tp, nm } 322 allocs[#allocs + 1] = { tp, nm }
@@ -327,7 +327,7 @@ local Property = Method:clone {
327 for i, v in ipairs(vals) do 327 for i, v in ipairs(vals) do
328 local dir, tps, nm = v:direction_get(), v:type_get(), 328 local dir, tps, nm = v:direction_get(), v:type_get(),
329 kw_t(v:name_get()) 329 kw_t(v:name_get())
330 local tp = tps:c_type_get(eolian.c_type_type.PARAM) 330 local tp = tps:c_type_get(gen_unit, eolian.c_type_type.PARAM)
331 args [#args + 1] = nm 331 args [#args + 1] = nm
332 cargs[#cargs + 1] = tp .. " " .. nm 332 cargs[#cargs + 1] = tp .. " " .. nm
333 vargs[#vargs + 1] = typeconv(tps, nm, true) 333 vargs[#vargs + 1] = typeconv(tps, nm, true)
diff --git a/src/tests/eolian/eolian_parsing.c b/src/tests/eolian/eolian_parsing.c
index 58acf55..f1b4430 100644
--- a/src/tests/eolian/eolian_parsing.c
+++ b/src/tests/eolian/eolian_parsing.c
@@ -364,7 +364,7 @@ START_TEST(eolian_typedef)
364 364
365 /* Lowest alias base */ 365 /* Lowest alias base */
366 fail_if(!(tdl = eolian_typedecl_alias_get_by_name(unit, "Evas.Coord3"))); 366 fail_if(!(tdl = eolian_typedecl_alias_get_by_name(unit, "Evas.Coord3")));
367 fail_if(!(type = eolian_typedecl_aliased_base_get(tdl))); 367 fail_if(!(type = eolian_typedecl_aliased_base_get(unit, tdl)));
368 fail_if(strcmp(eolian_type_name_get(type), "int")); 368 fail_if(strcmp(eolian_type_name_get(type), "int"));
369 369
370 /* Complex type */ 370 /* Complex type */
@@ -372,13 +372,13 @@ START_TEST(eolian_typedef)
372 fail_if(!(type_name = eolian_typedecl_name_get(tdl))); 372 fail_if(!(type_name = eolian_typedecl_name_get(tdl)));
373 fail_if(strcmp(type_name, "List_Objects")); 373 fail_if(strcmp(type_name, "List_Objects"));
374 fail_if(!(type = eolian_typedecl_base_type_get(tdl))); 374 fail_if(!(type = eolian_typedecl_base_type_get(tdl)));
375 fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_DEFAULT))); 375 fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_DEFAULT)));
376 fail_if(eolian_type_is_owned(type)); 376 fail_if(eolian_type_is_owned(type));
377 fail_if(strcmp(type_name, "Eina_List *")); 377 fail_if(strcmp(type_name, "Eina_List *"));
378 eina_stringshare_del(type_name); 378 eina_stringshare_del(type_name);
379 fail_if(!(type = eolian_type_base_type_get(type))); 379 fail_if(!(type = eolian_type_base_type_get(type)));
380 fail_if(!!eolian_type_next_type_get(type)); 380 fail_if(!!eolian_type_next_type_get(type));
381 fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_DEFAULT))); 381 fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_DEFAULT)));
382 fail_if(strcmp(type_name, "Eo *")); 382 fail_if(strcmp(type_name, "Eo *"));
383 fail_if(eolian_type_is_owned(type)); 383 fail_if(eolian_type_is_owned(type));
384 eina_stringshare_del(type_name); 384 eina_stringshare_del(type_name);
@@ -428,21 +428,21 @@ START_TEST(eolian_complex_type)
428 /* Properties return type */ 428 /* Properties return type */
429 fail_if(!(fid = eolian_class_function_get_by_name(class, "a", EOLIAN_PROPERTY))); 429 fail_if(!(fid = eolian_class_function_get_by_name(class, "a", EOLIAN_PROPERTY)));
430 fail_if(!(type = eolian_function_return_type_get(fid, EOLIAN_PROP_SET))); 430 fail_if(!(type = eolian_function_return_type_get(fid, EOLIAN_PROP_SET)));
431 fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_RETURN))); 431 fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_RETURN)));
432 fail_if(!eolian_type_is_owned(type)); 432 fail_if(!eolian_type_is_owned(type));
433 fail_if(eolian_type_builtin_type_get(type) != EOLIAN_TYPE_BUILTIN_LIST); 433 fail_if(eolian_type_builtin_type_get(type) != EOLIAN_TYPE_BUILTIN_LIST);
434 fail_if(strcmp(type_name, "Eina_List *")); 434 fail_if(strcmp(type_name, "Eina_List *"));
435 eina_stringshare_del(type_name); 435 eina_stringshare_del(type_name);
436 fail_if(!(type = eolian_type_base_type_get(type))); 436 fail_if(!(type = eolian_type_base_type_get(type)));
437 fail_if(!!eolian_type_next_type_get(type)); 437 fail_if(!!eolian_type_next_type_get(type));
438 fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_DEFAULT))); 438 fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_DEFAULT)));
439 fail_if(eolian_type_is_owned(type)); 439 fail_if(eolian_type_is_owned(type));
440 fail_if(eolian_type_builtin_type_get(type) != EOLIAN_TYPE_BUILTIN_ARRAY); 440 fail_if(eolian_type_builtin_type_get(type) != EOLIAN_TYPE_BUILTIN_ARRAY);
441 fail_if(strcmp(type_name, "Eina_Array *")); 441 fail_if(strcmp(type_name, "Eina_Array *"));
442 eina_stringshare_del(type_name); 442 eina_stringshare_del(type_name);
443 fail_if(!(type = eolian_type_base_type_get(type))); 443 fail_if(!(type = eolian_type_base_type_get(type)));
444 fail_if(!!eolian_type_next_type_get(type)); 444 fail_if(!!eolian_type_next_type_get(type));
445 fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_DEFAULT))); 445 fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_DEFAULT)));
446 fail_if(!eolian_type_is_owned(type)); 446 fail_if(!eolian_type_is_owned(type));
447 fail_if(strcmp(type_name, "Eo *")); 447 fail_if(strcmp(type_name, "Eo *"));
448 eina_stringshare_del(type_name); 448 eina_stringshare_del(type_name);
@@ -453,13 +453,13 @@ START_TEST(eolian_complex_type)
453 eina_iterator_free(iter); 453 eina_iterator_free(iter);
454 fail_if(strcmp(eolian_parameter_name_get(param), "value")); 454 fail_if(strcmp(eolian_parameter_name_get(param), "value"));
455 fail_if(!(type = eolian_parameter_type_get(param))); 455 fail_if(!(type = eolian_parameter_type_get(param)));
456 fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_PARAM))); 456 fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_PARAM)));
457 fail_if(!eolian_type_is_owned(type)); 457 fail_if(!eolian_type_is_owned(type));
458 fail_if(strcmp(type_name, "Eina_List *")); 458 fail_if(strcmp(type_name, "Eina_List *"));
459 eina_stringshare_del(type_name); 459 eina_stringshare_del(type_name);
460 fail_if(!(type = eolian_type_base_type_get(type))); 460 fail_if(!(type = eolian_type_base_type_get(type)));
461 fail_if(!!eolian_type_next_type_get(type)); 461 fail_if(!!eolian_type_next_type_get(type));
462 fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_DEFAULT))); 462 fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_DEFAULT)));
463 fail_if(eolian_type_is_owned(type)); 463 fail_if(eolian_type_is_owned(type));
464 fail_if(strcmp(type_name, "const char *")); 464 fail_if(strcmp(type_name, "const char *"));
465 eina_stringshare_del(type_name); 465 eina_stringshare_del(type_name);
@@ -467,13 +467,13 @@ START_TEST(eolian_complex_type)
467 /* Methods return type */ 467 /* Methods return type */
468 fail_if(!(fid = eolian_class_function_get_by_name(class, "foo", EOLIAN_METHOD))); 468 fail_if(!(fid = eolian_class_function_get_by_name(class, "foo", EOLIAN_METHOD)));
469 fail_if(!(type = eolian_function_return_type_get(fid, EOLIAN_METHOD))); 469 fail_if(!(type = eolian_function_return_type_get(fid, EOLIAN_METHOD)));
470 fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_RETURN))); 470 fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_RETURN)));
471 fail_if(!eolian_type_is_owned(type)); 471 fail_if(!eolian_type_is_owned(type));
472 fail_if(strcmp(type_name, "Eina_List *")); 472 fail_if(strcmp(type_name, "Eina_List *"));
473 eina_stringshare_del(type_name); 473 eina_stringshare_del(type_name);
474 fail_if(!(type = eolian_type_base_type_get(type))); 474 fail_if(!(type = eolian_type_base_type_get(type)));
475 fail_if(!!eolian_type_next_type_get(type)); 475 fail_if(!!eolian_type_next_type_get(type));
476 fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_DEFAULT))); 476 fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_DEFAULT)));
477 fail_if(eolian_type_is_owned(type)); 477 fail_if(eolian_type_is_owned(type));
478 fail_if(eolian_type_builtin_type_get(type) != EOLIAN_TYPE_BUILTIN_STRINGSHARE); 478 fail_if(eolian_type_builtin_type_get(type) != EOLIAN_TYPE_BUILTIN_STRINGSHARE);
479 fail_if(strcmp(type_name, "Eina_Stringshare *")); 479 fail_if(strcmp(type_name, "Eina_Stringshare *"));
@@ -485,7 +485,7 @@ START_TEST(eolian_complex_type)
485 eina_iterator_free(iter); 485 eina_iterator_free(iter);
486 fail_if(strcmp(eolian_parameter_name_get(param), "buf")); 486 fail_if(strcmp(eolian_parameter_name_get(param), "buf"));
487 fail_if(!(type = eolian_parameter_type_get(param))); 487 fail_if(!(type = eolian_parameter_type_get(param)));
488 fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_PARAM))); 488 fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_PARAM)));
489 fail_if(!eolian_type_is_owned(type)); 489 fail_if(!eolian_type_is_owned(type));
490 fail_if(eolian_type_builtin_type_get(type) != EOLIAN_TYPE_BUILTIN_MSTRING); 490 fail_if(eolian_type_builtin_type_get(type) != EOLIAN_TYPE_BUILTIN_MSTRING);
491 fail_if(strcmp(type_name, "char *")); 491 fail_if(strcmp(type_name, "char *"));
@@ -621,7 +621,7 @@ START_TEST(eolian_simple_parsing)
621 /* Function return */ 621 /* Function return */
622 tp = eolian_function_return_type_get(fid, EOLIAN_METHOD); 622 tp = eolian_function_return_type_get(fid, EOLIAN_METHOD);
623 fail_if(!tp); 623 fail_if(!tp);
624 string = eolian_type_c_type_get(tp, EOLIAN_C_TYPE_RETURN); 624 string = eolian_type_c_type_get(unit, tp, EOLIAN_C_TYPE_RETURN);
625 fail_if(!string); 625 fail_if(!string);
626 fail_if(strcmp(string, "char *")); 626 fail_if(strcmp(string, "char *"));
627 eina_stringshare_del(string); 627 eina_stringshare_del(string);
@@ -708,7 +708,7 @@ START_TEST(eolian_struct)
708 fail_if(!(field = eolian_typedecl_struct_field_get(tdl, "something"))); 708 fail_if(!(field = eolian_typedecl_struct_field_get(tdl, "something")));
709 fail_if(!(ftype = eolian_typedecl_struct_field_type_get(field))); 709 fail_if(!(ftype = eolian_typedecl_struct_field_type_get(field)));
710 fail_if(eolian_type_is_ptr(ftype)); 710 fail_if(eolian_type_is_ptr(ftype));
711 fail_if(!(type_name = eolian_type_c_type_get(ftype, EOLIAN_C_TYPE_DEFAULT))); 711 fail_if(!(type_name = eolian_type_c_type_get(unit, ftype, EOLIAN_C_TYPE_DEFAULT)));
712 fail_if(strcmp(type_name, "const char *")); 712 fail_if(strcmp(type_name, "const char *"));
713 eina_stringshare_del(type_name); 713 eina_stringshare_del(type_name);
714 714
@@ -724,7 +724,7 @@ START_TEST(eolian_struct)
724 fail_if(!(type_name = eolian_type_name_get(ftype))); 724 fail_if(!(type_name = eolian_type_name_get(ftype)));
725 fail_if(strcmp(type_name, "Named")); 725 fail_if(strcmp(type_name, "Named"));
726 fail_if(eolian_type_type_get(ftype) != EOLIAN_TYPE_REGULAR); 726 fail_if(eolian_type_type_get(ftype) != EOLIAN_TYPE_REGULAR);
727 fail_if(eolian_typedecl_type_get(eolian_type_typedecl_get(ftype)) 727 fail_if(eolian_typedecl_type_get(eolian_type_typedecl_get(unit, ftype))
728 != EOLIAN_TYPEDECL_STRUCT); 728 != EOLIAN_TYPEDECL_STRUCT);
729 729
730 /* opaque struct */ 730 /* opaque struct */
@@ -736,7 +736,7 @@ START_TEST(eolian_struct)
736 fail_if(!(type = eolian_function_return_type_get(func, EOLIAN_METHOD))); 736 fail_if(!(type = eolian_function_return_type_get(func, EOLIAN_METHOD)));
737 fail_if(eolian_type_type_get(type) != EOLIAN_TYPE_REGULAR); 737 fail_if(eolian_type_type_get(type) != EOLIAN_TYPE_REGULAR);
738 fail_if(!eolian_type_is_ptr(type)); 738 fail_if(!eolian_type_is_ptr(type));
739 fail_if(!(tdl = eolian_type_typedecl_get(type))); 739 fail_if(!(tdl = eolian_type_typedecl_get(unit, type)));
740 fail_if(eolian_typedecl_type_get(tdl) != EOLIAN_TYPEDECL_STRUCT); 740 fail_if(eolian_typedecl_type_get(tdl) != EOLIAN_TYPEDECL_STRUCT);
741 741
742 eolian_free(eos); 742 eolian_free(eos);
@@ -1468,20 +1468,20 @@ START_TEST(eolian_function_types)
1468 fail_if(strcmp(eolian_function_name_get(fid), "SimpleFunc")); 1468 fail_if(strcmp(eolian_function_name_get(fid), "SimpleFunc"));
1469 1469
1470 fail_if(!(type = eolian_function_return_type_get(fid, EOLIAN_FUNCTION_POINTER))); // void is null_return_type? 1470 fail_if(!(type = eolian_function_return_type_get(fid, EOLIAN_FUNCTION_POINTER))); // void is null_return_type?
1471 fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_RETURN))); 1471 fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_RETURN)));
1472 fail_if(strcmp(type_name, "const char *")); 1472 fail_if(strcmp(type_name, "const char *"));
1473 fail_if(!(iter = (eolian_function_parameters_get(fid)))); 1473 fail_if(!(iter = (eolian_function_parameters_get(fid))));
1474 1474
1475 fail_if(!(eina_iterator_next(iter, (void**)&param))); 1475 fail_if(!(eina_iterator_next(iter, (void**)&param)));
1476 fail_if(strcmp(eolian_parameter_name_get(param), "a")); 1476 fail_if(strcmp(eolian_parameter_name_get(param), "a"));
1477 fail_if(!(type = eolian_parameter_type_get(param))); 1477 fail_if(!(type = eolian_parameter_type_get(param)));
1478 fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_PARAM))); 1478 fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_PARAM)));
1479 fail_if(strcmp(type_name, "int")); 1479 fail_if(strcmp(type_name, "int"));
1480 1480
1481 fail_if(!(eina_iterator_next(iter, (void**)&param))); 1481 fail_if(!(eina_iterator_next(iter, (void**)&param)));
1482 fail_if(strcmp(eolian_parameter_name_get(param), "b")); 1482 fail_if(strcmp(eolian_parameter_name_get(param), "b"));
1483 fail_if(!(type = eolian_parameter_type_get(param))); 1483 fail_if(!(type = eolian_parameter_type_get(param)));
1484 fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_PARAM))); 1484 fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_PARAM)));
1485 fail_if(strcmp(type_name, "double")); 1485 fail_if(strcmp(type_name, "double"));
1486 1486
1487 fail_if(eina_iterator_next(iter, &dummy)); 1487 fail_if(eina_iterator_next(iter, &dummy));
@@ -1494,7 +1494,7 @@ START_TEST(eolian_function_types)
1494 fail_if(eolian_function_type_get(fid) != EOLIAN_FUNCTION_POINTER); 1494 fail_if(eolian_function_type_get(fid) != EOLIAN_FUNCTION_POINTER);
1495 1495
1496 fail_if(!(type = eolian_function_return_type_get(fid, EOLIAN_FUNCTION_POINTER))); 1496 fail_if(!(type = eolian_function_return_type_get(fid, EOLIAN_FUNCTION_POINTER)));
1497 fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_RETURN))); 1497 fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_RETURN)));
1498 fail_if(strcmp(type_name, "double")); 1498 fail_if(strcmp(type_name, "double"));
1499 fail_if(!(iter = (eolian_function_parameters_get(fid)))); 1499 fail_if(!(iter = (eolian_function_parameters_get(fid))));
1500 1500
@@ -1504,7 +1504,7 @@ START_TEST(eolian_function_types)
1504 fail_if(!(type = eolian_parameter_type_get(param))); 1504 fail_if(!(type = eolian_parameter_type_get(param)));
1505 fail_if(eolian_parameter_direction_get(param) != EOLIAN_IN_PARAM); 1505 fail_if(eolian_parameter_direction_get(param) != EOLIAN_IN_PARAM);
1506 fail_if(eolian_type_is_owned(type)); 1506 fail_if(eolian_type_is_owned(type));
1507 fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_PARAM))); 1507 fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_PARAM)));
1508 fail_if(strcmp(type_name, "const char *")); 1508 fail_if(strcmp(type_name, "const char *"));
1509 1509
1510 /*out own string */ 1510 /*out own string */
@@ -1513,7 +1513,7 @@ START_TEST(eolian_function_types)
1513 fail_if(eolian_parameter_direction_get(param) != EOLIAN_OUT_PARAM); 1513 fail_if(eolian_parameter_direction_get(param) != EOLIAN_OUT_PARAM);
1514 fail_if(!(type = eolian_parameter_type_get(param))); 1514 fail_if(!(type = eolian_parameter_type_get(param)));
1515 fail_if(!eolian_type_is_owned(type)); 1515 fail_if(!eolian_type_is_owned(type));
1516 fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_PARAM))); 1516 fail_if(!(type_name = eolian_type_c_type_get(unit, type, EOLIAN_C_TYPE_PARAM)));
1517 fail_if(strcmp(type_name, "char *")); 1517 fail_if(strcmp(type_name, "char *"));
1518 1518
1519 fail_if(eina_iterator_next(iter, &dummy)); 1519 fail_if(eina_iterator_next(iter, &dummy));
@@ -1536,7 +1536,7 @@ START_TEST(eolian_function_types)
1536 fail_if(eolian_type_is_owned(type)); 1536 fail_if(eolian_type_is_owned(type));
1537 fail_if(!(type_name = eolian_type_name_get(type))); 1537 fail_if(!(type_name = eolian_type_name_get(type)));
1538 fail_if(strcmp(type_name, "VoidFunc")); 1538 fail_if(strcmp(type_name, "VoidFunc"));
1539 fail_if(!(arg_decl = eolian_type_typedecl_get(type))); 1539 fail_if(!(arg_decl = eolian_type_typedecl_get(unit, type)));
1540 fail_if(eolian_typedecl_type_get(arg_decl) != EOLIAN_TYPEDECL_FUNCTION_POINTER); 1540 fail_if(eolian_typedecl_type_get(arg_decl) != EOLIAN_TYPEDECL_FUNCTION_POINTER);
1541 1541
1542 fail_if(!(eina_iterator_next(iter, (void**)&param))); 1542 fail_if(!(eina_iterator_next(iter, (void**)&param)));
@@ -1547,7 +1547,7 @@ START_TEST(eolian_function_types)
1547 fail_if(eolian_type_type_get(type) != EOLIAN_TYPE_REGULAR); 1547 fail_if(eolian_type_type_get(type) != EOLIAN_TYPE_REGULAR);
1548 fail_if(!(type_name = eolian_type_name_get(type))); 1548 fail_if(!(type_name = eolian_type_name_get(type)));
1549 fail_if(strcmp(type_name, "SimpleFunc")); 1549 fail_if(strcmp(type_name, "SimpleFunc"));
1550 fail_if(!(arg_decl = eolian_type_typedecl_get(type))); 1550 fail_if(!(arg_decl = eolian_type_typedecl_get(unit, type)));
1551 fail_if(eolian_typedecl_type_get(arg_decl) != EOLIAN_TYPEDECL_FUNCTION_POINTER); 1551 fail_if(eolian_typedecl_type_get(arg_decl) != EOLIAN_TYPEDECL_FUNCTION_POINTER);
1552 1552
1553 fail_if(eina_iterator_next(iter, &dummy)); 1553 fail_if(eina_iterator_next(iter, &dummy));
@@ -1589,7 +1589,7 @@ START_TEST(eolian_function_as_arguments)
1589 fail_if(eolian_type_is_owned(type)); 1589 fail_if(eolian_type_is_owned(type));
1590 fail_if(!(type_name = eolian_type_name_get(type))); 1590 fail_if(!(type_name = eolian_type_name_get(type)));
1591 fail_if(strcmp(type_name, "SimpleFunc")); 1591 fail_if(strcmp(type_name, "SimpleFunc"));
1592 fail_if(!(arg_decl = eolian_type_typedecl_get(type))); 1592 fail_if(!(arg_decl = eolian_type_typedecl_get(unit, type)));
1593 fail_if(eolian_typedecl_type_get(arg_decl) != EOLIAN_TYPEDECL_FUNCTION_POINTER); 1593 fail_if(eolian_typedecl_type_get(arg_decl) != EOLIAN_TYPEDECL_FUNCTION_POINTER);
1594 1594
1595 fail_if(eina_iterator_next(iter, &dummy)); 1595 fail_if(eina_iterator_next(iter, &dummy));