Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: swig/Lib/python/pyrun.swg

Issue 553095: Checkin swig binaries for win, linux and Mac... (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/
Patch Set: '' Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « swig/Lib/python/pyprimtypes.swg ('k') | swig/Lib/python/pyruntime.swg » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /* -----------------------------------------------------------------------------
2 * See the LICENSE file for information on copyright, usage and redistribution
3 * of SWIG, and the README file for authors - http://www.swig.org/release.html.
4 *
5 * pyrun.swg
6 *
7 * This file contains the runtime support for Python modules
8 * and includes code for managing global variables and pointer
9 * type checking.
10 *
11 * ----------------------------------------------------------------------------- */
12
13 /* Common SWIG API */
14
15 /* for raw pointers */
16 #define SWIG_Python_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtrAn dOwn(obj, pptr, type, flags, 0)
17 #define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(o bj, pptr, type, flags)
18 #define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAn dOwn(obj, pptr, type, flags, own)
19 #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerOb j(ptr, type, flags)
20 #define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplici t(ty)
21 #define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(p tr, src)
22 #define swig_owntype int
23
24 /* for raw packed data */
25 #define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Python_ConvertPacke d(obj, ptr, sz, ty)
26 #define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj (ptr, sz, type)
27
28 /* for class or struct pointers */
29 #define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, ppt r, type, flags)
30 #define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags)
31
32 /* for C or C++ function pointers */
33 #define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_Python_ConvertFunct ionPtr(obj, pptr, type)
34 #define SWIG_NewFunctionPtrObj(ptr, type) SWIG_Python_NewPointerOb j(ptr, type, 0)
35
36 /* for C++ member pointers, ie, member methods */
37 #define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Python_ConvertPacke d(obj, ptr, sz, ty)
38 #define SWIG_NewMemberObj(ptr, sz, type) SWIG_Python_NewPackedObj (ptr, sz, type)
39
40
41 /* Runtime API */
42
43 #define SWIG_GetModule(clientdata) SWIG_Python_GetModule()
44 #define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(po inter)
45 #define SWIG_NewClientData(obj) SwigPyClientData_New(obj )
46
47 #define SWIG_SetErrorObj SWIG_Python_SetErrorObj
48 #define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg
49 #define SWIG_ErrorType(code) SWIG_Python_ErrorType(co de)
50 #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg( SWIG_ErrorType(code), msg)
51 #define SWIG_fail goto fail
52
53
54 /* Runtime API implementation */
55
56 /* Error manipulation */
57
58 SWIGINTERN void
59 SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) {
60 SWIG_PYTHON_THREAD_BEGIN_BLOCK;
61 PyErr_SetObject(errtype, obj);
62 Py_DECREF(obj);
63 SWIG_PYTHON_THREAD_END_BLOCK;
64 }
65
66 SWIGINTERN void
67 SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) {
68 SWIG_PYTHON_THREAD_BEGIN_BLOCK;
69 PyErr_SetString(errtype, (char *) msg);
70 SWIG_PYTHON_THREAD_END_BLOCK;
71 }
72
73 #define SWIG_Python_Raise(obj, type, desc) SWIG_Python_SetErrorObj(SWIG_Python_ ExceptionType(desc), obj)
74
75 /* Set a constant value */
76
77 SWIGINTERN void
78 SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) {
79 PyDict_SetItemString(d, (char*) name, obj);
80 Py_DECREF(obj);
81 }
82
83 /* Append a value to the result obj */
84
85 SWIGINTERN PyObject*
86 SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) {
87 #if !defined(SWIG_PYTHON_OUTPUT_TUPLE)
88 if (!result) {
89 result = obj;
90 } else if (result == Py_None) {
91 Py_DECREF(result);
92 result = obj;
93 } else {
94 if (!PyList_Check(result)) {
95 PyObject *o2 = result;
96 result = PyList_New(1);
97 PyList_SetItem(result, 0, o2);
98 }
99 PyList_Append(result,obj);
100 Py_DECREF(obj);
101 }
102 return result;
103 #else
104 PyObject* o2;
105 PyObject* o3;
106 if (!result) {
107 result = obj;
108 } else if (result == Py_None) {
109 Py_DECREF(result);
110 result = obj;
111 } else {
112 if (!PyTuple_Check(result)) {
113 o2 = result;
114 result = PyTuple_New(1);
115 PyTuple_SET_ITEM(result, 0, o2);
116 }
117 o3 = PyTuple_New(1);
118 PyTuple_SET_ITEM(o3, 0, obj);
119 o2 = result;
120 result = PySequence_Concat(o2, o3);
121 Py_DECREF(o2);
122 Py_DECREF(o3);
123 }
124 return result;
125 #endif
126 }
127
128 /* Unpack the argument tuple */
129
130 SWIGINTERN int
131 SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssi ze_t max, PyObject **objs)
132 {
133 if (!args) {
134 if (!min && !max) {
135 return 1;
136 } else {
137 PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none",
138 name, (min == max ? "" : "at least "), (int)min);
139 return 0;
140 }
141 }
142 if (!PyTuple_Check(args)) {
143 PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tup le");
144 return 0;
145 } else {
146 register Py_ssize_t l = PyTuple_GET_SIZE(args);
147 if (l < min) {
148 PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d",
149 name, (min == max ? "" : "at least "), (int)min, (int)l);
150 return 0;
151 } else if (l > max) {
152 PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d",
153 name, (min == max ? "" : "at most "), (int)max, (int)l);
154 return 0;
155 } else {
156 register int i;
157 for (i = 0; i < l; ++i) {
158 objs[i] = PyTuple_GET_ITEM(args, i);
159 }
160 for (; l < max; ++l) {
161 objs[l] = 0;
162 }
163 return i + 1;
164 }
165 }
166 }
167
168 /* A functor is a function object with one single object argument */
169 #if PY_VERSION_HEX >= 0x02020000
170 #define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObj Args(functor, obj, NULL);
171 #else
172 #define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunction(fu nctor, "O", obj);
173 #endif
174
175 /*
176 Helper for static pointer initialization for both C and C++ code, for example
177 static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...);
178 */
179 #ifdef __cplusplus
180 #define SWIG_STATIC_POINTER(var) var
181 #else
182 #define SWIG_STATIC_POINTER(var) var = 0; if (!var) var
183 #endif
184
185 /* -----------------------------------------------------------------------------
186 * Pointer declarations
187 * ----------------------------------------------------------------------------- */
188
189 /* Flags for new pointer objects */
190 #define SWIG_POINTER_NOSHADOW (SWIG_POINTER_OWN << 1)
191 #define SWIG_POINTER_NEW (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN)
192
193 #define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1)
194
195 #ifdef __cplusplus
196 extern "C" {
197 #if 0
198 } /* cc-mode */
199 #endif
200 #endif
201
202 /* How to access Py_None */
203 #if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
204 # ifndef SWIG_PYTHON_NO_BUILD_NONE
205 # ifndef SWIG_PYTHON_BUILD_NONE
206 # define SWIG_PYTHON_BUILD_NONE
207 # endif
208 # endif
209 #endif
210
211 #ifdef SWIG_PYTHON_BUILD_NONE
212 # ifdef Py_None
213 # undef Py_None
214 # define Py_None SWIG_Py_None()
215 # endif
216 SWIGRUNTIMEINLINE PyObject *
217 _SWIG_Py_None(void)
218 {
219 PyObject *none = Py_BuildValue((char*)"");
220 Py_DECREF(none);
221 return none;
222 }
223 SWIGRUNTIME PyObject *
224 SWIG_Py_None(void)
225 {
226 static PyObject *SWIG_STATIC_POINTER(none) = _SWIG_Py_None();
227 return none;
228 }
229 #endif
230
231 /* The python void return value */
232
233 SWIGRUNTIMEINLINE PyObject *
234 SWIG_Py_Void(void)
235 {
236 PyObject *none = Py_None;
237 Py_INCREF(none);
238 return none;
239 }
240
241 /* SwigPyClientData */
242
243 typedef struct {
244 PyObject *klass;
245 PyObject *newraw;
246 PyObject *newargs;
247 PyObject *destroy;
248 int delargs;
249 int implicitconv;
250 } SwigPyClientData;
251
252 SWIGRUNTIMEINLINE int
253 SWIG_Python_CheckImplicit(swig_type_info *ty)
254 {
255 SwigPyClientData *data = (SwigPyClientData *)ty->clientdata;
256 return data ? data->implicitconv : 0;
257 }
258
259 SWIGRUNTIMEINLINE PyObject *
260 SWIG_Python_ExceptionType(swig_type_info *desc) {
261 SwigPyClientData *data = desc ? (SwigPyClientData *) desc->clientdata : 0;
262 PyObject *klass = data ? data->klass : 0;
263 return (klass ? klass : PyExc_RuntimeError);
264 }
265
266
267 SWIGRUNTIME SwigPyClientData *
268 SwigPyClientData_New(PyObject* obj)
269 {
270 if (!obj) {
271 return 0;
272 } else {
273 SwigPyClientData *data = (SwigPyClientData *)malloc(sizeof(SwigPyClientData) );
274 /* the klass element */
275 data->klass = obj;
276 Py_INCREF(data->klass);
277 /* the newraw method and newargs arguments used to create a new raw instance */
278 if (PyClass_Check(obj)) {
279 data->newraw = 0;
280 data->newargs = obj;
281 Py_INCREF(obj);
282 } else {
283 #if (PY_VERSION_HEX < 0x02020000)
284 data->newraw = 0;
285 #else
286 data->newraw = PyObject_GetAttrString(data->klass, (char *)"__new__");
287 #endif
288 if (data->newraw) {
289 Py_INCREF(data->newraw);
290 data->newargs = PyTuple_New(1);
291 PyTuple_SetItem(data->newargs, 0, obj);
292 } else {
293 data->newargs = obj;
294 }
295 Py_INCREF(data->newargs);
296 }
297 /* the destroy method, aka as the C++ delete method */
298 data->destroy = PyObject_GetAttrString(data->klass, (char *)"__swig_destroy_ _");
299 if (PyErr_Occurred()) {
300 PyErr_Clear();
301 data->destroy = 0;
302 }
303 if (data->destroy) {
304 int flags;
305 Py_INCREF(data->destroy);
306 flags = PyCFunction_GET_FLAGS(data->destroy);
307 #ifdef METH_O
308 data->delargs = !(flags & (METH_O));
309 #else
310 data->delargs = 0;
311 #endif
312 } else {
313 data->delargs = 0;
314 }
315 data->implicitconv = 0;
316 return data;
317 }
318 }
319
320 SWIGRUNTIME void
321 SwigPyClientData_Del(SwigPyClientData* data)
322 {
323 Py_XDECREF(data->newraw);
324 Py_XDECREF(data->newargs);
325 Py_XDECREF(data->destroy);
326 }
327
328 /* =============== SwigPyObject =====================*/
329
330 typedef struct {
331 PyObject_HEAD
332 void *ptr;
333 swig_type_info *ty;
334 int own;
335 PyObject *next;
336 } SwigPyObject;
337
338 SWIGRUNTIME PyObject *
339 SwigPyObject_long(SwigPyObject *v)
340 {
341 return PyLong_FromVoidPtr(v->ptr);
342 }
343
344 SWIGRUNTIME PyObject *
345 SwigPyObject_format(const char* fmt, SwigPyObject *v)
346 {
347 PyObject *res = NULL;
348 PyObject *args = PyTuple_New(1);
349 if (args) {
350 if (PyTuple_SetItem(args, 0, SwigPyObject_long(v)) == 0) {
351 PyObject *ofmt = SWIG_Python_str_FromChar(fmt);
352 if (ofmt) {
353 #if PY_VERSION_HEX >= 0x03000000
354 res = PyUnicode_Format(ofmt,args);
355 #else
356 res = PyString_Format(ofmt,args);
357 #endif
358 Py_DECREF(ofmt);
359 }
360 Py_DECREF(args);
361 }
362 }
363 return res;
364 }
365
366 SWIGRUNTIME PyObject *
367 SwigPyObject_oct(SwigPyObject *v)
368 {
369 return SwigPyObject_format("%o",v);
370 }
371
372 SWIGRUNTIME PyObject *
373 SwigPyObject_hex(SwigPyObject *v)
374 {
375 return SwigPyObject_format("%x",v);
376 }
377
378 SWIGRUNTIME PyObject *
379 #ifdef METH_NOARGS
380 SwigPyObject_repr(SwigPyObject *v)
381 #else
382 SwigPyObject_repr(SwigPyObject *v, PyObject *args)
383 #endif
384 {
385 const char *name = SWIG_TypePrettyName(v->ty);
386 PyObject *repr = SWIG_Python_str_FromFormat("<Swig Object of type '%s' at %p>" , name, v);
387 if (v->next) {
388 #ifdef METH_NOARGS
389 PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next);
390 #else
391 PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next, args);
392 #endif
393 #if PY_VERSION_HEX >= 0x03000000
394 PyObject *joined = PyUnicode_Concat(repr, nrep);
395 Py_DecRef(repr);
396 Py_DecRef(nrep);
397 repr = joined;
398 #else
399 PyString_ConcatAndDel(&repr,nrep);
400 #endif
401 }
402 return repr;
403 }
404
405 SWIGRUNTIME int
406 SwigPyObject_print(SwigPyObject *v, FILE *fp, int SWIGUNUSEDPARM(flags))
407 {
408 char *str;
409 #ifdef METH_NOARGS
410 PyObject *repr = SwigPyObject_repr(v);
411 #else
412 PyObject *repr = SwigPyObject_repr(v, NULL);
413 #endif
414 if (repr) {
415 str = SWIG_Python_str_AsChar(repr);
416 fputs(str, fp);
417 SWIG_Python_str_DelForPy3(str);
418 Py_DECREF(repr);
419 return 0;
420 } else {
421 return 1;
422 }
423 }
424
425 SWIGRUNTIME PyObject *
426 SwigPyObject_str(SwigPyObject *v)
427 {
428 char result[SWIG_BUFFER_SIZE];
429 return SWIG_PackVoidPtr(result, v->ptr, v->ty->name, sizeof(result)) ?
430 SWIG_Python_str_FromChar(result) : 0;
431 }
432
433 SWIGRUNTIME int
434 SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w)
435 {
436 void *i = v->ptr;
437 void *j = w->ptr;
438 return (i < j) ? -1 : ((i > j) ? 1 : 0);
439 }
440
441 /* Added for Python 3.x, would it also be useful for Python 2.x? */
442 SWIGRUNTIME PyObject*
443 SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op)
444 {
445 PyObject* res;
446 if( op != Py_EQ && op != Py_NE ) {
447 Py_INCREF(Py_NotImplemented);
448 return Py_NotImplemented;
449 }
450 if( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) )
451 res = Py_True;
452 else
453 res = Py_False;
454 Py_INCREF(res);
455 return res;
456 }
457
458
459 SWIGRUNTIME PyTypeObject* _PySwigObject_type(void);
460
461 SWIGRUNTIME PyTypeObject*
462 SwigPyObject_type(void) {
463 static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigObject_type();
464 return type;
465 }
466
467 SWIGRUNTIMEINLINE int
468 SwigPyObject_Check(PyObject *op) {
469 return (Py_TYPE(op) == SwigPyObject_type())
470 || (strcmp(Py_TYPE(op)->tp_name,"SwigPyObject") == 0);
471 }
472
473 SWIGRUNTIME PyObject *
474 SwigPyObject_New(void *ptr, swig_type_info *ty, int own);
475
476 SWIGRUNTIME void
477 SwigPyObject_dealloc(PyObject *v)
478 {
479 SwigPyObject *sobj = (SwigPyObject *) v;
480 PyObject *next = sobj->next;
481 if (sobj->own == SWIG_POINTER_OWN) {
482 swig_type_info *ty = sobj->ty;
483 SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0;
484 PyObject *destroy = data ? data->destroy : 0;
485 if (destroy) {
486 /* destroy is always a VARARGS method */
487 PyObject *res;
488 if (data->delargs) {
489 /* we need to create a temporary object to carry the destroy operation * /
490 PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0);
491 res = SWIG_Python_CallFunctor(destroy, tmp);
492 Py_DECREF(tmp);
493 } else {
494 PyCFunction meth = PyCFunction_GET_FUNCTION(destroy);
495 PyObject *mself = PyCFunction_GET_SELF(destroy);
496 res = ((*meth)(mself, v));
497 }
498 Py_XDECREF(res);
499 }
500 #if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
501 else {
502 const char *name = SWIG_TypePrettyName(ty);
503 printf("swig/python detected a memory leak of type '%s', no destructor fou nd.\n", (name ? name : "unknown"));
504 }
505 #endif
506 }
507 Py_XDECREF(next);
508 PyObject_DEL(v);
509 }
510
511 SWIGRUNTIME PyObject*
512 SwigPyObject_append(PyObject* v, PyObject* next)
513 {
514 SwigPyObject *sobj = (SwigPyObject *) v;
515 #ifndef METH_O
516 PyObject *tmp = 0;
517 if (!PyArg_ParseTuple(next,(char *)"O:append", &tmp)) return NULL;
518 next = tmp;
519 #endif
520 if (!SwigPyObject_Check(next)) {
521 return NULL;
522 }
523 sobj->next = next;
524 Py_INCREF(next);
525 return SWIG_Py_Void();
526 }
527
528 SWIGRUNTIME PyObject*
529 #ifdef METH_NOARGS
530 SwigPyObject_next(PyObject* v)
531 #else
532 SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
533 #endif
534 {
535 SwigPyObject *sobj = (SwigPyObject *) v;
536 if (sobj->next) {
537 Py_INCREF(sobj->next);
538 return sobj->next;
539 } else {
540 return SWIG_Py_Void();
541 }
542 }
543
544 SWIGINTERN PyObject*
545 #ifdef METH_NOARGS
546 SwigPyObject_disown(PyObject *v)
547 #else
548 SwigPyObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
549 #endif
550 {
551 SwigPyObject *sobj = (SwigPyObject *)v;
552 sobj->own = 0;
553 return SWIG_Py_Void();
554 }
555
556 SWIGINTERN PyObject*
557 #ifdef METH_NOARGS
558 SwigPyObject_acquire(PyObject *v)
559 #else
560 SwigPyObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
561 #endif
562 {
563 SwigPyObject *sobj = (SwigPyObject *)v;
564 sobj->own = SWIG_POINTER_OWN;
565 return SWIG_Py_Void();
566 }
567
568 SWIGINTERN PyObject*
569 SwigPyObject_own(PyObject *v, PyObject *args)
570 {
571 PyObject *val = 0;
572 #if (PY_VERSION_HEX < 0x02020000)
573 if (!PyArg_ParseTuple(args,(char *)"|O:own",&val))
574 #else
575 if (!PyArg_UnpackTuple(args, (char *)"own", 0, 1, &val))
576 #endif
577 {
578 return NULL;
579 }
580 else
581 {
582 SwigPyObject *sobj = (SwigPyObject *)v;
583 PyObject *obj = PyBool_FromLong(sobj->own);
584 if (val) {
585 #ifdef METH_NOARGS
586 if (PyObject_IsTrue(val)) {
587 SwigPyObject_acquire(v);
588 } else {
589 SwigPyObject_disown(v);
590 }
591 #else
592 if (PyObject_IsTrue(val)) {
593 SwigPyObject_acquire(v,args);
594 } else {
595 SwigPyObject_disown(v,args);
596 }
597 #endif
598 }
599 return obj;
600 }
601 }
602
603 #ifdef METH_O
604 static PyMethodDef
605 swigobject_methods[] = {
606 {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_NOARGS, (char *)" releases ownership of the pointer"},
607 {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS, (char *)" aquires ownership of the pointer"},
608 {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)" returns/sets ownership of the pointer"},
609 {(char *)"append", (PyCFunction)SwigPyObject_append, METH_O, (char *)" appends another 'this' object"},
610 {(char *)"next", (PyCFunction)SwigPyObject_next, METH_NOARGS, (char *)" returns the next 'this' object"},
611 {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_NOARGS, (char *)" returns object representation"},
612 {0, 0, 0, 0}
613 };
614 #else
615 static PyMethodDef
616 swigobject_methods[] = {
617 {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_VARARGS, (char *) "releases ownership of the pointer"},
618 {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_VARARGS, (char *) "aquires ownership of the pointer"},
619 {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *) "returns/sets ownership of the pointer"},
620 {(char *)"append", (PyCFunction)SwigPyObject_append, METH_VARARGS, (char *) "appends another 'this' object"},
621 {(char *)"next", (PyCFunction)SwigPyObject_next, METH_VARARGS, (char *) "returns the next 'this' object"},
622 {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_VARARGS, (char *)" returns object representation"},
623 {0, 0, 0, 0}
624 };
625 #endif
626
627 #if PY_VERSION_HEX < 0x02020000
628 SWIGINTERN PyObject *
629 SwigPyObject_getattr(SwigPyObject *sobj,char *name)
630 {
631 return Py_FindMethod(swigobject_methods, (PyObject *)sobj, name);
632 }
633 #endif
634
635 SWIGRUNTIME PyTypeObject*
636 _PySwigObject_type(void) {
637 static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer";
638
639 static PyNumberMethods SwigPyObject_as_number = {
640 (binaryfunc)0, /*nb_add*/
641 (binaryfunc)0, /*nb_subtract*/
642 (binaryfunc)0, /*nb_multiply*/
643 /* nb_divide removed in Python 3 */
644 #if PY_VERSION_HEX < 0x03000000
645 (binaryfunc)0, /*nb_divide*/
646 #endif
647 (binaryfunc)0, /*nb_remainder*/
648 (binaryfunc)0, /*nb_divmod*/
649 (ternaryfunc)0,/*nb_power*/
650 (unaryfunc)0, /*nb_negative*/
651 (unaryfunc)0, /*nb_positive*/
652 (unaryfunc)0, /*nb_absolute*/
653 (inquiry)0, /*nb_nonzero*/
654 0, /*nb_invert*/
655 0, /*nb_lshift*/
656 0, /*nb_rshift*/
657 0, /*nb_and*/
658 0, /*nb_xor*/
659 0, /*nb_or*/
660 #if PY_VERSION_HEX < 0x03000000
661 0, /*nb_coerce*/
662 #endif
663 (unaryfunc)SwigPyObject_long, /*nb_int*/
664 #if PY_VERSION_HEX < 0x03000000
665 (unaryfunc)SwigPyObject_long, /*nb_long*/
666 #else
667 0, /*nb_reserved*/
668 #endif
669 (unaryfunc)0, /*nb_float*/
670 #if PY_VERSION_HEX < 0x03000000
671 (unaryfunc)SwigPyObject_oct, /*nb_oct*/
672 (unaryfunc)SwigPyObject_hex, /*nb_hex*/
673 #endif
674 #if PY_VERSION_HEX >= 0x03000000 /* 3.0 */
675 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index, nb_inplace_divi de removed */
676 #elif PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */
677 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */
678 #elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */
679 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */
680 #elif PY_VERSION_HEX >= 0x02000000 /* 2.0.0 */
681 0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */
682 #endif
683 };
684
685 static PyTypeObject swigpyobject_type;
686 static int type_init = 0;
687 if (!type_init) {
688 const PyTypeObject tmp
689 = {
690 /* PyObject header changed in Python 3 */
691 #if PY_VERSION_HEX >= 0x03000000
692 PyVarObject_HEAD_INIT(&PyType_Type, 0)
693 #else
694 PyObject_HEAD_INIT(NULL)
695 0, /* ob_size */
696 #endif
697 (char *)"SwigPyObject", /* tp_name */
698 sizeof(SwigPyObject), /* tp_basicsize */
699 0, /* tp_itemsize */
700 (destructor)SwigPyObject_dealloc, /* tp_dealloc */
701 (printfunc)SwigPyObject_print, /* tp_print */
702 #if PY_VERSION_HEX < 0x02020000
703 (getattrfunc)SwigPyObject_getattr, /* tp_getattr */
704 #else
705 (getattrfunc)0, /* tp_getattr */
706 #endif
707 (setattrfunc)0, /* tp_setattr */
708 #if PY_VERSION_HEX >= 0x03000000
709 0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */
710 #else
711 (cmpfunc)SwigPyObject_compare, /* tp_compare */
712 #endif
713 (reprfunc)SwigPyObject_repr, /* tp_repr */
714 &SwigPyObject_as_number, /* tp_as_number */
715 0, /* tp_as_sequence */
716 0, /* tp_as_mapping */
717 (hashfunc)0, /* tp_hash */
718 (ternaryfunc)0, /* tp_call */
719 (reprfunc)SwigPyObject_str, /* tp_str */
720 PyObject_GenericGetAttr, /* tp_getattro */
721 0, /* tp_setattro */
722 0, /* tp_as_buffer */
723 Py_TPFLAGS_DEFAULT, /* tp_flags */
724 swigobject_doc, /* tp_doc */
725 0, /* tp_traverse */
726 0, /* tp_clear */
727 (richcmpfunc)SwigPyObject_richcompare, /* tp_richcompare */
728 0, /* tp_weaklistoffset */
729 #if PY_VERSION_HEX >= 0x02020000
730 0, /* tp_iter */
731 0, /* tp_iternext */
732 swigobject_methods, /* tp_methods */
733 0, /* tp_members */
734 0, /* tp_getset */
735 0, /* tp_base */
736 0, /* tp_dict */
737 0, /* tp_descr_get */
738 0, /* tp_descr_set */
739 0, /* tp_dictoffset */
740 0, /* tp_init */
741 0, /* tp_alloc */
742 0, /* tp_new */
743 0, /* tp_free */
744 0, /* tp_is_gc */
745 0, /* tp_bases */
746 0, /* tp_mro */
747 0, /* tp_cache */
748 0, /* tp_subclasses */
749 0, /* tp_weaklist */
750 #endif
751 #if PY_VERSION_HEX >= 0x02030000
752 0, /* tp_del */
753 #endif
754 #ifdef COUNT_ALLOCS
755 0,0,0,0 /* tp_alloc -> tp_next */
756 #endif
757 };
758 swigpyobject_type = tmp;
759 /* for Python 3 we already assigned ob_type in PyVarObject_HEAD_INIT() */
760 #if PY_VERSION_HEX < 0x03000000
761 swigpyobject_type.ob_type = &PyType_Type;
762 #endif
763 type_init = 1;
764 }
765 return &swigpyobject_type;
766 }
767
768 SWIGRUNTIME PyObject *
769 SwigPyObject_New(void *ptr, swig_type_info *ty, int own)
770 {
771 SwigPyObject *sobj = PyObject_NEW(SwigPyObject, SwigPyObject_type());
772 if (sobj) {
773 sobj->ptr = ptr;
774 sobj->ty = ty;
775 sobj->own = own;
776 sobj->next = 0;
777 }
778 return (PyObject *)sobj;
779 }
780
781 /* -----------------------------------------------------------------------------
782 * Implements a simple Swig Packed type, and use it instead of string
783 * ----------------------------------------------------------------------------- */
784
785 typedef struct {
786 PyObject_HEAD
787 void *pack;
788 swig_type_info *ty;
789 size_t size;
790 } SwigPyPacked;
791
792 SWIGRUNTIME int
793 SwigPyPacked_print(SwigPyPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags))
794 {
795 char result[SWIG_BUFFER_SIZE];
796 fputs("<Swig Packed ", fp);
797 if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
798 fputs("at ", fp);
799 fputs(result, fp);
800 }
801 fputs(v->ty->name,fp);
802 fputs(">", fp);
803 return 0;
804 }
805
806 SWIGRUNTIME PyObject *
807 SwigPyPacked_repr(SwigPyPacked *v)
808 {
809 char result[SWIG_BUFFER_SIZE];
810 if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
811 return SWIG_Python_str_FromFormat("<Swig Packed at %s%s>", result, v->ty->na me);
812 } else {
813 return SWIG_Python_str_FromFormat("<Swig Packed %s>", v->ty->name);
814 }
815 }
816
817 SWIGRUNTIME PyObject *
818 SwigPyPacked_str(SwigPyPacked *v)
819 {
820 char result[SWIG_BUFFER_SIZE];
821 if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){
822 return SWIG_Python_str_FromFormat("%s%s", result, v->ty->name);
823 } else {
824 return SWIG_Python_str_FromChar(v->ty->name);
825 }
826 }
827
828 SWIGRUNTIME int
829 SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w)
830 {
831 size_t i = v->size;
832 size_t j = w->size;
833 int s = (i < j) ? -1 : ((i > j) ? 1 : 0);
834 return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size);
835 }
836
837 SWIGRUNTIME PyTypeObject* _PySwigPacked_type(void);
838
839 SWIGRUNTIME PyTypeObject*
840 SwigPyPacked_type(void) {
841 static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigPacked_type();
842 return type;
843 }
844
845 SWIGRUNTIMEINLINE int
846 SwigPyPacked_Check(PyObject *op) {
847 return ((op)->ob_type == _PySwigPacked_type())
848 || (strcmp((op)->ob_type->tp_name,"SwigPyPacked") == 0);
849 }
850
851 SWIGRUNTIME void
852 SwigPyPacked_dealloc(PyObject *v)
853 {
854 if (SwigPyPacked_Check(v)) {
855 SwigPyPacked *sobj = (SwigPyPacked *) v;
856 free(sobj->pack);
857 }
858 PyObject_DEL(v);
859 }
860
861 SWIGRUNTIME PyTypeObject*
862 _PySwigPacked_type(void) {
863 static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer";
864 static PyTypeObject swigpypacked_type;
865 static int type_init = 0;
866 if (!type_init) {
867 const PyTypeObject tmp
868 = {
869 /* PyObject header changed in Python 3 */
870 #if PY_VERSION_HEX>=0x03000000
871 PyVarObject_HEAD_INIT(&PyType_Type, 0)
872 #else
873 PyObject_HEAD_INIT(NULL)
874 0, /* ob_size */
875 #endif
876 (char *)"SwigPyPacked", /* tp_name */
877 sizeof(SwigPyPacked), /* tp_basicsize */
878 0, /* tp_itemsize */
879 (destructor)SwigPyPacked_dealloc, /* tp_dealloc */
880 (printfunc)SwigPyPacked_print, /* tp_print */
881 (getattrfunc)0, /* tp_getattr */
882 (setattrfunc)0, /* tp_setattr */
883 #if PY_VERSION_HEX>=0x03000000
884 0, /* tp_reserved in 3.0.1 */
885 #else
886 (cmpfunc)SwigPyPacked_compare, /* tp_compare */
887 #endif
888 (reprfunc)SwigPyPacked_repr, /* tp_repr */
889 0, /* tp_as_number */
890 0, /* tp_as_sequence */
891 0, /* tp_as_mapping */
892 (hashfunc)0, /* tp_hash */
893 (ternaryfunc)0, /* tp_call */
894 (reprfunc)SwigPyPacked_str, /* tp_str */
895 PyObject_GenericGetAttr, /* tp_getattro */
896 0, /* tp_setattro */
897 0, /* tp_as_buffer */
898 Py_TPFLAGS_DEFAULT, /* tp_flags */
899 swigpacked_doc, /* tp_doc */
900 0, /* tp_traverse */
901 0, /* tp_clear */
902 0, /* tp_richcompare */
903 0, /* tp_weaklistoffset */
904 #if PY_VERSION_HEX >= 0x02020000
905 0, /* tp_iter */
906 0, /* tp_iternext */
907 0, /* tp_methods */
908 0, /* tp_members */
909 0, /* tp_getset */
910 0, /* tp_base */
911 0, /* tp_dict */
912 0, /* tp_descr_get */
913 0, /* tp_descr_set */
914 0, /* tp_dictoffset */
915 0, /* tp_init */
916 0, /* tp_alloc */
917 0, /* tp_new */
918 0, /* tp_free */
919 0, /* tp_is_gc */
920 0, /* tp_bases */
921 0, /* tp_mro */
922 0, /* tp_cache */
923 0, /* tp_subclasses */
924 0, /* tp_weaklist */
925 #endif
926 #if PY_VERSION_HEX >= 0x02030000
927 0, /* tp_del */
928 #endif
929 #ifdef COUNT_ALLOCS
930 0,0,0,0 /* tp_alloc -> tp_next */
931 #endif
932 };
933 swigpypacked_type = tmp;
934 /* for Python 3 the ob_type already assigned in PyVarObject_HEAD_INIT() */
935 #if PY_VERSION_HEX < 0x03000000
936 swigpypacked_type.ob_type = &PyType_Type;
937 #endif
938 type_init = 1;
939 }
940 return &swigpypacked_type;
941 }
942
943 SWIGRUNTIME PyObject *
944 SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty)
945 {
946 SwigPyPacked *sobj = PyObject_NEW(SwigPyPacked, SwigPyPacked_type());
947 if (sobj) {
948 void *pack = malloc(size);
949 if (pack) {
950 memcpy(pack, ptr, size);
951 sobj->pack = pack;
952 sobj->ty = ty;
953 sobj->size = size;
954 } else {
955 PyObject_DEL((PyObject *) sobj);
956 sobj = 0;
957 }
958 }
959 return (PyObject *) sobj;
960 }
961
962 SWIGRUNTIME swig_type_info *
963 SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size)
964 {
965 if (SwigPyPacked_Check(obj)) {
966 SwigPyPacked *sobj = (SwigPyPacked *)obj;
967 if (sobj->size != size) return 0;
968 memcpy(ptr, sobj->pack, size);
969 return sobj->ty;
970 } else {
971 return 0;
972 }
973 }
974
975 /* -----------------------------------------------------------------------------
976 * pointers/data manipulation
977 * ----------------------------------------------------------------------------- */
978
979 SWIGRUNTIMEINLINE PyObject *
980 _SWIG_This(void)
981 {
982 return SWIG_Python_str_FromChar("this");
983 }
984
985 SWIGRUNTIME PyObject *
986 SWIG_This(void)
987 {
988 static PyObject *SWIG_STATIC_POINTER(swig_this) = _SWIG_This();
989 return swig_this;
990 }
991
992 /* #define SWIG_PYTHON_SLOW_GETSET_THIS */
993
994 /* TODO: I don't know how to implement the fast getset in Python 3 right now */
995 #if PY_VERSION_HEX>=0x03000000
996 #define SWIG_PYTHON_SLOW_GETSET_THIS
997 #endif
998
999 SWIGRUNTIME SwigPyObject *
1000 SWIG_Python_GetSwigThis(PyObject *pyobj)
1001 {
1002 if (SwigPyObject_Check(pyobj)) {
1003 return (SwigPyObject *) pyobj;
1004 } else {
1005 PyObject *obj = 0;
1006 #if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000))
1007 if (PyInstance_Check(pyobj)) {
1008 obj = _PyInstance_Lookup(pyobj, SWIG_This());
1009 } else {
1010 PyObject **dictptr = _PyObject_GetDictPtr(pyobj);
1011 if (dictptr != NULL) {
1012 PyObject *dict = *dictptr;
1013 obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0;
1014 } else {
1015 #ifdef PyWeakref_CheckProxy
1016 if (PyWeakref_CheckProxy(pyobj)) {
1017 PyObject *wobj = PyWeakref_GET_OBJECT(pyobj);
1018 return wobj ? SWIG_Python_GetSwigThis(wobj) : 0;
1019 }
1020 #endif
1021 obj = PyObject_GetAttr(pyobj,SWIG_This());
1022 if (obj) {
1023 Py_DECREF(obj);
1024 } else {
1025 if (PyErr_Occurred()) PyErr_Clear();
1026 return 0;
1027 }
1028 }
1029 }
1030 #else
1031 obj = PyObject_GetAttr(pyobj,SWIG_This());
1032 if (obj) {
1033 Py_DECREF(obj);
1034 } else {
1035 if (PyErr_Occurred()) PyErr_Clear();
1036 return 0;
1037 }
1038 #endif
1039 if (obj && !SwigPyObject_Check(obj)) {
1040 /* a PyObject is called 'this', try to get the 'real this'
1041 SwigPyObject from it */
1042 return SWIG_Python_GetSwigThis(obj);
1043 }
1044 return (SwigPyObject *)obj;
1045 }
1046 }
1047
1048 /* Acquire a pointer value */
1049
1050 SWIGRUNTIME int
1051 SWIG_Python_AcquirePtr(PyObject *obj, int own) {
1052 if (own == SWIG_POINTER_OWN) {
1053 SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj);
1054 if (sobj) {
1055 int oldown = sobj->own;
1056 sobj->own = own;
1057 return oldown;
1058 }
1059 }
1060 return 0;
1061 }
1062
1063 /* Convert a pointer value */
1064
1065 SWIGRUNTIME int
1066 SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) {
1067 if (!obj) return SWIG_ERROR;
1068 if (obj == Py_None) {
1069 if (ptr) *ptr = 0;
1070 return SWIG_OK;
1071 } else {
1072 SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj);
1073 if (own)
1074 *own = 0;
1075 while (sobj) {
1076 void *vptr = sobj->ptr;
1077 if (ty) {
1078 swig_type_info *to = sobj->ty;
1079 if (to == ty) {
1080 /* no type cast needed */
1081 if (ptr) *ptr = vptr;
1082 break;
1083 } else {
1084 swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
1085 if (!tc) {
1086 sobj = (SwigPyObject *)sobj->next;
1087 } else {
1088 if (ptr) {
1089 int newmemory = 0;
1090 *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
1091 if (newmemory == SWIG_CAST_NEW_MEMORY) {
1092 assert(own);
1093 if (own)
1094 *own = *own | SWIG_CAST_NEW_MEMORY;
1095 }
1096 }
1097 break;
1098 }
1099 }
1100 } else {
1101 if (ptr) *ptr = vptr;
1102 break;
1103 }
1104 }
1105 if (sobj) {
1106 if (own)
1107 *own = *own | sobj->own;
1108 if (flags & SWIG_POINTER_DISOWN) {
1109 sobj->own = 0;
1110 }
1111 return SWIG_OK;
1112 } else {
1113 int res = SWIG_ERROR;
1114 if (flags & SWIG_POINTER_IMPLICIT_CONV) {
1115 SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0;
1116 if (data && !data->implicitconv) {
1117 PyObject *klass = data->klass;
1118 if (klass) {
1119 PyObject *impconv;
1120 data->implicitconv = 1; /* avoid recursion and call 'explicit' const ructors*/
1121 impconv = SWIG_Python_CallFunctor(klass, obj);
1122 data->implicitconv = 0;
1123 if (PyErr_Occurred()) {
1124 PyErr_Clear();
1125 impconv = 0;
1126 }
1127 if (impconv) {
1128 SwigPyObject *iobj = SWIG_Python_GetSwigThis(impconv);
1129 if (iobj) {
1130 void *vptr;
1131 res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0 , 0);
1132 if (SWIG_IsOK(res)) {
1133 if (ptr) {
1134 *ptr = vptr;
1135 /* transfer the ownership to 'ptr' */
1136 iobj->own = 0;
1137 res = SWIG_AddCast(res);
1138 res = SWIG_AddNewMask(res);
1139 } else {
1140 res = SWIG_AddCast(res);
1141 }
1142 }
1143 }
1144 Py_DECREF(impconv);
1145 }
1146 }
1147 }
1148 }
1149 return res;
1150 }
1151 }
1152 }
1153
1154 /* Convert a function ptr value */
1155
1156 SWIGRUNTIME int
1157 SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) {
1158 if (!PyCFunction_Check(obj)) {
1159 return SWIG_ConvertPtr(obj, ptr, ty, 0);
1160 } else {
1161 void *vptr = 0;
1162
1163 /* here we get the method pointer for callbacks */
1164 const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
1165 const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0;
1166 if (desc)
1167 desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0;
1168 if (!desc)
1169 return SWIG_ERROR;
1170 if (ty) {
1171 swig_cast_info *tc = SWIG_TypeCheck(desc,ty);
1172 if (tc) {
1173 int newmemory = 0;
1174 *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
1175 assert(!newmemory); /* newmemory handling not yet implemented */
1176 } else {
1177 return SWIG_ERROR;
1178 }
1179 } else {
1180 *ptr = vptr;
1181 }
1182 return SWIG_OK;
1183 }
1184 }
1185
1186 /* Convert a packed value value */
1187
1188 SWIGRUNTIME int
1189 SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *t y) {
1190 swig_type_info *to = SwigPyPacked_UnpackData(obj, ptr, sz);
1191 if (!to) return SWIG_ERROR;
1192 if (ty) {
1193 if (to != ty) {
1194 /* check type cast? */
1195 swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
1196 if (!tc) return SWIG_ERROR;
1197 }
1198 }
1199 return SWIG_OK;
1200 }
1201
1202 /* -----------------------------------------------------------------------------
1203 * Create a new pointer object
1204 * ----------------------------------------------------------------------------- */
1205
1206 /*
1207 Create a new instance object, without calling __init__, and set the
1208 'this' attribute.
1209 */
1210
1211 SWIGRUNTIME PyObject*
1212 SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this)
1213 {
1214 #if (PY_VERSION_HEX >= 0x02020000)
1215 PyObject *inst = 0;
1216 PyObject *newraw = data->newraw;
1217 if (newraw) {
1218 inst = PyObject_Call(newraw, data->newargs, NULL);
1219 if (inst) {
1220 #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
1221 PyObject **dictptr = _PyObject_GetDictPtr(inst);
1222 if (dictptr != NULL) {
1223 PyObject *dict = *dictptr;
1224 if (dict == NULL) {
1225 dict = PyDict_New();
1226 *dictptr = dict;
1227 PyDict_SetItem(dict, SWIG_This(), swig_this);
1228 }
1229 }
1230 #else
1231 PyObject *key = SWIG_This();
1232 PyObject_SetAttr(inst, key, swig_this);
1233 #endif
1234 }
1235 } else {
1236 #if PY_VERSION_HEX >= 0x03000000
1237 inst = PyBaseObject_Type.tp_new((PyTypeObject*) data->newargs, Py_None, Py_N one);
1238 PyObject_SetAttr(inst, SWIG_This(), swig_this);
1239 Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG;
1240 #else
1241 PyObject *dict = PyDict_New();
1242 PyDict_SetItem(dict, SWIG_This(), swig_this);
1243 inst = PyInstance_NewRaw(data->newargs, dict);
1244 Py_DECREF(dict);
1245 #endif
1246 }
1247 return inst;
1248 #else
1249 #if (PY_VERSION_HEX >= 0x02010000)
1250 PyObject *inst;
1251 PyObject *dict = PyDict_New();
1252 PyDict_SetItem(dict, SWIG_This(), swig_this);
1253 inst = PyInstance_NewRaw(data->newargs, dict);
1254 Py_DECREF(dict);
1255 return (PyObject *) inst;
1256 #else
1257 PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type);
1258 if (inst == NULL) {
1259 return NULL;
1260 }
1261 inst->in_class = (PyClassObject *)data->newargs;
1262 Py_INCREF(inst->in_class);
1263 inst->in_dict = PyDict_New();
1264 if (inst->in_dict == NULL) {
1265 Py_DECREF(inst);
1266 return NULL;
1267 }
1268 #ifdef Py_TPFLAGS_HAVE_WEAKREFS
1269 inst->in_weakreflist = NULL;
1270 #endif
1271 #ifdef Py_TPFLAGS_GC
1272 PyObject_GC_Init(inst);
1273 #endif
1274 PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this);
1275 return (PyObject *) inst;
1276 #endif
1277 #endif
1278 }
1279
1280 SWIGRUNTIME void
1281 SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this)
1282 {
1283 PyObject *dict;
1284 #if (PY_VERSION_HEX >= 0x02020000) && !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
1285 PyObject **dictptr = _PyObject_GetDictPtr(inst);
1286 if (dictptr != NULL) {
1287 dict = *dictptr;
1288 if (dict == NULL) {
1289 dict = PyDict_New();
1290 *dictptr = dict;
1291 }
1292 PyDict_SetItem(dict, SWIG_This(), swig_this);
1293 return;
1294 }
1295 #endif
1296 dict = PyObject_GetAttrString(inst, (char*)"__dict__");
1297 PyDict_SetItem(dict, SWIG_This(), swig_this);
1298 Py_DECREF(dict);
1299 }
1300
1301
1302 SWIGINTERN PyObject *
1303 SWIG_Python_InitShadowInstance(PyObject *args) {
1304 PyObject *obj[2];
1305 if (!SWIG_Python_UnpackTuple(args,(char*)"swiginit", 2, 2, obj)) {
1306 return NULL;
1307 } else {
1308 SwigPyObject *sthis = SWIG_Python_GetSwigThis(obj[0]);
1309 if (sthis) {
1310 SwigPyObject_append((PyObject*) sthis, obj[1]);
1311 } else {
1312 SWIG_Python_SetSwigThis(obj[0], obj[1]);
1313 }
1314 return SWIG_Py_Void();
1315 }
1316 }
1317
1318 /* Create a new pointer object */
1319
1320 SWIGRUNTIME PyObject *
1321 SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int flags) {
1322 if (!ptr) {
1323 return SWIG_Py_Void();
1324 } else {
1325 int own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0;
1326 PyObject *robj = SwigPyObject_New(ptr, type, own);
1327 SwigPyClientData *clientdata = type ? (SwigPyClientData *)(type->clientdata) : 0;
1328 if (clientdata && !(flags & SWIG_POINTER_NOSHADOW)) {
1329 PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj);
1330 if (inst) {
1331 Py_DECREF(robj);
1332 robj = inst;
1333 }
1334 }
1335 return robj;
1336 }
1337 }
1338
1339 /* Create a new packed object */
1340
1341 SWIGRUNTIMEINLINE PyObject *
1342 SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) {
1343 return ptr ? SwigPyPacked_New((void *) ptr, sz, type) : SWIG_Py_Void();
1344 }
1345
1346 /* ----------------------------------------------------------------------------- *
1347 * Get type list
1348 * ----------------------------------------------------------------------------- */
1349
1350 #ifdef SWIG_LINK_RUNTIME
1351 void *SWIG_ReturnGlobalTypeList(void *);
1352 #endif
1353
1354 SWIGRUNTIME swig_module_info *
1355 SWIG_Python_GetModule(void) {
1356 static void *type_pointer = (void *)0;
1357 /* first check if module already created */
1358 if (!type_pointer) {
1359 #ifdef SWIG_LINK_RUNTIME
1360 type_pointer = SWIG_ReturnGlobalTypeList((void *)0);
1361 #else
1362 type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERS ION,
1363 (char*)"type_pointer" SWIG_TYPE_TABLE_NAME);
1364 if (PyErr_Occurred()) {
1365 PyErr_Clear();
1366 type_pointer = (void *)0;
1367 }
1368 #endif
1369 }
1370 return (swig_module_info *) type_pointer;
1371 }
1372
1373 #if PY_MAJOR_VERSION < 2
1374 /* PyModule_AddObject function was introduced in Python 2.0. The following func tion
1375 is copied out of Python/modsupport.c in python version 2.3.4 */
1376 SWIGINTERN int
1377 PyModule_AddObject(PyObject *m, char *name, PyObject *o)
1378 {
1379 PyObject *dict;
1380 if (!PyModule_Check(m)) {
1381 PyErr_SetString(PyExc_TypeError,
1382 "PyModule_AddObject() needs module as first arg");
1383 return SWIG_ERROR;
1384 }
1385 if (!o) {
1386 PyErr_SetString(PyExc_TypeError,
1387 "PyModule_AddObject() needs non-NULL value");
1388 return SWIG_ERROR;
1389 }
1390
1391 dict = PyModule_GetDict(m);
1392 if (dict == NULL) {
1393 /* Internal error -- modules must have a dict! */
1394 PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__",
1395 PyModule_GetName(m));
1396 return SWIG_ERROR;
1397 }
1398 if (PyDict_SetItemString(dict, name, o))
1399 return SWIG_ERROR;
1400 Py_DECREF(o);
1401 return SWIG_OK;
1402 }
1403 #endif
1404
1405 SWIGRUNTIME void
1406 SWIG_Python_DestroyModule(void *vptr)
1407 {
1408 swig_module_info *swig_module = (swig_module_info *) vptr;
1409 swig_type_info **types = swig_module->types;
1410 size_t i;
1411 for (i =0; i < swig_module->size; ++i) {
1412 swig_type_info *ty = types[i];
1413 if (ty->owndata) {
1414 SwigPyClientData *data = (SwigPyClientData *) ty->clientdata;
1415 if (data) SwigPyClientData_Del(data);
1416 }
1417 }
1418 Py_DECREF(SWIG_This());
1419 }
1420
1421 SWIGRUNTIME void
1422 SWIG_Python_SetModule(swig_module_info *swig_module) {
1423 static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} };/* Sentinel */
1424
1425 #if PY_VERSION_HEX >= 0x03000000
1426 /* Add a dummy module object into sys.modules */
1427 PyObject *module = PyImport_AddModule((char*)"swig_runtime_data" SWIG_RUNTIME_ VERSION);
1428 #else
1429 PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSI ON,
1430 swig_empty_runtime_method_table);
1431 #endif
1432 PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_De stroyModule);
1433 if (pointer && module) {
1434 PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, point er);
1435 } else {
1436 Py_XDECREF(pointer);
1437 }
1438 }
1439
1440 /* The python cached type query */
1441 SWIGRUNTIME PyObject *
1442 SWIG_Python_TypeCache(void) {
1443 static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New();
1444 return cache;
1445 }
1446
1447 SWIGRUNTIME swig_type_info *
1448 SWIG_Python_TypeQuery(const char *type)
1449 {
1450 PyObject *cache = SWIG_Python_TypeCache();
1451 PyObject *key = SWIG_Python_str_FromChar(type);
1452 PyObject *obj = PyDict_GetItem(cache, key);
1453 swig_type_info *descriptor;
1454 if (obj) {
1455 descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
1456 } else {
1457 swig_module_info *swig_module = SWIG_Python_GetModule();
1458 descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type);
1459 if (descriptor) {
1460 obj = PyCObject_FromVoidPtr(descriptor, NULL);
1461 PyDict_SetItem(cache, key, obj);
1462 Py_DECREF(obj);
1463 }
1464 }
1465 Py_DECREF(key);
1466 return descriptor;
1467 }
1468
1469 /*
1470 For backward compatibility only
1471 */
1472 #define SWIG_POINTER_EXCEPTION 0
1473 #define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg)
1474 #define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags)
1475
1476 SWIGRUNTIME int
1477 SWIG_Python_AddErrMesg(const char* mesg, int infront)
1478 {
1479 if (PyErr_Occurred()) {
1480 PyObject *type = 0;
1481 PyObject *value = 0;
1482 PyObject *traceback = 0;
1483 PyErr_Fetch(&type, &value, &traceback);
1484 if (value) {
1485 char *tmp;
1486 PyObject *old_str = PyObject_Str(value);
1487 Py_XINCREF(type);
1488 PyErr_Clear();
1489 if (infront) {
1490 PyErr_Format(type, "%s %s", mesg, tmp = SWIG_Python_str_AsChar(old_str)) ;
1491 } else {
1492 PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg) ;
1493 }
1494 SWIG_Python_str_DelForPy3(tmp);
1495 Py_DECREF(old_str);
1496 }
1497 return 1;
1498 } else {
1499 return 0;
1500 }
1501 }
1502
1503 SWIGRUNTIME int
1504 SWIG_Python_ArgFail(int argnum)
1505 {
1506 if (PyErr_Occurred()) {
1507 /* add information about failing argument */
1508 char mesg[256];
1509 PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum);
1510 return SWIG_Python_AddErrMesg(mesg, 1);
1511 } else {
1512 return 0;
1513 }
1514 }
1515
1516 SWIGRUNTIMEINLINE const char *
1517 SwigPyObject_GetDesc(PyObject *self)
1518 {
1519 SwigPyObject *v = (SwigPyObject *)self;
1520 swig_type_info *ty = v ? v->ty : 0;
1521 return ty ? ty->str : (char*)"";
1522 }
1523
1524 SWIGRUNTIME void
1525 SWIG_Python_TypeError(const char *type, PyObject *obj)
1526 {
1527 if (type) {
1528 #if defined(SWIG_COBJECT_TYPES)
1529 if (obj && SwigPyObject_Check(obj)) {
1530 const char *otype = (const char *) SwigPyObject_GetDesc(obj);
1531 if (otype) {
1532 PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received",
1533 type, otype);
1534 return;
1535 }
1536 } else
1537 #endif
1538 {
1539 const char *otype = (obj ? obj->ob_type->tp_name : 0);
1540 if (otype) {
1541 PyObject *str = PyObject_Str(obj);
1542 const char *cstr = str ? SWIG_Python_str_AsChar(str) : 0;
1543 if (cstr) {
1544 PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is receive d",
1545 type, otype, cstr);
1546 SWIG_Python_str_DelForPy3(cstr);
1547 } else {
1548 PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received",
1549 type, otype);
1550 }
1551 Py_XDECREF(str);
1552 return;
1553 }
1554 }
1555 PyErr_Format(PyExc_TypeError, "a '%s' is expected", type);
1556 } else {
1557 PyErr_Format(PyExc_TypeError, "unexpected type is received");
1558 }
1559 }
1560
1561
1562 /* Convert a pointer value, signal an exception on a type mismatch */
1563 SWIGRUNTIME void *
1564 SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) {
1565 void *result;
1566 if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) {
1567 PyErr_Clear();
1568 #if SWIG_POINTER_EXCEPTION
1569 if (flags) {
1570 SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj);
1571 SWIG_Python_ArgFail(argnum);
1572 }
1573 #endif
1574 }
1575 return result;
1576 }
1577
1578
1579 #ifdef __cplusplus
1580 #if 0
1581 { /* cc-mode */
1582 #endif
1583 }
1584 #endif
OLDNEW
« no previous file with comments | « swig/Lib/python/pyprimtypes.swg ('k') | swig/Lib/python/pyruntime.swg » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698