From f922473ada7e3ffb77bbf5601c5225003f3a7b75 Mon Sep 17 00:00:00 2001 From: Reuben Dunnington Date: Wed, 9 Aug 2023 20:11:11 -0700 Subject: [PATCH] fix binding generation bug --- scripts/bindgen_bb.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/bindgen_bb.py b/scripts/bindgen_bb.py index 9806d74..5899bfb 100644 --- a/scripts/bindgen_bb.py +++ b/scripts/bindgen_bb.py @@ -119,6 +119,7 @@ for decl in data: s += '\n{\n\t' retTag = decl['ret']['tag'] + firstArgIndex = 0 if retTag == 'i': s += 'returns[0].i32_val = ' elif retTag == 'I': @@ -130,12 +131,11 @@ for decl in data: elif retTag == 'S': retTypeName = decl['ret']['name'] retTypeCName = decl['ret'].get('cname', retTypeName) - s += '*(' + retTypeCName + '*)(bb_module_instance_mem(module, returns[0].i32_val, sizeof(' + retTypeCName + '))) = ' + s += '*(' + retTypeCName + '*)(bb_module_instance_mem(module, params[0].i32_val, sizeof(' + retTypeCName + '))) = ' + firstArgIndex = 1 s += cname + '(' - firstArgIndex = 0 - for i, arg in enumerate(decl['args']): typeName = arg['type']['name'] typeCName = arg['type'].get('cname', typeName) @@ -209,7 +209,7 @@ for decl in data: paramTypes.append(translateTag(tag)) numParams += 1 - # dummy values to avoid 0-length arrays in C + # dummy values if numReturns == 0: retType = 'BB_VALTYPE_I32'