/tags/rel-1-3-29/SWIG/Lib/python/pybackward.swg
Unknown | 45 lines | 38 code | 7 blank | 0 comment | 0 complexity | da9842bffe94827d0f6157eea6d6a6d9 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
1/* 2 adding backward compatibility macros 3*/ 4 5#define SWIG_arg(x...) %arg(x) 6#define SWIG_Mangle(x...) %mangle(x) 7 8#define SWIG_As_frag(Type...) %fragment_name(As, Type) 9#define SWIG_As_name(Type...) %symbol_name(As, Type) 10#define SWIG_As(Type...) SWIG_As_name(Type) SWIG_AS_CALL_ARGS 11 12#define SWIG_Check_frag(Type...) %fragment_name(Check, Type) 13#define SWIG_Check_name(Type...) %symbol_name(Check, Type) 14#define SWIG_Check(Type...) SWIG_Check_name(Type) SWIG_AS_CALL_ARGS 15 16%define %ascheck_methods(Code, Type...) 17%fragment(SWIG_As_frag(Type),"header", fragment=SWIG_AsVal_frag(Type)) { 18SWIGINTERNINLINE Type 19SWIG_As(Type)(PyObject* obj) 20{ 21 Type v; 22 int res = SWIG_AsVal(Type)(obj, &v); 23 if (!SWIG_IsOK(res)) { 24 /* 25 this is needed to make valgrind/purify happier. 26 */ 27 memset((void*)&v, 0, sizeof(Type)); 28 SWIG_Error(res, ""); 29 } 30 return v; 31} 32} 33 34%fragment(SWIG_Check_frag(Type),"header",fragment=SWIG_AsVal_frag(Type)) { 35SWIGINTERNINLINE int 36SWIG_Check(Type)(PyObject* obj) 37{ 38 int res = SWIG_AsVal(Type)(obj, (Type*)0); 39 return SWIG_IsOK(res); 40} 41} 42%enddef 43 44%apply_checkctypes(%ascheck_methods) 45