@@ -403,6 +403,7 @@ def java_c_types(fn_arg, ret_arr_len):
403
403
java_hu_ty = java_hu_ty .replace ("LDKCResult" , "Result" )
404
404
java_hu_ty = java_hu_ty .replace ("LDKC2Tuple" , "TwoTuple" )
405
405
java_hu_ty = java_hu_ty .replace ("LDKC3Tuple" , "ThreeTuple" )
406
+ java_hu_ty = java_hu_ty .replace ("LDKC4Tuple" , "FourTuple" )
406
407
java_hu_ty = java_hu_ty .replace ("LDK" , "" )
407
408
fn_ty_arg = "J"
408
409
fn_arg = ma .group (2 ).strip ()
@@ -571,14 +572,17 @@ def map_fn_with_ref_option(line, re_match, ret_arr_len, c_call_string, doc_comme
571
572
struct_meth = method_name .rsplit ("Z" , 1 )[0 ][1 :] + "Z"
572
573
expected_struct = "LDKC" + struct_meth
573
574
struct_meth_name = method_name [len (struct_meth ) + 1 :].strip ("_" )
574
- elif method_name .startswith ("C2Tuple" ) or method_name .startswith ("C3Tuple" ):
575
+ elif method_name .startswith ("C2Tuple" ) or method_name .startswith ("C3Tuple" ) or method_name . startswith ( "C4Tuple" ) :
575
576
tuple_name = method_name .rsplit ("Z" , 1 )[0 ][2 :] + "Z"
576
577
if method_name .startswith ("C2Tuple" ):
577
578
struct_meth = "Two" + tuple_name
578
579
expected_struct = "LDKC2" + tuple_name
579
- else :
580
+ elif method_name . startswith ( "C3Tuple" ) :
580
581
struct_meth = "Three" + tuple_name
581
582
expected_struct = "LDKC3" + tuple_name
583
+ else :
584
+ struct_meth = "Four" + tuple_name
585
+ expected_struct = "LDKC4" + tuple_name
582
586
struct_meth_name = method_name [len (tuple_name ) + 2 :].strip ("_" )
583
587
else :
584
588
struct_meth = method_name .split ("_" )[0 ]
@@ -666,7 +670,7 @@ def map_fn_with_ref_option(line, re_match, ret_arr_len, c_call_string, doc_comme
666
670
not method_name .startswith ("_" ) and
667
671
method_name != "check_platform" and method_name != "Result_read" and
668
672
not expected_struct in unitary_enums and
669
- ((not method_name .startswith ("C2Tuple_" ) and not method_name .startswith ("C3Tuple_" ))
673
+ ((not method_name .startswith ("C2Tuple_" ) and not method_name .startswith ("C3Tuple_" ) and not method_name . startswith ( "C4Tuple_" ) )
670
674
or method_name .endswith ("_read" )))
671
675
672
676
# If we're adding a static method, and it returns a primitive or an array of primitives,
@@ -909,7 +913,7 @@ def create_getter(struct_name, field_decl, field_name, accessor, check_sfx):
909
913
map_fn_with_ref_option (dummy_line , reg_fn_regex .match (dummy_line ), None , None , "" , holds_ref )
910
914
911
915
def map_tuple (struct_name , field_lines ):
912
- human_ty = struct_name .replace ("LDKC2Tuple" , "TwoTuple" ).replace ("LDKC3Tuple" , "ThreeTuple" )
916
+ human_ty = struct_name .replace ("LDKC2Tuple" , "TwoTuple" ).replace ("LDKC3Tuple" , "ThreeTuple" ). replace ( "LDKC4Tuple" , "FourTuple" )
913
917
with open (f"{ sys .argv [3 ]} /structs/{ human_ty } { consts .file_ext } " , "w" ) as out_java_struct :
914
918
out_java_struct .write (consts .map_tuple (struct_name ))
915
919
ty_list = []
@@ -1008,7 +1012,7 @@ def map_tuple(struct_name, field_lines):
1008
1012
vec_ty_match = line_indicates_vec_regex .match (struct_line )
1009
1013
if vec_ty_match is not None and struct_name .startswith ("LDKCVec_" ):
1010
1014
vec_ty = vec_ty_match .group (2 )
1011
- elif struct_name .startswith ("LDKC2Tuple_" ) or struct_name .startswith ("LDKC3Tuple_" ):
1015
+ elif struct_name .startswith ("LDKC2Tuple_" ) or struct_name .startswith ("LDKC3Tuple_" ) or struct_name . startswith ( "LDKC4Tuple_" ) :
1012
1016
is_tuple = True
1013
1017
trait_fn_match = line_indicates_trait_regex .match (struct_line )
1014
1018
if trait_fn_match is not None :
@@ -1186,7 +1190,7 @@ def map_tuple(struct_name, field_lines):
1186
1190
with open (f"{ sys .argv [3 ]} /structs/{ struct_name .replace ('LDKCResult' , 'Result' )} { consts .file_ext } " , "a" ) as out_java_struct :
1187
1191
out_java_struct .write ("}\n " + consts .hu_struct_file_suffix )
1188
1192
for struct_name in tuple_types :
1189
- struct_hu_name = struct_name .replace ("LDKC2Tuple" , "TwoTuple" ).replace ("LDKC3Tuple" , "ThreeTuple" )
1193
+ struct_hu_name = struct_name .replace ("LDKC2Tuple" , "TwoTuple" ).replace ("LDKC3Tuple" , "ThreeTuple" ). replace ( "LDKC4Tuple" , "FourTuple" )
1190
1194
with open (f"{ sys .argv [3 ]} /structs/{ struct_hu_name } { consts .file_ext } " , "a" ) as out_java_struct :
1191
1195
out_java_struct .write ("}\n " + consts .hu_struct_file_suffix )
1192
1196
0 commit comments