massive typemap unification
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7676 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
5bbd841acc
commit
7e5e4fd1f9
40 changed files with 6234 additions and 7104 deletions
|
|
@ -48,12 +48,6 @@ std_wsstream.i wstring stream
|
|||
std_wstreambuf.i wstreambuf
|
||||
std_wstring.i wstring
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Backward compatibility
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
std_vectora.i vector + allocator (allocators are now supported in STD/STL)
|
||||
typemaps.i old in/out typemaps (doen't need to be included)
|
||||
|
||||
|
||||
/********************************************************************************
|
||||
|
|
@ -87,14 +81,9 @@ pyrun.swg Python run-time code
|
|||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
pyswigtype.swg SWIGTYPE
|
||||
pyvoid.swg void *
|
||||
pyobject.swg PyObject
|
||||
pystrbase.swg String base
|
||||
pystrings.swg Char strings (char *)
|
||||
pywstrings.swg Wchar Strings (wchar_t *)
|
||||
pyprimtypes.swg Primitive types (shot,int,double,etc)
|
||||
pymisctypes.swg Miscellaneos types (size_t, ptrdiff_t, etc)
|
||||
pyenum.swg enum especializations
|
||||
pycomplex.swg PyComplex and helper for C/C++ complex types
|
||||
pydocs.swg Typemaps documentation
|
||||
|
||||
|
|
@ -107,8 +96,10 @@ std_common.i general common code for the STD/STL implementation
|
|||
std_container.i general common code for the STD/STL containers
|
||||
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* deprecated
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Backward compatibility and deprecated
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
std_vectora.i vector + allocator (allocators are now supported in STD/STL)
|
||||
typemaps.i old in/out typemaps (doen't need to be included)
|
||||
defarg.swg for processing default arguments with shadow classes
|
||||
|
|
|
|||
|
|
@ -2,16 +2,15 @@
|
|||
* --- Argc & Argv ---
|
||||
* ------------------------------------------------------------ */
|
||||
|
||||
%fragment("SWIG_AsArgcArgv","header",
|
||||
fragment="SWIG_AsCharPtr") {
|
||||
%fragment("SWIG_AsArgcArgv","header",fragment="SWIG_AsCharPtrAndSize") {
|
||||
SWIGINTERN char**
|
||||
SWIG_AsArgcArgv(PyObject* input,
|
||||
swig_type_info* ppchar_info,
|
||||
size_t* argc, int* owner)
|
||||
SWIG_AsArgcArgv(PyObject* input,
|
||||
swig_type_info* ppchar_info,
|
||||
size_t* argc, int* owner)
|
||||
{
|
||||
char **argv = 0;
|
||||
size_t i = 0;
|
||||
if (SWIG_ConvertPtr(input, (void **)&argv, ppchar_info, 0) == -1) {
|
||||
if (SWIG_ConvertPtr(input, (void **)&argv, ppchar_info, 0) != SWIG_OK) {
|
||||
int list = 0;
|
||||
PyErr_Clear();
|
||||
list = PyList_Check(input);
|
||||
|
|
@ -21,10 +20,17 @@ SWIGINTERN char**
|
|||
*owner = 1;
|
||||
for (; i < *argc; ++i) {
|
||||
PyObject *obj = list ? PyList_GetItem(input,i) : PyTuple_GetItem(input,i);
|
||||
if (!SWIG_AsCharPtr(obj, &(argv[i]))) {
|
||||
char *cptr = 0; size_t size = 0; int alloc = 0;
|
||||
if (SWIG_AsCharPtrAndSize(obj, &cptr, &size, &alloc) == SWIG_OK) {
|
||||
if (cptr && size) {
|
||||
argv[i] = (alloc == SWIG_NEWOBJ) ? cptr : SWIG_new_copy_array(cptr, size, char);
|
||||
} else {
|
||||
argv[i] = 0;
|
||||
}
|
||||
} else {
|
||||
PyErr_Clear();
|
||||
PyErr_SetString(PyExc_TypeError,"list or tuple must contain strings only");
|
||||
}
|
||||
}
|
||||
}
|
||||
argv[i] = 0;
|
||||
return argv;
|
||||
|
|
@ -48,13 +54,11 @@ SWIGINTERN char**
|
|||
tuple
|
||||
*/
|
||||
|
||||
%typemap(in,fragment="SWIG_AsArgcArgv") (int ARGC, char **ARGV)
|
||||
(int owner) {
|
||||
size_t argc = 0;
|
||||
char **argv = SWIG_AsArgcArgv($input, $descriptor(char**), &argc, &owner);
|
||||
if (PyErr_Occurred()) {
|
||||
%typemap(in,noblock=0,fragment="SWIG_AsArgcArgv") (int ARGC, char **ARGV) (char **argv = 0, size_t argc = 0, int owner= 0) {
|
||||
argv = SWIG_AsArgcArgv($input, $descriptor(char**), &argc, &owner);
|
||||
if (!argv) {
|
||||
$1 = 0; $2 = 0;
|
||||
if (SWIG_arg_fail($argnum)) SWIG_fail;
|
||||
SWIG_arg_fail(SWIG_TypeError, "int ARGC, char **ARGV", $argnum);
|
||||
} else {
|
||||
$1 = ($1_ltype) argc;
|
||||
$2 = ($2_ltype) argv;
|
||||
|
|
@ -62,6 +66,12 @@ SWIGINTERN char**
|
|||
}
|
||||
|
||||
%typemap(freearg) (int ARGC, char **ARGV) {
|
||||
if (owner$argnum) SWIG_delete_array($2);
|
||||
if (owner$argnum) {
|
||||
size_t i = argc$argnum;
|
||||
while (i) {
|
||||
SWIG_delete_array(argv$argnum[--i]);
|
||||
}
|
||||
SWIG_delete_array(argv$argnum);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
Attribute implementation using JOHN E LENZ ideas.
|
||||
|
||||
The following macros convert a pair of set/get methods
|
||||
into a "native" python attribute.
|
||||
into a "native" attribute.
|
||||
|
||||
Use %attribute when you have a pair of get/set methods
|
||||
like in:
|
||||
|
|
|
|||
1
Lib/python/cdata.i
Normal file
1
Lib/python/cdata.i
Normal file
|
|
@ -0,0 +1 @@
|
|||
%include <typemaps/cdata.swg>
|
||||
|
|
@ -1,263 +0,0 @@
|
|||
/*
|
||||
* cstring.i
|
||||
* $Header$
|
||||
*
|
||||
* Author(s): David Beazley (beazley@cs.uchicago.edu)
|
||||
*
|
||||
* This file provides typemaps and macros for dealing with various forms
|
||||
* of C character string handling. The primary use of this module
|
||||
* is in returning character data that has been allocated or changed in
|
||||
* some way.
|
||||
*/
|
||||
|
||||
%include <pytuplehlp.swg>
|
||||
|
||||
%define %typemap_cstrings(Name, Char,
|
||||
SWIG_AsCharPtr,
|
||||
SWIG_AsCharPtrAndSize,
|
||||
SWIG_FromCharPtr,
|
||||
SWIG_FromCharArray)
|
||||
|
||||
/* %cstring_input_binary(TYPEMAP, SIZE)
|
||||
*
|
||||
* Macro makes a function accept binary string data along with
|
||||
* a size. For example:
|
||||
*
|
||||
* %cstring_input_binary(Char *buff, int size);
|
||||
* void foo(Char *buff, int size) {
|
||||
* }
|
||||
*
|
||||
*/
|
||||
|
||||
%define Name ## _input_binary(TYPEMAP, SIZE)
|
||||
%typemap(in, fragment=#SWIG_AsCharPtrAndSize) (TYPEMAP, SIZE)
|
||||
(Char *buf, size_t size)
|
||||
{
|
||||
SWIG_AsCharPtrAndSize($input, &buf, &size);
|
||||
if (SWIG_arg_fail($argnum)) SWIG_fail;
|
||||
$1 = ($1_ltype) buf;
|
||||
$2 = ($2_ltype) size - 1;
|
||||
}
|
||||
%enddef
|
||||
|
||||
|
||||
/*
|
||||
* %cstring_bounded_output(TYPEMAP, MAX)
|
||||
*
|
||||
* This macro is used to return a NULL-terminated output string of
|
||||
* some maximum length. For example:
|
||||
*
|
||||
* %cstring_bounded_output(Char *outx, 512);
|
||||
* void foo(Char *outx) {
|
||||
* sprintf(outx,"blah blah\n");
|
||||
* }
|
||||
*
|
||||
*/
|
||||
|
||||
%define Name ## _bounded_output(TYPEMAP,MAX)
|
||||
%typemap(in,numinputs=0) TYPEMAP(Char temp[MAX+1])
|
||||
"$1 = ($1_ltype) temp;";
|
||||
|
||||
%typemap(argout,fragment="t_output_helper," #SWIG_FromCharPtr ) TYPEMAP
|
||||
"$1[MAX] = 0; $result = t_output_helper($result, SWIG_FromCharPtr($1));";
|
||||
%enddef
|
||||
|
||||
|
||||
/*
|
||||
* %cstring_chunk_output(TYPEMAP, SIZE)
|
||||
*
|
||||
* This macro is used to return a chunk of binary string data.
|
||||
* Embedded NULLs are okay. For example:
|
||||
*
|
||||
* %cstring_chunk_output(Char *outx, 512);
|
||||
* void foo(Char *outx) {
|
||||
* memmove(outx, somedata, 512);
|
||||
* }
|
||||
*
|
||||
*/
|
||||
|
||||
%define Name ## _chunk_output(TYPEMAP,SIZE)
|
||||
%typemap(in,numinputs=0) TYPEMAP(Char temp[SIZE])
|
||||
"$1 = ($1_ltype) temp;";
|
||||
|
||||
%typemap(argout,fragment="t_output_helper," #SWIG_FromCharArray) TYPEMAP
|
||||
"$result = t_output_helper($result, SWIG_FromCharArray($1,SIZE));";
|
||||
%enddef
|
||||
|
||||
|
||||
/*
|
||||
* %cstring_bounded_mutable(TYPEMAP, SIZE)
|
||||
*
|
||||
* This macro is used to wrap a string that's going to mutate.
|
||||
*
|
||||
* %cstring_bounded_mutable(Char *in, 512);
|
||||
* void foo(in *x) {
|
||||
* while (*x) {
|
||||
* *x = toupper(*x);
|
||||
* x++;
|
||||
* }
|
||||
* }
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
%define Name ## _bounded_mutable(TYPEMAP,MAX)
|
||||
%typemap(in,fragment=#SWIG_AsCharPtrAndSize) TYPEMAP(Char temp[MAX+1]) {
|
||||
Char *t = 0; size_t n;
|
||||
SWIG_AsCharPtrAndSize($input, &t, &n);
|
||||
if (SWIG_arg_fail($argnum)) SWIG_fail;
|
||||
if ( n > (size_t)MAX ) n = (size_t)MAX;
|
||||
memcpy(temp, t, sizeof(Char)*n);
|
||||
temp[n] = 0;
|
||||
$1 = ($1_ltype) temp;
|
||||
}
|
||||
%typemap(argout,fragment="t_output_helper," #SWIG_FromCharPtr) TYPEMAP
|
||||
"$1[MAX] = 0; $result = t_output_helper($result, SWIG_FromCharPtr($1));";
|
||||
%enddef
|
||||
|
||||
|
||||
/*
|
||||
* %cstring_mutable(TYPEMAP [, expansion])
|
||||
*
|
||||
* This macro is used to wrap a string that will mutate in place.
|
||||
* It may change size up to a user-defined expansion.
|
||||
*
|
||||
* %cstring_mutable(Char *in);
|
||||
* void foo(in *x) {
|
||||
* while (*x) {
|
||||
* *x = toupper(*x);
|
||||
* x++;
|
||||
* }
|
||||
* }
|
||||
*
|
||||
*/
|
||||
|
||||
%define Name ## _mutable(TYPEMAP,EXP...)
|
||||
%typemap(in,fragment=#SWIG_AsCharPtrAndSize) TYPEMAP {
|
||||
#if #EXP == ""
|
||||
const size_t expansion = 1;
|
||||
#else
|
||||
const size_t expansion = 1 + EXP;
|
||||
#endif
|
||||
Char* t = 0; size_t n = 0;
|
||||
SWIG_AsCharPtrAndSize($input, &t, &n);
|
||||
if (SWIG_arg_fail($argnum)) SWIG_fail;
|
||||
$1 = SWIG_new_array(n+expansion, $*1_ltype);
|
||||
memcpy($1,t,sizeof(Char)*n);
|
||||
$1[n] = 0;
|
||||
}
|
||||
|
||||
%typemap(argout,fragment="t_output_helper," #SWIG_FromCharPtr) TYPEMAP {
|
||||
$result = t_output_helper($result,SWIG_FromCharPtr($1));
|
||||
SWIG_delete_array($1);
|
||||
}
|
||||
%enddef
|
||||
|
||||
/*
|
||||
* %cstring_output_maxsize(TYPEMAP, SIZE)
|
||||
*
|
||||
* This macro returns data in a string of some user-defined size.
|
||||
*
|
||||
* %cstring_output_maxsize(Char *outx, int max) {
|
||||
* void foo(Char *outx, int max) {
|
||||
* sprintf(outx,"blah blah\n");
|
||||
* }
|
||||
*/
|
||||
|
||||
%define Name ## _output_maxsize(TYPEMAP, SIZE)
|
||||
%typemap(in,fragment=SWIG_As_frag(unsigned long)) (TYPEMAP, SIZE) {
|
||||
$2 = ($2_ltype) SWIG_As(unsigned long)($input);
|
||||
if (SWIG_arg_fail($argnum)) SWIG_fail;
|
||||
$1 = SWIG_new_array($2+1, $*1_ltype);
|
||||
}
|
||||
%typemap(argout,fragment="t_output_helper," #SWIG_FromCharPtr) (TYPEMAP,SIZE) {
|
||||
$result = t_output_helper($result,SWIG_FromCharPtr($1));
|
||||
SWIG_delete_array($1);
|
||||
}
|
||||
%enddef
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* %cstring_output_withsize(TYPEMAP, SIZE)
|
||||
*
|
||||
* This macro is used to return Character data along with a size
|
||||
* parameter.
|
||||
*
|
||||
* %cstring_output_maxsize(Char *outx, int *max) {
|
||||
* void foo(Char *outx, int *max) {
|
||||
* sprintf(outx,"blah blah\n");
|
||||
* *max = strlen(outx);
|
||||
* }
|
||||
*/
|
||||
|
||||
%define Name ## _output_withsize(TYPEMAP, SIZE)
|
||||
%typemap(in,fragment=SWIG_As_frag(unsigned long)) (TYPEMAP, SIZE) {
|
||||
size_t n = SWIG_As(unsigned long)($input);
|
||||
if (SWIG_arg_fail($argnum)) SWIG_fail;
|
||||
$1 = SWIG_new_array(n+1, $*1_ltype);
|
||||
$2 = SWIG_new($*2_ltype);
|
||||
*$2 = n;
|
||||
}
|
||||
%typemap(argout,fragment="t_output_helper," #SWIG_FromCharArray) (TYPEMAP,SIZE) {
|
||||
$result = t_output_helper($result, SWIG_FromCharArray($1,*$2));
|
||||
SWIG_delete_array($1);
|
||||
SWIG_delete($2);
|
||||
}
|
||||
%enddef
|
||||
|
||||
|
||||
/*
|
||||
* %cstring_output_allocate(TYPEMAP, RELEASE)
|
||||
*
|
||||
* This macro is used to return Character data that was
|
||||
* allocated with new or malloc.
|
||||
*
|
||||
* %cstring_output_allocated(Char **outx, free($1));
|
||||
* void foo(Char **outx) {
|
||||
* *outx = (Char *) malloc(512);
|
||||
* sprintf(outx,"blah blah\n");
|
||||
* }
|
||||
*/
|
||||
|
||||
%define Name ## _output_allocate(TYPEMAP, RELEASE)
|
||||
%typemap(in,numinputs=0) TYPEMAP($*1_ltype temp = 0)
|
||||
"$1 = &temp;";
|
||||
|
||||
%typemap(argout,fragment="t_output_helper," #SWIG_FromCharPtr) TYPEMAP {
|
||||
if (*$1) {
|
||||
$result = t_output_helper($result,SWIG_FromCharPtr(*$1));
|
||||
RELEASE;
|
||||
}
|
||||
}
|
||||
%enddef
|
||||
|
||||
|
||||
/*
|
||||
* %cstring_output_allocate_size(TYPEMAP, SIZE, RELEASE)
|
||||
*
|
||||
* This macro is used to return Character data that was
|
||||
* allocated with new or malloc.
|
||||
*
|
||||
* %cstring_output_allocated(Char **outx, int *sz, free($1));
|
||||
* void foo(Char **outx, int *sz) {
|
||||
* *outx = (Char *) malloc(512);
|
||||
* sprintf(outx,"blah blah\n");
|
||||
* *sz = strlen(outx);
|
||||
* }
|
||||
*/
|
||||
|
||||
%define Name ## _output_allocate_size(TYPEMAP, SIZE, RELEASE)
|
||||
%typemap(in,numinputs=0) (TYPEMAP, SIZE) ($*1_ltype temp = 0, $*2_ltype tempn)
|
||||
"$1 = &temp; $2 = &tempn;";
|
||||
|
||||
%typemap(argout,fragment="t_output_helper," #SWIG_FromCharArray)(TYPEMAP,SIZE) {
|
||||
if (*$1) {
|
||||
$result = t_output_helper($result,SWIG_FromCharArray(*$1,*$2));
|
||||
RELEASE;
|
||||
}
|
||||
}
|
||||
%enddef
|
||||
|
||||
%enddef
|
||||
|
||||
|
|
@ -125,13 +125,13 @@
|
|||
* }
|
||||
*/
|
||||
|
||||
%include <typemaps/cstring.swg>
|
||||
%include <pystrings.swg>
|
||||
%include <cstrbase.swg>
|
||||
|
||||
%typemap_cstrings(%cstring,
|
||||
char,
|
||||
SWIG_AsCharPtr,
|
||||
SWIG_AsCharPtrAndSize,
|
||||
SWIG_FromCharPtr,
|
||||
SWIG_FromCharArray);
|
||||
SWIG_FromCharPtrAndSize);
|
||||
|
||||
|
|
|
|||
|
|
@ -125,13 +125,13 @@
|
|||
*/
|
||||
|
||||
|
||||
%include <typemaps/cstring.swg>
|
||||
%include <pywstrings.swg>
|
||||
%include <cstrbase.swg>
|
||||
|
||||
%typemap_cstrings(%cwstring,
|
||||
wchar_t,
|
||||
SWIG_AsWCharPtr,
|
||||
SWIG_AsWCharPtrAndSize,
|
||||
SWIG_FromWCharPtr,
|
||||
SWIG_FromWCharArray);
|
||||
SWIG_FromWCharPtrAndSize);
|
||||
|
||||
|
|
|
|||
|
|
@ -90,30 +90,40 @@ namespace Swig {
|
|||
protected:
|
||||
std::string swig_msg;
|
||||
public:
|
||||
DirectorException(const char* hdr ="", const char* msg ="")
|
||||
: swig_msg(hdr) {
|
||||
swig_msg += msg;
|
||||
DirectorException(PyObject *error, const char* hdr ="", const char* msg ="")
|
||||
: swig_msg(hdr)
|
||||
{
|
||||
if (strlen(msg)) {
|
||||
swig_msg += " ";
|
||||
swig_msg += msg;
|
||||
}
|
||||
if (!PyErr_Occurred()) {
|
||||
PyErr_SetString(PyExc_TypeError, getMessage());
|
||||
SWIG_Python_SetErrorMsg(error, getMessage());
|
||||
} else {
|
||||
SWIG_Python_AddErrMesg(getMessage(), 1);
|
||||
SWIG_Python_AddErrorMsg(getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
const char *getMessage() const {
|
||||
const char *getMessage() const
|
||||
{
|
||||
return swig_msg.c_str();
|
||||
}
|
||||
|
||||
static void raise(const char* msg = "")
|
||||
static void raise(PyObject *error, const char *msg)
|
||||
{
|
||||
throw DirectorException(msg);
|
||||
throw DirectorException(error, msg);
|
||||
}
|
||||
|
||||
static void raise(const char *msg)
|
||||
{
|
||||
raise(PyExc_RuntimeError, msg);
|
||||
}
|
||||
};
|
||||
|
||||
/* unknown exception handler */
|
||||
class UnknownExceptionHandler
|
||||
{
|
||||
static void handler();
|
||||
|
||||
static void handler();
|
||||
public:
|
||||
|
||||
#ifdef SWIG_DIRECTOR_UEH
|
||||
|
|
@ -133,11 +143,22 @@ namespace Swig {
|
|||
/* type mismatch in the return value from a python method call */
|
||||
class DirectorTypeMismatchException : public Swig::DirectorException {
|
||||
public:
|
||||
DirectorTypeMismatchException(const char* msg="")
|
||||
: Swig::DirectorException("Swig director type mismatch: ", msg) {
|
||||
DirectorTypeMismatchException(PyObject *error, const char* msg="")
|
||||
: Swig::DirectorException(error, "Swig director type mismatch", msg)
|
||||
{
|
||||
}
|
||||
|
||||
static void raise(const char* msg = "")
|
||||
DirectorTypeMismatchException(const char* msg="")
|
||||
: Swig::DirectorException(PyExc_TypeError, "Swig director type mismatch", msg)
|
||||
{
|
||||
}
|
||||
|
||||
static void raise(PyObject *error, const char *msg)
|
||||
{
|
||||
throw DirectorTypeMismatchException(error, msg);
|
||||
}
|
||||
|
||||
static void raise(const char *msg)
|
||||
{
|
||||
throw DirectorTypeMismatchException(msg);
|
||||
}
|
||||
|
|
@ -147,11 +168,11 @@ namespace Swig {
|
|||
class DirectorMethodException : public Swig::DirectorException {
|
||||
public:
|
||||
DirectorMethodException(const char* msg = "")
|
||||
: DirectorException("Swig director python method error: ", msg)
|
||||
: DirectorException(PyExc_RuntimeError, "Swig director method error", msg)
|
||||
{
|
||||
}
|
||||
|
||||
static void raise(const char* msg = "")
|
||||
static void raise(const char *msg)
|
||||
{
|
||||
throw DirectorMethodException(msg);
|
||||
}
|
||||
|
|
@ -162,11 +183,11 @@ namespace Swig {
|
|||
{
|
||||
public:
|
||||
DirectorPureVirtualException(const char* msg = "")
|
||||
: DirectorException("Swig director pure virtal method called: ", msg)
|
||||
: DirectorException(PyExc_RuntimeError, "Swig director pure virtal method called", msg)
|
||||
{
|
||||
}
|
||||
|
||||
static void raise(const char* msg = "")
|
||||
static void raise(const char *msg)
|
||||
{
|
||||
throw DirectorPureVirtualException(msg);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,19 +14,19 @@ SWIG_AsValFilePtr(PyObject *obj, FILE **val) {
|
|||
static swig_type_info* desc = 0;
|
||||
FILE *ptr = 0;
|
||||
if (!desc) desc = SWIG_TypeQuery("FILE *");
|
||||
if ((SWIG_ConvertPtr(obj,(void **)(&ptr), desc, 0)) != -1) {
|
||||
if ((SWIG_ConvertPtr(obj,(void **)(&ptr), desc, 0)) == SWIG_OK) {
|
||||
if (val) *val = ptr;
|
||||
return 1;
|
||||
return SWIG_OK;
|
||||
}
|
||||
if (PyFile_Check(obj)) {
|
||||
if (val) *val = PyFile_AsFile(obj);
|
||||
return 1;
|
||||
return SWIG_OK;
|
||||
}
|
||||
if (val) PyErr_SetString(PyExc_TypeError, "a FILE* is expected");
|
||||
return 0;
|
||||
return SWIG_TypeError;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
%fragment("SWIG_AsFilePtr","header",fragment="SWIG_AsValFilePtr") {
|
||||
SWIGINTERNINLINE FILE*
|
||||
SWIG_AsFilePtr(PyObject *obj) {
|
||||
|
|
@ -36,13 +36,5 @@ SWIG_AsFilePtr(PyObject *obj) {
|
|||
}
|
||||
}
|
||||
|
||||
%fragment("SWIG_CheckFilePtr","header",fragment="SWIG_AsValFilePtr") {
|
||||
SWIGINTERNINLINE int
|
||||
SWIG_CheckFilePtr(PyObject *obj) {
|
||||
return SWIG_AsValFilePtr(obj, (FILE **)(0));
|
||||
}
|
||||
}
|
||||
|
||||
/* defining the typemaps */
|
||||
%typemap_ascheck(SWIG_CCode(POINTER), SWIG_AsFilePtr, SWIG_CheckFilePtr,
|
||||
"SWIG_AsFilePtr", "SWIG_CheckFilePtr", FILE*);
|
||||
%typemap_asval(SWIG_CCode(POINTER), SWIG_AsValFilePtr, "SWIG_AsValFilePtr", FILE*);
|
||||
|
|
|
|||
|
|
@ -1,217 +1,2 @@
|
|||
%include <std_common.i>
|
||||
|
||||
/*
|
||||
The %implict macro allows a SwigType to be accepted
|
||||
as an input parameter and use its implicit constructors when needed.
|
||||
|
||||
|
||||
%implicit(A, int, double, B);
|
||||
|
||||
%inline
|
||||
{
|
||||
struct B { };
|
||||
struct A
|
||||
{
|
||||
int ii;
|
||||
A(int i) { ii = 1; }
|
||||
A(double d) { ii = 2; }
|
||||
A(const B& b) { ii = 3; }
|
||||
};
|
||||
|
||||
int get(A a) { return a.ii; }
|
||||
}
|
||||
|
||||
Here, you can call 'get' as
|
||||
|
||||
get(1) ==> get(A(1))
|
||||
get(2.0) ==> get(A(2.0))
|
||||
get(B()) ==> get(A(B()))
|
||||
|
||||
and swig will construct an 'A' temporal variable using the
|
||||
corresponding implicit constructor.
|
||||
|
||||
|
||||
The plain implicit macro takes care of simple type list. If it doesn't
|
||||
work because you are passing template types with commas, then use
|
||||
the %implicit_{1,2,3} versions, and the SWIG_arg macro.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
%define %implicit_type(...)
|
||||
%traits_swigtype(__VA_ARGS__);
|
||||
%enddef
|
||||
|
||||
%define %implicit_frag(...) ,fragment=SWIG_Traits_frag(__VA_ARGS__) %enddef
|
||||
|
||||
%define %implicit_code(...)
|
||||
if (swig::check<__VA_ARGS__ >(obj)) {
|
||||
if (val) *val = new value_type(swig::as<__VA_ARGS__ >(obj));
|
||||
return SWIG_NEWOBJ;
|
||||
}
|
||||
%enddef
|
||||
|
||||
/* implicit */
|
||||
|
||||
%define %implicit(Type, ...)
|
||||
|
||||
%formacro_1(%implicit_type,__VA_ARGS__);
|
||||
|
||||
%fragment(SWIG_Traits_frag(Type),"header",
|
||||
fragment="StdTraits"
|
||||
%formacro_1(%implicit_frag,__VA_ARGS__)) %{
|
||||
namespace swig {
|
||||
template <> struct traits<Type > {
|
||||
typedef pointer_category category;
|
||||
static const char* type_name() { return "Type"; }
|
||||
};
|
||||
|
||||
template <> struct traits_asptr< Type > {
|
||||
typedef Type value_type;
|
||||
static int asptr(PyObject *obj, value_type **val) {
|
||||
Type *vptr;
|
||||
static swig_type_info* desc = SWIG_TypeQuery("Type *");
|
||||
if ((SWIG_ConvertPtr(obj, (void **)&vptr, desc, 0) != -1)) {
|
||||
if (val) *val = vptr;
|
||||
return SWIG_OLDOBJ;
|
||||
} else {
|
||||
if (PyErr_Occurred()) PyErr_Clear();
|
||||
%formacro_1(%implicit_code,__VA_ARGS__)
|
||||
}
|
||||
if (val) {
|
||||
PyErr_SetString(PyExc_TypeError, "a " "Type" " is expected");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
}
|
||||
%}
|
||||
|
||||
%typemap_traits_ptr(SWIG_CCode(POINTER),Type);
|
||||
%enddef
|
||||
|
||||
/* implicit_1 */
|
||||
|
||||
|
||||
%define %implicit_1(Type, Imp1)
|
||||
%traits_swigtype(Imp1);
|
||||
|
||||
%fragment(SWIG_Traits_frag(Type),"header",
|
||||
fragment="StdTraits",
|
||||
fragment=SWIG_Traits_frag(Imp1)) %{
|
||||
namespace swig {
|
||||
template <> struct traits< Type > {
|
||||
typedef pointer_category category;
|
||||
static const char* type_name() { return "Type"; }
|
||||
};
|
||||
|
||||
template <> struct traits_asptr< Type > {
|
||||
typedef Type value_type;
|
||||
static int asptr(PyObject *obj, value_type **val) {
|
||||
Type *vptr;
|
||||
static swig_type_info* desc = SWIG_TypeQuery("Type *");
|
||||
if ((SWIG_ConvertPtr(obj, (void **)&vptr, desc, 0) != -1)) {
|
||||
if (val) *val = vptr;
|
||||
return SWIG_OLDOBJ;
|
||||
} else {
|
||||
if (PyErr_Occurred()) PyErr_Clear();
|
||||
%implicit_code(Imp1);
|
||||
}
|
||||
if (val) {
|
||||
PyErr_SetString(PyExc_TypeError, "a " "Type" " is expected");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
}
|
||||
%}
|
||||
|
||||
%typemap_traits_ptr(SWIG_CCode(POINTER),Type);
|
||||
|
||||
%enddef
|
||||
|
||||
/* implicit_2 */
|
||||
|
||||
%define %implicit_2(Type, Imp1, Imp2)
|
||||
%traits_swigtype(Imp1);
|
||||
%traits_swigtype(Imp2);
|
||||
|
||||
%fragment(SWIG_Traits_frag(Type),"header",
|
||||
fragment="StdTraits",
|
||||
fragment=SWIG_Traits_frag(Imp1),
|
||||
fragment=SWIG_Traits_frag(Imp2)) %{
|
||||
namespace swig {
|
||||
template <> struct traits< Type > {
|
||||
typedef pointer_category category;
|
||||
static const char* type_name() { return "Type"; }
|
||||
};
|
||||
|
||||
template <> struct traits_asptr< Type > {
|
||||
typedef Type value_type;
|
||||
static int asptr(PyObject *obj, value_type **val) {
|
||||
Type *vptr;
|
||||
static swig_type_info* desc = SWIG_TypeQuery("Type *");
|
||||
if ((SWIG_ConvertPtr(obj, (void **)&vptr, desc, 0) != -1)) {
|
||||
if (val) *val = vptr;
|
||||
return SWIG_OLDOBJ;
|
||||
} else {
|
||||
if (PyErr_Occurred()) PyErr_Clear();
|
||||
%implicit_code(Imp1);
|
||||
%implicit_code(Imp2);
|
||||
}
|
||||
if (val) {
|
||||
PyErr_SetString(PyExc_TypeError, "a " "Type" " is expected");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
}
|
||||
%}
|
||||
|
||||
%typemap_traits_ptr(SWIG_CCode(POINTER),Type);
|
||||
%enddef
|
||||
|
||||
|
||||
/* implicit_3 */
|
||||
|
||||
%define %implicit_3(Type, Imp1, Imp2, Imp3)
|
||||
%traits_swigtype(Imp1);
|
||||
%traits_swigtype(Imp2);
|
||||
%traits_swigtype(Imp3);
|
||||
|
||||
%fragment(SWIG_Traits_frag(Type),"header",
|
||||
fragment="StdTraits",
|
||||
fragment=SWIG_Traits_frag(Imp1),
|
||||
fragment=SWIG_Traits_frag(Imp2),
|
||||
fragment=SWIG_Traits_frag(Imp3)) %{
|
||||
namespace swig {
|
||||
template <> struct traits< Type > {
|
||||
typedef pointer_category category;
|
||||
static const char* type_name() { return "Type"; }
|
||||
};
|
||||
|
||||
template <> struct traits_asptr< Type > {
|
||||
typedef Type value_type;
|
||||
static int asptr(PyObject *obj, value_type **val) {
|
||||
Type *vptr;
|
||||
static swig_type_info* desc = SWIG_TypeQuery("Type *");
|
||||
if ((SWIG_ConvertPtr(obj, (void **)&vptr, desc, 0) != -1)) {
|
||||
if (val) *val = vptr;
|
||||
return SWIG_OLDOBJ;
|
||||
} else {
|
||||
if (PyErr_Occurred()) PyErr_Clear();
|
||||
%implicit_code(Imp1);
|
||||
%implicit_code(Imp2);
|
||||
%implicit_code(Imp3);
|
||||
}
|
||||
if (val) {
|
||||
PyErr_SetString(PyExc_TypeError, "a " "Type" " is expected");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
}
|
||||
%}
|
||||
|
||||
%typemap_traits_ptr(SWIG_CCode(POINTER),Type);
|
||||
%enddef
|
||||
%include <typemaps/implicit.swg>
|
||||
|
|
|
|||
|
|
@ -1,47 +1,16 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* SWIG API. Portion that goes into the runtime
|
||||
* Python API portion that goes into the runtime
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* for internal method declarations
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef SWIGINTERN
|
||||
# define SWIGINTERN static SWIGUNUSED
|
||||
#endif
|
||||
|
||||
#ifndef SWIGINTERNINLINE
|
||||
# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
|
||||
#endif
|
||||
|
||||
/*
|
||||
Exception handling in wrappers
|
||||
*/
|
||||
#define SWIG_fail goto fail
|
||||
#define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg)
|
||||
#define SWIG_append_errmsg(msg) SWIG_Python_AddErrMesg(msg,0)
|
||||
#define SWIG_preppend_errmsg(msg) SWIG_Python_AddErrMesg(msg,1)
|
||||
#define SWIG_type_error(type,obj) SWIG_Python_TypeError(type,obj)
|
||||
#define SWIG_null_ref(type) SWIG_Python_NullRef(type)
|
||||
|
||||
/*
|
||||
Contract support
|
||||
*/
|
||||
#define SWIG_contract_assert(expr, msg) \
|
||||
if (!(expr)) { PyErr_SetString(PyExc_RuntimeError, (char *) msg ); goto fail; } else
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Constant declarations
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
/* Constant Types */
|
||||
#define SWIG_PY_INT 1
|
||||
#define SWIG_PY_FLOAT 2
|
||||
#define SWIG_PY_STRING 3
|
||||
#define SWIG_PY_POINTER 4
|
||||
#define SWIG_PY_BINARY 5
|
||||
|
||||
|
|
@ -56,12 +25,28 @@ typedef struct swig_const_info {
|
|||
} swig_const_info;
|
||||
|
||||
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Alloc. memory flags
|
||||
* Append a value to the result obj
|
||||
* ----------------------------------------------------------------------------- */
|
||||
#define SWIG_OLDOBJ 1
|
||||
#define SWIG_NEWOBJ SWIG_OLDOBJ + 1
|
||||
#define SWIG_PYSTR SWIG_NEWOBJ + 1
|
||||
SWIGINTERN PyObject*
|
||||
SWIG_Python_AppendResult(PyObject* result, PyObject* obj) {
|
||||
if (!result) {
|
||||
result = obj;
|
||||
} else if (result == Py_None) {
|
||||
Py_DECREF(result);
|
||||
result = obj;
|
||||
} else {
|
||||
if (!PyList_Check(result)) {
|
||||
PyObject *o2 = result;
|
||||
result = PyList_New(1);
|
||||
PyList_SetItem(result, 0, o2);
|
||||
}
|
||||
PyList_Append(result,obj);
|
||||
Py_DECREF(obj);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,42 +10,36 @@
|
|||
/* the common from conversor */
|
||||
%define %swig_fromcplx_conv(Type, Real, Imag)
|
||||
%fragment(SWIG_From_frag(Type),"header")
|
||||
%{
|
||||
{
|
||||
SWIGINTERNINLINE PyObject*
|
||||
SWIG_From(Type)(SWIG_cplusplus(const Type&, Type) c)
|
||||
SWIG_From(Type)(SWIG_cplusplus(const Type&, Type) c)
|
||||
{
|
||||
return PyComplex_FromDoubles(Real(c), Imag(c));
|
||||
}
|
||||
%}
|
||||
}
|
||||
%enddef
|
||||
|
||||
/* the double case */
|
||||
%define %swig_cplxdbl_conv(Type, Constructor, Real, Imag)
|
||||
%fragment(SWIG_AsVal_frag(Type),"header",
|
||||
fragment=SWIG_AsVal_frag(double))
|
||||
%{
|
||||
{
|
||||
SWIGINTERN int
|
||||
SWIG_AsVal(Type) (PyObject *o, Type* val)
|
||||
SWIG_AsVal(Type) (PyObject *o, Type* val)
|
||||
{
|
||||
if (PyComplex_Check(o)) {
|
||||
if (val) *val = Constructor(PyComplex_RealAsDouble(o),
|
||||
PyComplex_ImagAsDouble(o));
|
||||
return 1;
|
||||
if (val) *val = Constructor(PyComplex_RealAsDouble(o), PyComplex_ImagAsDouble(o));
|
||||
return SWIG_OK;
|
||||
} else {
|
||||
double d;
|
||||
if (SWIG_AsVal(double)(o, &d)) {
|
||||
if (SWIG_AsVal(double)(o, &d) == SWIG_OK) {
|
||||
if (val) *val = Constructor(d, 0.0);
|
||||
return 1;
|
||||
} else {
|
||||
PyErr_Clear();
|
||||
return SWIG_OK;
|
||||
}
|
||||
}
|
||||
if (val) {
|
||||
SWIG_type_error("Type", o);
|
||||
}
|
||||
return 0;
|
||||
return SWIG_TypeError;
|
||||
}
|
||||
}
|
||||
%}
|
||||
%swig_fromcplx_conv(Type, Real, Imag);
|
||||
%enddef
|
||||
|
||||
|
|
@ -55,37 +49,26 @@ SWIGINTERN int
|
|||
fragment="SWIG_CheckDoubleInRange",
|
||||
fragment=SWIG_AsVal_frag(float)) {
|
||||
SWIGINTERN int
|
||||
SWIG_AsVal(Type)(PyObject *o, Type *val)
|
||||
SWIG_AsVal(Type)(PyObject *o, Type *val)
|
||||
{
|
||||
const char* errmsg = val ? #Type : 0;
|
||||
if (PyComplex_Check(o)) {
|
||||
double re = PyComplex_RealAsDouble(o);
|
||||
double im = PyComplex_ImagAsDouble(o);
|
||||
if (SWIG_CheckDoubleInRange(re, -FLT_MAX, FLT_MAX, errmsg)
|
||||
&& SWIG_CheckDoubleInRange(im, -FLT_MAX, FLT_MAX, errmsg)) {
|
||||
if ((-FLT_MAX <= re && re <= FLT_MAX) && (-FLT_MAX <= im && im <= FLT_MAX)) {
|
||||
if (val) *val = Constructor(SWIG_numeric_cast(re, float),
|
||||
SWIG_numeric_cast(im, float));
|
||||
return 1;
|
||||
return SWIG_OK;
|
||||
} else {
|
||||
return 0;
|
||||
return SWIG_TypeError;
|
||||
}
|
||||
} else {
|
||||
double re;
|
||||
if (SWIG_AsVal(double)(o, &re)) {
|
||||
if (SWIG_CheckDoubleInRange(re, -FLT_MAX, FLT_MAX, errmsg)) {
|
||||
if (val) *val = Constructor(SWIG_numeric_cast(re,float), 0.0);
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
PyErr_Clear();
|
||||
float re;
|
||||
if (SWIG_AsVal(float)(o, &re) == SWIG_OK) {
|
||||
if (val) *val = Constructor(re, 0.0);
|
||||
return SWIG_OK;
|
||||
}
|
||||
}
|
||||
if (val) {
|
||||
SWIG_type_error("Type", o);
|
||||
}
|
||||
return 0;
|
||||
return SWIG_TypeError;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
%}
|
||||
|
||||
%fragment("PySequence_Base","header")
|
||||
%{
|
||||
{
|
||||
namespace swig {
|
||||
inline size_t
|
||||
check_index(ptrdiff_t i, size_t size, bool insert = false) {
|
||||
|
|
@ -115,13 +115,13 @@ namespace swig {
|
|||
}
|
||||
}
|
||||
}
|
||||
%}
|
||||
}
|
||||
|
||||
%fragment("PySequence_Cont","header",
|
||||
fragment="StdTraits",
|
||||
fragment="PySequence_Base",
|
||||
fragment="PyObject_var")
|
||||
%{
|
||||
{
|
||||
#include <iterator>
|
||||
namespace swig
|
||||
{
|
||||
|
|
@ -140,12 +140,12 @@ namespace swig
|
|||
return swig::as<T>(item, true);
|
||||
} catch (std::exception& e) {
|
||||
char msg[1024];
|
||||
PyOS_snprintf(msg, sizeof(msg), "in sequence element %d ", _index);
|
||||
snprintf(msg, sizeof(msg), "in sequence element %d ", _index);
|
||||
if (!PyErr_Occurred()) {
|
||||
SWIG_type_error(swig::type_name<T>(), item);
|
||||
SWIG_set_errmsg(SWIG_TypeError,swig::type_name<T>());
|
||||
}
|
||||
SWIG_append_errmsg(msg);
|
||||
SWIG_append_errmsg(e.what());
|
||||
SWIG_Python_AddErrorMsg(msg);
|
||||
SWIG_Python_AddErrorMsg(e.what());
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
|
@ -335,9 +335,8 @@ namespace swig
|
|||
if (!swig::check<value_type>(item)) {
|
||||
if (set_err) {
|
||||
char msg[1024];
|
||||
PyOS_snprintf(msg, sizeof(msg), "in sequence element %d", i);
|
||||
SWIG_type_error(swig::type_name<value_type>(), item);
|
||||
SWIG_append_errmsg(msg);
|
||||
snprintf(msg, sizeof(msg), "in sequence element %d of type %s", i, swig::type_name<value_type>());
|
||||
SWIG_set_errmsg(SWIG_TypeError, msg);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -350,7 +349,7 @@ namespace swig
|
|||
};
|
||||
|
||||
}
|
||||
%}
|
||||
}
|
||||
|
||||
|
||||
/**** The python container methods ****/
|
||||
|
|
@ -444,20 +443,20 @@ namespace swig
|
|||
%fragment("StdSequenceTraits","header",
|
||||
fragment="StdTraits",fragment="PyObject_var",
|
||||
fragment="PySequence_Cont")
|
||||
%{
|
||||
{
|
||||
namespace swig {
|
||||
template <class PySeq, class Seq>
|
||||
inline void
|
||||
assign(const PySeq& pyseq, Seq* seq) {
|
||||
#ifdef SWIG_STD_NOASSIGN_STL
|
||||
%#ifdef SWIG_STD_NOASSIGN_STL
|
||||
typedef typename PySeq::value_type value_type;
|
||||
typename PySeq::const_iterator it = pyseq.begin();
|
||||
for (;it != pyseq.end(); ++it) {
|
||||
seq->insert(seq->end(),(value_type)(*it));
|
||||
}
|
||||
#else
|
||||
%#else
|
||||
seq->assign(pyseq.begin(), pyseq.end());
|
||||
#endif
|
||||
%#endif
|
||||
}
|
||||
|
||||
template <class Seq, class T = typename Seq::value_type >
|
||||
|
|
@ -487,7 +486,7 @@ namespace swig
|
|||
} else {
|
||||
sequence *p;
|
||||
if (SWIG_ConvertPtr(obj,(void**)&p,
|
||||
swig::type_info<sequence>(),0) != -1) {
|
||||
swig::type_info<sequence>(),0) == SWIG_OK) {
|
||||
if (seq) *seq = p;
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -525,4 +524,4 @@ namespace swig
|
|||
}
|
||||
};
|
||||
}
|
||||
%}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,52 +0,0 @@
|
|||
/* ------------------------------------------------------------
|
||||
* Enums
|
||||
* ------------------------------------------------------------ */
|
||||
%apply int { enum SWIGTYPE };
|
||||
%apply const int& { const enum SWIGTYPE& };
|
||||
|
||||
%typemap(in,fragment=SWIG_As_frag(int)) const enum SWIGTYPE& ($basetype temp) {
|
||||
temp = SWIG_static_cast(SWIG_As(int)($input),$basetype);
|
||||
if (SWIG_arg_fail($argnum)) SWIG_fail;
|
||||
$1 = &temp;
|
||||
}
|
||||
|
||||
|
||||
%typemap(varin,fragment=SWIG_AsVal_frag(int)) enum SWIGTYPE
|
||||
{
|
||||
if (sizeof(int) != sizeof($1)) {
|
||||
PyErr_SetString(PyExc_AttributeError, "enum variable '$name' can not be set");
|
||||
return 1;
|
||||
}
|
||||
if (!SWIG_AsVal(int)($input, (int*)(void*)(&$1))) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
typemaps needed due to unnamed enums
|
||||
*/
|
||||
%define PY_ENUM_OUT_TYPEMAPS(from_meth,pyfrag)
|
||||
%typemap(out,fragment=pyfrag) enum SWIGTYPE
|
||||
"$result = from_meth(($1));";
|
||||
%typemap(out,fragment=pyfrag) const enum SWIGTYPE&
|
||||
"$result = from_meth((*$1));";
|
||||
%typemap(varout,fragment=pyfrag) enum SWIGTYPE, const enum SWIGTYPE&
|
||||
"$result = from_meth($1);";
|
||||
%typemap(constcode,fragment=pyfrag) enum SWIGTYPE
|
||||
"PyDict_SetItemString(d,\"$symname\", from_meth($value));";
|
||||
%typemap(directorin,fragment=pyfrag) enum SWIGTYPE *DIRECTORIN
|
||||
"$input = from_meth(*$1_name);";
|
||||
%typemap(directorin,fragment=pyfrag) enum SWIGTYPE, const enum SWIGTYPE&
|
||||
"$input = from_meth($1_name);";
|
||||
%typemap(throws,fragment=pyfrag) enum SWIGTYPE
|
||||
"PyErr_SetObject(PyExc_RuntimeError, from_meth($1));
|
||||
SWIG_fail;";
|
||||
%enddef
|
||||
|
||||
PY_ENUM_OUT_TYPEMAPS(SWIG_From(int),SWIG_From_frag(int));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
81
Lib/python/pyerrors.swg
Normal file
81
Lib/python/pyerrors.swg
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* error manipulation
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
%insert("header") %{
|
||||
|
||||
SWIGINTERN PyObject*
|
||||
SWIG_Python_ErrorType(int code) {
|
||||
switch(code) {
|
||||
case SWIG_MemoryError:
|
||||
return PyExc_MemoryError;
|
||||
break;
|
||||
case SWIG_IOError:
|
||||
return PyExc_IOError;
|
||||
break;
|
||||
case SWIG_RuntimeError:
|
||||
return PyExc_RuntimeError;
|
||||
break;
|
||||
case SWIG_IndexError:
|
||||
return PyExc_IndexError;
|
||||
break;
|
||||
case SWIG_TypeError:
|
||||
return PyExc_TypeError;
|
||||
break;
|
||||
case SWIG_DivisionByZero:
|
||||
return PyExc_ZeroDivisionError;
|
||||
break;
|
||||
case SWIG_OverflowError:
|
||||
return PyExc_OverflowError;
|
||||
break;
|
||||
case SWIG_SyntaxError:
|
||||
return PyExc_SyntaxError;
|
||||
break;
|
||||
case SWIG_ValueError:
|
||||
return PyExc_ValueError;
|
||||
break;
|
||||
case SWIG_SystemError:
|
||||
return PyExc_SystemError;
|
||||
break;
|
||||
case SWIG_AttributeError:
|
||||
return PyExc_AttributeError;
|
||||
break;
|
||||
default:
|
||||
return PyExc_RuntimeError;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SWIGINTERN void
|
||||
SWIG_Python_SetErrorMsg(PyObject *type, const char *mesg) {
|
||||
PyErr_SetString(type, mesg);
|
||||
}
|
||||
|
||||
SWIGINTERNINLINE void
|
||||
SWIG_Python_SetExceptionObj(swig_type_info *desc, PyObject *obj) {
|
||||
PyErr_SetObject((desc && desc->clientdata ? (PyObject *)(desc->clientdata) : PyExc_RuntimeError), obj);
|
||||
}
|
||||
|
||||
|
||||
SWIGINTERN void
|
||||
SWIG_Python_AddErrorMsg(const char* mesg)
|
||||
{
|
||||
PyObject *type = 0;
|
||||
PyObject *value = 0;
|
||||
PyObject *traceback = 0;
|
||||
|
||||
if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback);
|
||||
if (value) {
|
||||
PyObject *old_str = PyObject_Str(value);
|
||||
Py_XINCREF(type);
|
||||
PyErr_Clear();
|
||||
PyErr_Format(type, "%s %s", PyString_AsString(old_str), mesg);
|
||||
Py_DECREF(old_str);
|
||||
} else {
|
||||
PyErr_Format(PyExc_RuntimeError, mesg);
|
||||
}
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
|
|
@ -173,33 +173,18 @@ SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) {
|
|||
size_t i;
|
||||
for (i = 0; constants[i].type; ++i) {
|
||||
switch(constants[i].type) {
|
||||
case SWIG_PY_INT:
|
||||
obj = PyInt_FromLong(constants[i].lvalue);
|
||||
break;
|
||||
case SWIG_PY_FLOAT:
|
||||
obj = PyFloat_FromDouble(constants[i].dvalue);
|
||||
break;
|
||||
case SWIG_PY_STRING:
|
||||
if (constants[i].pvalue) {
|
||||
obj = PyString_FromString((char *) constants[i].pvalue);
|
||||
} else {
|
||||
Py_INCREF(Py_None);
|
||||
obj = Py_None;
|
||||
}
|
||||
break;
|
||||
case SWIG_PY_POINTER:
|
||||
obj = SWIG_NewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0);
|
||||
break;
|
||||
case SWIG_PY_BINARY:
|
||||
obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype));
|
||||
obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype), 0);
|
||||
break;
|
||||
default:
|
||||
obj = 0;
|
||||
break;
|
||||
}
|
||||
if (obj) {
|
||||
PyDict_SetItemString(d,constants[i].name,obj);
|
||||
Py_DECREF(obj);
|
||||
PyDict_SetItemString(d, constants[i].name, obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -250,10 +235,6 @@ SWIG_Python_FixMethods(PyMethodDef *methods,
|
|||
}
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------*
|
||||
* Initialize type list
|
||||
* -----------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,233 +0,0 @@
|
|||
//
|
||||
// Uncomment the following definition if you don't want the in/out
|
||||
// typemaps by default, ie, you prefer to use typemaps.i.
|
||||
//
|
||||
//#define SWIG_INOUT_NODEF
|
||||
|
||||
//
|
||||
// Use the following definition to enable the INPUT parameters to
|
||||
// accept both 'by value' and 'pointer' objects.
|
||||
//
|
||||
#define SWIG_INPUT_ACCEPT_PTRS
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Pointer handling
|
||||
//
|
||||
// These mappings provide support for input/output arguments and common
|
||||
// uses for C/C++ pointers.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
// INPUT typemaps.
|
||||
// These remap a C pointer to be an "INPUT" value which is passed by value
|
||||
// instead of reference.
|
||||
|
||||
/*
|
||||
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.
|
||||
|
||||
To use these, suppose you had a C function like this :
|
||||
|
||||
double fadd(double *a, double *b) {
|
||||
return *a+*b;
|
||||
}
|
||||
|
||||
You could wrap it with SWIG as follows :
|
||||
|
||||
double fadd(double *INPUT, double *INPUT);
|
||||
|
||||
or you can use the %apply directive :
|
||||
|
||||
%apply double *INPUT { double *a, double *b };
|
||||
double fadd(double *a, double *b);
|
||||
|
||||
*/
|
||||
#ifdef SWIG_INPUT_ACCEPT_PTRS
|
||||
#define SWIG_CheckInputPtr(input,arg,desc,disown) (SWIG_ConvertPtr(input,arg,desc,disown) != -1)
|
||||
#else
|
||||
#define SWIG_CheckInputPtr(input,arg,desc,disown) (0)
|
||||
#endif
|
||||
|
||||
%define _PYVAL_INPUT_TYPEMAP(code,as_meth,check_meth,as_frag,check_frag,Type)
|
||||
%typemap(in,fragment=as_frag) Type *INPUT ($*1_ltype temp, int res = 0) {
|
||||
if (!SWIG_CheckInputPtr($input,(void **)(&$1),$1_descriptor,$disown)) {
|
||||
temp = as_meth($input);
|
||||
if (SWIG_arg_fail($argnum)) SWIG_fail;
|
||||
$1 = &temp;
|
||||
res = SWIG_NEWOBJ;
|
||||
}
|
||||
}
|
||||
%typemap(in,fragment=as_frag) Type &INPUT($*1_ltype temp, int res = 0) {
|
||||
if (!SWIG_CheckInputPtr($input,(void **)(&$1),$1_descriptor,$disown)) {
|
||||
temp = as_meth($input);
|
||||
if (SWIG_arg_fail($argnum)) SWIG_fail;
|
||||
$1 = &temp;
|
||||
res = SWIG_NEWOBJ;
|
||||
}
|
||||
if (!$1) {
|
||||
SWIG_null_ref("$basetype");
|
||||
}
|
||||
if (SWIG_arg_fail($argnum)) SWIG_fail;
|
||||
}
|
||||
%typemap(typecheck,precedence=code,fragment=check_frag) Type *INPUT, Type &INPUT {
|
||||
void *ptr;
|
||||
$1 = (check_meth($input) || (SWIG_CheckInputPtr($input,&ptr,$1_descriptor,0)));
|
||||
}
|
||||
%enddef
|
||||
|
||||
%define _PYPTR_INPUT_TYPEMAP(code,asptr_meth,asptr_frag,Type)
|
||||
%typemap(in,fragment=asptr_frag) Type *INPUT(int res = 0) {
|
||||
res = asptr_meth($input, &$1);
|
||||
if (!res) {
|
||||
SWIG_type_error("$basetype", $input);
|
||||
}
|
||||
if (SWIG_arg_fail($argnum)) SWIG_fail;
|
||||
}
|
||||
|
||||
%typemap(in,fragment=asptr_frag) Type &INPUT(int res = 0) {
|
||||
res = asptr_meth($input, &$1);
|
||||
if (!res) {
|
||||
SWIG_type_error("$basetype", $input);
|
||||
} else {
|
||||
if (!$1) {
|
||||
SWIG_null_ref("$basetype");
|
||||
}
|
||||
}
|
||||
if (SWIG_arg_fail($argnum)) SWIG_fail;
|
||||
}
|
||||
%typemap(freearg) Type *INPUT, Type &INPUT
|
||||
"if (res$argnum == SWIG_NEWOBJ) delete $1;";
|
||||
%typemap(typecheck,precedence=code,fragment=asptr_frag) Type *INPUT, Type &INPUT
|
||||
"$1 = asptr_meth($input, (Type**)0) != 0;"
|
||||
%enddef
|
||||
|
||||
// OUTPUT typemaps. These typemaps are used for parameters that
|
||||
// are output only. The output value is appended to the result as
|
||||
// a list element.
|
||||
|
||||
/*
|
||||
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
|
||||
multiple output values, they are returned in the form of a Python tuple.
|
||||
|
||||
|
||||
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:
|
||||
|
||||
double modf(double x, double *ip);
|
||||
|
||||
You could wrap it with SWIG as follows :
|
||||
|
||||
double modf(double x, double *OUTPUT);
|
||||
|
||||
or you can use the %apply directive :
|
||||
|
||||
%apply double *OUTPUT { double *ip };
|
||||
double modf(double x, double *ip);
|
||||
|
||||
The Python output of the function would be a tuple containing both
|
||||
output values.
|
||||
|
||||
*/
|
||||
|
||||
// These typemaps contributed by Robin Dunn
|
||||
//----------------------------------------------------------------------
|
||||
//
|
||||
// T_OUTPUT typemap (and helper function) to return multiple argouts as
|
||||
// a tuple instead of a list.
|
||||
//
|
||||
// Author: Robin Dunn
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
%include <pytuplehlp.swg>
|
||||
|
||||
%define _PYVAL_OUTPUT_TYPEMAP(from_meth, from_frag, Type)
|
||||
%typemap(in,numinputs=0) Type *OUTPUT ($*1_ltype temp, int res = 0),
|
||||
Type &OUTPUT ($*1_ltype temp, int res = 0)
|
||||
"$1 = &temp; res = SWIG_NEWOBJ;";
|
||||
%fragment("t_out_helper"{Type},"header",
|
||||
fragment="t_output_helper",fragment=from_frag) {}
|
||||
%typemap(argout,fragment="t_out_helper"{Type}) Type *OUTPUT, Type &OUTPUT
|
||||
"$result = t_output_helper($result, ((res$argnum == SWIG_NEWOBJ) ?
|
||||
from_meth((*$1)) : SWIG_NewPointerObj((void*)($1), $1_descriptor, 0)));";
|
||||
|
||||
%enddef
|
||||
|
||||
|
||||
// INOUT
|
||||
// Mappings for an argument that is both an input and output
|
||||
// parameter
|
||||
|
||||
/*
|
||||
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.
|
||||
|
||||
For example, suppose you were trying to wrap the following function :
|
||||
|
||||
void neg(double *x) {
|
||||
*x = -(*x);
|
||||
}
|
||||
|
||||
You could wrap it with SWIG as follows :
|
||||
|
||||
void neg(double *INOUT);
|
||||
|
||||
or you can use the %apply directive :
|
||||
|
||||
%apply double *INOUT { double *x };
|
||||
void neg(double *x);
|
||||
|
||||
Unlike C, this mapping does not directly modify the input value (since
|
||||
this makes no sense in Python). Rather, the modified input value shows
|
||||
up as the return value of the function. Thus, to apply this function
|
||||
to a Python variable you might do this :
|
||||
|
||||
x = neg(x)
|
||||
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
%define _PYVAL_INOUT_TYPEMAP(Type)
|
||||
%typemap(in) Type *INOUT = Type *INPUT;
|
||||
%typemap(in) Type &INOUT = Type &INPUT;
|
||||
%typemap(typecheck) Type *INOUT = Type *INPUT;
|
||||
%typemap(typecheck) Type &INOUT = Type &INPUT;
|
||||
%typemap(argout) Type *INOUT = Type *OUTPUT;
|
||||
%typemap(argout) Type &INOUT = Type &OUTPUT;
|
||||
%enddef
|
||||
|
||||
|
||||
%define _PYPTR_INOUT_TYPEMAP(Type)
|
||||
_PYVAL_INOUT_TYPEMAP(SWIG_arg(Type))
|
||||
%typemap(freearg) Type *INOUT = Type *INPUT;
|
||||
%typemap(freearg) Type &INOUT = Type &INPUT;
|
||||
%enddef
|
||||
|
||||
#ifndef SWIG_INOUT_NODEF
|
||||
#define PYVAL_INPUT_TYPEMAP(code,_a,_c,_af,_cf,...) \
|
||||
_PYVAL_INPUT_TYPEMAP(SWIG_arg(code),SWIG_arg(_a),SWIG_arg(_c), \
|
||||
SWIG_arg(_af),SWIG_arg(_cf),SWIG_arg(__VA_ARGS__))
|
||||
|
||||
#define PYPTR_INPUT_TYPEMAP(code,_a,_af,...) \
|
||||
_PYPTR_INPUT_TYPEMAP(SWIG_arg(code),SWIG_arg(_a),SWIG_arg(_af), \
|
||||
SWIG_arg(__VA_ARGS__))
|
||||
|
||||
#define PYVAL_OUTPUT_TYPEMAP(_f,_ff,...) \
|
||||
_PYVAL_OUTPUT_TYPEMAP(SWIG_arg(_f),SWIG_arg(_ff),SWIG_arg(__VA_ARGS__))
|
||||
|
||||
#define PYVAL_INOUT_TYPEMAP(...) _PYVAL_INOUT_TYPEMAP(SWIG_arg(__VA_ARGS__))
|
||||
#define PYPTR_INOUT_TYPEMAP(...) _PYPTR_INOUT_TYPEMAP(SWIG_arg(__VA_ARGS__))
|
||||
#else /* You need to include typemaps.i */
|
||||
#define PYVAL_OUTPUT_TYPEMAP(...)
|
||||
#define PYVAL_INPUT_TYPEMAP(...)
|
||||
#define PYVAL_INOUT_TYPEMAP(...)
|
||||
#define PYPTR_INPUT_TYPEMAP(...)
|
||||
#define PYPTR_INOUT_TYPEMAP(...)
|
||||
#endif /* SWIG_INOUT_DEFAULT */
|
||||
|
|
@ -1,159 +1 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* SWIG API. Portion only visible from SWIG
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#define SWIG_arg(Arg...) Arg
|
||||
|
||||
#define SWIG_str(Type...) #Type
|
||||
|
||||
#define SWIG_Mangle(Type...) #@Type
|
||||
#define SWIG_Descriptor(Type...) SWIGTYPE_ ## #@Type
|
||||
|
||||
#define SWIG_NameType(Name, Type...) SWIG_ ## Name ## _ ## #@Type
|
||||
#define SWIG_StringType(Name, Type...) "SWIG_" #Name "_" {Type}
|
||||
|
||||
#define SWIG_AsVal(Type...) SWIG_NameType(AsVal, Type)
|
||||
#define SWIG_AsPtr(Type...) SWIG_NameType(AsPtr, Type)
|
||||
#define SWIG_As(Type...) SWIG_NameType(As, Type)
|
||||
#define SWIG_From(Type...) SWIG_NameType(From, Type)
|
||||
#define SWIG_Check(Type...) SWIG_NameType(Check, Type)
|
||||
#define SWIG_CCode(Type...) SWIG_NameType(TYPECHECK, Type)
|
||||
#define SWIG_OrderType(Type...) SWIG_NameType(OrderType, Type)
|
||||
#define SWIG_EqualType(Type...) SWIG_NameType(EqualType, Type)
|
||||
|
||||
#define SWIG_Traits_frag(Type...) SWIG_StringType(Traits, Type)
|
||||
#define SWIG_AsPtr_frag(Type...) SWIG_StringType(AsPtr, Type)
|
||||
#define SWIG_AsVal_frag(Type...) SWIG_StringType(AsVal, Type)
|
||||
#define SWIG_As_frag(Type...) SWIG_StringType(As, Type)
|
||||
#define SWIG_From_frag(Type...) SWIG_StringType(From, Type)
|
||||
#define SWIG_Check_frag(Type...) SWIG_StringType(Check, Type)
|
||||
#define SWIG_CCode_frag(Type...) SWIG_StringType(TYPECHECK, Type)
|
||||
|
||||
/* Internal C/C++ API */
|
||||
#ifdef SWIG_NO_CPLUSPLUS_CAST
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Disable 'modern' cplusplus casting operators
|
||||
* ----------------------------------------------------------------------------- */
|
||||
#ifdef SWIG_CPLUSPLUS_CAST
|
||||
#undef SWIG_CPLUSPLUS_CAST
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus)
|
||||
#define SWIG_new(Type...) (new Type)
|
||||
#define SWIG_new_copy(ptr,Type...) (new Type(*ptr))
|
||||
#define SWIG_new_array(size,Type...) (new Type[(size)])
|
||||
#define SWIG_delete(cptr) delete cptr
|
||||
#define SWIG_delete_array(cptr) delete[] cptr
|
||||
#else /* C case */
|
||||
#define SWIG_new(Type...) ((Type*)malloc(sizeof(Type)))
|
||||
#define SWIG_new_copy(ptr,Type...) ((Type*)memcpy(malloc(sizeof(Type)),ptr,sizeof(Type)))
|
||||
#define SWIG_new_array(size,Type...) ((Type*) malloc((size)*sizeof(Type)))
|
||||
#define SWIG_delete(cptr) free((char*)cptr)
|
||||
#define SWIG_delete_array(cptr) free((char*)cptr)
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#if defined(__cplusplus) && defined(SWIG_CPLUSPLUS_CAST)
|
||||
#define SWIG_const_cast(a,Type...) const_cast<Type >(a)
|
||||
#define SWIG_static_cast(a,Type...) static_cast<Type >(a)
|
||||
#define SWIG_reinterpret_cast(a,Type...) reinterpret_cast<Type >(a)
|
||||
#define SWIG_numeric_cast(a,Type...) static_cast<Type >(a)
|
||||
#else /* C case */
|
||||
#define SWIG_const_cast(a,Type...) (Type)(a)
|
||||
#define SWIG_static_cast(a,Type...) (Type)(a)
|
||||
#define SWIG_reinterpret_cast(a,Type...) (Type)(a)
|
||||
#define SWIG_numeric_cast(a,Type...) (Type)(a)
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Auxiliar swig macros used to write typemaps
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
/* define a new macro */
|
||||
%define SWIG_define(Def, Val)
|
||||
%#define Def Val
|
||||
%enddef
|
||||
|
||||
/* include C++ or C value */
|
||||
%define SWIG_cplusplus(cppval, cval)
|
||||
#ifdef __cplusplus
|
||||
cppval
|
||||
#else
|
||||
cval
|
||||
#endif
|
||||
%enddef
|
||||
|
||||
/* for loop for macro with one argument */
|
||||
%define %_formacro_1(macro, arg1,...)
|
||||
macro(arg1)
|
||||
#if #__VA_ARGS__ != "__fordone__"
|
||||
%_formacro_1(macro, __VA_ARGS__)
|
||||
#endif
|
||||
%enddef
|
||||
|
||||
/* for loop for macro with one argument */
|
||||
%define %formacro_1(macro,...)
|
||||
%_formacro_1(macro,__VA_ARGS__,__fordone__)
|
||||
%enddef
|
||||
|
||||
/* for loop for macro with two arguments */
|
||||
%define %_formacro_2(macro, arg1, arg2, ...)
|
||||
macro(arg1, arg2)
|
||||
#if #__VA_ARGS__ != "__fordone__"
|
||||
%_formacro_2(macro, __VA_ARGS__)
|
||||
#endif
|
||||
%enddef
|
||||
|
||||
/* for loop for macro with two arguments */
|
||||
%define %formacro_2(macro,...)
|
||||
%_formacro_2(macro, __VA_ARGS__, __fordone__)
|
||||
%enddef
|
||||
|
||||
|
||||
/*
|
||||
mark a flag, ie, define a macro name but ignore it in
|
||||
the interface.
|
||||
|
||||
the flags latter can be used with %evalif
|
||||
*/
|
||||
|
||||
%define %swig_mark_flag(x)
|
||||
%ignore x;
|
||||
#define x 1
|
||||
%enddef
|
||||
|
||||
/*
|
||||
%swig_equal_type and %swig_order_type flagged a type of having equal (==,!=)
|
||||
and/or order methods (<=,>=,<,>).
|
||||
*/
|
||||
#define %swig_equal_type(...) %swig_mark_flag(SWIG_EqualType(__VA_ARGS__))
|
||||
#define %swig_order_type(...) \
|
||||
%swig_mark_flag(SWIG_EqualType(__VA_ARGS__)) \
|
||||
%swig_mark_flag(SWIG_OrderType(__VA_ARGS__))
|
||||
|
||||
/*
|
||||
%evalif and %evalif_2 are use to evaluate or process
|
||||
an expression if the given predicate is 'true' (1).
|
||||
*/
|
||||
%define %_evalif(_x,_expr)
|
||||
#if _x == 1
|
||||
_expr
|
||||
#endif
|
||||
%enddef
|
||||
|
||||
%define %_evalif_2(_x,_y,_expr)
|
||||
#if _x == 1 && _y == 1
|
||||
_expr
|
||||
#endif
|
||||
%enddef
|
||||
|
||||
%define %evalif(_x,...)
|
||||
%_evalif(SWIG_arg(_x),SWIG_arg(__VA_ARGS__))
|
||||
%enddef
|
||||
|
||||
%define %evalif_2(_x,_y,...)
|
||||
%_evalif_2(SWIG_arg(_x),SWIG_arg(_y),SWIG_arg(__VA_ARGS__))
|
||||
%enddef
|
||||
|
||||
|
||||
%include <typemaps/swigmacros.swg>
|
||||
|
|
|
|||
|
|
@ -1,29 +0,0 @@
|
|||
|
||||
/* ------------------------------------------------------------
|
||||
* --- ANSI/Posix C/C++ types ---
|
||||
* ------------------------------------------------------------ */
|
||||
|
||||
%types(size_t);
|
||||
%apply unsigned long { size_t };
|
||||
%apply const unsigned long& { const size_t& };
|
||||
%apply unsigned long& { size_t& };
|
||||
|
||||
%types(ptrdiff_t);
|
||||
%apply long { ptrdiff_t };
|
||||
%apply const long& { const ptrdiff_t& };
|
||||
%apply long& { ptrdiff_t& };
|
||||
|
||||
#ifdef __cplusplus
|
||||
%types(std::size_t);
|
||||
%apply unsigned long { std::size_t };
|
||||
%apply const unsigned long& { const std::size_t& };
|
||||
%apply unsigned long& { std::size_t& };
|
||||
|
||||
%types(std::ptrdiff_t);
|
||||
%apply long { std::ptrdiff_t };
|
||||
%apply const long& { const std::ptrdiff_t& };
|
||||
%apply long& { std::ptrdiff_t& };
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
/* ------------------------------------------------------------
|
||||
* PyObject * - Just pass straight through unmodified
|
||||
* ------------------------------------------------------------ */
|
||||
|
||||
%typemap(in) PyObject * "$1 = $input;";
|
||||
%typemap(out) PyObject * "$result = $1;";
|
||||
|
||||
%typemap(constcode) PyObject * "PyDict_SetItemString(d,\"$symname\", $value);";
|
||||
|
||||
%typemap(directorin, parse="O") PyObject * "";
|
||||
%typemap(directorout) PyObject * "$result = $input;";
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_POINTER) PyObject * "$1 = ($input != 0);";
|
||||
|
||||
%typemap(throws) PyObject *
|
||||
"PyErr_SetObject(PyExc_RuntimeError, $1);
|
||||
SWIG_fail;";
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue