X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=gen_type_mapping.py;h=475e132bc447a1b71133b763181dd277c7af19e8;hb=061af94fdcd85acba1cbaed29cba0e9a3a1fd6b4;hp=3e0d9aeef86b7a5578d5d9a3009925a5e78193bd;hpb=753d902bc977acbf08b3166f054673236c39c01b;p=ldk-java diff --git a/gen_type_mapping.py b/gen_type_mapping.py index 3e0d9aee..475e132b 100644 --- a/gen_type_mapping.py +++ b/gen_type_mapping.py @@ -398,7 +398,14 @@ class TypeMappingGenerator: ret_conv = ("long " + ty_info.var_name + "_ref = (long)(&", ") | 1;"), ret_conv_name = ty_info.var_name + "_ref", to_hu_conv = to_hu_conv, to_hu_conv_name = ty_info.var_name + "_conv", from_hu_conv = (from_hu_conv + ")", from_hu_conv_sfx)) - # The manually-defined types - TxOut and Transaction + # The manually-defined types - TxOut and u5 + if ty_info.rust_obj == "LDKu5": + return ConvInfo(ty_info = ty_info, arg_name = ty_info.var_name, + arg_conv = "", arg_conv_name = "(LDKu5){ ._0 = " + ty_info.var_name + " }", arg_conv_cleanup = None, + ret_conv = ("uint8_t " + ty_info.var_name + "_val = ", "._0;"), ret_conv_name = ty_info.var_name + "_val", + to_hu_conv = ty_info.java_hu_ty + " " + ty_info.var_name + "_conv = new " + ty_info.java_hu_ty + "(" + ty_info.var_name + ");", + to_hu_conv_name = ty_info.var_name + "_conv", from_hu_conv = (ty_info.var_name + ".ptr", "")) + assert ty_info.rust_obj == "LDKTxOut" if not ty_info.is_ptr and not holds_ref: ret_conv = ("LDKTxOut* " + ty_info.var_name + "_ref = MALLOC(sizeof(LDKTxOut), \"LDKTxOut\");\n*" + ty_info.var_name + "_ref = ", ";")