add to %argument_fail

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@8185 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2006-01-02 17:37:53 +00:00
commit 66efeaa788
12 changed files with 72 additions and 76 deletions

View file

@ -57,7 +57,7 @@ SWIG_AsArgcArgv(PyObject* input,
argv = SWIG_AsArgcArgv($input, $descriptor(char**), &argc, &owner); argv = SWIG_AsArgcArgv($input, $descriptor(char**), &argc, &owner);
if (!argv) { if (!argv) {
$1 = 0; $2 = 0; $1 = 0; $2 = 0;
%argument_fail(SWIG_TypeError, "int ARGC, char **ARGV", $argnum); %argument_fail(SWIG_TypeError, "int ARGC, char **ARGV", $symname, $argnum);
} else { } else {
$1 = ($1_ltype) argc; $1 = ($1_ltype) argc;
$2 = ($2_ltype) argv; $2 = ($2_ltype) argv;

View file

@ -32,7 +32,7 @@
%typemap(in,noblock=1,fragment=#SWIG_AsCharPtrAndSize) (TYPEMAP, SIZE) %typemap(in,noblock=1,fragment=#SWIG_AsCharPtrAndSize) (TYPEMAP, SIZE)
(Char *buf = 0, size_t size = 0, int alloc = 0) { (Char *buf = 0, size_t size = 0, int alloc = 0) {
if (!SWIG_IsOK((SWIG_AsCharPtrAndSize($input, &buf, &size, &alloc)))) { if (!SWIG_IsOK((SWIG_AsCharPtrAndSize($input, &buf, &size, &alloc)))) {
%argument_fail(SWIG_TypeError, "(TYPEMAP, SIZE)", $argnum); %argument_fail(SWIG_TypeError, "(TYPEMAP, SIZE)", $symname, $argnum);
} }
$1 = ($1_ltype) buf; $1 = ($1_ltype) buf;
$2 = ($2_ltype) size - 1; $2 = ($2_ltype) size - 1;
@ -115,7 +115,7 @@
%typemap(in,noblock=1,fragment=#SWIG_AsCharPtrAndSize) TYPEMAP %typemap(in,noblock=1,fragment=#SWIG_AsCharPtrAndSize) TYPEMAP
(Char temp[MAX+1], Char *t = 0, size_t n = 0, int alloc = 0) { (Char temp[MAX+1], Char *t = 0, size_t n = 0, int alloc = 0) {
if (!SWIG_IsOK((SWIG_AsCharPtrAndSize($input, &t, &n, &alloc)))) { if (!SWIG_IsOK((SWIG_AsCharPtrAndSize($input, &t, &n, &alloc)))) {
%argument_fail(SWIG_TypeError, "TYPEMAP", $argnum); %argument_fail(SWIG_TypeError, "TYPEMAP", $symname, $argnum);
} }
if ( n > (size_t) MAX ) n = (size_t) MAX; if ( n > (size_t) MAX ) n = (size_t) MAX;
memcpy(temp, t, sizeof(Char)*n); memcpy(temp, t, sizeof(Char)*n);
@ -154,7 +154,7 @@
expansion += EXP; expansion += EXP;
#endif #endif
if (!SWIG_IsOK((SWIG_AsCharPtrAndSize($input, &t, &n, &alloc)))) { if (!SWIG_IsOK((SWIG_AsCharPtrAndSize($input, &t, &n, &alloc)))) {
%argument_fail(SWIG_TypeError, "TYPEMAP", $argnum); %argument_fail(SWIG_TypeError, "TYPEMAP", $symname, $argnum);
} }
$1 = %new_array(n+expansion, $*1_ltype); $1 = %new_array(n+expansion, $*1_ltype);
memcpy($1,t,sizeof(Char)*n); memcpy($1,t,sizeof(Char)*n);
@ -183,7 +183,7 @@
%define Name ## _output_maxsize(TYPEMAP, SIZE) %define Name ## _output_maxsize(TYPEMAP, SIZE)
%typemap(in,noblock=1,fragment=SWIG_AsVal_frag(size_t)) (TYPEMAP, SIZE) (size_t size, Char *buff = 0) { %typemap(in,noblock=1,fragment=SWIG_AsVal_frag(size_t)) (TYPEMAP, SIZE) (size_t size, Char *buff = 0) {
if (!SWIG_IsOK((SWIG_AsVal(size_t)($input, &size)))) { if (!SWIG_IsOK((SWIG_AsVal(size_t)($input, &size)))) {
%argument_fail(SWIG_TypeError, "(TYPEMAP, SIZE)", $argnum); %argument_fail(SWIG_TypeError, "(TYPEMAP, SIZE)", $symname, $argnum);
} }
buff= %new_array(size+1, Char); buff= %new_array(size+1, Char);
$2 = %numeric_cast(size, $2_ltype); $2 = %numeric_cast(size, $2_ltype);
@ -213,7 +213,7 @@
%define Name ## _output_withsize(TYPEMAP, SIZE) %define Name ## _output_withsize(TYPEMAP, SIZE)
%typemap(in,noblock=1,fragment=SWIG_AsVal_frag(size_t)) (TYPEMAP, SIZE) (size_t n, Char *buff = 0, $*2_ltype size) { %typemap(in,noblock=1,fragment=SWIG_AsVal_frag(size_t)) (TYPEMAP, SIZE) (size_t n, Char *buff = 0, $*2_ltype size) {
if (!SWIG_IsOK((SWIG_AsVal(size_t)($input, &n)))) { if (!SWIG_IsOK((SWIG_AsVal(size_t)($input, &n)))) {
%argument_fail(SWIG_TypeError, "(TYPEMAP, SIZE)", $argnum); %argument_fail(SWIG_TypeError, "(TYPEMAP, SIZE)", $symname, $argnum);
} }
buff= %new_array(n+1, Char); buff= %new_array(n+1, Char);
$1 = %static_cast(buff, $1_ltype); $1 = %static_cast(buff, $1_ltype);

View file

@ -8,7 +8,7 @@
%typemap(in,fragment=SWIG_AsVal_frag(int),noblock=1) const enum SWIGTYPE& (int val, int ecode, $basetype temp) { %typemap(in,fragment=SWIG_AsVal_frag(int),noblock=1) const enum SWIGTYPE& (int val, int ecode, $basetype temp) {
ecode = SWIG_AsVal(int)($input, &val); ecode = SWIG_AsVal(int)($input, &val);
if (!SWIG_IsOK(ecode)) { if (!SWIG_IsOK(ecode)) {
%argument_fail(ecode, "$type", $argnum); %argument_fail(ecode, "$type", $symname, $argnum);
} else { } else {
temp = %static_cast(val,$basetype); temp = %static_cast(val,$basetype);
$1 = &temp; $1 = &temp;

View file

@ -4,10 +4,10 @@
/* macros for error manipulation */ /* macros for error manipulation */
#define %nullref_fmt() "invalid null reference " #define %nullref_fmt() "invalid null reference "
#define %varfail_fmt(_type,_name) "in variable '"_name"' of type '"_type"'" #define %varfail_fmt(_type,_name) "in variable '"`_name`"' of type '"`_type`"'"
#define %argfail_fmt(_type,_argn) "in argument " #_argn" of type '" _type"'" #define %argfail_fmt(_type,_name,_argn) "in method '" `_name` "', argument " `_argn`" of type '" `_type`"'"
#define %outfail_fmt(_type) "in output value of type '"_type"'" #define %outfail_fmt(_type) "in output value of type '"_type"'"
#define %argnullref_fmt(_type, _argn) %nullref_fmt() %argfail_fmt(_type, _argn) #define %argnullref_fmt(_type,_name,_argn) %nullref_fmt() %argfail_fmt(_type, _name, _argn)
#define %varnullref_fmt(_type,_name) %nullref_fmt() %varfail_fmt(_type, _name) #define %varnullref_fmt(_type,_name) %nullref_fmt() %varfail_fmt(_type, _name)
#define %outnullref_fmt(_type) %nullref_fmt() %outfail_fmt(_type) #define %outnullref_fmt(_type) %nullref_fmt() %outfail_fmt(_type)

View file

@ -82,7 +82,7 @@ or you can use the %apply directive :
Type val; Type val;
int ecode = asval_meth($input, &val); int ecode = asval_meth($input, &val);
if (!SWIG_IsOK(ecode)) { if (!SWIG_IsOK(ecode)) {
%argument_fail(ecode, "$*ltype",$argnum); %argument_fail(ecode, "$*ltype",$symname, $argnum);
} }
temp = %static_cast(val, $*ltype); temp = %static_cast(val, $*ltype);
$1 = &temp; $1 = &temp;
@ -94,7 +94,7 @@ or you can use the %apply directive :
Type val; Type val;
int ecode = asval_meth($input, &val); int ecode = asval_meth($input, &val);
if (!SWIG_IsOK(ecode)) { if (!SWIG_IsOK(ecode)) {
%argument_fail(ecode, "$*ltype",$argnum); %argument_fail(ecode, "$*ltype",$symname, $argnum);
} }
temp = %static_cast(val, $*ltype); temp = %static_cast(val, $*ltype);
$1 = &temp; $1 = &temp;
@ -118,17 +118,17 @@ or you can use the %apply directive :
%typemap(in,noblock=1,fragment=asptr_frag) Type *INPUT(int res) { %typemap(in,noblock=1,fragment=asptr_frag) Type *INPUT(int res) {
res = asptr_meth($input, &$1); res = asptr_meth($input, &$1);
if (!SWIG_IsOK(res)) { if (!SWIG_IsOK(res)) {
%argument_fail(SWIG_TypeError,"$type",$argnum); %argument_fail(SWIG_TypeError,"$type",$symname, $argnum);
} }
res = SWIG_AddTmpMask(res); res = SWIG_AddTmpMask(res);
} }
%typemap(in,noblock=1,fragment=asptr_frag) Type &INPUT(int res) { %typemap(in,noblock=1,fragment=asptr_frag) Type &INPUT(int res) {
res = asptr_meth($input, &$1); res = asptr_meth($input, &$1);
if (!SWIG_IsOK(res)) { if (!SWIG_IsOK(res)) {
%argument_fail(SWIG_TypeError,"$type",$argnum); %argument_fail(SWIG_TypeError,"$type",$symname, $argnum);
} }
if (!$1) { if (!$1) {
%argument_nullref("$type",$argnum); %argument_nullref("$type",$symname, $argnum);
} }
res = SWIG_AddTmpMask(res); res = SWIG_AddTmpMask(res);
} }

View file

@ -205,12 +205,8 @@ SWIGINTERNINLINE int
SWIG_CanCastAsInteger(double *d, double min, double max) { SWIG_CanCastAsInteger(double *d, double min, double max) {
double x = *d; double x = *d;
if (min <= x && x <= max) { if (min <= x && x <= max) {
%#ifdef SWIG_HAS_NO_RINT double fx = floor(x);
/* Use the python mechanism to round, or so */ double rd = ((x - fx) < 0.5) ? fx : ceil(x); /* simple rint */
double rd = (x < 0) ? ceil(x) : floor(x);
%#else
double rd = rint(x);
%#endif
if ((errno == EDOM) || (errno == ERANGE)) { if ((errno == EDOM) || (errno == ERANGE)) {
errno = 0; errno = 0;
} else { } else {

View file

@ -28,7 +28,7 @@
%typemap(in,fragment=frag) Type { %typemap(in,fragment=frag) Type {
Type *ptr = (Type *)0; Type *ptr = (Type *)0;
int res = asptr_meth($input, &ptr); int res = asptr_meth($input, &ptr);
if (!SWIG_IsOK(res) || !ptr) { %argument_fail(SWIG_TypeError, "$type", $argnum); } if (!SWIG_IsOK(res) || !ptr) { %argument_fail(SWIG_TypeError, "$type", $symname, $argnum); }
$1 = *ptr; $1 = *ptr;
if (SWIG_IsNewObj(res)) %delete(ptr); if (SWIG_IsNewObj(res)) %delete(ptr);
} }
@ -36,8 +36,8 @@
%typemap(in,fragment=frag) const Type & (int res = SWIG_OLDOBJ) { %typemap(in,fragment=frag) const Type & (int res = SWIG_OLDOBJ) {
Type *ptr = (Type *)0; Type *ptr = (Type *)0;
res = asptr_meth($input, &ptr); res = asptr_meth($input, &ptr);
if (!SWIG_IsOK(res)) { %argument_fail(SWIG_TypeError,"$type",$argnum); } if (!SWIG_IsOK(res)) { %argument_fail(SWIG_TypeError,"$type",$symname, $argnum); }
if (!ptr) { %argument_nullref("$type",$argnum); } if (!ptr) { %argument_nullref("$type",$symname, $argnum); }
$1 = ptr; $1 = ptr;
} }
%typemap(freearg,noblock=1) const Type & { %typemap(freearg,noblock=1) const Type & {

View file

@ -31,7 +31,7 @@
Char * (Char *buf = 0, int alloc = 0), Char * (Char *buf = 0, int alloc = 0),
const Char * (Char *buf = 0, int alloc = 0) { const Char * (Char *buf = 0, int alloc = 0) {
if (!SWIG_IsOK(SWIG_AsCharPtr($input, &buf, &alloc))) { if (!SWIG_IsOK(SWIG_AsCharPtr($input, &buf, &alloc))) {
%argument_fail(SWIG_TypeError,"$type",$argnum); %argument_fail(SWIG_TypeError,"$type",$symname, $argnum);
} }
$1 = buf; $1 = buf;
} }
@ -41,7 +41,7 @@
%typemap(in,noblock=1,fragment=#SWIG_AsCharPtr) Char const*& (Char *buf = 0, int alloc = 0) { %typemap(in,noblock=1,fragment=#SWIG_AsCharPtr) Char const*& (Char *buf = 0, int alloc = 0) {
if (!SWIG_IsOK((SWIG_AsCharPtr($input, &buf, &alloc)))) { if (!SWIG_IsOK((SWIG_AsCharPtr($input, &buf, &alloc)))) {
%argument_fail(SWIG_TypeError,"$type",$argnum); %argument_fail(SWIG_TypeError,"$type",$symname, $argnum);
} }
$1 = &temp; $1 = &temp;
} }
@ -250,7 +250,7 @@
const Char [ANY](Char temp[$1_dim0]) const Char [ANY](Char temp[$1_dim0])
{ {
if (!SWIG_IsOK((SWIG_AsCharArray($input, temp, $1_dim0)))) { if (!SWIG_IsOK((SWIG_AsCharArray($input, temp, $1_dim0)))) {
%argument_fail(SWIG_TypeError,"$type",$argnum); %argument_fail(SWIG_TypeError,"$type",$symname, $argnum);
} }
$1 = temp; $1 = temp;
} }
@ -259,7 +259,7 @@
%typemap(in,noblock=1,fragment=#SWIG_AsCharArray) const Char (&)[ANY] (Char temp[$1_dim0]) %typemap(in,noblock=1,fragment=#SWIG_AsCharArray) const Char (&)[ANY] (Char temp[$1_dim0])
{ {
if (!SWIG_IsOK((SWIG_AsCharArray($input, temp, $1_dim0)))) { if (!SWIG_IsOK((SWIG_AsCharArray($input, temp, $1_dim0)))) {
%argument_fail(SWIG_TypeError,"$type",$argnum); %argument_fail(SWIG_TypeError,"$type",$symname, $argnum);
} }
$1 = &temp; $1 = &temp;
} }
@ -398,7 +398,7 @@
(const Char *STRING, size_t LENGTH) (Char *buf = 0, size_t size = 0, int alloc = 0) (const Char *STRING, size_t LENGTH) (Char *buf = 0, size_t size = 0, int alloc = 0)
{ {
if (!SWIG_IsOK((SWIG_AsCharPtrAndSize($input, &buf, &size, &alloc)))) { if (!SWIG_IsOK((SWIG_AsCharPtrAndSize($input, &buf, &size, &alloc)))) {
%argument_fail(SWIG_TypeError,"$type",$argnum); %argument_fail(SWIG_TypeError,"$type",$symname, $argnum);
} }
$1 = %static_cast(buf, $1_ltype); $1 = %static_cast(buf, $1_ltype);
$2 = %numeric_cast(size - 1, $2_ltype); $2 = %numeric_cast(size - 1, $2_ltype);
@ -417,7 +417,7 @@
(const Char *STRING, size_t SIZE) (Char *buf = 0, size_t size = 0, int alloc = 0) (const Char *STRING, size_t SIZE) (Char *buf = 0, size_t size = 0, int alloc = 0)
{ {
if (!SWIG_IsOK((SWIG_AsCharPtrAndSize($input, &buf, &size, &alloc)))) { if (!SWIG_IsOK((SWIG_AsCharPtrAndSize($input, &buf, &size, &alloc)))) {
%argument_fail(SWIG_TypeError,"$type",$argnum); %argument_fail(SWIG_TypeError,"$type",$symname, $argnum);
} }
$1 = %static_cast(buf, $1_ltype); $1 = %static_cast(buf, $1_ltype);
$2 = %numeric_cast(size, $2_ltype); $2 = %numeric_cast(size, $2_ltype);
@ -438,7 +438,7 @@
(size_t LENGHT, const Char *STRING) (Char *buf = 0, size_t size = 0, int alloc = 0) (size_t LENGHT, const Char *STRING) (Char *buf = 0, size_t size = 0, int alloc = 0)
{ {
if (!SWIG_IsOK((SWIG_AsCharPtrAndSize($input, &buf, &size, &alloc)))) { if (!SWIG_IsOK((SWIG_AsCharPtrAndSize($input, &buf, &size, &alloc)))) {
%argument_fail(SWIG_TypeError,"$type",$argnum); %argument_fail(SWIG_TypeError,"$type",$symname, $argnum);
} }
$2 = %static_cast(buf, $2_ltype) ; $2 = %static_cast(buf, $2_ltype) ;
$1 = %numeric_cast(size - 1, $1_ltype) ; $1 = %numeric_cast(size - 1, $1_ltype) ;
@ -456,7 +456,7 @@
(size_t SIZE, const Char *STRING) (Char *buf = 0, size_t size = 0, int alloc = 0) (size_t SIZE, const Char *STRING) (Char *buf = 0, size_t size = 0, int alloc = 0)
{ {
if (!SWIG_IsOK((SWIG_AsCharPtrAndSize($input, &buf, &size, &alloc)))) { if (!SWIG_IsOK((SWIG_AsCharPtrAndSize($input, &buf, &size, &alloc)))) {
%argument_fail(SWIG_TypeError, "$type",$argnum); %argument_fail(SWIG_TypeError, "$type",$symname, $argnum);
} }
$2 = %static_cast(buf, $2_ltype) ; $2 = %static_cast(buf, $2_ltype) ;
$1 = %numeric_cast(size, $1_ltype) ; $1 = %numeric_cast(size, $1_ltype) ;

View file

@ -5,7 +5,7 @@
/* Pointers and arrays */ /* Pointers and arrays */
%typemap(in, noblock=1) SWIGTYPE *(void *argp = 0) { %typemap(in, noblock=1) SWIGTYPE *(void *argp = 0) {
if (!SWIG_IsOK((SWIG_ConvertPtr($input, &argp,$descriptor, $disown | %convertptr_flags)))) { if (!SWIG_IsOK((SWIG_ConvertPtr($input, &argp,$descriptor, $disown | %convertptr_flags)))) {
%argument_fail(SWIG_TypeError, "$type", $argnum); %argument_fail(SWIG_TypeError, "$type", $symname, $argnum);
} }
$1 = %reinterpret_cast(argp, $ltype); $1 = %reinterpret_cast(argp, $ltype);
} }
@ -13,7 +13,7 @@
%typemap(in, noblock=1) SWIGTYPE [] (void *argp = 0) { %typemap(in, noblock=1) SWIGTYPE [] (void *argp = 0) {
if (!SWIG_IsOK((SWIG_ConvertPtr($input, &argp,$descriptor, $disown | %convertptr_flags)))) { if (!SWIG_IsOK((SWIG_ConvertPtr($input, &argp,$descriptor, $disown | %convertptr_flags)))) {
%argument_fail(SWIG_TypeError, "$type", $argnum); %argument_fail(SWIG_TypeError, "$type", $symname, $argnum);
} }
$1 = %reinterpret_cast(argp, $ltype); $1 = %reinterpret_cast(argp, $ltype);
} }
@ -22,7 +22,7 @@
%typemap(in, noblock=1) SWIGTYPE* const& (void *argp = 0, $*ltype temp) { %typemap(in, noblock=1) SWIGTYPE* const& (void *argp = 0, $*ltype temp) {
if (!SWIG_IsOK((SWIG_ConvertPtr($input, &argp, $*descriptor, $disown | %convertptr_flags)))) { if (!SWIG_IsOK((SWIG_ConvertPtr($input, &argp, $*descriptor, $disown | %convertptr_flags)))) {
%argument_fail(SWIG_TypeError, "$*ltype", $argnum); %argument_fail(SWIG_TypeError, "$*ltype", $symname, $argnum);
} }
temp = %reinterpret_cast(argp, $*ltype); temp = %reinterpret_cast(argp, $*ltype);
$1 = &temp; $1 = &temp;
@ -33,9 +33,9 @@
/* Reference */ /* Reference */
%typemap(in, noblock=1) SWIGTYPE & (void *argp = 0) { %typemap(in, noblock=1) SWIGTYPE & (void *argp = 0) {
if (!SWIG_IsOK((SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags)))) { if (!SWIG_IsOK((SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags)))) {
%argument_fail(SWIG_TypeError, "$type", $argnum); %argument_fail(SWIG_TypeError, "$type", $symname, $argnum);
} }
if (!argp) { %argument_nullref("$type", $argnum); } if (!argp) { %argument_nullref("$type", $symname, $argnum); }
$1 = %reinterpret_cast(argp, $ltype); $1 = %reinterpret_cast(argp, $ltype);
} }
%typemap(freearg) SWIGTYPE & ""; %typemap(freearg) SWIGTYPE & "";
@ -44,9 +44,9 @@
%typemap(in,implicitconv=1) const SWIGTYPE & (void *argp = 0, int res) { %typemap(in,implicitconv=1) const SWIGTYPE & (void *argp = 0, int res) {
res = SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags | %implicitconv_flag); res = SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags | %implicitconv_flag);
if (!SWIG_IsOK(res)) { if (!SWIG_IsOK(res)) {
%argument_fail(SWIG_TypeError, "$type", $argnum); %argument_fail(SWIG_TypeError, "$type", $symname, $argnum);
} }
if (!argp) { %argument_nullref("$type", $argnum); } if (!argp) { %argument_nullref("$type", $symname, $argnum); }
$1 = %reinterpret_cast(argp, $ltype); $1 = %reinterpret_cast(argp, $ltype);
} }
%typemap(freearg,noblock=1,match="in",implicitconv=1) const SWIGTYPE & %typemap(freearg,noblock=1,match="in",implicitconv=1) const SWIGTYPE &
@ -56,9 +56,9 @@
#else #else
%typemap(in,noblock=1) const SWIGTYPE & (void *argp) { %typemap(in,noblock=1) const SWIGTYPE & (void *argp) {
if (!SWIG_IsOK((SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags)))) { if (!SWIG_IsOK((SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags)))) {
%argument_fail(SWIG_TypeError, "$type", $argnum); %argument_fail(SWIG_TypeError, "$type", $symname, $argnum);
} }
if (!argp) { %argument_nullref("$type", $argnum); } if (!argp) { %argument_nullref("$type", $symname, $argnum); }
$1 = %reinterpret_cast(argp, $ltype); $1 = %reinterpret_cast(argp, $ltype);
} }
#endif #endif
@ -69,10 +69,10 @@
void *argp; void *argp;
int res = SWIG_ConvertPtr($input, &argp, $&descriptor, %convertptr_flags | %implicitconv_flag); int res = SWIG_ConvertPtr($input, &argp, $&descriptor, %convertptr_flags | %implicitconv_flag);
if (!SWIG_IsOK(res)) { if (!SWIG_IsOK(res)) {
%argument_fail(SWIG_TypeError, "$type", $argnum); %argument_fail(SWIG_TypeError, "$type", $symname, $argnum);
} }
if (!argp) { if (!argp) {
%argument_nullref("$type", $argnum); %argument_nullref("$type", $symname, $argnum);
} else { } else {
$&ltype temp = %reinterpret_cast(argp, $&ltype); $&ltype temp = %reinterpret_cast(argp, $&ltype);
$1 = *temp; $1 = *temp;
@ -84,10 +84,10 @@
void *argp; void *argp;
$&ltype temp; $&ltype temp;
if (!SWIG_IsOK((SWIG_ConvertPtr($input, &argp, $&descriptor, %convertptr_flags)))) { if (!SWIG_IsOK((SWIG_ConvertPtr($input, &argp, $&descriptor, %convertptr_flags)))) {
%argument_fail(SWIG_TypeError, "$type", $argnum); %argument_fail(SWIG_TypeError, "$type", $symname, $argnum);
} }
if (!argp) { if (!argp) {
%argument_nullref("$type", $argnum); %argument_nullref("$type", $symname, $argnum);
} else { } else {
$1 = *(%reinterpret_cast(argp, $&ltype)); $1 = *(%reinterpret_cast(argp, $&ltype));
} }
@ -451,7 +451,7 @@
%typemap(in,noblock=1) SWIGTYPE (CLASS::*) { %typemap(in,noblock=1) SWIGTYPE (CLASS::*) {
if (!SWIG_IsOK((SWIG_ConvertMember($input, %as_voidptr(&$1), sizeof($type),$descriptor)))) { if (!SWIG_IsOK((SWIG_ConvertMember($input, %as_voidptr(&$1), sizeof($type),$descriptor)))) {
%argument_fail(SWIG_TypeError,"$type",$argnum); %argument_fail(SWIG_TypeError,"$type",$symname, $argnum);
} }
} }
@ -502,7 +502,7 @@
*/ */
%typemap(in, noblock=1) SWIGTYPE ((*)(ANY)) { %typemap(in, noblock=1) SWIGTYPE ((*)(ANY)) {
if (!SWIG_IsOK((SWIG_ConvertFunctionPtr($input, (void**)(&$1), $descriptor)))) { if (!SWIG_IsOK((SWIG_ConvertFunctionPtr($input, (void**)(&$1), $descriptor)))) {
%argument_fail(SWIG_TypeError,"$type",$argnum); %argument_fail(SWIG_TypeError,"$type",$symname, $argnum);
} }
} }
@ -562,7 +562,7 @@
%typemap(in, noblock=1) SWIGTYPE *DISOWN { %typemap(in, noblock=1) SWIGTYPE *DISOWN {
if (!SWIG_IsOK((SWIG_ConvertPtr($input, %as_voidptrptr(&$1), $descriptor, SWIG_POINTER_DISOWN | %convertptr_flags)))) { if (!SWIG_IsOK((SWIG_ConvertPtr($input, %as_voidptrptr(&$1), $descriptor, SWIG_POINTER_DISOWN | %convertptr_flags)))) {
%argument_fail(SWIG_TypeError,"$type", $argnum); %argument_fail(SWIG_TypeError,"$type", $symname, $argnum);
} }
} }

View file

@ -132,8 +132,8 @@
* ----------------------------------------------------------------------------- */ * ----------------------------------------------------------------------------- */
#define %error_block(Block...) %block(Block) #define %error_block(Block...) %block(Block)
#define %argument_fail(code, type, argn) SWIG_exception(code, %argfail_fmt(type, argn)) #define %argument_fail(code, type, name, argn) SWIG_exception(code, %argfail_fmt(type, name, argn))
#define %argument_nullref(type, argn) SWIG_exception(SWIG_ValueError, %argnullref_fmt(type, argn)) #define %argument_nullref(type, name, argn) SWIG_exception(SWIG_ValueError, %argnullref_fmt(type, name, argn))
#define %variable_fail(code, type, name) SWIG_exception(code, %varfail_fmt(type, name)) #define %variable_fail(code, type, name) SWIG_exception(code, %varfail_fmt(type, name))
#define %variable_nullref(type, name) SWIG_exception(SWIG_ValueError, %varnullref_fmt(type, name)) #define %variable_nullref(type, name) SWIG_exception(SWIG_ValueError, %varnullref_fmt(type, name))

View file

@ -34,7 +34,7 @@
%typemap(in,noblock=1,fragment=frag) Type (Type val, int ecode = 0) { %typemap(in,noblock=1,fragment=frag) Type (Type val, int ecode = 0) {
ecode = asval_meth($input, &val); ecode = asval_meth($input, &val);
if (!SWIG_IsOK(ecode)) { if (!SWIG_IsOK(ecode)) {
%argument_fail(ecode, "$ltype", $argnum); %argument_fail(ecode, "$ltype", $symname, $argnum);
} }
$1 = %static_cast(val,$ltype); $1 = %static_cast(val,$ltype);
} }
@ -42,7 +42,7 @@
%typemap(in,noblock=1,fragment=frag) const Type & ($*ltype temp, Type val, int ecode = 0) { %typemap(in,noblock=1,fragment=frag) const Type & ($*ltype temp, Type val, int ecode = 0) {
ecode = asval_meth($input, &val); ecode = asval_meth($input, &val);
if (!SWIG_IsOK(ecode)) { if (!SWIG_IsOK(ecode)) {
%argument_fail(ecode, "$*ltype", $argnum); %argument_fail(ecode, "$*ltype", $symname, $argnum);
} }
temp = %static_cast(val, $*ltype); temp = %static_cast(val, $*ltype);
$1 = &temp; $1 = &temp;

View file

@ -6,14 +6,14 @@
%typemap(in,noblock=1) void * { %typemap(in,noblock=1) void * {
if (!SWIG_IsOK((SWIG_ConvertPtr($input,%as_voidptrptr(&$1), 0, $disown)))) { if (!SWIG_IsOK((SWIG_ConvertPtr($input,%as_voidptrptr(&$1), 0, $disown)))) {
%argument_fail(SWIG_TypeError, "$type", $argnum); %argument_fail(SWIG_TypeError, "$type", $symname, $argnum);
} }
} }
%typemap(freearg) void * ""; %typemap(freearg) void * "";
%typemap(in,noblock=1) void * const& ($*ltype temp) { %typemap(in,noblock=1) void * const& ($*ltype temp) {
if (!SWIG_IsOK((SWIG_ConvertPtr($input, %as_voidptrptr(&temp), 0, $disown)))) { if (!SWIG_IsOK((SWIG_ConvertPtr($input, %as_voidptrptr(&temp), 0, $disown)))) {
%argument_fail(SWIG_TypeError, "Stype", $argnum); %argument_fail(SWIG_TypeError, "Stype", $symname, $argnum);
} }
$1 = &temp; $1 = &temp;
} }