abac0-leakabac0-meimei-idmei-rt0-nmei_rt0tvf-new-xml
Last change
on this file since fc9548a was
97f6219,
checked in by Mike Ryan <mikeryan@…>, 14 years ago
|
convert from native Python files to FILE * in swig
|
-
Property mode set to
100644
|
File size:
750 bytes
|
Rev | Line | |
---|
[11e3eb7] | 1 | %include "chunk.i" |
---|
| 2 | |
---|
[06e2fc5] | 3 | %typemap(argout) bool &success { |
---|
| 4 | PyObject *o, *o2, *o3; |
---|
| 5 | o = PyBool_FromLong(*$1); |
---|
| 6 | if ((!$result) || ($result == Py_None)) { |
---|
| 7 | $result = o; |
---|
| 8 | } else { |
---|
| 9 | if (!PyTuple_Check($result)) { |
---|
| 10 | PyObject *o2 = $result; |
---|
| 11 | $result = PyTuple_New(1); |
---|
| 12 | PyTuple_SetItem($result,0,o2); |
---|
| 13 | } |
---|
| 14 | o3 = PyTuple_New(2); |
---|
| 15 | PyTuple_SetItem(o3,0,o); |
---|
| 16 | PyTuple_SetItem(o3,1,$result); |
---|
| 17 | $result = o3; |
---|
| 18 | } |
---|
| 19 | } |
---|
| 20 | |
---|
| 21 | %typemap(in,numinputs=0) bool &success(bool temp) { |
---|
| 22 | $1 = &temp; |
---|
| 23 | } |
---|
[97f6219] | 24 | |
---|
| 25 | // treat Python files as FILE * |
---|
| 26 | %typemap(in) std::FILE * %{ |
---|
| 27 | if (!PyFile_Check($input)) |
---|
| 28 | SWIG_exception(SWIG_TypeError, "Expected file object"); |
---|
| 29 | |
---|
| 30 | $1 = PyFile_AsFile($input); |
---|
| 31 | %} |
---|
Note: See
TracBrowser
for help on using the repository browser.