1 /* ----------------------------------------------------------------------------- 2 * pikerun.swg 3 * 4 * This file contains the runtime support for Pike modules 5 * and includes code for managing global variables and pointer 6 * type checking. 7 * ----------------------------------------------------------------------------- */ 8 9 #ifdef __cplusplus 10 extern "C" { 11 #endif 12 #include "pike/object.h" 13 #include "pike/program.h" 14 #ifdef __cplusplus 15 } 16 #endif 17 #include <assert.h> 18 19 /* Stores information about a wrapped object */ 20 typedef struct swig_object_wrapper { 21 void *self; 22 swig_type_info *type; 23 } swig_object_wrapper; 24 25 #ifdef THIS 26 #undef THIS 27 #endif 28 #define THIS (((swig_object_wrapper *) Pike_fp->current_storage)->self) 29 30 #define SWIG_ConvertPtr SWIG_Pike_ConvertPtr 31 #define SWIG_NewPointerObj SWIG_Pike_NewPointerObj 32 #define SWIG_GetModule(clientdata) SWIG_Pike_GetModule(clientdata) 33 #define SWIG_SetModule(clientdata, pointer) SWIG_Pike_SetModule(pointer) 34 35 /* These need to be filled in before type sharing between modules will work */ 36 static swig_module_info *SWIG_Pike_GetModule(void *SWIGUNUSEDPARM(clientdata)) { 37 return 0; 38 } 39 40 static void SWIG_Pike_SetModule(swig_module_info *pointer) { 41 42 } 43 44 /* Convert a pointer value */ 45 static int 46 SWIG_Pike_ConvertPtr(struct object *obj, void **ptr, swig_type_info *ty, int flags) { 47 struct program *pr; 48 swig_cast_info *tc; 49 swig_object_wrapper *obj_wrapper; 50 51 if (ty) { 52 pr = (struct program *) ty->clientdata; 53 obj_wrapper = (swig_object_wrapper *) get_storage(obj, pr); 54 if (obj_wrapper && obj_wrapper->type) { 55 tc = SWIG_TypeCheckStruct(obj_wrapper->type, ty); 56 if (tc) { 57 int newmemory = 0; 58 *ptr = SWIG_TypeCast(tc, obj_wrapper->self, &newmemory); 59 assert(!newmemory); /* newmemory handling not yet implemented */ 60 return 0; 61 } 62 } 63 } 64 return -1; 65 } 66 67 /* Create a new pointer object */ 68 static struct object * 69 SWIG_Pike_NewPointerObj(void *ptr, swig_type_info *type, int own) { 70 return 0; 71 } 72