- 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")
+ out_java_struct = None
+ if (expected_struct in opaque_structs or expected_struct in trait_structs
+ or expected_struct in complex_enums or expected_struct in complex_enums
+ or expected_struct in result_types or expected_struct in tuple_types) and not is_free:
+ out_java_struct = open(f"{sys.argv[3]}/structs/{struct_meth}{consts.file_ext}", "a")
+ out_java_struct.write(out_java_struct_delta)
+ elif (not is_free and not method_name.endswith("_clone") and
+ not method_name.startswith("TxOut") and
+ not method_name.startswith("_") and
+ method_name != "check_platform" and method_name != "Result_read" and
+ not expected_struct in unitary_enums and
+ ((not method_name.startswith("C2Tuple_") and not method_name.startswith("C3Tuple_"))
+ or method_name.endswith("_read"))):
+ out_java_struct = open(f"{sys.argv[3]}/structs/UtilMethods{consts.file_ext}", "a")
+ for line in out_java_struct_delta.splitlines():
+ if not line.strip().startswith("this."):
+ out_java_struct.write(line + "\n")