mods to use "default" typemap instead of default arguments for new default argument wrapping approach
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6304 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
5b33b2f08f
commit
ff38a4e4ef
2 changed files with 16 additions and 9 deletions
|
|
@ -74,13 +74,18 @@ static SWIGCDATA cdata_##__VA_ARGS__(TYPE *ptr, int nelements) {
|
|||
return d;
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(default) int nelements "$1 = 1;"
|
||||
|
||||
#if #__VA_ARGS__ == ""
|
||||
SWIGCDATA cdata_##TYPE(TYPE *ptr, int nelements = 1);
|
||||
SWIGCDATA cdata_##TYPE(TYPE *ptr, int nelements);
|
||||
#else
|
||||
SWIGCDATA cdata_##__VA_ARGS__(TYPE *ptr, int nelements = 1);
|
||||
SWIGCDATA cdata_##__VA_ARGS__(TYPE *ptr, int nelements);
|
||||
#endif
|
||||
%enddef
|
||||
|
||||
%typemap(default) int nelements;
|
||||
|
||||
%name(cdata)
|
||||
%cdata(void);
|
||||
|
||||
|
|
|
|||
|
|
@ -34,11 +34,11 @@
|
|||
#else
|
||||
%name(malloc_##TYPE)
|
||||
#endif
|
||||
TYPE *malloc(int nbytes
|
||||
#if #TYPE != "void"
|
||||
= sizeof(TYPE)
|
||||
%typemap(default) int nbytes "$1 = (int) sizeof(TYPE);"
|
||||
#endif
|
||||
);
|
||||
TYPE *malloc(int nbytes);
|
||||
%typemap(default) int nbytes;
|
||||
%enddef
|
||||
|
||||
%define %calloc(TYPE,...)
|
||||
|
|
@ -47,13 +47,15 @@ TYPE *malloc(int nbytes
|
|||
#else
|
||||
%name(calloc_##TYPE)
|
||||
#endif
|
||||
TYPE *calloc(int nobj = 1, int sz =
|
||||
#if #TYPE != "void"
|
||||
sizeof(TYPE)
|
||||
%typemap(default) int sz "$1 = (int) sizeof(TYPE);"
|
||||
#else
|
||||
1
|
||||
%typemap(default) int sz "$1 = 1;"
|
||||
#endif
|
||||
);
|
||||
%typemap(default) int nobj "$1 = 1;"
|
||||
TYPE *calloc(int nobj, int sz);
|
||||
%typemap(default) int sz;
|
||||
%typemap(default) int nobj;
|
||||
%enddef
|
||||
|
||||
%define %realloc(TYPE,...)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue