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:
William S Fulton 2004-10-04 20:08:25 +00:00
commit ff38a4e4ef
2 changed files with 16 additions and 9 deletions

View file

@ -74,13 +74,18 @@ static SWIGCDATA cdata_##__VA_ARGS__(TYPE *ptr, int nelements) {
return d; return d;
} }
} }
%typemap(default) int nelements "$1 = 1;"
#if #__VA_ARGS__ == "" #if #__VA_ARGS__ == ""
SWIGCDATA cdata_##TYPE(TYPE *ptr, int nelements = 1); SWIGCDATA cdata_##TYPE(TYPE *ptr, int nelements);
#else #else
SWIGCDATA cdata_##__VA_ARGS__(TYPE *ptr, int nelements = 1); SWIGCDATA cdata_##__VA_ARGS__(TYPE *ptr, int nelements);
#endif #endif
%enddef %enddef
%typemap(default) int nelements;
%name(cdata) %name(cdata)
%cdata(void); %cdata(void);

View file

@ -34,11 +34,11 @@
#else #else
%name(malloc_##TYPE) %name(malloc_##TYPE)
#endif #endif
TYPE *malloc(int nbytes
#if #TYPE != "void" #if #TYPE != "void"
= sizeof(TYPE) %typemap(default) int nbytes "$1 = (int) sizeof(TYPE);"
#endif #endif
); TYPE *malloc(int nbytes);
%typemap(default) int nbytes;
%enddef %enddef
%define %calloc(TYPE,...) %define %calloc(TYPE,...)
@ -47,13 +47,15 @@ TYPE *malloc(int nbytes
#else #else
%name(calloc_##TYPE) %name(calloc_##TYPE)
#endif #endif
TYPE *calloc(int nobj = 1, int sz =
#if #TYPE != "void" #if #TYPE != "void"
sizeof(TYPE) %typemap(default) int sz "$1 = (int) sizeof(TYPE);"
#else #else
1 %typemap(default) int sz "$1 = 1;"
#endif #endif
); %typemap(default) int nobj "$1 = 1;"
TYPE *calloc(int nobj, int sz);
%typemap(default) int sz;
%typemap(default) int nobj;
%enddef %enddef
%define %realloc(TYPE,...) %define %realloc(TYPE,...)