summaryrefslogtreecommitdiff
path: root/pikul.i
blob: b00709e8554c2a9d01826e6acad03e50ad5cfb06 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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();