abac0-leakabac0-meicompt_changesgec13mei-idmei-rt0-nmei_rt0mei_rt2mei_rt2_fix_1meiyap-rt1meiyap1rt2tvf-new-xml
Last change
on this file since f2ca623 was
a5a8234,
checked in by Mike Ryan <mikeryan@…>, 14 years ago
|
add the chunk swig file.. forgot to add this a few revisions ago
|
-
Property mode set to
100644
|
File size:
712 bytes
|
Line | |
---|
1 | // bytearrays are new as of 2.6 |
---|
2 | %{ |
---|
3 | #if (PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 6) || PY_MAJOR_VERSION > 2 |
---|
4 | #define MODERN_PYTHON |
---|
5 | #endif |
---|
6 | %} |
---|
7 | |
---|
8 | // abac_chunk_t is a bytearray or a string |
---|
9 | %typemap(in) abac_chunk_t %{ |
---|
10 | #ifdef MODERN_PYTHON |
---|
11 | $1.ptr = (unsigned char *)PyByteArray_AS_STRING($input); |
---|
12 | $1.len = PyByteArray_GET_SIZE($input); |
---|
13 | #else |
---|
14 | PyString_AsStringAndSize( |
---|
15 | $input, |
---|
16 | (char **)&$1.ptr, |
---|
17 | &$1.len |
---|
18 | ); |
---|
19 | #endif |
---|
20 | %} |
---|
21 | |
---|
22 | %typemap(out) abac_chunk_t %{ |
---|
23 | #ifdef MODERN_PYTHON |
---|
24 | $result = PyByteArray_FromStringAndSize( |
---|
25 | (const char *)$1.ptr, |
---|
26 | $1.len |
---|
27 | ); |
---|
28 | #else |
---|
29 | $result = PyString_FromStringAndSize( |
---|
30 | (const char *)$1.ptr, |
---|
31 | $1.len |
---|
32 | ); |
---|
33 | #endif |
---|
34 | %} |
---|
Note: See
TracBrowser
for help on using the repository browser.