- if c_call_string is None:
- write_c(re_match.group(2) + "(")
- else:
- write_c(c_call_string)
- for idx, info in enumerate(arg_names):
- if info.arg_conv_name is not None:
- if idx != 0:
- write_c(", ")
- elif c_call_string is not None:
- continue
- write_c(info.arg_conv_name)
- write_c(")")
- if ret_info.ret_conv is not None:
- write_c(ret_conv_sfx.replace('\n', '\n\t'))
- else:
- write_c(";")
- for info in arg_names:
- if info.arg_conv_cleanup is not None:
- write_c("\n\t" + info.arg_conv_cleanup.replace("\n", "\n\t"))
- if ret_info.ret_conv is not None:
- write_c("\n\treturn " + ret_info.ret_conv_name + ";")
- elif ret_info.c_ty != "void":
- write_c("\n\treturn ret_val;")
- write_c("\n}\n\n")
- if out_java_struct is not None:
- out_java_struct.write("\t\t")
- if ret_info.java_ty != "void":
- out_java_struct.write(ret_info.java_ty + " ret = ")
- out_java_struct.write("bindings." + re_match.group(2) + "(")
- for idx, info in enumerate(arg_names):
- if idx != 0:
- out_java_struct.write(", ")
- if idx == 0 and takes_self:
- out_java_struct.write("this.ptr")
- elif info.arg_name in default_constructor_args:
- out_java_struct.write("bindings." + info.java_hu_ty + "_new(")
- for explode_idx, explode_arg in enumerate(default_constructor_args[info.arg_name]):
- if explode_idx != 0:
- out_java_struct.write(", ")
- expl_arg_name = info.arg_name + "_" + explode_arg.arg_name
- if explode_arg.from_hu_conv is not None:
- out_java_struct.write(explode_arg.from_hu_conv[0].replace(explode_arg.arg_name, expl_arg_name))
- else:
- out_java_struct.write(expl_arg_name)
- out_java_struct.write(")")
- elif info.from_hu_conv is not None:
- out_java_struct.write(info.from_hu_conv[0])
- else:
- out_java_struct.write(info.arg_name)
- out_java_struct.write(");\n")
- if ret_info.to_hu_conv is not None:
- if not takes_self:
- out_java_struct.write("\t\t" + ret_info.to_hu_conv.replace("\n", "\n\t\t").replace("this", ret_info.to_hu_conv_name) + "\n")
- else:
- out_java_struct.write("\t\t" + ret_info.to_hu_conv.replace("\n", "\n\t\t") + "\n")