| 1 | /* ---------------------------------------------------------------------------- |
|---|
| 2 | * This file was automatically generated by SWIG (http://www.swig.org). |
|---|
| 3 | * Version 1.3.16u-20030530-2151 |
|---|
| 4 | * |
|---|
| 5 | * This file is not intended to be easily readable and contains a number of |
|---|
| 6 | * coding conventions designed to improve portability and efficiency. Do not make |
|---|
| 7 | * changes to this file unless you know what you are doing--modify the SWIG |
|---|
| 8 | * interface file instead. |
|---|
| 9 | * ----------------------------------------------------------------------------- */ |
|---|
| 10 | |
|---|
| 11 | #define SWIGPYTHON |
|---|
| 12 | |
|---|
| 13 | #ifdef __cplusplus |
|---|
| 14 | template<class T> class SwigValueWrapper { |
|---|
| 15 | T *tt; |
|---|
| 16 | public: |
|---|
| 17 | inline SwigValueWrapper() : tt(0) { } |
|---|
| 18 | inline ~SwigValueWrapper() { if (tt) delete tt; } |
|---|
| 19 | inline SwigValueWrapper& operator=(const T& t) { tt = new T(t); return *this; } |
|---|
| 20 | inline operator T&() const { return *tt; } |
|---|
| 21 | inline T *operator&() { return tt; } |
|---|
| 22 | }; |
|---|
| 23 | #endif |
|---|
| 24 | |
|---|
| 25 | |
|---|
| 26 | #include "Python.h" |
|---|
| 27 | |
|---|
| 28 | /*********************************************************************** |
|---|
| 29 | * common.swg |
|---|
| 30 | * |
|---|
| 31 | * This file contains generic SWIG runtime support for pointer |
|---|
| 32 | * type checking as well as a few commonly used macros to control |
|---|
| 33 | * external linkage. |
|---|
| 34 | * |
|---|
| 35 | * Author : David Beazley (beazley@cs.uchicago.edu) |
|---|
| 36 | * |
|---|
| 37 | * Copyright (c) 1999-2000, The University of Chicago |
|---|
| 38 | * |
|---|
| 39 | * This file may be freely redistributed without license or fee provided |
|---|
| 40 | * this copyright message remains intact. |
|---|
| 41 | ************************************************************************/ |
|---|
| 42 | |
|---|
| 43 | #include <string.h> |
|---|
| 44 | |
|---|
| 45 | #if defined(_WIN32) || defined(__WIN32__) |
|---|
| 46 | # if defined(_MSC_VER) |
|---|
| 47 | # if defined(STATIC_LINKED) |
|---|
| 48 | # define SWIGEXPORT(a) a |
|---|
| 49 | # define SWIGIMPORT(a) extern a |
|---|
| 50 | # else |
|---|
| 51 | # define SWIGEXPORT(a) __declspec(dllexport) a |
|---|
| 52 | # define SWIGIMPORT(a) extern a |
|---|
| 53 | # endif |
|---|
| 54 | # else |
|---|
| 55 | # if defined(__BORLANDC__) |
|---|
| 56 | # define SWIGEXPORT(a) a _export |
|---|
| 57 | # define SWIGIMPORT(a) a _export |
|---|
| 58 | # else |
|---|
| 59 | # define SWIGEXPORT(a) a |
|---|
| 60 | # define SWIGIMPORT(a) a |
|---|
| 61 | # endif |
|---|
| 62 | # endif |
|---|
| 63 | #else |
|---|
| 64 | # define SWIGEXPORT(a) a |
|---|
| 65 | # define SWIGIMPORT(a) a |
|---|
| 66 | #endif |
|---|
| 67 | |
|---|
| 68 | #ifdef SWIG_GLOBAL |
|---|
| 69 | #define SWIGRUNTIME(a) SWIGEXPORT(a) |
|---|
| 70 | #else |
|---|
| 71 | #define SWIGRUNTIME(a) static a |
|---|
| 72 | #endif |
|---|
| 73 | |
|---|
| 74 | #ifdef __cplusplus |
|---|
| 75 | extern "C" { |
|---|
| 76 | #endif |
|---|
| 77 | |
|---|
| 78 | typedef void *(*swig_converter_func)(void *); |
|---|
| 79 | typedef struct swig_type_info *(*swig_dycast_func)(void **); |
|---|
| 80 | |
|---|
| 81 | typedef struct swig_type_info { |
|---|
| 82 | const char *name; |
|---|
| 83 | swig_converter_func converter; |
|---|
| 84 | const char *str; |
|---|
| 85 | void *clientdata; |
|---|
| 86 | swig_dycast_func dcast; |
|---|
| 87 | struct swig_type_info *next; |
|---|
| 88 | struct swig_type_info *prev; |
|---|
| 89 | } swig_type_info; |
|---|
| 90 | |
|---|
| 91 | #ifdef SWIG_NOINCLUDE |
|---|
| 92 | |
|---|
| 93 | SWIGIMPORT(swig_type_info *) SWIG_TypeRegister(swig_type_info *); |
|---|
| 94 | SWIGIMPORT(swig_type_info *) SWIG_TypeCheck(char *c, swig_type_info *); |
|---|
| 95 | SWIGIMPORT(void *) SWIG_TypeCast(swig_type_info *, void *); |
|---|
| 96 | SWIGIMPORT(swig_type_info *) SWIG_TypeDynamicCast(swig_type_info *, void **); |
|---|
| 97 | SWIGIMPORT(swig_type_info *) SWIG_TypeQuery(const char *); |
|---|
| 98 | SWIGIMPORT(void) SWIG_TypeClientData(swig_type_info *, void *); |
|---|
| 99 | |
|---|
| 100 | #else |
|---|
| 101 | |
|---|
| 102 | static swig_type_info *swig_type_list = 0; |
|---|
| 103 | |
|---|
| 104 | /* Register a type mapping with the type-checking */ |
|---|
| 105 | SWIGRUNTIME(swig_type_info *) |
|---|
| 106 | SWIG_TypeRegister(swig_type_info *ti) |
|---|
| 107 | { |
|---|
| 108 | swig_type_info *tc, *head, *ret, *next; |
|---|
| 109 | /* Check to see if this type has already been registered */ |
|---|
| 110 | tc = swig_type_list; |
|---|
| 111 | while (tc) { |
|---|
| 112 | if (strcmp(tc->name, ti->name) == 0) { |
|---|
| 113 | /* Already exists in the table. Just add additional types to the list */ |
|---|
| 114 | if (tc->clientdata) ti->clientdata = tc->clientdata; |
|---|
| 115 | head = tc; |
|---|
| 116 | next = tc->next; |
|---|
| 117 | goto l1; |
|---|
| 118 | } |
|---|
| 119 | tc = tc->prev; |
|---|
| 120 | } |
|---|
| 121 | head = ti; |
|---|
| 122 | next = 0; |
|---|
| 123 | |
|---|
| 124 | /* Place in list */ |
|---|
| 125 | ti->prev = swig_type_list; |
|---|
| 126 | swig_type_list = ti; |
|---|
| 127 | |
|---|
| 128 | /* Build linked lists */ |
|---|
| 129 | l1: |
|---|
| 130 | ret = head; |
|---|
| 131 | tc = ti + 1; |
|---|
| 132 | /* Patch up the rest of the links */ |
|---|
| 133 | while (tc->name) { |
|---|
| 134 | head->next = tc; |
|---|
| 135 | tc->prev = head; |
|---|
| 136 | head = tc; |
|---|
| 137 | tc++; |
|---|
| 138 | } |
|---|
| 139 | head->next = next; |
|---|
| 140 | return ret; |
|---|
| 141 | } |
|---|
| 142 | |
|---|
| 143 | /* Check the typename */ |
|---|
| 144 | SWIGRUNTIME(swig_type_info *) |
|---|
| 145 | SWIG_TypeCheck(char *c, swig_type_info *ty) |
|---|
| 146 | { |
|---|
| 147 | swig_type_info *s; |
|---|
| 148 | if (!ty) return 0; /* Void pointer */ |
|---|
| 149 | s = ty->next; /* First element always just a name */ |
|---|
| 150 | do { |
|---|
| 151 | if (strcmp(s->name,c) == 0) { |
|---|
| 152 | if (s == ty->next) return s; |
|---|
| 153 | /* Move s to the top of the linked list */ |
|---|
| 154 | s->prev->next = s->next; |
|---|
| 155 | if (s->next) { |
|---|
| 156 | s->next->prev = s->prev; |
|---|
| 157 | } |
|---|
| 158 | /* Insert s as second element in the list */ |
|---|
| 159 | s->next = ty->next; |
|---|
| 160 | if (ty->next) ty->next->prev = s; |
|---|
| 161 | ty->next = s; |
|---|
| 162 | return s; |
|---|
| 163 | } |
|---|
| 164 | s = s->next; |
|---|
| 165 | } while (s && (s != ty->next)); |
|---|
| 166 | return 0; |
|---|
| 167 | } |
|---|
| 168 | |
|---|
| 169 | /* Cast a pointer up an inheritance hierarchy */ |
|---|
| 170 | SWIGRUNTIME(void *) |
|---|
| 171 | SWIG_TypeCast(swig_type_info *ty, void *ptr) |
|---|
| 172 | { |
|---|
| 173 | if ((!ty) || (!ty->converter)) return ptr; |
|---|
| 174 | return (*ty->converter)(ptr); |
|---|
| 175 | } |
|---|
| 176 | |
|---|
| 177 | /* Dynamic pointer casting. Down an inheritance hierarchy */ |
|---|
| 178 | SWIGRUNTIME(swig_type_info *) |
|---|
| 179 | SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) |
|---|
| 180 | { |
|---|
| 181 | swig_type_info *lastty = ty; |
|---|
| 182 | if (!ty || !ty->dcast) return ty; |
|---|
| 183 | while (ty && (ty->dcast)) { |
|---|
| 184 | ty = (*ty->dcast)(ptr); |
|---|
| 185 | if (ty) lastty = ty; |
|---|
| 186 | } |
|---|
| 187 | return lastty; |
|---|
| 188 | } |
|---|
| 189 | |
|---|
| 190 | /* Search for a swig_type_info structure */ |
|---|
| 191 | SWIGRUNTIME(swig_type_info *) |
|---|
| 192 | SWIG_TypeQuery(const char *name) { |
|---|
| 193 | swig_type_info *ty = swig_type_list; |
|---|
| 194 | while (ty) { |
|---|
| 195 | if (ty->str && (strcmp(name,ty->str) == 0)) return ty; |
|---|
| 196 | if (ty->name && (strcmp(name,ty->name) == 0)) return ty; |
|---|
| 197 | ty = ty->prev; |
|---|
| 198 | } |
|---|
| 199 | return 0; |
|---|
| 200 | } |
|---|
| 201 | |
|---|
| 202 | /* Set the clientdata field for a type */ |
|---|
| 203 | SWIGRUNTIME(void) |
|---|
| 204 | SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { |
|---|
| 205 | swig_type_info *tc, *equiv; |
|---|
| 206 | if (ti->clientdata) return; |
|---|
| 207 | ti->clientdata = clientdata; |
|---|
| 208 | equiv = ti->next; |
|---|
| 209 | while (equiv) { |
|---|
| 210 | if (!equiv->converter) { |
|---|
| 211 | tc = swig_type_list; |
|---|
| 212 | while (tc) { |
|---|
| 213 | if ((strcmp(tc->name, equiv->name) == 0)) |
|---|
| 214 | SWIG_TypeClientData(tc,clientdata); |
|---|
| 215 | tc = tc->prev; |
|---|
| 216 | } |
|---|
| 217 | } |
|---|
| 218 | equiv = equiv->next; |
|---|
| 219 | } |
|---|
| 220 | } |
|---|
| 221 | #endif |
|---|
| 222 | |
|---|
| 223 | #ifdef __cplusplus |
|---|
| 224 | } |
|---|
| 225 | |
|---|
| 226 | #endif |
|---|
| 227 | |
|---|
| 228 | /*********************************************************************** |
|---|
| 229 | * python.swg |
|---|
| 230 | * |
|---|
| 231 | * This file contains the runtime support for Python modules |
|---|
| 232 | * and includes code for managing global variables and pointer |
|---|
| 233 | * type checking. |
|---|
| 234 | * |
|---|
| 235 | * Author : David Beazley (beazley@cs.uchicago.edu) |
|---|
| 236 | ************************************************************************/ |
|---|
| 237 | |
|---|
| 238 | #include "Python.h" |
|---|
| 239 | |
|---|
| 240 | #ifdef __cplusplus |
|---|
| 241 | extern "C" { |
|---|
| 242 | #endif |
|---|
| 243 | |
|---|
| 244 | #define SWIG_PY_INT 1 |
|---|
| 245 | #define SWIG_PY_FLOAT 2 |
|---|
| 246 | #define SWIG_PY_STRING 3 |
|---|
| 247 | #define SWIG_PY_POINTER 4 |
|---|
| 248 | #define SWIG_PY_BINARY 5 |
|---|
| 249 | |
|---|
| 250 | /* Flags for pointer conversion */ |
|---|
| 251 | |
|---|
| 252 | #define SWIG_POINTER_EXCEPTION 0x1 |
|---|
| 253 | #define SWIG_POINTER_DISOWN 0x2 |
|---|
| 254 | |
|---|
| 255 | /* Exception handling in wrappers */ |
|---|
| 256 | #define SWIG_fail goto fail |
|---|
| 257 | |
|---|
| 258 | /* Constant information structure */ |
|---|
| 259 | typedef struct swig_const_info { |
|---|
| 260 | int type; |
|---|
| 261 | char *name; |
|---|
| 262 | long lvalue; |
|---|
| 263 | double dvalue; |
|---|
| 264 | void *pvalue; |
|---|
| 265 | swig_type_info **ptype; |
|---|
| 266 | } swig_const_info; |
|---|
| 267 | |
|---|
| 268 | #ifdef SWIG_NOINCLUDE |
|---|
| 269 | |
|---|
| 270 | SWIGEXPORT(PyObject *) SWIG_newvarlink(); |
|---|
| 271 | SWIGEXPORT(void) SWIG_addvarlink(PyObject *, char *, PyObject *(*)(void), int (*)(PyObject *)); |
|---|
| 272 | SWIGEXPORT(int) SWIG_ConvertPtr(PyObject *, void **, swig_type_info *, int); |
|---|
| 273 | SWIGEXPORT(int) SWIG_ConvertPacked(PyObject *, void *, int sz, swig_type_info *, int); |
|---|
| 274 | SWIGEXPORT(char *) SWIG_PackData(char *c, void *, int); |
|---|
| 275 | SWIGEXPORT(char *) SWIG_UnpackData(char *c, void *, int); |
|---|
| 276 | SWIGEXPORT(PyObject *) SWIG_NewPointerObj(void *, swig_type_info *,int own); |
|---|
| 277 | SWIGEXPORT(PyObject *) SWIG_NewPackedObj(void *, int sz, swig_type_info *); |
|---|
| 278 | SWIGEXPORT(void) SWIG_InstallConstants(PyObject *d, swig_const_info constants[]); |
|---|
| 279 | #else |
|---|
| 280 | |
|---|
| 281 | /* ----------------------------------------------------------------------------- |
|---|
| 282 | * global variable support code. |
|---|
| 283 | * ----------------------------------------------------------------------------- */ |
|---|
| 284 | |
|---|
| 285 | typedef struct swig_globalvar { |
|---|
| 286 | char *name; /* Name of global variable */ |
|---|
| 287 | PyObject *(*get_attr)(void); /* Return the current value */ |
|---|
| 288 | int (*set_attr)(PyObject *); /* Set the value */ |
|---|
| 289 | struct swig_globalvar *next; |
|---|
| 290 | } swig_globalvar; |
|---|
| 291 | |
|---|
| 292 | typedef struct swig_varlinkobject { |
|---|
| 293 | PyObject_HEAD |
|---|
| 294 | swig_globalvar *vars; |
|---|
| 295 | } swig_varlinkobject; |
|---|
| 296 | |
|---|
| 297 | static PyObject * |
|---|
| 298 | swig_varlink_repr(swig_varlinkobject *v) { |
|---|
| 299 | v = v; |
|---|
| 300 | return PyString_FromString("<Global variables>"); |
|---|
| 301 | } |
|---|
| 302 | |
|---|
| 303 | static int |
|---|
| 304 | swig_varlink_print(swig_varlinkobject *v, FILE *fp, int flags) { |
|---|
| 305 | swig_globalvar *var; |
|---|
| 306 | flags = flags; |
|---|
| 307 | fprintf(fp,"Global variables { "); |
|---|
| 308 | for (var = v->vars; var; var=var->next) { |
|---|
| 309 | fprintf(fp,"%s", var->name); |
|---|
| 310 | if (var->next) fprintf(fp,", "); |
|---|
| 311 | } |
|---|
| 312 | fprintf(fp," }\n"); |
|---|
| 313 | return 0; |
|---|
| 314 | } |
|---|
| 315 | |
|---|
| 316 | static PyObject * |
|---|
| 317 | swig_varlink_getattr(swig_varlinkobject *v, char *n) { |
|---|
| 318 | swig_globalvar *var = v->vars; |
|---|
| 319 | while (var) { |
|---|
| 320 | if (strcmp(var->name,n) == 0) { |
|---|
| 321 | return (*var->get_attr)(); |
|---|
| 322 | } |
|---|
| 323 | var = var->next; |
|---|
| 324 | } |
|---|
| 325 | PyErr_SetString(PyExc_NameError,"Unknown C global variable"); |
|---|
| 326 | return NULL; |
|---|
| 327 | } |
|---|
| 328 | |
|---|
| 329 | static int |
|---|
| 330 | swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) { |
|---|
| 331 | swig_globalvar *var = v->vars; |
|---|
| 332 | while (var) { |
|---|
| 333 | if (strcmp(var->name,n) == 0) { |
|---|
| 334 | return (*var->set_attr)(p); |
|---|
| 335 | } |
|---|
| 336 | var = var->next; |
|---|
| 337 | } |
|---|
| 338 | PyErr_SetString(PyExc_NameError,"Unknown C global variable"); |
|---|
| 339 | return 1; |
|---|
| 340 | } |
|---|
| 341 | |
|---|
| 342 | statichere PyTypeObject varlinktype = { |
|---|
| 343 | PyObject_HEAD_INIT(0) |
|---|
| 344 | 0, |
|---|
| 345 | (char *)"swigvarlink", /* Type name */ |
|---|
| 346 | sizeof(swig_varlinkobject), /* Basic size */ |
|---|
| 347 | 0, /* Itemsize */ |
|---|
| 348 | 0, /* Deallocator */ |
|---|
| 349 | (printfunc) swig_varlink_print, /* Print */ |
|---|
| 350 | (getattrfunc) swig_varlink_getattr, /* get attr */ |
|---|
| 351 | (setattrfunc) swig_varlink_setattr, /* Set attr */ |
|---|
| 352 | 0, /* tp_compare */ |
|---|
| 353 | (reprfunc) swig_varlink_repr, /* tp_repr */ |
|---|
| 354 | 0, /* tp_as_number */ |
|---|
| 355 | 0, /* tp_as_mapping*/ |
|---|
| 356 | 0, /* tp_hash */ |
|---|
| 357 | }; |
|---|
| 358 | |
|---|
| 359 | /* Create a variable linking object for use later */ |
|---|
| 360 | SWIGRUNTIME(PyObject *) |
|---|
| 361 | SWIG_newvarlink(void) { |
|---|
| 362 | swig_varlinkobject *result = 0; |
|---|
| 363 | result = PyMem_NEW(swig_varlinkobject,1); |
|---|
| 364 | varlinktype.ob_type = &PyType_Type; /* Patch varlinktype into a PyType */ |
|---|
| 365 | result->ob_type = &varlinktype; |
|---|
| 366 | result->vars = 0; |
|---|
| 367 | result->ob_refcnt = 0; |
|---|
| 368 | Py_XINCREF((PyObject *) result); |
|---|
| 369 | return ((PyObject*) result); |
|---|
| 370 | } |
|---|
| 371 | |
|---|
| 372 | SWIGRUNTIME(void) |
|---|
| 373 | SWIG_addvarlink(PyObject *p, char *name, |
|---|
| 374 | PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) { |
|---|
| 375 | swig_varlinkobject *v; |
|---|
| 376 | swig_globalvar *gv; |
|---|
| 377 | v= (swig_varlinkobject *) p; |
|---|
| 378 | gv = (swig_globalvar *) malloc(sizeof(swig_globalvar)); |
|---|
| 379 | gv->name = (char *) malloc(strlen(name)+1); |
|---|
| 380 | strcpy(gv->name,name); |
|---|
| 381 | gv->get_attr = get_attr; |
|---|
| 382 | gv->set_attr = set_attr; |
|---|
| 383 | gv->next = v->vars; |
|---|
| 384 | v->vars = gv; |
|---|
| 385 | } |
|---|
| 386 | |
|---|
| 387 | /* Pack binary data into a string */ |
|---|
| 388 | SWIGRUNTIME(char *) |
|---|
| 389 | SWIG_PackData(char *c, void *ptr, int sz) { |
|---|
| 390 | static char hex[17] = "0123456789abcdef"; |
|---|
| 391 | int i; |
|---|
| 392 | unsigned char *u = (unsigned char *) ptr; |
|---|
| 393 | register unsigned char uu; |
|---|
| 394 | for (i = 0; i < sz; i++,u++) { |
|---|
| 395 | uu = *u; |
|---|
| 396 | *(c++) = hex[(uu & 0xf0) >> 4]; |
|---|
| 397 | *(c++) = hex[uu & 0xf]; |
|---|
| 398 | } |
|---|
| 399 | return c; |
|---|
| 400 | } |
|---|
| 401 | |
|---|
| 402 | /* Unpack binary data from a string */ |
|---|
| 403 | SWIGRUNTIME(char *) |
|---|
| 404 | SWIG_UnpackData(char *c, void *ptr, int sz) { |
|---|
| 405 | register unsigned char uu = 0; |
|---|
| 406 | register int d; |
|---|
| 407 | unsigned char *u = (unsigned char *) ptr; |
|---|
| 408 | int i; |
|---|
| 409 | for (i = 0; i < sz; i++, u++) { |
|---|
| 410 | d = *(c++); |
|---|
| 411 | if ((d >= '0') && (d <= '9')) |
|---|
| 412 | uu = ((d - '0') << 4); |
|---|
| 413 | else if ((d >= 'a') && (d <= 'f')) |
|---|
| 414 | uu = ((d - ('a'-10)) << 4); |
|---|
| 415 | d = *(c++); |
|---|
| 416 | if ((d >= '0') && (d <= '9')) |
|---|
| 417 | uu |= (d - '0'); |
|---|
| 418 | else if ((d >= 'a') && (d <= 'f')) |
|---|
| 419 | uu |= (d - ('a'-10)); |
|---|
| 420 | *u = uu; |
|---|
| 421 | } |
|---|
| 422 | return c; |
|---|
| 423 | } |
|---|
| 424 | |
|---|
| 425 | /* Convert a pointer value */ |
|---|
| 426 | SWIGRUNTIME(int) |
|---|
| 427 | SWIG_ConvertPtr(PyObject *obj, void **ptr, swig_type_info *ty, int flags) { |
|---|
| 428 | swig_type_info *tc; |
|---|
| 429 | char *c; |
|---|
| 430 | static PyObject *SWIG_this = 0; |
|---|
| 431 | int newref = 0; |
|---|
| 432 | PyObject *pyobj = 0; |
|---|
| 433 | |
|---|
| 434 | if (!obj) return 0; |
|---|
| 435 | if (obj == Py_None) { |
|---|
| 436 | *ptr = 0; |
|---|
| 437 | return 0; |
|---|
| 438 | } |
|---|
| 439 | #ifdef SWIG_COBJECT_TYPES |
|---|
| 440 | if (!(PyCObject_Check(obj))) { |
|---|
| 441 | if (!SWIG_this) |
|---|
| 442 | SWIG_this = PyString_FromString("this"); |
|---|
| 443 | pyobj = obj; |
|---|
| 444 | obj = PyObject_GetAttr(obj,SWIG_this); |
|---|
| 445 | newref = 1; |
|---|
| 446 | if (!obj) goto type_error; |
|---|
| 447 | if (!PyCObject_Check(obj)) { |
|---|
| 448 | Py_DECREF(obj); |
|---|
| 449 | goto type_error; |
|---|
| 450 | } |
|---|
| 451 | } |
|---|
| 452 | *ptr = PyCObject_AsVoidPtr(obj); |
|---|
| 453 | c = (char *) PyCObject_GetDesc(obj); |
|---|
| 454 | if (newref) Py_DECREF(obj); |
|---|
| 455 | goto cobject; |
|---|
| 456 | #else |
|---|
| 457 | if (!(PyString_Check(obj))) { |
|---|
| 458 | if (!SWIG_this) |
|---|
| 459 | SWIG_this = PyString_FromString("this"); |
|---|
| 460 | pyobj = obj; |
|---|
| 461 | obj = PyObject_GetAttr(obj,SWIG_this); |
|---|
| 462 | newref = 1; |
|---|
| 463 | if (!obj) goto type_error; |
|---|
| 464 | if (!PyString_Check(obj)) { |
|---|
| 465 | Py_DECREF(obj); |
|---|
| 466 | goto type_error; |
|---|
| 467 | } |
|---|
| 468 | } |
|---|
| 469 | c = PyString_AsString(obj); |
|---|
| 470 | /* Pointer values must start with leading underscore */ |
|---|
| 471 | if (*c != '_') { |
|---|
| 472 | *ptr = (void *) 0; |
|---|
| 473 | if (strcmp(c,"NULL") == 0) { |
|---|
| 474 | if (newref) { Py_DECREF(obj); } |
|---|
| 475 | return 0; |
|---|
| 476 | } else { |
|---|
| 477 | if (newref) { Py_DECREF(obj); } |
|---|
| 478 | goto type_error; |
|---|
| 479 | } |
|---|
| 480 | } |
|---|
| 481 | c++; |
|---|
| 482 | c = SWIG_UnpackData(c,ptr,sizeof(void *)); |
|---|
| 483 | if (newref) { Py_DECREF(obj); } |
|---|
| 484 | #endif |
|---|
| 485 | |
|---|
| 486 | #ifdef SWIG_COBJECT_TYPES |
|---|
| 487 | cobject: |
|---|
| 488 | #endif |
|---|
| 489 | |
|---|
| 490 | if (ty) { |
|---|
| 491 | tc = SWIG_TypeCheck(c,ty); |
|---|
| 492 | if (!tc) goto type_error; |
|---|
| 493 | *ptr = SWIG_TypeCast(tc,(void*) *ptr); |
|---|
| 494 | } |
|---|
| 495 | |
|---|
| 496 | if ((pyobj) && (flags & SWIG_POINTER_DISOWN)) { |
|---|
| 497 | PyObject *zero = PyInt_FromLong(0); |
|---|
| 498 | PyObject_SetAttrString(pyobj,(char*)"thisown",zero); |
|---|
| 499 | Py_DECREF(zero); |
|---|
| 500 | } |
|---|
| 501 | return 0; |
|---|
| 502 | |
|---|
| 503 | type_error: |
|---|
| 504 | if (flags & SWIG_POINTER_EXCEPTION) { |
|---|
| 505 | if (ty) { |
|---|
| 506 | char *temp = (char *) malloc(64+strlen(ty->name)); |
|---|
| 507 | sprintf(temp,"Type error. Expected %s", ty->name); |
|---|
| 508 | PyErr_SetString(PyExc_TypeError, temp); |
|---|
| 509 | free((char *) temp); |
|---|
| 510 | } else { |
|---|
| 511 | PyErr_SetString(PyExc_TypeError,"Expected a pointer"); |
|---|
| 512 | } |
|---|
| 513 | } |
|---|
| 514 | return -1; |
|---|
| 515 | } |
|---|
| 516 | |
|---|
| 517 | /* Convert a packed value value */ |
|---|
| 518 | SWIGRUNTIME(int) |
|---|
| 519 | SWIG_ConvertPacked(PyObject *obj, void *ptr, int sz, swig_type_info *ty, int flags) { |
|---|
| 520 | swig_type_info *tc; |
|---|
| 521 | char *c; |
|---|
| 522 | |
|---|
| 523 | if ((!obj) || (!PyString_Check(obj))) goto type_error; |
|---|
| 524 | c = PyString_AsString(obj); |
|---|
| 525 | /* Pointer values must start with leading underscore */ |
|---|
| 526 | if (*c != '_') goto type_error; |
|---|
| 527 | c++; |
|---|
| 528 | c = SWIG_UnpackData(c,ptr,sz); |
|---|
| 529 | if (ty) { |
|---|
| 530 | tc = SWIG_TypeCheck(c,ty); |
|---|
| 531 | if (!tc) goto type_error; |
|---|
| 532 | } |
|---|
| 533 | return 0; |
|---|
| 534 | |
|---|
| 535 | type_error: |
|---|
| 536 | |
|---|
| 537 | if (flags) { |
|---|
| 538 | if (ty) { |
|---|
| 539 | char *temp = (char *) malloc(64+strlen(ty->name)); |
|---|
| 540 | sprintf(temp,"Type error. Expected %s", ty->name); |
|---|
| 541 | PyErr_SetString(PyExc_TypeError, temp); |
|---|
| 542 | free((char *) temp); |
|---|
| 543 | } else { |
|---|
| 544 | PyErr_SetString(PyExc_TypeError,"Expected a pointer"); |
|---|
| 545 | } |
|---|
| 546 | } |
|---|
| 547 | return -1; |
|---|
| 548 | } |
|---|
| 549 | |
|---|
| 550 | /* Create a new pointer object */ |
|---|
| 551 | SWIGRUNTIME(PyObject *) |
|---|
| 552 | SWIG_NewPointerObj(void *ptr, swig_type_info *type, int own) { |
|---|
| 553 | PyObject *robj; |
|---|
| 554 | if (!ptr) { |
|---|
| 555 | Py_INCREF(Py_None); |
|---|
| 556 | return Py_None; |
|---|
| 557 | } |
|---|
| 558 | #ifdef SWIG_COBJECT_TYPES |
|---|
| 559 | robj = PyCObject_FromVoidPtrAndDesc((void *) ptr, (char *) type->name, NULL); |
|---|
| 560 | #else |
|---|
| 561 | { |
|---|
| 562 | char result[1024]; |
|---|
| 563 | char *r = result; |
|---|
| 564 | *(r++) = '_'; |
|---|
| 565 | r = SWIG_PackData(r,&ptr,sizeof(void *)); |
|---|
| 566 | strcpy(r,type->name); |
|---|
| 567 | robj = PyString_FromString(result); |
|---|
| 568 | } |
|---|
| 569 | #endif |
|---|
| 570 | if (!robj || (robj == Py_None)) return robj; |
|---|
| 571 | if (type->clientdata) { |
|---|
| 572 | PyObject *inst; |
|---|
| 573 | PyObject *args = Py_BuildValue((char*)"(O)", robj); |
|---|
| 574 | Py_DECREF(robj); |
|---|
| 575 | inst = PyObject_CallObject((PyObject *) type->clientdata, args); |
|---|
| 576 | Py_DECREF(args); |
|---|
| 577 | if (inst) { |
|---|
| 578 | if (own) { |
|---|
| 579 | PyObject *n = PyInt_FromLong(1); |
|---|
| 580 | PyObject_SetAttrString(inst,(char*)"thisown",n); |
|---|
| 581 | Py_DECREF(n); |
|---|
| 582 | } |
|---|
| 583 | robj = inst; |
|---|
| 584 | } |
|---|
| 585 | } |
|---|
| 586 | return robj; |
|---|
| 587 | } |
|---|
| 588 | |
|---|
| 589 | SWIGRUNTIME(PyObject *) |
|---|
| 590 | SWIG_NewPackedObj(void *ptr, int sz, swig_type_info *type) { |
|---|
| 591 | char result[1024]; |
|---|
| 592 | char *r = result; |
|---|
| 593 | if ((2*sz + 1 + strlen(type->name)) > 1000) return 0; |
|---|
| 594 | *(r++) = '_'; |
|---|
| 595 | r = SWIG_PackData(r,ptr,sz); |
|---|
| 596 | strcpy(r,type->name); |
|---|
| 597 | return PyString_FromString(result); |
|---|
| 598 | } |
|---|
| 599 | |
|---|
| 600 | /* Install Constants */ |
|---|
| 601 | SWIGRUNTIME(void) |
|---|
| 602 | SWIG_InstallConstants(PyObject *d, swig_const_info constants[]) { |
|---|
| 603 | int i; |
|---|
| 604 | PyObject *obj; |
|---|
| 605 | for (i = 0; constants[i].type; i++) { |
|---|
| 606 | switch(constants[i].type) { |
|---|
| 607 | case SWIG_PY_INT: |
|---|
| 608 | obj = PyInt_FromLong(constants[i].lvalue); |
|---|
| 609 | break; |
|---|
| 610 | case SWIG_PY_FLOAT: |
|---|
| 611 | obj = PyFloat_FromDouble(constants[i].dvalue); |
|---|
| 612 | break; |
|---|
| 613 | case SWIG_PY_STRING: |
|---|
| 614 | obj = PyString_FromString((char *) constants[i].pvalue); |
|---|
| 615 | break; |
|---|
| 616 | case SWIG_PY_POINTER: |
|---|
| 617 | obj = SWIG_NewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0); |
|---|
| 618 | break; |
|---|
| 619 | case SWIG_PY_BINARY: |
|---|
| 620 | obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype)); |
|---|
| 621 | break; |
|---|
| 622 | default: |
|---|
| 623 | obj = 0; |
|---|
| 624 | break; |
|---|
| 625 | } |
|---|
| 626 | if (obj) { |
|---|
| 627 | PyDict_SetItemString(d,constants[i].name,obj); |
|---|
| 628 | Py_DECREF(obj); |
|---|
| 629 | } |
|---|
| 630 | } |
|---|
| 631 | } |
|---|
| 632 | |
|---|
| 633 | #endif |
|---|
| 634 | |
|---|
| 635 | #ifdef __cplusplus |
|---|
| 636 | } |
|---|
| 637 | #endif |
|---|
| 638 | |
|---|
| 639 | |
|---|
| 640 | |
|---|
| 641 | |
|---|
| 642 | |
|---|
| 643 | |
|---|
| 644 | |
|---|
| 645 | |
|---|
| 646 | /* -------- TYPES TABLE (BEGIN) -------- */ |
|---|
| 647 | |
|---|
| 648 | #define SWIGTYPE_p_nodeN swig_types[0] |
|---|
| 649 | #define SWIGTYPE_p_NodeStack swig_types[1] |
|---|
| 650 | #define SWIGTYPE_p_Node swig_types[2] |
|---|
| 651 | #define SWIGTYPE_p_IntStack swig_types[3] |
|---|
| 652 | #define SWIGTYPE_p_PyObject swig_types[4] |
|---|
| 653 | #define SWIGTYPE_p_Cursor swig_types[5] |
|---|
| 654 | #define SWIGTYPE_p_intN swig_types[6] |
|---|
| 655 | #define SWIGTYPE_p_SGFError swig_types[7] |
|---|
| 656 | static swig_type_info *swig_types[9]; |
|---|
| 657 | |
|---|
| 658 | /* -------- TYPES TABLE (END) -------- */ |
|---|
| 659 | |
|---|
| 660 | |
|---|
| 661 | /*----------------------------------------------- |
|---|
| 662 | @(target):= _sgfpars.so |
|---|
| 663 | ------------------------------------------------*/ |
|---|
| 664 | #define SWIG_init init_sgfpars |
|---|
| 665 | |
|---|
| 666 | #define SWIG_name "_sgfpars" |
|---|
| 667 | |
|---|
| 668 | #include "sgfpars.h" |
|---|
| 669 | |
|---|
| 670 | #ifdef __cplusplus |
|---|
| 671 | extern "C" { |
|---|
| 672 | #endif |
|---|
| 673 | static PyObject *_wrap_new_SGFError(PyObject *self, PyObject *args) { |
|---|
| 674 | PyObject *resultobj; |
|---|
| 675 | SGFError *result; |
|---|
| 676 | |
|---|
| 677 | if(!PyArg_ParseTuple(args,(char *)":new_SGFError")) goto fail; |
|---|
| 678 | { |
|---|
| 679 | try { |
|---|
| 680 | result = (SGFError *)new SGFError(); |
|---|
| 681 | |
|---|
| 682 | }catch(SGFError e) { |
|---|
| 683 | SGFError *ecopy = new SGFError(e); |
|---|
| 684 | PyObject *err = SWIG_NewPointerObj(ecopy, SWIGTYPE_p_SGFError, 1); |
|---|
| 685 | PyErr_SetObject((PyObject *) SWIGTYPE_p_SGFError->clientdata, err); |
|---|
| 686 | return NULL; |
|---|
| 687 | } |
|---|
| 688 | } |
|---|
| 689 | resultobj = SWIG_NewPointerObj((void *) result, SWIGTYPE_p_SGFError, 1); |
|---|
| 690 | return resultobj; |
|---|
| 691 | fail: |
|---|
| 692 | return NULL; |
|---|
| 693 | } |
|---|
| 694 | |
|---|
| 695 | |
|---|
| 696 | static PyObject *_wrap_delete_SGFError(PyObject *self, PyObject *args) { |
|---|
| 697 | PyObject *resultobj; |
|---|
| 698 | SGFError *arg1 = (SGFError *) 0 ; |
|---|
| 699 | PyObject * obj0 = 0 ; |
|---|
| 700 | |
|---|
| 701 | if(!PyArg_ParseTuple(args,(char *)"O:delete_SGFError",&obj0)) goto fail; |
|---|
| 702 | if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_SGFError,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; |
|---|
| 703 | { |
|---|
| 704 | try { |
|---|
| 705 | delete arg1; |
|---|
| 706 | |
|---|
| 707 | }catch(SGFError e) { |
|---|
| 708 | SGFError *ecopy = new SGFError(e); |
|---|
| 709 | PyObject *err = SWIG_NewPointerObj(ecopy, SWIGTYPE_p_SGFError, 1); |
|---|
| 710 | PyErr_SetObject((PyObject *) SWIGTYPE_p_SGFError->clientdata, err); |
|---|
| 711 | return NULL; |
|---|
| 712 | } |
|---|
| 713 | } |
|---|
| 714 | Py_INCREF(Py_None); resultobj = Py_None; |
|---|
| 715 | return resultobj; |
|---|
| 716 | fail: |
|---|
| 717 | return NULL; |
|---|
| 718 | } |
|---|
| 719 | |
|---|
| 720 | |
|---|
| 721 | static PyObject * SGFError_swigregister(PyObject *self, PyObject *args) { |
|---|
| 722 | PyObject *obj; |
|---|
| 723 | if (!PyArg_ParseTuple(args,(char*)"O", &obj)) return NULL; |
|---|
| 724 | SWIG_TypeClientData(SWIGTYPE_p_SGFError, obj); |
|---|
| 725 | Py_INCREF(obj); |
|---|
| 726 | return Py_BuildValue((char *)""); |
|---|
| 727 | } |
|---|
| 728 | static PyObject *_wrap_SGFescape(PyObject *self, PyObject *args) { |
|---|
| 729 | PyObject *resultobj; |
|---|
| 730 | char *arg1 ; |
|---|
| 731 | char *result; |
|---|
| 732 | |
|---|
| 733 | if(!PyArg_ParseTuple(args,(char *)"s:SGFescape",&arg1)) goto fail; |
|---|
| 734 | { |
|---|
| 735 | try { |
|---|
| 736 | result = (char *)SGFescape(arg1); |
|---|
| 737 | |
|---|
| 738 | }catch(SGFError e) { |
|---|
| 739 | SGFError *ecopy = new SGFError(e); |
|---|
| 740 | PyObject *err = SWIG_NewPointerObj(ecopy, SWIGTYPE_p_SGFError, 1); |
|---|
| 741 | PyErr_SetObject((PyObject *) SWIGTYPE_p_SGFError->clientdata, err); |
|---|
| 742 | return NULL; |
|---|
| 743 | } |
|---|
| 744 | } |
|---|
| 745 | resultobj = result ? PyString_FromString(result) : Py_BuildValue((char*)""); |
|---|
| 746 | return resultobj; |
|---|
| 747 | fail: |
|---|
| 748 | return NULL; |
|---|
| 749 | } |
|---|
| 750 | |
|---|
| 751 | |
|---|
| 752 | static PyObject *_wrap_Node_previous_set(PyObject *self, PyObject *args) { |
|---|
| 753 | |
|---|