Eolian: Add more param conversion

This commit is contained in:
Kai Huuhko 2014-06-17 13:52:05 +03:00
parent 5bd82c2883
commit 9734b81fd1
1 changed files with 13 additions and 5 deletions

View File

@ -46,13 +46,14 @@ complex_types = (
)
param_type_mapping = {
"Eina_Bool": ("bint", None),
"Evas_Coord": ("int", None),
"Eina_Bool": ("bint", None, None),
"Evas_Coord": ("int", None, None),
"char *": (
"",
"if isinstance({0}, unicode): {0} = PyUnicode_AsUTF8String({0})",
None
),
"Eo *": ("_Eo_Base", None)
"Eo *": ("_Eo_Base", None, "{0}.obj")
}
return_type_mapping = {
@ -61,8 +62,8 @@ return_type_mapping = {
"Elm_Object_Item *": (
"_ObjectItem", 'object_item_to_python({0})'
),
"Evas_Object *": ("_Eo", 'object_from_instance({0})'),
"Eo *": ("_Eo", 'object_from_instance({0})'),
"Evas_Object *": ("_Eo_Base", 'object_from_instance({0})'),
"Eo *": ("_Eo_Base", 'object_from_instance({0})'),
}
@ -252,6 +253,13 @@ class Method(object):
if conv:
gen.write(conv.format(n))
for i, (t, n) in enumerate(self.c_params):
t = t.replace("const ", "")
if t in param_type_mapping:
conv = param_type_mapping[t][2]
if conv:
self.c_params[i] = (t, conv.format(n))
c_params = ", ".join([c[1] for c in self.c_params])
c_call = "eo_do(self.obj, %s(%s))" % (self.c_name, c_params)
if self.ret_type: