⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 svmc_wrap.c

📁 支持向量机的c++和java语言实现
💻 C
📖 第 1 页 / 共 5 页
字号:
    pyswigpacked_type.ob_type = &PyType_Type;    type_init = 1;  }  return &pyswigpacked_type;}SWIGRUNTIME PyObject *PySwigPacked_New(void *ptr, size_t size, swig_type_info *ty){  PySwigPacked *sobj = PyObject_NEW(PySwigPacked, PySwigPacked_type());  if (sobj) {    void *pack = malloc(size);    if (pack) {      memcpy(pack, ptr, size);      sobj->pack = pack;      sobj->ty   = ty;      sobj->size = size;    } else {      PyObject_DEL((PyObject *) sobj);      sobj = 0;    }  }  return (PyObject *) sobj;}SWIGRUNTIME swig_type_info *PySwigPacked_UnpackData(PyObject *obj, void *ptr, size_t size){  if (PySwigPacked_Check(obj)) {    PySwigPacked *sobj = (PySwigPacked *)obj;    if (sobj->size != size) return 0;    memcpy(ptr, sobj->pack, size);    return sobj->ty;  } else {    return 0;  }}/* ----------------------------------------------------------------------------- * pointers/data manipulation * ----------------------------------------------------------------------------- */SWIGRUNTIMEINLINE PyObject *_SWIG_This(void){  return PyString_FromString("this");}SWIGRUNTIME PyObject *SWIG_This(void){  static PyObject *SWIG_STATIC_POINTER(swig_this) = _SWIG_This();  return swig_this;}/* #define SWIG_PYTHON_SLOW_GETSET_THIS */SWIGRUNTIME PySwigObject *SWIG_Python_GetSwigThis(PyObject *pyobj) {  if (PySwigObject_Check(pyobj)) {    return (PySwigObject *) pyobj;  } else {    PyObject *obj = 0;#if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000))    if (PyInstance_Check(pyobj)) {      obj = _PyInstance_Lookup(pyobj, SWIG_This());          } else {      PyObject **dictptr = _PyObject_GetDictPtr(pyobj);      if (dictptr != NULL) {	PyObject *dict = *dictptr;	obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0;      } else {#ifdef PyWeakref_CheckProxy	if (PyWeakref_CheckProxy(pyobj)) {	  PyObject *wobj = PyWeakref_GET_OBJECT(pyobj);	  return wobj ? SWIG_Python_GetSwigThis(wobj) : 0;	}#endif	obj = PyObject_GetAttr(pyobj,SWIG_This());	if (obj) {	  Py_DECREF(obj);	} else {	  if (PyErr_Occurred()) PyErr_Clear();	  return 0;	}      }    }#else    obj = PyObject_GetAttr(pyobj,SWIG_This());    if (obj) {      Py_DECREF(obj);    } else {      if (PyErr_Occurred()) PyErr_Clear();      return 0;    }#endif    if (obj && !PySwigObject_Check(obj)) {      /* a PyObject is called 'this', try to get the 'real this'	 PySwigObject from it */       return SWIG_Python_GetSwigThis(obj);    }    return (PySwigObject *)obj;  }}/* Acquire a pointer value */SWIGRUNTIME intSWIG_Python_AcquirePtr(PyObject *obj, int own) {  if (own) {    PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);    if (sobj) {      int oldown = sobj->own;      sobj->own = own;      return oldown;    }  }  return 0;}/* Convert a pointer value */SWIGRUNTIME intSWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) {  if (!obj) return SWIG_ERROR;  if (obj == Py_None) {    if (ptr) *ptr = 0;    return SWIG_OK;  } else {    PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);    while (sobj) {      void *vptr = sobj->ptr;      if (ty) {	swig_type_info *to = sobj->ty;	if (to == ty) {	  /* no type cast needed */	  if (ptr) *ptr = vptr;	  break;	} else {	  swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);	  if (!tc) {	    sobj = (PySwigObject *)sobj->next;	  } else {	    if (ptr) *ptr = SWIG_TypeCast(tc,vptr);	    break;	  }	}      } else {	if (ptr) *ptr = vptr;	break;      }    }    if (sobj) {      if (own) *own = sobj->own;      if (flags & SWIG_POINTER_DISOWN) {	sobj->own = 0;      }      return SWIG_OK;    } else {      int res = SWIG_ERROR;      if (flags & SWIG_POINTER_IMPLICIT_CONV) {	PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;	if (data && !data->implicitconv) {	  PyObject *klass = data->klass;	  if (klass) {	    PyObject *impconv;	    data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/	    impconv = SWIG_Python_CallFunctor(klass, obj);	    data->implicitconv = 0;	    if (PyErr_Occurred()) {	      PyErr_Clear();	      impconv = 0;	    }	    if (impconv) {	      PySwigObject *iobj = SWIG_Python_GetSwigThis(impconv);	      if (iobj) {		void *vptr;		res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0);		if (SWIG_IsOK(res)) {		  if (ptr) {		    *ptr = vptr;		    /* transfer the ownership to 'ptr' */		    iobj->own = 0;		    res = SWIG_AddCast(res);		    res = SWIG_AddNewMask(res);		  } else {		    res = SWIG_AddCast(res);		    		  }		}	      }	      Py_DECREF(impconv);	    }	  }	}      }      return res;    }  }}/* Convert a function ptr value */SWIGRUNTIME intSWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) {  if (!PyCFunction_Check(obj)) {    return SWIG_ConvertPtr(obj, ptr, ty, 0);  } else {    void *vptr = 0;        /* here we get the method pointer for callbacks */    const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);    const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0;    if (desc) {      desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0;      if (!desc) return SWIG_ERROR;    }    if (ty) {      swig_cast_info *tc = SWIG_TypeCheck(desc,ty);      if (!tc) return SWIG_ERROR;      *ptr = SWIG_TypeCast(tc,vptr);    } else {      *ptr = vptr;    }    return SWIG_OK;  }}/* Convert a packed value value */SWIGRUNTIME intSWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) {  swig_type_info *to = PySwigPacked_UnpackData(obj, ptr, sz);  if (!to) return SWIG_ERROR;  if (ty) {    if (to != ty) {      /* check type cast? */      swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);      if (!tc) return SWIG_ERROR;    }  }  return SWIG_OK;}  /* ----------------------------------------------------------------------------- * Create a new pointer object * ----------------------------------------------------------------------------- *//*  Create a new instance object, whitout calling __init__, and set the  'this' attribute.*/SWIGRUNTIME PyObject* SWIG_Python_NewShadowInstance(PySwigClientData *data, PyObject *swig_this){#if (PY_VERSION_HEX >= 0x02020000)  PyObject *inst = 0;  PyObject *newraw = data->newraw;  if (newraw) {    inst = PyObject_Call(newraw, data->newargs, NULL);    if (inst) {#if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)      PyObject **dictptr = _PyObject_GetDictPtr(inst);      if (dictptr != NULL) {	PyObject *dict = *dictptr;	if (dict == NULL) {	  dict = PyDict_New();	  *dictptr = dict;	  PyDict_SetItem(dict, SWIG_This(), swig_this);	}      }#else      PyObject *key = SWIG_This();      PyObject_SetAttr(inst, key, swig_this);#endif    }  } else {    PyObject *dict = PyDict_New();    PyDict_SetItem(dict, SWIG_This(), swig_this);    inst = PyInstance_NewRaw(data->newargs, dict);    Py_DECREF(dict);  }  return inst;#else#if (PY_VERSION_HEX >= 0x02010000)  PyObject *inst;  PyObject *dict = PyDict_New();  PyDict_SetItem(dict, SWIG_This(), swig_this);  inst = PyInstance_NewRaw(data->newargs, dict);  Py_DECREF(dict);  return (PyObject *) inst;#else  PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type);  if (inst == NULL) {    return NULL;  }  inst->in_class = (PyClassObject *)data->newargs;  Py_INCREF(inst->in_class);  inst->in_dict = PyDict_New();  if (inst->in_dict == NULL) {    Py_DECREF(inst);    return NULL;  }#ifdef Py_TPFLAGS_HAVE_WEAKREFS  inst->in_weakreflist = NULL;#endif#ifdef Py_TPFLAGS_GC  PyObject_GC_Init(inst);#endif  PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this);  return (PyObject *) inst;#endif#endif}SWIGRUNTIME voidSWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this){ PyObject *dict;#if (PY_VERSION_HEX >= 0x02020000) && !defined(SWIG_PYTHON_SLOW_GETSET_THIS) PyObject **dictptr = _PyObject_GetDictPtr(inst); if (dictptr != NULL) {   dict = *dictptr;   if (dict == NULL) {     dict = PyDict_New();     *dictptr = dict;   }   PyDict_SetItem(dict, SWIG_This(), swig_this);   return; }#endif dict = PyObject_GetAttrString(inst, (char*)"__dict__"); PyDict_SetItem(dict, SWIG_This(), swig_this); Py_DECREF(dict);} SWIGINTERN PyObject *SWIG_Python_InitShadowInstance(PyObject *args) {  PyObject *obj[2];  if (!SWIG_Python_UnpackTuple(args,(char*)"swiginit", 2, 2, obj)) {    return NULL;  } else {    PySwigObject *sthis = SWIG_Python_GetSwigThis(obj[0]);    if (sthis) {      PySwigObject_append((PyObject*) sthis, obj[1]);    } else {      SWIG_Python_SetSwigThis(obj[0], obj[1]);    }    return SWIG_Py_Void();  }}/* Create a new pointer object */SWIGRUNTIME PyObject *SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int flags) {  if (!ptr) {    return SWIG_Py_Void();  } else {    int own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0;    PyObject *robj = PySwigObject_New(ptr, type, own);    PySwigClientData *clientdata = type ? (PySwigClientData *)(type->clientdata) : 0;    if (clientdata && !(flags & SWIG_POINTER_NOSHADOW)) {      PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj);      if (inst) {	Py_DECREF(robj);	robj = inst;      }    }    return robj;  }}/* Create a new packed object */SWIGRUNTIMEINLINE PyObject *SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) {  return ptr ? PySwigPacked_New((void *) ptr, sz, type) : SWIG_Py_Void();}/* -----------------------------------------------------------------------------* *  Get type list  * -----------------------------------------------------------------------------*/#ifdef SWIG_LINK_RUNTIMEvoid *SWIG_ReturnGlobalTypeList(void *);#endifSWIGRUNTIME swig_module_info *SWIG_Python_GetModule(void) {  static void *type_pointer = (void *)0;  /* first check if module already created */  if (!type_pointer) {#ifdef SWIG_LINK_RUNTIME    type_pointer = SWIG_ReturnGlobalTypeList((void *)0);#else    type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,				    (char*)"type_pointer" SWIG_TYPE_TABLE_NAME);    if (PyErr_Occurred()) {      PyErr_Clear();      type_pointer = (void *)0;    }#endif  }  return (swig_module_info *) type_pointer;}#if PY_MAJOR_VERSION < 2/* PyModule_AddObject function was introduced in Python 2.0.  The following function   is copied out of Python/modsupport.c in python version 2.3.4 */SWIGINTERN intPyModule_AddObject(PyObject *m, char *name, PyObject *o){  PyObject *dict;  if (!PyModule_Check(m)) {    PyErr_SetString(PyExc_TypeError,		    "PyModule_AddObject() needs module as first arg");    return SWIG_ERROR;  }  if (!o) {    PyErr_SetString(PyExc_TypeError,		    "PyModule_AddObject() needs non-NULL value");    return SWIG_ERROR;  }    dict = PyModule_GetDict(m);  if (dict == NULL) {    /* Internal error -- modules must have a dict! */    PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__",		 PyModule_GetName(m));    return SWIG_ERROR;  }  if (PyDict_SetItemString(dict, name, o))    return SWIG_ERROR;  Py_DECREF(o);  return SWIG_OK;}#endifSWIGRUNTIME voidSWIG_Python_DestroyModule(void *vptr){  swig_module_info *swig_module = (swig_module_info *) vptr;  swig_type_info **types = swig_module->types;  size_t i;  for (i =0; i < swig_module->size; ++i) {    swig_type_info *ty = types[i];    if (ty->owndata) {      PySwigClientData *data = (PySwigClientData *) ty->clientdata;      if (data) PySwigClientData_Del(data);    }  

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -