be sure we use #if defined(...) instead of the fragil #ifdef everywhere, fix missing director typemaps and cosmetics

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7742 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2005-10-27 10:35:38 +00:00
commit b1b8fc9b31
7 changed files with 38 additions and 19 deletions

View file

@ -297,18 +297,20 @@
#define SWIG_FROM_CALL_ARGS
#endif
#define SWIG_Traits_frag(Type...) %string_type(Traits, Type)
#define SWIG_AsPtr_frag(Type...) %string_type(AsPtr, Type)
#define SWIG_AsVal_frag(Type...) %string_type(AsVal, Type)
#define SWIG_From_frag(Type...) %string_type(From, Type)
#define %fragment_name(Name, Type...) %string_name(Name) "_" {Type}
#define SWIG_AsVal_dec(Type...) %name_type(AsVal, Type) SWIG_ASVAL_DECL_ARGS
#define SWIG_AsPtr_dec(Type...) %name_type(AsPtr, Type) SWIG_ASPTR_DECL_ARGS
#define SWIG_From_dec(Type...) %name_type(From, Type) SWIG_FROM_DECL_ARGS
#define SWIG_Traits_frag(Type...) %fragment_name(Traits, Type)
#define SWIG_AsPtr_frag(Type...) %fragment_name(AsPtr, Type)
#define SWIG_AsVal_frag(Type...) %fragment_name(AsVal, Type)
#define SWIG_From_frag(Type...) %fragment_name(From, Type)
#define SWIG_AsVal(Type...) %name_type(AsVal, Type) SWIG_ASVAL_CALL_ARGS
#define SWIG_AsPtr(Type...) %name_type(AsPtr, Type) SWIG_ASPTR_CALL_ARGS
#define SWIG_From(Type...) %name_type(From, Type) SWIG_FROM_CALL_ARGS
#define SWIG_AsVal_dec(Type...) %symbol_name(AsVal, Type) SWIG_ASVAL_DECL_ARGS
#define SWIG_AsPtr_dec(Type...) %symbol_name(AsPtr, Type) SWIG_ASPTR_DECL_ARGS
#define SWIG_From_dec(Type...) %symbol_name(From, Type) SWIG_FROM_DECL_ARGS
#define SWIG_AsVal(Type...) %symbol_name(AsVal, Type) SWIG_ASVAL_CALL_ARGS
#define SWIG_AsPtr(Type...) %symbol_name(AsPtr, Type) SWIG_ASPTR_CALL_ARGS
#define SWIG_From(Type...) %symbol_name(From, Type) SWIG_FROM_CALL_ARGS
/* ------------------------------------------------------------
* common fragments

View file

@ -70,7 +70,7 @@ or you can use the %apply directive :
double fadd(double *a, double *b);
*/
#ifdef SWIG_INPUT_ACCEPT_PTRS
#if defined(SWIG_INPUT_ACCEPT_PTRS)
#define %check_input_ptr(input,arg,desc,disown) (SWIG_ConvertPtr(input,%as_voidptrptr(arg),desc,disown) == SWIG_OK)
#else
#define %check_input_ptr(input,arg,desc,disown) (0)

View file

@ -165,7 +165,9 @@
$result = buf;
}
%typemap(directorout,noblock=1,fragment=#SWIG_AsCharPtr) Char * const& (Char* buf = 0, int alloc = 0) {
%typemap(directorout,noblock=1,fragment=#SWIG_AsCharPtr)
Char * const& (Char* buf = 0, int alloc = 0),
Char const* const& (Char* buf = 0, int alloc = 0) {
if (SWIG_AsCharPtr($input, &buf, &alloc) != SWIG_OK) {
%dirout_fail(SWIG_TypeError, "$type");
}

View file

@ -111,9 +111,9 @@ nocppval
* Casting operators
* ----------------------------------------------------------------------------- */
#ifdef SWIG_NO_CPLUSPLUS_CAST
#if defined(SWIG_NO_CPLUSPLUS_CAST)
/* Disable 'modern' cplusplus casting operators */
# ifdef SWIG_CPLUSPLUS_CAST
# if defined(SWIG_CPLUSPLUS_CAST)
# undef SWIG_CPLUSPLUS_CAST
# endif
#endif
@ -159,9 +159,9 @@ nocppval
* ----------------------------------------------------------------------------- */
#define %mangle(Type...) #@Type
#define %name_type(Name, Type...) SWIG_ ## Name ## _ ## #@Type
#define %string_type(Name, Type...) "SWIG_" #Name "_" {Type}
#define %checkcode(Code) %name_type(TYPECHECK, Code)
#define %string_name(Name) "SWIG_" %str(Name)
#define %symbol_name(Name, Type...) SWIG_ ## Name ## _ #@Type
#define %checkcode(Code) SWIG_TYPECHECK_ ## Code
/* -----------------------------------------------------------------------------

View file

@ -250,7 +250,7 @@
/* directorin */
%typemap(directorin,noblock=1) SWIGTYPE* {
%typemap(directorin,noblock=1) SWIGTYPE*, SWIGTYPE* const& {
$input = SWIG_NewPointerObj(%as_voidptr($1_name), $descriptor, %newpointer_flags);
}

View file

@ -160,7 +160,7 @@ phased out in future releases.
*/
#ifdef SWIG_INOUT_NODEF
#if defined(SWIG_INOUT_NODEF)
%apply_checkctypes(%typemaps_inoutn)

View file

@ -48,6 +48,13 @@
#if defined(SWIG_DIRECTOR_TYPEMAPS)
/* directorin */
%typemap(directorin,noblock=1) void *, void const*, void *const, void const *const,
void const *&, void *const &, void const *const & {
$input = SWIG_NewPointerObj(%as_voidptr($1_name), $descriptor, %newpointer_flags);
}
/* directorout */
%typemap(directorout,noblock=1) void * (void *argp) {
@ -57,6 +64,14 @@
$result = %reinterpret_cast(argp, $ltype);
}
%typemap(directorout,noblock=1) void * const& ($*ltype temp) {
if (SWIG_ConvertPtr($input, %as_voidptrptr(&temp), 0, $disown) != SWIG_OK) {
%dirout_fail(SWIG_TypeError,"$type");
}
$result = &temp;
}
#endif /* SWIG_DIRECTOR_TYPEMAPS */