diff --git a/Lib/typemaps/swigmacros.swg b/Lib/typemaps/swigmacros.swg index b1a2cfcbf..c9b42facf 100644 --- a/Lib/typemaps/swigmacros.swg +++ b/Lib/typemaps/swigmacros.swg @@ -23,29 +23,29 @@ SWIG provides the following casting macros, which implement the corresponding C++ casting operations: - %const_cast(a, Type) const_cast(a) - %static_cast(a, Type) static_cast(a) - %reinterpret_cast(a, Type) reinterpret_cast(a) - %numeric_cast(a, Type) static_cast(a) - %as_voidptr(a) const_cast(static_cast(a)) - %as_voidptrptr(a) reinterpret_cast(a) - + %const_cast(a, Type) const_cast(a) + %static_cast(a, Type) static_cast(a) + %reinterpret_cast(a, Type) reinterpret_cast(a) + %numeric_cast(a, Type) static_cast(a) + %as_voidptr(a) const_cast(static_cast(a)) + %as_voidptrptr(a) reinterpret_cast(a) + or their C unsafe versions. In C++ we use the safe version unless SWIG_NO_CPLUSPLUS_CAST is defined (usually via the -nocppcast swig flag). Memory allocation: ------------------ - + These allocation/freeing macros are safe to use in C or C++ and dispatch the proper new/delete/delete[] or free/malloc calls as needed. - + %new_instance(Type) Allocate a new instance of given Type %new_copy(value,Type) Allocate and initialize a new instance with 'value' %new_array(size,Type) Allocate a new array with given size and Type %new_copy_array(cptr,size,Type) Allocate and initialize a new array from 'cptr' - %delete(cptr) Delete an instance + %delete(cptr) Delete an instance %delete_array(cptr) Delete an array @@ -54,13 +54,13 @@ %formacro(Macro, Args...) or %formacro_1(Macro, Args...) for i in Args - do + do Macro($i) done %formacro_2(Macro2, Args...) for i,j in Args - do + do Macro2($i, $j) done @@ -71,12 +71,12 @@ %mark_flag(flag) flag := True - %evalif(flag,expr) + %evalif(flag,expr) if flag; then expr fi - %evalif_2(flag1 flag2,expr) + %evalif_2(flag1 flag2,expr) if flag1 and flag2; then expr fi @@ -84,7 +84,7 @@ */ /* ----------------------------------------------------------------------------- - * Basic preprocessor macros + * Basic preprocessor macros * ----------------------------------------------------------------------------- */ #define %arg(Arg...) Arg @@ -115,7 +115,7 @@ nocppval %define_as(SWIGVERSION, SWIG_VERSION) %#define SWIG_VERSION SWIGVERSION } -#endif +#endif @@ -153,10 +153,10 @@ nocppval /* ----------------------------------------------------------------------------- - * Allocating/freeing elements + * Allocating/freeing elements * ----------------------------------------------------------------------------- */ -#if defined(__cplusplus) +#if defined(__cplusplus) # define %new_instance(Type...) (new Type) # define %new_copy(val,Type...) (new Type(%static_cast(val, const Type&))) # define %new_array(size,Type...) (new Type[size]) @@ -184,7 +184,7 @@ nocppval /* ----------------------------------------------------------------------------- - * Auxiliary loop macros + * Auxiliary loop macros * ----------------------------------------------------------------------------- */ @@ -213,10 +213,10 @@ nocppval * SWIG flags * ----------------------------------------------------------------------------- */ -/* +/* mark a flag, ie, define a macro name but ignore it in - the interface. - + the interface. + the flag can be later used with %evalif */ @@ -224,16 +224,16 @@ nocppval /* - %evalif and %evalif_2 are use to evaluate or process + %evalif and %evalif_2 are use to evaluate or process an expression if the given predicate is 'true' (1). */ -%define %_evalif(_x,_expr) +%define %_evalif(_x,_expr) #if _x == 1 _expr #endif %enddef -%define %_evalif_2(_x,_y,_expr) +%define %_evalif_2(_x,_y,_expr) #if _x == 1 && _y == 1 _expr #endif