📄 xdelta3_wrap.c
字号:
{ // alloc_size input is #7th position in xd3_xxcode_memory() arg5 = malloc(alloc_size7); arg6 = &alloc_size7; } result = (int)xd3_decode_memory((char const *)arg1,arg2,(char const *)arg3,arg4,arg5,arg6,arg7,arg8); { resultobj = SWIG_From_int((int)(result)); } { if (result == 0) { PyObject *o; // alloc_size7 now carries actual size o = PyString_FromStringAndSize(arg5,alloc_size7); resultobj = t_output_helper(resultobj,o); } else { resultobj = t_output_helper(resultobj,Py_None); } free(arg5); } return resultobj; fail: return NULL;}static PyObject *_wrap_xd3_main_cmdline(PyObject *self, PyObject *args) { PyObject *resultobj = NULL; int arg1 ; char **arg2 = (char **) 0 ; int result; int owner1 ; PyObject * obj0 = 0 ; if(!PyArg_ParseTuple(args,(char *)"O:xd3_main_cmdline",&obj0)) goto fail; { size_t argc = 0; char **argv = SWIG_AsArgcArgv(obj0, SWIGTYPE_p_p_char, &argc, &owner1); if (PyErr_Occurred()) { arg1 = 0; arg2 = 0; if (SWIG_arg_fail(1)) SWIG_fail; } else { arg1 = (int) argc; arg2 = (char **) argv; } } result = (int)xd3_main_cmdline(arg1,arg2); { resultobj = SWIG_From_int((int)(result)); } { if (owner1) free((char*)arg2); } return resultobj; fail: { if (owner1) free((char*)arg2); } return NULL;}static PyMethodDef SwigMethods[] = { { (char *)"xd3_encode_memory", _wrap_xd3_encode_memory, METH_VARARGS, NULL}, { (char *)"xd3_decode_memory", _wrap_xd3_decode_memory, METH_VARARGS, NULL}, { (char *)"xd3_main_cmdline", _wrap_xd3_main_cmdline, METH_VARARGS, NULL}, { NULL, NULL, 0, NULL }};/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, 0};static swig_type_info _swigt__p_p_char = {"_p_p_char", "char **", 0, 0, 0};static swig_type_info _swigt__p_unsigned_int = {"_p_unsigned_int", "unsigned int *", 0, 0, 0};static swig_type_info _swigt__ptrdiff_t = {"_ptrdiff_t", "ptrdiff_t", 0, 0, 0};static swig_type_info _swigt__size_t = {"_size_t", "size_t", 0, 0, 0};static swig_type_info *swig_type_initial[] = { &_swigt__p_char, &_swigt__p_p_char, &_swigt__p_unsigned_int, &_swigt__ptrdiff_t, &_swigt__size_t,};static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};static swig_cast_info _swigc__p_p_char[] = { {&_swigt__p_p_char, 0, 0, 0},{0, 0, 0, 0}};static swig_cast_info _swigc__p_unsigned_int[] = { {&_swigt__p_unsigned_int, 0, 0, 0},{0, 0, 0, 0}};static swig_cast_info _swigc__ptrdiff_t[] = { {&_swigt__ptrdiff_t, 0, 0, 0},{0, 0, 0, 0}};static swig_cast_info _swigc__size_t[] = { {&_swigt__size_t, 0, 0, 0},{0, 0, 0, 0}};static swig_cast_info *swig_cast_initial[] = { _swigc__p_char, _swigc__p_p_char, _swigc__p_unsigned_int, _swigc__ptrdiff_t, _swigc__size_t,};/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */static swig_const_info swig_const_table[] = {{0, 0, 0, 0.0, 0, 0}};#ifdef __cplusplus}#endif/************************************************************************* * Type initialization: * This problem is tough by the requirement that no dynamic * memory is used. Also, since swig_type_info structures store pointers to * swig_cast_info structures and swig_cast_info structures store pointers back * to swig_type_info structures, we need some lookup code at initialization. * The idea is that swig generates all the structures that are needed. * The runtime then collects these partially filled structures. * The SWIG_InitializeModule function takes these initial arrays out of * swig_module, and does all the lookup, filling in the swig_module.types * array with the correct data and linking the correct swig_cast_info * structures together. * The generated swig_type_info structures are assigned staticly to an initial * array. We just loop though that array, and handle each type individually. * First we lookup if this type has been already loaded, and if so, use the * loaded structure instead of the generated one. Then we have to fill in the * cast linked list. The cast data is initially stored in something like a * two-dimensional array. Each row corresponds to a type (there are the same * number of rows as there are in the swig_type_initial array). Each entry in * a column is one of the swig_cast_info structures for that type. * The cast_initial array is actually an array of arrays, because each row has * a variable number of columns. So to actually build the cast linked list, * we find the array of casts associated with the type, and loop through it * adding the casts to the list. The one last trick we need to do is making * sure the type pointer in the swig_cast_info struct is correct. * First off, we lookup the cast->type name to see if it is already loaded. * There are three cases to handle: * 1) If the cast->type has already been loaded AND the type we are adding * casting info to has not been loaded (it is in this module), THEN we * replace the cast->type pointer with the type pointer that has already * been loaded. * 2) If BOTH types (the one we are adding casting info to, and the * cast->type) are loaded, THEN the cast info has already been loaded by * the previous module so we just ignore it. * 3) Finally, if cast->type has not already been loaded, then we add that * swig_cast_info to the linked list (because the cast->type) pointer will * be correct.**/#ifdef __cplusplusextern "C" {#endif SWIGRUNTIME void SWIG_InitializeModule(void *clientdata) { swig_type_info *type, *ret; swig_cast_info *cast; size_t i; swig_module_info *module_head; static int init_run = 0; clientdata = clientdata; if (init_run) return; init_run = 1; /* Initialize the swig_module */ swig_module.type_initial = swig_type_initial; swig_module.cast_initial = swig_cast_initial; /* Try and load any already created modules */ module_head = SWIG_GetModule(clientdata); if (module_head) { swig_module.next = module_head->next; module_head->next = &swig_module; } else { /* This is the first module loaded */ swig_module.next = &swig_module; SWIG_SetModule(clientdata, &swig_module); } /* Now work on filling in swig_module.types */ for (i = 0; i < swig_module.size; ++i) { type = 0; /* if there is another module already loaded */ if (swig_module.next != &swig_module) { type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name); } if (type) { /* Overwrite clientdata field */ if (swig_module.type_initial[i]->clientdata) type->clientdata = swig_module.type_initial[i]->clientdata; } else { type = swig_module.type_initial[i]; } /* Insert casting types */ cast = swig_module.cast_initial[i]; while (cast->type) { /* Don't need to add information already in the list */ ret = 0; if (swig_module.next != &swig_module) { ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); } if (ret && type == swig_module.type_initial[i]) { cast->type = ret; ret = 0; } if (!ret) { if (type->cast) { type->cast->prev = cast; cast->next = type->cast; } type->cast = cast; } cast++; } /* Set entry in modules->types array equal to the type */ swig_module.types[i] = type; } } /* This function will propagate the clientdata field of type to * any new swig_type_info structures that have been added into the list * of equivalent types. It is like calling * SWIG_TypeClientData(type, clientdata) a second time. */ SWIGRUNTIME void SWIG_PropagateClientData(void) { size_t i; swig_cast_info *equiv; static int init_run = 0; if (init_run) return; init_run = 1; for (i = 0; i < swig_module.size; i++) { if (swig_module.types[i]->clientdata) { equiv = swig_module.types[i]->cast; while (equiv) { if (!equiv->converter) { if (equiv->type && !equiv->type->clientdata) SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); } equiv = equiv->next; } } } } #ifdef __cplusplus}#endif#ifdef __cplusplusextern "C" {#endif /* Python-specific SWIG API */#define SWIG_newvarlink() SWIG_Python_newvarlink()#define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr)#define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants) /* ----------------------------------------------------------------------------- * global variable support code. * ----------------------------------------------------------------------------- */ typedef struct swig_globalvar { char *name; /* Name of global variable */ PyObject *(*get_attr)(void); /* Return the current value */ int (*set_attr)(PyObject *); /* Set the value */ struct swig_globalvar *next; } swig_globalvar; typedef struct swig_varlinkobject { PyObject_HEAD swig_globalvar *vars; } swig_varlinkobject; SWIGINTERN PyObject * swig_varlink_repr(swig_varlinkobject *v) { v = v; return PyString_FromString("<Swig global variables>"); } SWIGINTERN int swig_varlink_print(swig_varlinkobject *v, FILE *fp, int flags) { swig_globalvar *var; flags = flags; fprintf(fp,"Swig global variables { "); for (var = v->vars; var; var=var->next) { fprintf(fp,"%s", var->name); if (var->next) fprintf(fp,", "); } fprintf(fp," }\n"); return 0; } SWIGINTERN PyObject * swig_varlink_getattr(swig_varlinkobject *v, char *n) { swig_globalvar *var = v->vars; while (var) { if (strcmp(var->name,n) == 0) { return (*var->get_attr)(); } var = var->next; } PyErr_SetString(PyExc_NameError,"Unknown C global variable"); return NULL; } SWIGINTERN int swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) { swig_globalvar *var = v->vars; while (var) { if (strcmp(var->name,n) == 0) { return (*var->set_attr)(p); } var = var->next; } PyErr_SetString(PyExc_NameError,"Unknown C global variable"); return 1; } SWIGINTERN PyTypeObject* swig_varlink_type(void) { static char varlink__doc__[] = "Swig var link object"; static PyTypeObject varlink_type#if !defined(__cplusplus) ; static int type_init = 0; if (!type_init) { PyTypeObject tmp#endif = { PyObject_HEAD_INIT(&PyType_Type) 0, /* Number of items in variable part (ob_size) */ (char *)"swigvarlink", /* Type name (tp_name) */ sizeof(swig_varlinkobject), /* Basic size (tp_basicsize) */ 0, /* Itemsize (tp_itemsize) */ 0, /* Deallocator (tp_dealloc) */ (printfunc) swig_varlink_print, /* Print (tp_print) */ (getattrfunc) swig_varlink_getattr, /* get attr (tp_getattr) */ (setattrfunc) swig_varlink_setattr, /* Set attr (tp_setattr) */ 0, /* tp_compare */ (reprfunc) swig_varlink_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ 0, /* tp_flags */ varlink__doc__, /* tp_doc */#if PY_VERSION_HEX >= 0x02000000 0, /* tp_traverse */ 0, /* tp_clear */#endif#if PY_VERSION_HEX >= 0x02010000 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */#endif#if PY_VERSION_HEX >= 0x02020000 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */#endif#if PY_VERSION_HEX >= 0x02030000 0, /* tp_del */#endif#ifdef COUNT_ALLOCS 0,0,0,0 /* tp_alloc -> tp_next */#endif };#if !defined(__cplusplus) varlink_type = tmp; type_init = 1; }#endif return &varlink_type; } /* Create a variable linking object for use later */ SWIGINTERN PyObject * SWIG_Python_newvarlink(void) { swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type()); if (result) { result->vars = 0; } return ((PyObject*) result); } SWIGINTERN void SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) { swig_varlinkobject *v = (swig_varlinkobject *) p; swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar)); if (gv) { size_t size = strlen(name)+1; gv->name = (char *)malloc(size); if (gv->name) { strncpy(gv->name,name,size); gv->get_attr = get_attr; gv->set_attr = set_attr; gv->next = v->vars; } } v->vars = gv; } /* ----------------------------------------------------------------------------- * constants/methods manipulation * ----------------------------------------------------------------------------- */ /* Install Constants */ SWIGINTERN void SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) { PyObject *obj = 0; size_t i; for (i = 0; constants[i].type; ++i) { switch(constants[i].type) { case SWIG_PY_INT: obj = PyInt_FromLong(constants[i].lvalue); break; case SWIG_PY_FLOAT: obj = PyFloat_FromDouble(constants[i].dvalue); break; case SWIG_PY_STRING: if (constants[i].pvalue) { obj = PyString_FromString((char *) constants[i].pvalue); } else { Py_INCREF(Py_None); obj = Py_None; } break; case SWIG_PY_POINTER: obj = SWIG_NewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0); break; case SWIG_PY_BINARY: obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype)); break;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -