abac0-leakabac0-meicompt_changesgec13mei-idmei-rt0-nmei_rt0mei_rt2mei_rt2_fix_1meiyap-rt1meiyap1rt2tvf-new-xml
Last change
on this file since 9b0b961 was
9b0b961,
checked in by Mike Ryan <mikeryan@…>, 14 years ago
|
map abac_chunk_t <-> python byte array
|
-
Property mode set to
100644
|
File size:
833 bytes
|
Line | |
---|
1 | %typemap(argout) bool &success { |
---|
2 | PyObject *o, *o2, *o3; |
---|
3 | o = PyBool_FromLong(*$1); |
---|
4 | if ((!$result) || ($result == Py_None)) { |
---|
5 | $result = o; |
---|
6 | } else { |
---|
7 | if (!PyTuple_Check($result)) { |
---|
8 | PyObject *o2 = $result; |
---|
9 | $result = PyTuple_New(1); |
---|
10 | PyTuple_SetItem($result,0,o2); |
---|
11 | } |
---|
12 | o3 = PyTuple_New(2); |
---|
13 | PyTuple_SetItem(o3,0,o); |
---|
14 | PyTuple_SetItem(o3,1,$result); |
---|
15 | $result = o3; |
---|
16 | } |
---|
17 | } |
---|
18 | |
---|
19 | %typemap(in,numinputs=0) bool &success(bool temp) { |
---|
20 | $1 = &temp; |
---|
21 | } |
---|
22 | |
---|
23 | // abac_chunk_t is a bytearray |
---|
24 | %typemap(in) abac_chunk_t { |
---|
25 | $1.ptr = (unsigned char *)PyByteArray_AS_STRING($input); |
---|
26 | $1.len = PyByteArray_GET_SIZE($input); |
---|
27 | } |
---|
28 | |
---|
29 | %typemap(out) abac_chunk_t { |
---|
30 | $result = PyByteArray_FromStringAndSize( |
---|
31 | (const char *)$1.ptr, |
---|
32 | $1.len |
---|
33 | ); |
---|
34 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.