From 7da1092518e5ea1518255a4473c178f52549fd81 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Thu, 27 Jul 2023 20:34:49 +0000 Subject: [PATCH] Add handling for signed int64 type --- genbindings.py | 8 ++++++++ java_strings.py | 1 + typescript_strings.py | 1 + 3 files changed, 10 insertions(+) diff --git a/genbindings.py b/genbindings.py index c11cd823..e8ddb657 100755 --- a/genbindings.py +++ b/genbindings.py @@ -326,6 +326,14 @@ def java_c_types(fn_arg, ret_arr_len): fn_ty_arg = "I" fn_arg = fn_arg[8:].strip() is_primitive = True + elif fn_arg.startswith("int64_t"): + mapped_type = consts.c_type_map['int64_t'] + java_ty = mapped_type[0] + c_ty = "int64_t" + arr_ty = "int64_t" + fn_ty_arg = "J" + fn_arg = fn_arg[7:].strip() + 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['uint64_t'] diff --git a/java_strings.py b/java_strings.py index d903cddf..d12237fe 100644 --- a/java_strings.py +++ b/java_strings.py @@ -17,6 +17,7 @@ class Consts: uint16_t = ['short'], uint32_t = ['int'], uint64_t = ['long'], + int64_t = ['long'], ) self.java_type_map = dict( String = "String" diff --git a/typescript_strings.py b/typescript_strings.py index 54b50742..82c3fa0c 100644 --- a/typescript_strings.py +++ b/typescript_strings.py @@ -21,6 +21,7 @@ class Consts: uint8_t = ['number', 'number', 'Uint8Array'], uint16_t = ['number', 'number', 'Uint16Array'], uint32_t = ['number', 'number', 'Uint32Array'], + int64_t = ['bigint', 'bigint', 'BigInt64Array'], uint64_t = ['bigint', 'bigint', 'BigUint64Array'], ) self.java_type_map = dict( -- 2.39.5