Implement cdata typemaps for C
Just use the struct directly in the C wrappers.
This commit is contained in:
parent
d3412499bb
commit
bca00c65dd
2 changed files with 22 additions and 1 deletions
|
|
@ -33,7 +33,6 @@ FAILING_C_TESTS := \
|
|||
function_typedef \
|
||||
lextype \
|
||||
li_carrays \
|
||||
li_cdata \
|
||||
li_cpointer \
|
||||
nested \
|
||||
nested_extend_c \
|
||||
|
|
|
|||
22
Lib/cdata.i
22
Lib/cdata.i
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue