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