Fix typemaps for templates with more than one parameter
Ensure that any commas inside SWIG_STR() used in "out" typemaps for class types are not interpreted as macro argument separators by using an extra pair of parenthesis around the type.
This commit is contained in:
parent
c73acc44a7
commit
8104c24f71
1 changed files with 6 additions and 5 deletions
11
Lib/c/c.swg
11
Lib/c/c.swg
|
|
@ -19,7 +19,8 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
|
|
||||||
#define SWIG_STR(x) #x
|
#define SWIG_STR2(x) #x
|
||||||
|
#define SWIG_STR(x) SWIG_STR2(x)
|
||||||
#define SWIG_contract_assert(expr, msg) if(!(expr)) { printf("%s\n", msg); SWIG_exit(0); } else
|
#define SWIG_contract_assert(expr, msg) if(!(expr)) { printf("%s\n", msg); SWIG_exit(0); } else
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
|
@ -273,16 +274,16 @@ same_action_all_primitive_types_but_void(out, "$result = $1;")
|
||||||
}
|
}
|
||||||
|
|
||||||
%typemap(out) SWIGTYPE *&, SWIGTYPE ** {
|
%typemap(out) SWIGTYPE *&, SWIGTYPE ** {
|
||||||
static SwigObj* _ptr = (SwigObj*) SWIG_create_object($1, SWIG_STR($1_basetype));
|
static SwigObj* _ptr = (SwigObj*) SWIG_create_object($1, SWIG_STR(($1_basetype)));
|
||||||
$result = &_ptr;
|
$result = &_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
%typemap(out) SWIGTYPE {
|
%typemap(out) SWIGTYPE {
|
||||||
$result = (SwigObj*) SWIG_create_object(&$1, SWIG_STR($1_basetype));
|
$result = (SwigObj*) SWIG_create_object(&$1, SWIG_STR(($1_basetype)));
|
||||||
}
|
}
|
||||||
|
|
||||||
%typemap(out) SWIGTYPE *, SWIGTYPE & {
|
%typemap(out) SWIGTYPE *, SWIGTYPE & {
|
||||||
$result = (SwigObj*) SWIG_create_object($1, SWIG_STR($1_basetype));
|
$result = (SwigObj*) SWIG_create_object($1, SWIG_STR(($1_basetype)));
|
||||||
}
|
}
|
||||||
|
|
||||||
%typemap(out) SWIGTYPE * [ANY], SWIGTYPE [ANY][ANY] {
|
%typemap(out) SWIGTYPE * [ANY], SWIGTYPE [ANY][ANY] {
|
||||||
|
|
@ -297,7 +298,7 @@ same_action_all_primitive_types_but_void(out, "$result = $1;")
|
||||||
_temp = (SwigObj**) malloc($1_dim0 * sizeof(SwigObj*));
|
_temp = (SwigObj**) malloc($1_dim0 * sizeof(SwigObj*));
|
||||||
for (i = 0 ; i < $1_dim0; ++i) {
|
for (i = 0 ; i < $1_dim0; ++i) {
|
||||||
if ($1[i]) {
|
if ($1[i]) {
|
||||||
_temp[i] = SWIG_create_object($1[i], SWIG_STR($1_ltype));
|
_temp[i] = SWIG_create_object($1[i], SWIG_STR(($1_ltype)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
_temp[i] = (SwigObj*) 0;
|
_temp[i] = (SwigObj*) 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue