From 1264915af1cd1f47a34873360c4e88ae73a1bd33 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: Tue, 20 Jul 2021 00:11:56 +0800 Subject: Function to get list of just the service codes --- pikul.i | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'pikul.i') diff --git a/pikul.i b/pikul.i index 331cfcb..fca870a 100644 --- a/pikul.i +++ b/pikul.i @@ -17,6 +17,21 @@ %typemap(freearg) char *[] { free($1); } +%typemap(out) char ** { + int len = 0; + while ($1[len]) + len++; + SV **svs = malloc(len * sizeof(SV *)); + for (int i = 0; i < len; i++) { + svs[i] = sv_newmortal(); + sv_setpv((SV *)svs[i], $1[i]); + }; + AV *myav = av_make(len, svs); + free(svs); + $result = newRV_noinc((SV *)myav); + sv_2mortal($result); + argvi++; +} %typemap(in) char **[] { AV *items = (AV *)SvRV($input); @@ -43,6 +58,7 @@ %rename("%(strip:[pikul_])s") ""; void pikul_init(enum pikul_company, char *[]); +char **pikul_codes(const char *, const char *, double); double pikul_cost(const char *, const char *, double, const char *); char *pikul_order(const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, int, -- cgit v1.2.3