From 26869a393a01643c6ad8cb8c672cf79eb8aac440 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Sun, 1 Oct 2023 18:44:24 +0000 Subject: [PATCH] Update TransactionOutputs type aliasing rules in genbindings.sh --- genbindings.sh | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/genbindings.sh b/genbindings.sh index 8270e3cd..fbc237f7 100755 --- a/genbindings.sh +++ b/genbindings.sh @@ -68,11 +68,14 @@ fi cp "$1/lightning-c-bindings/include/lightning.h" ./ if is_gnu_sed; then - sed -i "s/TransactionOutputs/C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ/g" ./lightning.h + sed -i "s/TransactionOutputs/C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ/g" ./lightning.h else - # OSX sed is for some reason not compatible with GNU sed - sed -i '' "s/TransactionOutputs/C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ/g" ./lightning.h + # OSX sed is for some reason not compatible with GNU sed + sed -i '' "s/TransactionOutputs/C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ/g" ./lightning.h fi +echo "#define LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ LDKCVec_TransactionOutputsZ" > header.c +echo "#define CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free CVec_TransactionOutputsZ_free" >> header.c + if [ "$LDK_GARBAGECOLLECTED_GIT_OVERRIDE" = "" ]; then export LDK_GARBAGECOLLECTED_GIT_OVERRIDE=$(git describe --tag --dirty) @@ -96,8 +99,8 @@ if [ "$2" = "c_sharp" ]; then # __unmangle_inner_ptr, but the C code expects to be able to call it. echo "#define __unmangle_inner_ptr(a) (a)" > c_sharp/bindings.c fi - echo "#define LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ LDKCVec_TransactionOutputsZ" >> c_sharp/bindings.c - echo "#define CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free CVec_TransactionOutputsZ_free" >> c_sharp/bindings.c + cat header.c >> c_sharp/bindings.c + cat header.c >> c_sharp/bindings.c cat c_sharp/bindings.c.body >> c_sharp/bindings.c IS_MAC=false @@ -143,8 +146,8 @@ elif [ "$2" = "python" ]; then # __unmangle_inner_ptr, but the C code expects to be able to call it. echo "#define __unmangle_inner_ptr(a) (a)" > python/bindings.c fi - echo "#define LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ LDKCVec_TransactionOutputsZ" >> python/bindings.c - echo "#define CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free CVec_TransactionOutputsZ_free" >> python/bindings.c + echo "#define LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ LDKCVec_TransactionOutputsZ" >> python/bindings.c + echo "#define CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free CVec_TransactionOutputsZ_free" >> python/bindings.c cat python/bindings.c.body >> python/bindings.c IS_MAC=false @@ -189,8 +192,7 @@ elif [ "$2" = "wasm" ]; then # __unmangle_inner_ptr, but the C code expects to be able to call it. echo "#define __unmangle_inner_ptr(a) (a)" > ts/bindings.c fi - echo "#define LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ LDKCVec_TransactionOutputsZ" >> ts/bindings.c - echo "#define CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free CVec_TransactionOutputsZ_free" >> ts/bindings.c + cat header.c >> ts/bindings.c cat ts/bindings.c.body >> ts/bindings.c echo "Building TS bindings..." @@ -254,8 +256,8 @@ else # __unmangle_inner_ptr, but the C code expects to be able to call it. echo "#define __unmangle_inner_ptr(a) (a)" > src/main/jni/bindings.c fi - echo "#define LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ LDKCVec_TransactionOutputsZ" >> src/main/jni/bindings.c - echo "#define CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free CVec_TransactionOutputsZ_free" >> src/main/jni/bindings.c + cat header.c >> src/main/jni/bindings.c + cat header.c >> src/main/jni/bindings.c cat src/main/jni/bindings.c.body >> src/main/jni/bindings.c javac -h src/main/jni src/main/java/org/ldk/enums/*.java src/main/java/org/ldk/impl/*.java rm src/main/java/org/ldk/enums/*.class src/main/java/org/ldk/impl/bindings*.class -- 2.39.5