| 1 | /* ----------------------------------------------------------------------------- |
| 2 | * SWIG API. Portion only visible from SWIG |
| 3 | * ----------------------------------------------------------------------------- */ |
| 4 | |
| 5 | #define SWIG_arg(Arg...) Arg |
| 6 | |
| 7 | #define SWIG_str(Type...) #Type |
| 8 | |
| 9 | #define SWIG_Mangle(Type...) #@Type |
| 10 | #define SWIG_Descriptor(Type...) SWIGTYPE_ ## #@Type |
| 11 | |
| 12 | #define SWIG_NameType(Name, Type...) SWIG_ ## Name ## _ ## #@Type |
| 13 | #define SWIG_StringType(Name, Type...) "SWIG_" #Name "_" {Type} |
| 14 | |
| 15 | #define SWIG_AsVal(Type...) SWIG_NameType(AsVal, Type) |
| 16 | #define SWIG_AsPtr(Type...) SWIG_NameType(AsPtr, Type) |
| 17 | #define SWIG_As(Type...) SWIG_NameType(As, Type) |
| 18 | #define SWIG_From(Type...) SWIG_NameType(From, Type) |
| 19 | #define SWIG_Check(Type...) SWIG_NameType(Check, Type) |
| 20 | #define SWIG_CCode(Type...) SWIG_NameType(TYPECHECK, Type) |
| 21 | #define SWIG_OrderType(Type...) SWIG_NameType(OrderType, Type) |
| 22 | #define SWIG_EqualType(Type...) SWIG_NameType(EqualType, Type) |
| 23 | |
| 24 | #define SWIG_Traits_frag(Type...) SWIG_StringType(Traits, Type) |
| 25 | #define SWIG_AsPtr_frag(Type...) SWIG_StringType(AsPtr, Type) |
| 26 | #define SWIG_AsVal_frag(Type...) SWIG_StringType(AsVal, Type) |
| 27 | #define SWIG_As_frag(Type...) SWIG_StringType(As, Type) |
| 28 | #define SWIG_From_frag(Type...) SWIG_StringType(From, Type) |
| 29 | #define SWIG_Check_frag(Type...) SWIG_StringType(Check, Type) |
| 30 | #define SWIG_CCode_frag(Type...) SWIG_StringType(TYPECHECK, Type) |
| 31 | |
| 32 | /* Internal C/C++ API */ |
| 33 | #ifdef SWIG_NO_CPLUSPLUS_CAST |
| 34 | /* ----------------------------------------------------------------------------- |
| 35 | * Disable 'modern' cplusplus casting operators |
| 36 | * ----------------------------------------------------------------------------- */ |
| 37 | #ifdef SWIG_CPLUSPLUS_CAST |
| 38 | #undef SWIG_CPLUSPLUS_CAST |
| 39 | #endif |
| 40 | #endif |
| 41 | |
| 42 | #if defined(__cplusplus) |
| 43 | #define SWIG_new(Type...) (new Type) |
| 44 | #define SWIG_new_copy(ptr,Type...) (new Type(*ptr)) |
| 45 | #define SWIG_new_array(size,Type...) (new Type[(size)]) |
| 46 | #define SWIG_delete(cptr) delete cptr |
| 47 | #define SWIG_delete_array(cptr) delete[] cptr |
| 48 | #else /* C case */ |
| 49 | #define SWIG_new(Type...) ((Type*)malloc(sizeof(Type))) |
| 50 | #define SWIG_new_copy(ptr,Type...) ((Type*)memcpy(malloc(sizeof(Type)),ptr,sizeof(Type))) |
| 51 | #define SWIG_new_array(size,Type...) ((Type*) malloc((size)*sizeof(Type))) |
| 52 | #define SWIG_delete(cptr) free((char*)cptr) |
| 53 | #define SWIG_delete_array(cptr) free((char*)cptr) |
| 54 | #endif /* __cplusplus */ |
| 55 | |
| 56 | #if defined(__cplusplus) && defined(SWIG_CPLUSPLUS_CAST) |
| 57 | #define SWIG_const_cast(a,Type...) const_cast<Type >(a) |
| 58 | #define SWIG_static_cast(a,Type...) static_cast<Type >(a) |
| 59 | #define SWIG_reinterpret_cast(a,Type...) reinterpret_cast<Type >(a) |
| 60 | #define SWIG_numeric_cast(a,Type...) static_cast<Type >(a) |
| 61 | #else /* C case */ |
| 62 | #define SWIG_const_cast(a,Type...) (Type)(a) |
| 63 | #define SWIG_static_cast(a,Type...) (Type)(a) |
| 64 | #define SWIG_reinterpret_cast(a,Type...) (Type)(a) |
| 65 | #define SWIG_numeric_cast(a,Type...) (Type)(a) |
| 66 | #endif /* __cplusplus */ |
| 67 | |
| 68 | |
| 69 | /* ----------------------------------------------------------------------------- |
| 70 | * Auxiliar swig macros used to write typemaps |
| 71 | * ----------------------------------------------------------------------------- */ |
| 72 | |
| 73 | /* define a new macro */ |
| 74 | %define SWIG_define(Def, Val) |
| 75 | %#define Def Val |
| 76 | %enddef |
| 77 | |
| 78 | /* include C++ or C value */ |
| 79 | %define SWIG_cplusplus(cppval, cval) |
| 80 | #ifdef __cplusplus |
| 81 | cppval |
| 82 | #else |
| 83 | cval |
| 84 | #endif |
| 85 | %enddef |
| 86 | |
| 87 | /* for loop for macro with one argument */ |
| 88 | %define %_formacro_1(macro, arg1,...) |
| 89 | macro(arg1) |
| 90 | #if #__VA_ARGS__ != "__fordone__" |
| 91 | %_formacro_1(macro, __VA_ARGS__) |
| 92 | #endif |
| 93 | %enddef |
| 94 | |
| 95 | /* for loop for macro with one argument */ |
| 96 | %define %formacro_1(macro,...) |
| 97 | %_formacro_1(macro,__VA_ARGS__,__fordone__) |
| 98 | %enddef |
| 99 | |
| 100 | /* for loop for macro with two arguments */ |
| 101 | %define %_formacro_2(macro, arg1, arg2, ...) |
| 102 | macro(arg1, arg2) |
| 103 | #if #__VA_ARGS__ != "__fordone__" |
| 104 | %_formacro_2(macro, __VA_ARGS__) |
| 105 | #endif |
| 106 | %enddef |
| 107 | |
| 108 | /* for loop for macro with two arguments */ |
| 109 | %define %formacro_2(macro,...) |
| 110 | %_formacro_2(macro, __VA_ARGS__, __fordone__) |
| 111 | %enddef |
| 112 | |
| 113 | |
| 114 | /* |
| 115 | mark a flag, ie, define a macro name but ignore it in |
| 116 | the interface. |
| 117 | |
| 118 | the flags latter can be used with %evalif |
| 119 | */ |
| 120 | |
| 121 | %define %swig_mark_flag(x) |
| 122 | %ignore x; |
| 123 | #define x 1 |
| 124 | %enddef |
| 125 | |
| 126 | /* |
| 127 | %swig_equal_type and %swig_order_type flagged a type of having equal (==,!=) |
| 128 | and/or order methods (<=,>=,<,>). |
| 129 | */ |
| 130 | #define %swig_equal_type(...) %swig_mark_flag(SWIG_EqualType(__VA_ARGS__)) |
| 131 | #define %swig_order_type(...) \ |
| 132 | %swig_mark_flag(SWIG_EqualType(__VA_ARGS__)) \ |
| 133 | %swig_mark_flag(SWIG_OrderType(__VA_ARGS__)) |
| 134 | |
| 135 | /* |
| 136 | %evalif and %evalif_2 are use to evaluate or process |
| 137 | an expression if the given predicate is 'true' (1). |
| 138 | */ |
| 139 | %define %_evalif(_x,_expr) |
| 140 | #if _x == 1 |
| 141 | _expr |
| 142 | #endif |
| 143 | %enddef |
| 144 | |
| 145 | %define %_evalif_2(_x,_y,_expr) |
| 146 | #if _x == 1 && _y == 1 |
| 147 | _expr |
| 148 | #endif |
| 149 | %enddef |
| 150 | |
| 151 | %define %evalif(_x,...) |
| 152 | %_evalif(SWIG_arg(_x),SWIG_arg(__VA_ARGS__)) |
| 153 | %enddef |
| 154 | |
| 155 | %define %evalif_2(_x,_y,...) |
| 156 | %_evalif_2(SWIG_arg(_x),SWIG_arg(_y),SWIG_arg(__VA_ARGS__)) |
| 157 | %enddef |
| 158 | |
| 159 | |