Eolian: Handle None in strings
This commit is contained in:
parent
bcac382354
commit
8b59680eec
|
@ -18,7 +18,7 @@ handler = logging.StreamHandler()
|
||||||
formatter = logging.Formatter("%(name)s %(levelname)s: %(message)s")
|
formatter = logging.Formatter("%(name)s %(levelname)s: %(message)s")
|
||||||
handler.setFormatter(formatter)
|
handler.setFormatter(formatter)
|
||||||
log = logging.getLogger("efl.eolian")
|
log = logging.getLogger("efl.eolian")
|
||||||
log.setLevel(logging.DEBUG)
|
log.setLevel(logging.INFO)
|
||||||
log.addHandler(handler)
|
log.addHandler(handler)
|
||||||
|
|
||||||
from efl import eolian
|
from efl import eolian
|
||||||
|
@ -51,7 +51,7 @@ param_type_mapping = {
|
||||||
"char *": (
|
"char *": (
|
||||||
"",
|
"",
|
||||||
"if isinstance({0}, unicode): {0} = PyUnicode_AsUTF8String({0})",
|
"if isinstance({0}, unicode): {0} = PyUnicode_AsUTF8String({0})",
|
||||||
None
|
"<{1}>if {0} is not None else NULL"
|
||||||
),
|
),
|
||||||
"Eo *": ("_Eo_Base", None, "{0}.obj")
|
"Eo *": ("_Eo_Base", None, "{0}.obj")
|
||||||
}
|
}
|
||||||
|
@ -251,14 +251,14 @@ class Method(object):
|
||||||
if t in param_type_mapping:
|
if t in param_type_mapping:
|
||||||
conv = param_type_mapping[t][1]
|
conv = param_type_mapping[t][1]
|
||||||
if conv:
|
if conv:
|
||||||
gen.write(conv.format(n))
|
gen.write(conv.format(n, t))
|
||||||
|
|
||||||
for i, (t, n) in enumerate(self.c_params):
|
for i, (t, n) in enumerate(self.c_params):
|
||||||
t = t.replace("const ", "")
|
t = t.replace("const ", "")
|
||||||
if t in param_type_mapping:
|
if t in param_type_mapping:
|
||||||
conv = param_type_mapping[t][2]
|
conv = param_type_mapping[t][2]
|
||||||
if conv:
|
if conv:
|
||||||
self.c_params[i] = (t, conv.format(n))
|
self.c_params[i] = (t, conv.format(n, t))
|
||||||
|
|
||||||
c_params = ", ".join([c[1] for c in self.c_params])
|
c_params = ", ".join([c[1] for c in self.c_params])
|
||||||
c_call = "eo_do(self.obj, %s(%s))" % (self.c_name, c_params)
|
c_call = "eo_do(self.obj, %s(%s))" % (self.c_name, c_params)
|
||||||
|
|
Loading…
Reference in New Issue