The great merge
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4141 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
5fcae5eb66
commit
12a43edc2d
1508 changed files with 125983 additions and 44037 deletions
|
|
@ -12,19 +12,6 @@
|
|||
// Disclaimer : Unless you really understand how typemaps work, this file
|
||||
// probably isn't going to make much sense.
|
||||
//
|
||||
#ifdef AUTODOC
|
||||
%section "Typemap Library (Python)",info,after,pre,nosort,skip=1,chop_left=3,chop_right=0,chop_top=0,chop_bottom=0
|
||||
%text %{
|
||||
%include typemaps.i
|
||||
|
||||
The SWIG typemap library provides a language independent mechanism for
|
||||
supporting output arguments, input values, and other C function
|
||||
calling mechanisms. The primary use of the library is to provide a
|
||||
better interface to certain C function--especially those involving
|
||||
pointers.
|
||||
%}
|
||||
|
||||
#endif
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Pointer handling
|
||||
|
|
@ -37,11 +24,7 @@ pointers.
|
|||
// These remap a C pointer to be an "INPUT" value which is passed by value
|
||||
// instead of reference.
|
||||
|
||||
|
||||
#ifdef AUTODOC
|
||||
%subsection "Input Methods"
|
||||
|
||||
%text %{
|
||||
/*
|
||||
The following methods can be applied to turn a pointer into a simple
|
||||
"input" value. That is, instead of passing a pointer to an object,
|
||||
you would use a real value instead.
|
||||
|
|
@ -49,10 +32,13 @@ you would use a real value instead.
|
|||
int *INPUT
|
||||
short *INPUT
|
||||
long *INPUT
|
||||
long long *INPUT
|
||||
unsigned int *INPUT
|
||||
unsigned short *INPUT
|
||||
unsigned long *INPUT
|
||||
unsigned long long *INPUT
|
||||
unsigned char *INPUT
|
||||
bool *INPUT
|
||||
float *INPUT
|
||||
double *INPUT
|
||||
|
||||
|
|
@ -73,73 +59,40 @@ or you can use the %apply directive :
|
|||
%apply double *INPUT { double *a, double *b };
|
||||
double fadd(double *a, double *b);
|
||||
|
||||
%}
|
||||
#endif
|
||||
*/
|
||||
|
||||
%typemap(python,in) double *INPUT(double temp)
|
||||
%define INPUT_TYPEMAP(type, converter)
|
||||
%typemap(in) type *INPUT(type temp), type &INPUT(type temp)
|
||||
{
|
||||
temp = PyFloat_AsDouble($source);
|
||||
$target = &temp;
|
||||
temp = converter($input);
|
||||
if (PyErr_Occurred()) SWIG_fail;
|
||||
$1 = &temp;
|
||||
}
|
||||
%typemap(typecheck) type *INPUT = type;
|
||||
%typemap(typecheck) type &INPUT = type;
|
||||
%enddef
|
||||
|
||||
%typemap(python,in) float *INPUT(float temp)
|
||||
{
|
||||
temp = (float) PyFloat_AsDouble($source);
|
||||
$target = &temp;
|
||||
}
|
||||
INPUT_TYPEMAP(float, PyFloat_AsDouble);
|
||||
INPUT_TYPEMAP(double, PyFloat_AsDouble);
|
||||
INPUT_TYPEMAP(int, PyInt_AsLong);
|
||||
INPUT_TYPEMAP(short, PyInt_AsLong);
|
||||
INPUT_TYPEMAP(long, PyInt_AsLong);
|
||||
INPUT_TYPEMAP(long long, PyLong_AsLongLong);
|
||||
INPUT_TYPEMAP(unsigned int, PyInt_AsLong);
|
||||
INPUT_TYPEMAP(unsigned short, PyInt_AsLong);
|
||||
INPUT_TYPEMAP(unsigned long, PyInt_AsLong);
|
||||
INPUT_TYPEMAP(unsigned long long, PyLong_AsUnsignedLongLong);
|
||||
INPUT_TYPEMAP(unsigned char, PyInt_AsLong);
|
||||
INPUT_TYPEMAP(signed char, PyInt_AsLong);
|
||||
INPUT_TYPEMAP(bool, PyInt_AsLong);
|
||||
|
||||
%typemap(python,in) int *INPUT(int temp)
|
||||
{
|
||||
temp = (int) PyInt_AsLong($source);
|
||||
$target = &temp;
|
||||
}
|
||||
#undef INPUT_TYPEMAP
|
||||
|
||||
%typemap(python,in) short *INPUT(short temp)
|
||||
{
|
||||
temp = (short) PyInt_AsLong($source);
|
||||
$target = &temp;
|
||||
}
|
||||
|
||||
%typemap(python,in) long *INPUT(long temp)
|
||||
{
|
||||
temp = (long) PyInt_AsLong($source);
|
||||
$target = &temp;
|
||||
}
|
||||
%typemap(python,in) unsigned int *INPUT(unsigned int temp)
|
||||
{
|
||||
temp = (unsigned int) PyInt_AsLong($source);
|
||||
$target = &temp;
|
||||
}
|
||||
%typemap(python,in) unsigned short *INPUT(unsigned short temp)
|
||||
{
|
||||
temp = (unsigned short) PyInt_AsLong($source);
|
||||
$target = &temp;
|
||||
}
|
||||
%typemap(python,in) unsigned long *INPUT(unsigned long temp)
|
||||
{
|
||||
temp = (unsigned long) PyInt_AsLong($source);
|
||||
$target = &temp;
|
||||
}
|
||||
%typemap(python,in) unsigned char *INPUT(unsigned char temp)
|
||||
{
|
||||
temp = (unsigned char) PyInt_AsLong($source);
|
||||
$target = &temp;
|
||||
}
|
||||
|
||||
%typemap(python,in) signed char *INPUT(signed char temp)
|
||||
{
|
||||
temp = (unsigned char) PyInt_AsLong($source);
|
||||
$target = &temp;
|
||||
}
|
||||
|
||||
// OUTPUT typemaps. These typemaps are used for parameters that
|
||||
// are output only. The output value is appended to the result as
|
||||
// a list element.
|
||||
|
||||
#ifdef AUTODOC
|
||||
%subsection "Output Methods"
|
||||
|
||||
%text %{
|
||||
/*
|
||||
The following methods can be applied to turn a pointer into an "output"
|
||||
value. When calling a function, no input value would be given for
|
||||
a parameter, but an output value would be returned. In the case of
|
||||
|
|
@ -148,15 +101,16 @@ multiple output values, they are returned in the form of a Python tuple.
|
|||
int *OUTPUT
|
||||
short *OUTPUT
|
||||
long *OUTPUT
|
||||
long long *OUTPUT
|
||||
unsigned int *OUTPUT
|
||||
unsigned short *OUTPUT
|
||||
unsigned long *OUTPUT
|
||||
unsigned long long *OUTPUT
|
||||
unsigned char *OUTPUT
|
||||
bool *OUTPUT
|
||||
float *OUTPUT
|
||||
double *OUTPUT
|
||||
|
||||
A Python List can also be returned by using L_OUTPUT instead of OUTPUT.
|
||||
|
||||
For example, suppose you were trying to wrap the modf() function in the
|
||||
C math library which splits x into integral and fractional parts (and
|
||||
returns the integer part in one of its parameters).K:
|
||||
|
|
@ -176,70 +130,8 @@ or you can use the %apply directive :
|
|||
|
||||
The Python output of the function would be a tuple containing both
|
||||
output values.
|
||||
%}
|
||||
#endif
|
||||
|
||||
// Helper function for List output
|
||||
|
||||
%{
|
||||
static PyObject* l_output_helper(PyObject* target, PyObject* o) {
|
||||
PyObject* o2;
|
||||
if (!target) {
|
||||
target = o;
|
||||
} else if (target == Py_None) {
|
||||
Py_DECREF(Py_None);
|
||||
target = o;
|
||||
} else {
|
||||
if (!PyList_Check(target)) {
|
||||
o2 = target;
|
||||
target = PyList_New(0);
|
||||
PyList_Append(target, o2);
|
||||
Py_XDECREF(o2);
|
||||
}
|
||||
PyList_Append(target,o);
|
||||
Py_XDECREF(o);
|
||||
}
|
||||
return target;
|
||||
}
|
||||
%}
|
||||
|
||||
// Force the argument to be ignored.
|
||||
|
||||
%typemap(python,ignore) int *L_OUTPUT(int temp),
|
||||
short *L_OUTPUT(short temp),
|
||||
long *L_OUTPUT(long temp),
|
||||
unsigned int *L_OUTPUT(unsigned int temp),
|
||||
unsigned short *L_OUTPUT(unsigned short temp),
|
||||
unsigned long *L_OUTPUT(unsigned long temp),
|
||||
unsigned char *L_OUTPUT(unsigned char temp),
|
||||
signed char *L_OUTPUT(signed char temp),
|
||||
float *L_OUTPUT(float temp),
|
||||
double *L_OUTPUT(double temp)
|
||||
{
|
||||
$target = &temp;
|
||||
}
|
||||
|
||||
%typemap(python,argout) int *L_OUTPUT,
|
||||
short *L_OUTPUT,
|
||||
long *L_OUTPUT,
|
||||
unsigned int *L_OUTPUT,
|
||||
unsigned short *L_OUTPUT,
|
||||
unsigned long *L_OUTPUT,
|
||||
unsigned char *L_OUTPUT,
|
||||
signed char *L_OUTPUT
|
||||
{
|
||||
PyObject *o;
|
||||
o = PyInt_FromLong((long) (*$source));
|
||||
l_output_helper($target,o);
|
||||
}
|
||||
|
||||
%typemap(python,argout) float *L_OUTPUT,
|
||||
double *L_OUTPUT
|
||||
{
|
||||
PyObject *o;
|
||||
o = PyFloat_FromDouble((double) (*$source));
|
||||
$target = l_output_helper($target,o);
|
||||
}
|
||||
*/
|
||||
|
||||
// These typemaps contributed by Robin Dunn
|
||||
//----------------------------------------------------------------------
|
||||
|
|
@ -250,139 +142,52 @@ static PyObject* l_output_helper(PyObject* target, PyObject* o) {
|
|||
// Author: Robin Dunn
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
%{
|
||||
static PyObject* t_output_helper(PyObject* target, PyObject* o) {
|
||||
PyObject* o2;
|
||||
PyObject* o3;
|
||||
%include "fragments.i"
|
||||
|
||||
if (!target) {
|
||||
target = o;
|
||||
} else if (target == Py_None) {
|
||||
Py_DECREF(Py_None);
|
||||
target = o;
|
||||
} else {
|
||||
if (!PyTuple_Check(target)) {
|
||||
o2 = target;
|
||||
target = PyTuple_New(1);
|
||||
PyTuple_SetItem(target, 0, o2);
|
||||
}
|
||||
o3 = PyTuple_New(1);
|
||||
PyTuple_SetItem(o3, 0, o);
|
||||
|
||||
o2 = target;
|
||||
target = PySequence_Concat(o2, o3);
|
||||
Py_DECREF(o2);
|
||||
Py_DECREF(o3);
|
||||
}
|
||||
return target;
|
||||
%define OUTPUT_TYPEMAP(type, converter, convtype)
|
||||
%typemap(in,numinputs=0) type *OUTPUT(type temp), type &OUTPUT(type temp) "$1 = &temp;";
|
||||
%typemap(argout,fragment="t_output_helper") type *OUTPUT, type &OUTPUT {
|
||||
PyObject *o = converter(convtype (*$1));
|
||||
$result = t_output_helper($result,o);
|
||||
}
|
||||
%}
|
||||
%enddef
|
||||
|
||||
// Force the argument to be ignored.
|
||||
%typemap(python,ignore) int *T_OUTPUT(int temp),
|
||||
short *T_OUTPUT(short temp),
|
||||
long *T_OUTPUT(long temp),
|
||||
unsigned int *T_OUTPUT(unsigned int temp),
|
||||
unsigned short *T_OUTPUT(unsigned short temp),
|
||||
unsigned long *T_OUTPUT(unsigned long temp),
|
||||
unsigned char *T_OUTPUT(unsigned char temp),
|
||||
float *T_OUTPUT(float temp),
|
||||
double *T_OUTPUT(double temp)
|
||||
{
|
||||
$target = &temp;
|
||||
}
|
||||
OUTPUT_TYPEMAP(int, PyInt_FromLong, (long));
|
||||
OUTPUT_TYPEMAP(short, PyInt_FromLong, (long));
|
||||
OUTPUT_TYPEMAP(long, PyInt_FromLong, (long));
|
||||
OUTPUT_TYPEMAP(long long, PyLong_FromLongLong, (long long));
|
||||
OUTPUT_TYPEMAP(unsigned int, PyInt_FromLong, (long));
|
||||
OUTPUT_TYPEMAP(unsigned short, PyInt_FromLong, (long));
|
||||
OUTPUT_TYPEMAP(unsigned long, PyInt_FromLong, (long));
|
||||
OUTPUT_TYPEMAP(unsigned long long, PyLong_FromUnsignedLongLong, (unsigned long long));
|
||||
OUTPUT_TYPEMAP(unsigned char, PyInt_FromLong, (long));
|
||||
OUTPUT_TYPEMAP(signed char, PyInt_FromLong, (long));
|
||||
OUTPUT_TYPEMAP(bool, PyInt_FromLong, (long));
|
||||
OUTPUT_TYPEMAP(float, PyFloat_FromDouble, (double));
|
||||
OUTPUT_TYPEMAP(double, PyFloat_FromDouble, (double));
|
||||
|
||||
%typemap(python,argout) int *T_OUTPUT,
|
||||
short *T_OUTPUT,
|
||||
long *T_OUTPUT,
|
||||
unsigned int *T_OUTPUT,
|
||||
unsigned short *T_OUTPUT,
|
||||
unsigned long *T_OUTPUT,
|
||||
unsigned char *T_OUTPUT
|
||||
{
|
||||
PyObject *o;
|
||||
o = PyInt_FromLong((long) (*$source));
|
||||
$target = t_output_helper($target, o);
|
||||
}
|
||||
|
||||
%typemap(python,argout) float *T_OUTPUT,
|
||||
double *T_OUTPUT
|
||||
{
|
||||
PyObject *o;
|
||||
o = PyFloat_FromDouble((double) (*$source));
|
||||
$target = t_output_helper($target, o);
|
||||
}
|
||||
|
||||
// Set the default output typemap
|
||||
|
||||
#ifdef OUTPUT_LIST
|
||||
%typemap(python,ignore) int *OUTPUT = int *L_OUTPUT;
|
||||
%typemap(python,ignore) short *OUTPUT = short *L_OUTPUT;
|
||||
%typemap(python,ignore) long *OUTPUT = long *L_OUTPUT;
|
||||
%typemap(python,ignore) unsigned *OUTPUT = unsigned *L_OUTPUT;
|
||||
%typemap(python,ignore) unsigned short *OUTPUT = unsigned short *L_OUTPUT;
|
||||
%typemap(python,ignore) unsigned long *OUTPUT = unsigned long *L_OUTPUT;
|
||||
%typemap(python,ignore) unsigned char *OUTPUT = unsigned char *L_OUTPUT;
|
||||
%typemap(python,ignore) signed char *OUTPUT = signed char *L_OUTPUT;
|
||||
%typemap(python,ignore) double *OUTPUT = double *L_OUTPUT;
|
||||
%typemap(python,ignore) float *OUTPUT = float *L_OUTPUT;
|
||||
|
||||
%typemap(python,argout) int *OUTPUT = int *L_OUTPUT;
|
||||
%typemap(python,argout) short *OUTPUT = short *L_OUTPUT;
|
||||
%typemap(python,argout) long *OUTPUT = long *L_OUTPUT;
|
||||
%typemap(python,argout) unsigned *OUTPUT = unsigned *L_OUTPUT;
|
||||
%typemap(python,argout) unsigned short *OUTPUT = unsigned short *L_OUTPUT;
|
||||
%typemap(python,argout) unsigned long *OUTPUT = unsigned long *L_OUTPUT;
|
||||
%typemap(python,argout) unsigned char *OUTPUT = unsigned char *L_OUTPUT;
|
||||
%typemap(python,argout) signed char *OUTPUT = signed char *L_OUTPUT;
|
||||
%typemap(python,argout) double *OUTPUT = double *L_OUTPUT;
|
||||
%typemap(python,argout) float *OUTPUT = float *L_OUTPUT;
|
||||
#else
|
||||
%typemap(python,ignore) int *OUTPUT = int *T_OUTPUT;
|
||||
%typemap(python,ignore) short *OUTPUT = short *T_OUTPUT;
|
||||
%typemap(python,ignore) long *OUTPUT = long *T_OUTPUT;
|
||||
%typemap(python,ignore) unsigned *OUTPUT = unsigned *T_OUTPUT;
|
||||
%typemap(python,ignore) unsigned short *OUTPUT = unsigned short *T_OUTPUT;
|
||||
%typemap(python,ignore) unsigned long *OUTPUT = unsigned long *T_OUTPUT;
|
||||
%typemap(python,ignore) unsigned char *OUTPUT = unsigned char *T_OUTPUT;
|
||||
%typemap(python,ignore) signed char *OUTPUT = signed char *T_OUTPUT;
|
||||
%typemap(python,ignore) double *OUTPUT = double *T_OUTPUT;
|
||||
%typemap(python,ignore) float *OUTPUT = float *T_OUTPUT;
|
||||
|
||||
%typemap(python,argout) int *OUTPUT = int *T_OUTPUT;
|
||||
%typemap(python,argout) short *OUTPUT = short *T_OUTPUT;
|
||||
%typemap(python,argout) long *OUTPUT = long *T_OUTPUT;
|
||||
%typemap(python,argout) unsigned *OUTPUT = unsigned *T_OUTPUT;
|
||||
%typemap(python,argout) unsigned short *OUTPUT = unsigned short *T_OUTPUT;
|
||||
%typemap(python,argout) unsigned long *OUTPUT = unsigned long *T_OUTPUT;
|
||||
%typemap(python,argout) unsigned char *OUTPUT = unsigned char *T_OUTPUT;
|
||||
%typemap(python,argout) signed char *OUTPUT = signed char *T_OUTPUT;
|
||||
%typemap(python,argout) double *OUTPUT = double *T_OUTPUT;
|
||||
%typemap(python,argout) float *OUTPUT = float *T_OUTPUT;
|
||||
#endif
|
||||
#undef OUTPUT_TYPEMAP
|
||||
|
||||
// INOUT
|
||||
// Mappings for an argument that is both an input and output
|
||||
// parameter
|
||||
|
||||
|
||||
#ifdef AUTODOC
|
||||
%subsection "Input/Output Methods"
|
||||
|
||||
%text %{
|
||||
/*
|
||||
The following methods can be applied to make a function parameter both
|
||||
an input and output value. This combines the behavior of both the
|
||||
"INPUT" and "OUTPUT" methods described earlier. Output values are
|
||||
returned in the form of a Python tuple. To return a Python list,
|
||||
using L_INOUT instead.
|
||||
returned in the form of a Python tuple.
|
||||
|
||||
int *INOUT
|
||||
short *INOUT
|
||||
long *INOUT
|
||||
long long *INOUT
|
||||
unsigned int *INOUT
|
||||
unsigned short *INOUT
|
||||
unsigned long *INOUT
|
||||
unsigned long long *INOUT
|
||||
unsigned char *INOUT
|
||||
bool *INOUT
|
||||
float *INOUT
|
||||
double *INOUT
|
||||
|
||||
|
|
@ -413,149 +218,92 @@ to a Python variable you might do this :
|
|||
Note : previous versions of SWIG used the symbol 'BOTH' to mark
|
||||
input/output arguments. This is still supported, but will be slowly
|
||||
phased out in future releases.
|
||||
%}
|
||||
|
||||
#endif
|
||||
*/
|
||||
|
||||
%typemap(python,in) int *INOUT = int *INPUT;
|
||||
%typemap(python,in) short *INOUT = short *INPUT;
|
||||
%typemap(python,in) long *INOUT = long *INPUT;
|
||||
%typemap(python,in) unsigned *INOUT = unsigned *INPUT;
|
||||
%typemap(python,in) unsigned short *INOUT = unsigned short *INPUT;
|
||||
%typemap(python,in) unsigned long *INOUT = unsigned long *INPUT;
|
||||
%typemap(python,in) unsigned char *INOUT = unsigned char *INPUT;
|
||||
%typemap(python,in) float *INOUT = float *INPUT;
|
||||
%typemap(python,in) double *INOUT = double *INPUT;
|
||||
%typemap(in) int *INOUT = int *INPUT;
|
||||
%typemap(in) short *INOUT = short *INPUT;
|
||||
%typemap(in) long *INOUT = long *INPUT;
|
||||
%typemap(in) long long *INOUT = long long *INPUT;
|
||||
%typemap(in) unsigned *INOUT = unsigned *INPUT;
|
||||
%typemap(in) unsigned short *INOUT = unsigned short *INPUT;
|
||||
%typemap(in) unsigned long *INOUT = unsigned long *INPUT;
|
||||
%typemap(in) unsigned long long *INOUT = unsigned long long *INPUT;
|
||||
%typemap(in) unsigned char *INOUT = unsigned char *INPUT;
|
||||
%typemap(in) bool *INOUT = bool *INPUT;
|
||||
%typemap(in) float *INOUT = float *INPUT;
|
||||
%typemap(in) double *INOUT = double *INPUT;
|
||||
|
||||
%typemap(python,argout) int *INOUT = int *OUTPUT;
|
||||
%typemap(python,argout) short *INOUT = short *OUTPUT;
|
||||
%typemap(python,argout) long *INOUT = long *OUTPUT;
|
||||
%typemap(python,argout) unsigned *INOUT = unsigned *OUTPUT;
|
||||
%typemap(python,argout) unsigned short *INOUT = unsigned short *OUTPUT;
|
||||
%typemap(python,argout) unsigned long *INOUT = unsigned long *OUTPUT;
|
||||
%typemap(python,argout) unsigned char *INOUT = unsigned char *OUTPUT;
|
||||
%typemap(python,argout) float *INOUT = float *OUTPUT;
|
||||
%typemap(python,argout) double *INOUT = double *OUTPUT;
|
||||
%typemap(in) int &INOUT = int &INPUT;
|
||||
%typemap(in) short &INOUT = short &INPUT;
|
||||
%typemap(in) long &INOUT = long &INPUT;
|
||||
%typemap(in) long long &INOUT = long long &INPUT;
|
||||
%typemap(in) unsigned &INOUT = unsigned &INPUT;
|
||||
%typemap(in) unsigned short &INOUT = unsigned short &INPUT;
|
||||
%typemap(in) unsigned long &INOUT = unsigned long &INPUT;
|
||||
%typemap(in) unsigned long long &INOUT = unsigned long long &INPUT;
|
||||
%typemap(in) unsigned char &INOUT = unsigned char &INPUT;
|
||||
%typemap(in) bool &INOUT = bool &INPUT;
|
||||
%typemap(in) float &INOUT = float &INPUT;
|
||||
%typemap(in) double &INOUT = double &INPUT;
|
||||
|
||||
%typemap(python,in) int *T_INOUT = int *INPUT;
|
||||
%typemap(python,in) short *T_INOUT = short *INPUT;
|
||||
%typemap(python,in) long *T_INOUT = long *INPUT;
|
||||
%typemap(python,in) unsigned *T_INOUT = unsigned *INPUT;
|
||||
%typemap(python,in) unsigned short *T_INOUT = unsigned short *INPUT;
|
||||
%typemap(python,in) unsigned long *T_INOUT = unsigned long *INPUT;
|
||||
%typemap(python,in) unsigned char *T_INOUT = unsigned char *INPUT;
|
||||
%typemap(python,in) float *T_INOUT = float *INPUT;
|
||||
%typemap(python,in) double *T_INOUT = double *INPUT;
|
||||
%typemap(argout) int *INOUT = int *OUTPUT;
|
||||
%typemap(argout) short *INOUT = short *OUTPUT;
|
||||
%typemap(argout) long *INOUT = long *OUTPUT;
|
||||
%typemap(argout) long long *INOUT = long long *OUTPUT;
|
||||
%typemap(argout) unsigned *INOUT = unsigned *OUTPUT;
|
||||
%typemap(argout) unsigned short *INOUT = unsigned short *OUTPUT;
|
||||
%typemap(argout) unsigned long *INOUT = unsigned long *OUTPUT;
|
||||
%typemap(argout) unsigned long long *INOUT = unsigned long long *OUTPUT;
|
||||
%typemap(argout) unsigned char *INOUT = unsigned char *OUTPUT;
|
||||
%typemap(argout) bool *INOUT = bool *OUTPUT;
|
||||
%typemap(argout) float *INOUT = float *OUTPUT;
|
||||
%typemap(argout) double *INOUT = double *OUTPUT;
|
||||
|
||||
%typemap(python,argout) int *T_INOUT = int *T_OUTPUT;
|
||||
%typemap(python,argout) short *T_INOUT = short *T_OUTPUT;
|
||||
%typemap(python,argout) long *T_INOUT = long *T_OUTPUT;
|
||||
%typemap(python,argout) unsigned *T_INOUT = unsigned *T_OUTPUT;
|
||||
%typemap(python,argout) unsigned short *T_INOUT = unsigned short *T_OUTPUT;
|
||||
%typemap(python,argout) unsigned long *T_INOUT = unsigned long *T_OUTPUT;
|
||||
%typemap(python,argout) unsigned char *T_INOUT = unsigned char *T_OUTPUT;
|
||||
%typemap(python,argout) float *T_INOUT = float *T_OUTPUT;
|
||||
%typemap(python,argout) double *T_INOUT = double *T_OUTPUT;
|
||||
%typemap(argout) int &INOUT = int &OUTPUT;
|
||||
%typemap(argout) short &INOUT = short &OUTPUT;
|
||||
%typemap(argout) long &INOUT = long &OUTPUT;
|
||||
%typemap(argout) long long &INOUT = long long &OUTPUT;
|
||||
%typemap(argout) unsigned &INOUT = unsigned &OUTPUT;
|
||||
%typemap(argout) unsigned short &INOUT = unsigned short &OUTPUT;
|
||||
%typemap(argout) unsigned long &INOUT = unsigned long &OUTPUT;
|
||||
%typemap(argout) unsigned long long &INOUT = unsigned long long &OUTPUT;
|
||||
%typemap(argout) unsigned char &INOUT = unsigned char &OUTPUT;
|
||||
%typemap(argout) bool &INOUT = bool &OUTPUT;
|
||||
%typemap(argout) float &INOUT = float &OUTPUT;
|
||||
%typemap(argout) double &INOUT = double &OUTPUT;
|
||||
|
||||
%typemap(python,in) int *L_INOUT = int *INPUT;
|
||||
%typemap(python,in) short *L_INOUT = short *INPUT;
|
||||
%typemap(python,in) long *L_INOUT = long *INPUT;
|
||||
%typemap(python,in) unsigned *L_INOUT = unsigned *INPUT;
|
||||
%typemap(python,in) unsigned short *L_INOUT = unsigned short *INPUT;
|
||||
%typemap(python,in) unsigned long *L_INOUT = unsigned long *INPUT;
|
||||
%typemap(python,in) unsigned char *L_INOUT = unsigned char *INPUT;
|
||||
%typemap(python,in) float *L_INOUT = float *INPUT;
|
||||
%typemap(python,in) double *L_INOUT = double *INPUT;
|
||||
/* Overloading information */
|
||||
|
||||
%typemap(python,argout) int *L_INOUT = int *L_OUTPUT;
|
||||
%typemap(python,argout) short *L_INOUT = short *L_OUTPUT;
|
||||
%typemap(python,argout) long *L_INOUT = long *L_OUTPUT;
|
||||
%typemap(python,argout) unsigned *L_INOUT = unsigned *L_OUTPUT;
|
||||
%typemap(python,argout) unsigned short *L_INOUT = unsigned short *L_OUTPUT;
|
||||
%typemap(python,argout) unsigned long *L_INOUT = unsigned long *L_OUTPUT;
|
||||
%typemap(python,argout) unsigned char *L_INOUT = unsigned char *L_OUTPUT;
|
||||
%typemap(python,argout) float *L_INOUT = float *L_OUTPUT;
|
||||
%typemap(python,argout) double *L_INOUT = double *L_OUTPUT;
|
||||
%typemap(typecheck) double *INOUT = double;
|
||||
%typemap(typecheck) bool *INOUT = bool;
|
||||
%typemap(typecheck) signed char *INOUT = signed char;
|
||||
%typemap(typecheck) unsigned char *INOUT = unsigned char;
|
||||
%typemap(typecheck) unsigned long *INOUT = unsigned long;
|
||||
%typemap(typecheck) unsigned long long *INOUT = unsigned long long;
|
||||
%typemap(typecheck) unsigned short *INOUT = unsigned short;
|
||||
%typemap(typecheck) unsigned int *INOUT = unsigned int;
|
||||
%typemap(typecheck) long *INOUT = long;
|
||||
%typemap(typecheck) long long *INOUT = long long;
|
||||
%typemap(typecheck) short *INOUT = short;
|
||||
%typemap(typecheck) int *INOUT = int;
|
||||
%typemap(typecheck) float *INOUT = float;
|
||||
|
||||
// Backwards compatibility
|
||||
|
||||
%typemap(python,in) int *BOTH = int *INOUT;
|
||||
%typemap(python,in) short *BOTH = short *INOUT;
|
||||
%typemap(python,in) long *BOTH = long *INOUT;
|
||||
%typemap(python,in) unsigned *BOTH = unsigned *INOUT;
|
||||
%typemap(python,in) unsigned short *BOTH = unsigned short *INOUT;
|
||||
%typemap(python,in) unsigned long *BOTH = unsigned long *INOUT;
|
||||
%typemap(python,in) unsigned char *BOTH = unsigned char *INOUT;
|
||||
%typemap(python,in) float *BOTH = float *INOUT;
|
||||
%typemap(python,in) double *BOTH = double *INOUT;
|
||||
|
||||
%typemap(python,argout) int *BOTH = int *INOUT;
|
||||
%typemap(python,argout) short *BOTH = short *INOUT;
|
||||
%typemap(python,argout) long *BOTH = long *INOUT;
|
||||
%typemap(python,argout) unsigned *BOTH = unsigned *INOUT;
|
||||
%typemap(python,argout) unsigned short *BOTH = unsigned short *INOUT;
|
||||
%typemap(python,argout) unsigned long *BOTH = unsigned long *INOUT;
|
||||
%typemap(python,argout) unsigned char *BOTH = unsigned char *INOUT;
|
||||
%typemap(python,argout) float *BOTH = float *INOUT;
|
||||
%typemap(python,argout) double *BOTH = double *INOUT;
|
||||
|
||||
%typemap(python,in) int *T_BOTH = int *T_INOUT;
|
||||
%typemap(python,in) short *T_BOTH = short *T_INOUT;
|
||||
%typemap(python,in) long *T_BOTH = long *T_INOUT;
|
||||
%typemap(python,in) unsigned *T_BOTH = unsigned *T_INOUT;
|
||||
%typemap(python,in) unsigned short *T_BOTH = unsigned short *T_INOUT;
|
||||
%typemap(python,in) unsigned long *T_BOTH = unsigned long *T_INOUT;
|
||||
%typemap(python,in) unsigned char *T_BOTH = unsigned char *T_INOUT;
|
||||
%typemap(python,in) float *T_BOTH = float *T_INOUT;
|
||||
%typemap(python,in) double *T_BOTH = double *T_INOUT;
|
||||
|
||||
%typemap(python,argout) int *T_BOTH = int *T_INOUT;
|
||||
%typemap(python,argout) short *T_BOTH = short *T_INOUT;
|
||||
%typemap(python,argout) long *T_BOTH = long *T_INOUT;
|
||||
%typemap(python,argout) unsigned *T_BOTH = unsigned *T_INOUT;
|
||||
%typemap(python,argout) unsigned short *T_BOTH = unsigned short *T_INOUT;
|
||||
%typemap(python,argout) unsigned long *T_BOTH = unsigned long *T_INOUT;
|
||||
%typemap(python,argout) unsigned char *T_BOTH = unsigned char *T_INOUT;
|
||||
%typemap(python,argout) float *T_BOTH = float *T_INOUT;
|
||||
%typemap(python,argout) double *T_BOTH = double *T_INOUT;
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// Special types
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#ifdef AUTODOC
|
||||
%subsection "Special Methods"
|
||||
|
||||
%text %{
|
||||
The typemaps.i library also provides the following mappings :
|
||||
|
||||
PyObject *
|
||||
|
||||
When a PyObject * appears as either an input value or return
|
||||
value of a function, SWIG passes it through unmodified. Thus,
|
||||
if you want to write a C function that operates on PyObjects,
|
||||
it is easy to write. For example :
|
||||
|
||||
%include typemaps.i
|
||||
PyObject *spam(PyObject *obj1, int n);
|
||||
|
||||
Unlike normal Python wrapper functions, These functions can
|
||||
use any combination of parameters that you wish.
|
||||
|
||||
%}
|
||||
|
||||
#endif
|
||||
%typemap(typecheck) double &INOUT = double;
|
||||
%typemap(typecheck) bool &INOUT = bool;
|
||||
%typemap(typecheck) signed char &INOUT = signed char;
|
||||
%typemap(typecheck) unsigned char &INOUT = unsigned char;
|
||||
%typemap(typecheck) unsigned long &INOUT = unsigned long;
|
||||
%typemap(typecheck) unsigned long long &INOUT = unsigned long long;
|
||||
%typemap(typecheck) unsigned short &INOUT = unsigned short;
|
||||
%typemap(typecheck) unsigned int &INOUT = unsigned int;
|
||||
%typemap(typecheck) long &INOUT = long;
|
||||
%typemap(typecheck) long long &INOUT = long long;
|
||||
%typemap(typecheck) short &INOUT = short;
|
||||
%typemap(typecheck) int &INOUT = int;
|
||||
%typemap(typecheck) float &INOUT = float;
|
||||
|
||||
|
||||
// If a PyObject * appears as either an argument or a function return
|
||||
// value, simply pass it straight through.
|
||||
|
||||
%typemap(python,in) PyObject * {
|
||||
$target = $source;
|
||||
}
|
||||
|
||||
%typemap(python,out) PyObject * {
|
||||
$target = $source;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue