Eolian: Make None (NULL) IN-parameter values to work again
This commit is contained in:
parent
98a3a400de
commit
545e974bd4
|
@ -133,7 +133,9 @@ def conv_cls_name(cls):
|
|||
|
||||
def convert_in_param(tp, param_name, is_nonull=None):
|
||||
c_type = tp.c_type
|
||||
ptr = False
|
||||
if tp.type == eolian.TypeType.POINTER:
|
||||
ptr = True
|
||||
tp = tp.base_type
|
||||
if tp.c_type in builtin_types:
|
||||
raise EolianTypeError("pointers to builtins currently not supported")
|
||||
|
@ -155,19 +157,25 @@ def convert_in_param(tp, param_name, is_nonull=None):
|
|||
if keyword.iskeyword(param_name):
|
||||
param_name += "_"
|
||||
|
||||
conv_param_name = None
|
||||
|
||||
conv_expr_2 = conversions_in_c.get(key)
|
||||
if conv_expr_2 is not None:
|
||||
param_name = conv_expr_2.format(param_name)
|
||||
conv_param_name = conv_expr_2.format(param_name)
|
||||
|
||||
conv_t = mapping_in[key]
|
||||
if conv_t is None:
|
||||
# conv_t = ""
|
||||
conv_t = ""
|
||||
|
||||
if not is_nonull:
|
||||
key = "<{0}>{1} if {1} is not None else NULL".format(c_type, param_name)
|
||||
if ptr and not is_nonull:
|
||||
conv_param_name = "<{0}>{1} if {2} is not None else NULL".format(
|
||||
c_type,
|
||||
conv_param_name if conv_param_name else param_name,
|
||||
param_name
|
||||
)
|
||||
|
||||
return conv_expr_1, conv_t, param_name
|
||||
return conv_expr_1, conv_t, conv_param_name if conv_param_name else param_name
|
||||
|
||||
|
||||
def convert_out_param(tp, param_name):
|
||||
|
|
|
@ -27,7 +27,7 @@ img = elm.Image(win)
|
|||
img.size_hint_weight = (1.0, 1.0)
|
||||
img.smooth = True
|
||||
img.aspect_fixed = True
|
||||
img.file = sys.argv[1], ""
|
||||
img.file = sys.argv[1], None
|
||||
img.position = (0, 0)
|
||||
img.size = (w, h)
|
||||
|
||||
|
@ -38,7 +38,7 @@ def _mouse_down_cb(*args):
|
|||
if file_idx > len(sys.argv):
|
||||
file_idx = 1
|
||||
global img
|
||||
img.file = sys.argv[file_idx], ""
|
||||
img.file = sys.argv[file_idx], None
|
||||
return True
|
||||
|
||||
img.event_callback_add("mouse,down", _mouse_down_cb)
|
||||
|
|
Loading…
Reference in New Issue