elif fn_arg.startswith("uint16_t"):
mapped_type = consts.c_type_map['uint16_t']
java_ty = mapped_type[0]
- c_ty = "jshort"
+ c_ty = "int16_t"
fn_ty_arg = "S"
fn_arg = fn_arg[8:].strip()
is_primitive = True
is_primitive = True
elif fn_arg.startswith("uint64_t") or fn_arg.startswith("uintptr_t"):
# TODO: uintptr_t is arch-dependent :(
- mapped_type = consts.c_type_map['long']
+ mapped_type = consts.c_type_map['uint64_t']
java_ty = mapped_type[0]
c_ty = "int64_t"
fn_ty_arg = "J"
if is_opaque:
opaque_structs.add(struct_name)
with open(f"{sys.argv[3]}/structs/{struct_name.replace('LDK', '')}{consts.file_ext}", "w") as out_java_struct:
- out_java_struct.write(consts.hu_struct_file_prefix)
- out_java_struct.write("public class " + struct_name.replace("LDK","") + " extends CommonBase")
- if struct_name.startswith("LDKLocked"):
- out_java_struct.write(" implements AutoCloseable")
- out_java_struct.write(" {\n")
- out_java_struct.write("\t" + struct_name.replace("LDK", "") + "(Object _dummy, long ptr) { super(ptr); }\n")
- if struct_name.startswith("LDKLocked"):
- out_java_struct.write("\t@Override public void close() {\n")
- else:
- out_java_struct.write("\t@Override @SuppressWarnings(\"deprecation\")\n")
- out_java_struct.write("\tprotected void finalize() throws Throwable {\n")
- out_java_struct.write("\t\tsuper.finalize();\n")
- out_java_struct.write("\t\tif (ptr != 0) { bindings." + struct_name.replace("LDK","") + "_free(ptr); }\n")
- out_java_struct.write("\t}\n\n")
+ out_opaque_struct_human = consts.map_opaque_struct(struct_name)
+ out_java_struct.write(out_opaque_struct_human)
elif result_contents is not None:
assert result_contents in result_ptr_struct_items
res_ty, err_ty = result_ptr_struct_items[result_contents]