From f91513bcc8f2f001bb3096a2793f16f052f74861 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=EA=A6=AB=EA=A6=B6=EA=A6=8F=EA=A7=80=EA=A6=A6?= =?UTF-8?q?=EA=A6=BF=EA=A6=A7=EA=A6=AE=EA=A6=91=EA=A6=A9=EA=A6=AD=EA=A7=80?= Date: Mon, 22 Aug 2022 19:30:33 +0800 Subject: Use helpers for the supported basic arrays in SWIG https://swig.org/Doc4.0/SWIG.html#SWIG_nn26 Replacing the use of array functions from the carray library. --- pikul.i | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/pikul.i b/pikul.i index f6079c0..c045603 100644 --- a/pikul.i +++ b/pikul.i @@ -4,8 +4,28 @@ %} #ifdef SWIGJAVASCRIPT -%include "carrays.i" -%array_functions(char *, stringArray); +%inline %{ + char *provisions[3]; + void provisions_set(int i, char *val) + { + if (provisions[i]) + free(provisions[i]); + provisions[i] = (char *)malloc(strlen(val) + 1); + strcpy(provisions[i], val); + } + char *provisions_get(int i) + { + return provisions[i]; + } + void provisions_clear() + { + for (int i = 0; i < 3; i++) + if (provisions[i]) { + free(provisions[i]); + provisions[i] = NULL; + } + } +%} #endif #ifdef SWIGPERL -- cgit v1.2.3