summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2021-07-16 10:55:51 +0800
committerꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2021-07-16 10:55:51 +0800
commitd1b9c27a403fb2ac9e69e82ebea32722c6795daf (patch)
tree12bca2feb930d958577f9e04baa08803d13465c1
parent920878096a1721fd6e0c1b7008abac51803c5aa4 (diff)
SWIG files, therefore deprecating Pikul-XS
-rw-r--r--.gitignore3
-rw-r--r--Makefile.PL7
-rw-r--r--pikul.i28
3 files changed, 38 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index d367ba6..3c5fb6d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,3 +11,6 @@ install-sh
ltmain.sh
Makefile.in
missing
+*.old
+*.p*
+*_wrap.c
diff --git a/Makefile.PL b/Makefile.PL
new file mode 100644
index 0000000..2344c9c
--- /dev/null
+++ b/Makefile.PL
@@ -0,0 +1,7 @@
+use ExtUtils::MakeMaker;
+WriteMakefile(
+ NAME => 'Pikul',
+ INC => '`pkg-config --cflags json-c`',
+ LIBS => ['-lpikul -lcurl -ljson-c'],
+ OBJECT => '$(O_FILES)'
+);
diff --git a/pikul.i b/pikul.i
new file mode 100644
index 0000000..b00709e
--- /dev/null
+++ b/pikul.i
@@ -0,0 +1,28 @@
+%module Pikul
+%{
+#include "pikul.h"
+%}
+
+%typemap(in) char *[] {
+ AV *tempav = (AV *)SvRV($input);
+ I32 len = av_len(tempav);
+ $1 = (char **)malloc((len + 2) * sizeof(char *));
+ int i;
+ for (i = 0; i <= len; i++) {
+ SV **tv = av_fetch(tempav, i, 0);
+ $1[i] = (char *)SvPV(*tv, PL_na);
+ }
+ $1[i] = NULL;
+};
+%typemap(freearg) char *[] {
+ free($1);
+}
+
+%rename("%(strip:[pikul_])s") "";
+void pikul_init(enum pikul_company company, char *provisions[]);
+double pikul_cost(const char *origin, const char *destination, double weight, const char *service);
+char *pikul_order(const char *trx_id, const char *service, const char *sender_name,
+ const char *sender_phone, const char *origin, const char *sender_address,
+ const char *receiver_name, const char *receiver_phone, const char *destination,
+ const char *receiver_address, int nitems, char **items[], double value);
+void pikul_cleanup();