fn_arg = fn_arg[4:].strip()
is_primitive = True
elif fn_arg.startswith("uint8_t"):
- mapped_type = consts.c_type_map['byte']
+ mapped_type = consts.c_type_map['uint8_t']
java_ty = mapped_type[0]
c_ty = "int8_t"
fn_ty_arg = "B"
fn_arg = fn_arg[7:].strip()
is_primitive = True
elif fn_arg.startswith("uint16_t"):
- java_ty = "short"
+ mapped_type = consts.c_type_map['uint16_t']
+ java_ty = mapped_type[0]
c_ty = "jshort"
fn_ty_arg = "S"
fn_arg = fn_arg[8:].strip()
is_primitive = True
elif fn_arg.startswith("uint32_t"):
- java_ty = "int"
+ mapped_type = consts.c_type_map['uint32_t']
+ java_ty = mapped_type[0]
c_ty = "int32_t"
fn_ty_arg = "I"
fn_arg = fn_arg[8:].strip()
is_primitive = True
elif fn_arg.startswith("uint64_t") or fn_arg.startswith("uintptr_t"):
# TODO: uintptr_t is arch-dependent :(
- java_ty = "long"
+ mapped_type = consts.c_type_map['long']
+ java_ty = mapped_type[0]
c_ty = "int64_t"
fn_ty_arg = "J"
if fn_arg.startswith("uint64_t"):
arg_conv = opaque_arg_conv, arg_conv_name = "&" + ty_info.var_name + "_conv", arg_conv_cleanup = None,
ret_conv = (ty_info.rust_obj + " " + ty_info.var_name + "_var = *", opaque_ret_conv_suf),
ret_conv_name = ty_info.var_name + "_ref",
- to_hu_conv = ty_info.java_hu_ty + " " + ty_info.var_name + "_hu_conv = new " + ty_info.java_hu_ty + "(null, " + ty_info.var_name + ");",
+ # to_hu_conv = ty_info.java_hu_ty + " " + ty_info.var_name + "_hu_conv = new " + ty_info.java_hu_ty + "(null, " + ty_info.var_name + ");",
+ to_hu_conv = consts.to_hu_conv_templates['ptr'].replace('{human_type}', ty_info.java_hu_ty).replace('{var_name}', ty_info.var_name),
to_hu_conv_name = ty_info.var_name + "_hu_conv",
from_hu_conv = (ty_info.var_name + " == null ? 0 : " + ty_info.var_name + ".ptr & ~1", "this.ptrs_to.add(" + ty_info.var_name + ")"))
else:
arg_conv = opaque_arg_conv, arg_conv_name = ty_info.var_name + "_conv", arg_conv_cleanup = None,
ret_conv = (ty_info.rust_obj + " " + ty_info.var_name + "_var = ", opaque_ret_conv_suf),
ret_conv_name = ty_info.var_name + "_ref",
- to_hu_conv = ty_info.java_hu_ty + " " + ty_info.var_name + "_hu_conv = new " + ty_info.java_hu_ty + "(null, " + ty_info.var_name + ");",
+ # to_hu_conv = ty_info.java_hu_ty + " " + ty_info.var_name + "_hu_conv = new " + ty_info.java_hu_ty + "(null, " + ty_info.var_name + ");",
+ to_hu_conv = consts.to_hu_conv_templates['default'].replace('{human_type}', ty_info.java_hu_ty).replace('{var_name}', ty_info.var_name),
to_hu_conv_name = ty_info.var_name + "_hu_conv",
from_hu_conv = (ty_info.var_name + " == null ? 0 : " + ty_info.var_name + ".ptr & ~1", "this.ptrs_to.add(" + ty_info.var_name + ")"))