Implement cdata typemaps for C

Just use the struct directly in the C wrappers.
This commit is contained in:
Vadim Zeitlin 2016-04-23 01:30:35 +02:00
commit bca00c65dd
2 changed files with 22 additions and 1 deletions

View file

@ -33,7 +33,6 @@ FAILING_C_TESTS := \
function_typedef \
lextype \
li_carrays \
li_cdata \
li_cpointer \
nested \
nested_extend_c \

View file

@ -21,6 +21,28 @@ typedef struct SWIGCDATA {
}
%typemap(in) (const void *indata, int inlen) = (char *STRING, int LENGTH);
#elif SWIGC
%insert("cheader") {
typedef struct SWIGCDATA {
char *data;
int len;
} SWIGCDATA;
}
%typemap(ctype) SWIGCDATA "SWIGCDATA"
%typemap(cppouttype) SWIGCDATA "SWIGCDATA"
%typemap(out) SWIGCDATA {
$result = $1;
}
%typemap(ctype) (const void *indata, int inlen) "const SWIGCDATA*"
%typemap(in) (const void *indata, int inlen) {
$1 = $input->data;
$2 = $input->len;
}
#elif SWIGCHICKEN
%typemap(out) SWIGCDATA {