1 |
/* ---------------------------------------------------------------------------- |
2 |
* This file was automatically generated by SWIG (http://www.swig.org). |
3 |
* Version 1.3.25 |
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 |
* |
14 |
* This section contains generic SWIG labels for method/variable |
15 |
* declarations/attributes, and other compiler dependent labels. |
16 |
* |
17 |
************************************************************************/ |
18 |
|
19 |
/* template workaround for compilers that cannot correctly implement the C++ standard */ |
20 |
#ifndef SWIGTEMPLATEDISAMBIGUATOR |
21 |
# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) |
22 |
# define SWIGTEMPLATEDISAMBIGUATOR template |
23 |
# else |
24 |
# define SWIGTEMPLATEDISAMBIGUATOR |
25 |
# endif |
26 |
#endif |
27 |
|
28 |
/* inline attribute */ |
29 |
#ifndef SWIGINLINE |
30 |
# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) |
31 |
# define SWIGINLINE inline |
32 |
# else |
33 |
# define SWIGINLINE |
34 |
# endif |
35 |
#endif |
36 |
|
37 |
/* attribute recognised by some compilers to avoid 'unused' warnings */ |
38 |
#ifndef SWIGUNUSED |
39 |
# if defined(__GNUC__) || defined(__ICC) |
40 |
# define SWIGUNUSED __attribute__ ((unused)) |
41 |
# else |
42 |
# define SWIGUNUSED |
43 |
# endif |
44 |
#endif |
45 |
|
46 |
/* internal SWIG method */ |
47 |
#ifndef SWIGINTERN |
48 |
# define SWIGINTERN static SWIGUNUSED |
49 |
#endif |
50 |
|
51 |
/* internal inline SWIG method */ |
52 |
#ifndef SWIGINTERNINLINE |
53 |
# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE |
54 |
#endif |
55 |
|
56 |
/* exporting methods for Windows DLLs */ |
57 |
#ifndef SWIGEXPORT |
58 |
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) |
59 |
# if defined(STATIC_LINKED) |
60 |
# define SWIGEXPORT |
61 |
# else |
62 |
# define SWIGEXPORT __declspec(dllexport) |
63 |
# endif |
64 |
# else |
65 |
# define SWIGEXPORT |
66 |
# endif |
67 |
#endif |
68 |
|
69 |
/* calling conventions for Windows */ |
70 |
#ifndef SWIGSTDCALL |
71 |
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) |
72 |
# define SWIGSTDCALL __stdcall |
73 |
# else |
74 |
# define SWIGSTDCALL |
75 |
# endif |
76 |
#endif |
77 |
|
78 |
|
79 |
|
80 |
#include <Python.h> |
81 |
|
82 |
/*********************************************************************** |
83 |
* swigrun.swg |
84 |
* |
85 |
* This file contains generic CAPI SWIG runtime support for pointer |
86 |
* type checking. |
87 |
* |
88 |
************************************************************************/ |
89 |
|
90 |
/* This should only be incremented when either the layout of swig_type_info changes, |
91 |
or for whatever reason, the runtime changes incompatibly */ |
92 |
#define SWIG_RUNTIME_VERSION "2" |
93 |
|
94 |
/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ |
95 |
#ifdef SWIG_TYPE_TABLE |
96 |
# define SWIG_QUOTE_STRING(x) #x |
97 |
# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x) |
98 |
# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE) |
99 |
#else |
100 |
# define SWIG_TYPE_TABLE_NAME |
101 |
#endif |
102 |
|
103 |
/* |
104 |
You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for |
105 |
creating a static or dynamic library from the swig runtime code. |
106 |
In 99.9% of the cases, swig just needs to declare them as 'static'. |
107 |
|
108 |
But only do this if is strictly necessary, ie, if you have problems |
109 |
with your compiler or so. |
110 |
*/ |
111 |
|
112 |
#ifndef SWIGRUNTIME |
113 |
# define SWIGRUNTIME SWIGINTERN |
114 |
#endif |
115 |
|
116 |
#ifndef SWIGRUNTIMEINLINE |
117 |
# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE |
118 |
#endif |
119 |
|
120 |
#include <string.h> |
121 |
|
122 |
#ifdef __cplusplus |
123 |
extern "C" { |
124 |
#endif |
125 |
|
126 |
typedef void *(*swig_converter_func)(void *); |
127 |
typedef struct swig_type_info *(*swig_dycast_func)(void **); |
128 |
|
129 |
/* Structure to store inforomation on one type */ |
130 |
typedef struct swig_type_info { |
131 |
const char *name; /* mangled name of this type */ |
132 |
const char *str; /* human readable name of this type */ |
133 |
swig_dycast_func dcast; /* dynamic cast function down a hierarchy */ |
134 |
struct swig_cast_info *cast; /* linked list of types that can cast into this type */ |
135 |
void *clientdata; /* language specific type data */ |
136 |
} swig_type_info; |
137 |
|
138 |
/* Structure to store a type and conversion function used for casting */ |
139 |
typedef struct swig_cast_info { |
140 |
swig_type_info *type; /* pointer to type that is equivalent to this type */ |
141 |
swig_converter_func converter; /* function to cast the void pointers */ |
142 |
struct swig_cast_info *next; /* pointer to next cast in linked list */ |
143 |
struct swig_cast_info *prev; /* pointer to the previous cast */ |
144 |
} swig_cast_info; |
145 |
|
146 |
/* Structure used to store module information |
147 |
* Each module generates one structure like this, and the runtime collects |
148 |
* all of these structures and stores them in a circularly linked list.*/ |
149 |
typedef struct swig_module_info { |
150 |
swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */ |
151 |
size_t size; /* Number of types in this module */ |
152 |
struct swig_module_info *next; /* Pointer to next element in circularly linked list */ |
153 |
swig_type_info **type_initial; /* Array of initially generated type structures */ |
154 |
swig_cast_info **cast_initial; /* Array of initially generated casting structures */ |
155 |
void *clientdata; /* Language specific module data */ |
156 |
} swig_module_info; |
157 |
|
158 |
|
159 |
/* |
160 |
Compare two type names skipping the space characters, therefore |
161 |
"char*" == "char *" and "Class<int>" == "Class<int >", etc. |
162 |
|
163 |
Return 0 when the two name types are equivalent, as in |
164 |
strncmp, but skipping ' '. |
165 |
*/ |
166 |
SWIGRUNTIME int |
167 |
SWIG_TypeNameComp(const char *f1, const char *l1, |
168 |
const char *f2, const char *l2) { |
169 |
for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) { |
170 |
while ((*f1 == ' ') && (f1 != l1)) ++f1; |
171 |
while ((*f2 == ' ') && (f2 != l2)) ++f2; |
172 |
if (*f1 != *f2) return (int)(*f1 - *f2); |
173 |
} |
174 |
return (l1 - f1) - (l2 - f2); |
175 |
} |
176 |
|
177 |
/* |
178 |
Check type equivalence in a name list like <name1>|<name2>|... |
179 |
Return 0 if not equal, 1 if equal |
180 |
*/ |
181 |
SWIGRUNTIME int |
182 |
SWIG_TypeEquiv(const char *nb, const char *tb) { |
183 |
int equiv = 0; |
184 |
const char* te = tb + strlen(tb); |
185 |
const char* ne = nb; |
186 |
while (!equiv && *ne) { |
187 |
for (nb = ne; *ne; ++ne) { |
188 |
if (*ne == '|') break; |
189 |
} |
190 |
equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; |
191 |
if (*ne) ++ne; |
192 |
} |
193 |
return equiv; |
194 |
} |
195 |
|
196 |
/* |
197 |
Check type equivalence in a name list like <name1>|<name2>|... |
198 |
Return 0 if equal, -1 if nb < tb, 1 if nb > tb |
199 |
*/ |
200 |
SWIGRUNTIME int |
201 |
SWIG_TypeCompare(const char *nb, const char *tb) { |
202 |
int equiv = 0; |
203 |
const char* te = tb + strlen(tb); |
204 |
const char* ne = nb; |
205 |
while (!equiv && *ne) { |
206 |
for (nb = ne; *ne; ++ne) { |
207 |
if (*ne == '|') break; |
208 |
} |
209 |
equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; |
210 |
if (*ne) ++ne; |
211 |
} |
212 |
return equiv; |
213 |
} |
214 |
|
215 |
|
216 |
/* think of this as a c++ template<> or a scheme macro */ |
217 |
#define SWIG_TypeCheck_Template(comparison, ty) \ |
218 |
if (ty) { \ |
219 |
swig_cast_info *iter = ty->cast; \ |
220 |
while (iter) { \ |
221 |
if (comparison) { \ |
222 |
if (iter == ty->cast) return iter; \ |
223 |
/* Move iter to the top of the linked list */ \ |
224 |
iter->prev->next = iter->next; \ |
225 |
if (iter->next) \ |
226 |
iter->next->prev = iter->prev; \ |
227 |
iter->next = ty->cast; \ |
228 |
iter->prev = 0; \ |
229 |
if (ty->cast) ty->cast->prev = iter; \ |
230 |
ty->cast = iter; \ |
231 |
return iter; \ |
232 |
} \ |
233 |
iter = iter->next; \ |
234 |
} \ |
235 |
} \ |
236 |
return 0 |
237 |
|
238 |
/* |
239 |
Check the typename |
240 |
*/ |
241 |
SWIGRUNTIME swig_cast_info * |
242 |
SWIG_TypeCheck(const char *c, swig_type_info *ty) { |
243 |
SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty); |
244 |
} |
245 |
|
246 |
/* Same as previous function, except strcmp is replaced with a pointer comparison */ |
247 |
SWIGRUNTIME swig_cast_info * |
248 |
SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) { |
249 |
SWIG_TypeCheck_Template(iter->type == from, into); |
250 |
} |
251 |
|
252 |
/* |
253 |
Cast a pointer up an inheritance hierarchy |
254 |
*/ |
255 |
SWIGRUNTIMEINLINE void * |
256 |
SWIG_TypeCast(swig_cast_info *ty, void *ptr) { |
257 |
return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr); |
258 |
} |
259 |
|
260 |
/* |
261 |
Dynamic pointer casting. Down an inheritance hierarchy |
262 |
*/ |
263 |
SWIGRUNTIME swig_type_info * |
264 |
SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) { |
265 |
swig_type_info *lastty = ty; |
266 |
if (!ty || !ty->dcast) return ty; |
267 |
while (ty && (ty->dcast)) { |
268 |
ty = (*ty->dcast)(ptr); |
269 |
if (ty) lastty = ty; |
270 |
} |
271 |
return lastty; |
272 |
} |
273 |
|
274 |
/* |
275 |
Return the name associated with this type |
276 |
*/ |
277 |
SWIGRUNTIMEINLINE const char * |
278 |
SWIG_TypeName(const swig_type_info *ty) { |
279 |
return ty->name; |
280 |
} |
281 |
|
282 |
/* |
283 |
Return the pretty name associated with this type, |
284 |
that is an unmangled type name in a form presentable to the user. |
285 |
*/ |
286 |
SWIGRUNTIME const char * |
287 |
SWIG_TypePrettyName(const swig_type_info *type) { |
288 |
/* The "str" field contains the equivalent pretty names of the |
289 |
type, separated by vertical-bar characters. We choose |
290 |
to print the last name, as it is often (?) the most |
291 |
specific. */ |
292 |
if (type->str != NULL) { |
293 |
const char *last_name = type->str; |
294 |
const char *s; |
295 |
for (s = type->str; *s; s++) |
296 |
if (*s == '|') last_name = s+1; |
297 |
return last_name; |
298 |
} |
299 |
else |
300 |
return type->name; |
301 |
} |
302 |
|
303 |
/* |
304 |
Set the clientdata field for a type |
305 |
*/ |
306 |
SWIGRUNTIME void |
307 |
SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { |
308 |
if (!ti->clientdata) { |
309 |
swig_cast_info *cast = ti->cast; |
310 |
/* if (ti->clientdata == clientdata) return; */ |
311 |
ti->clientdata = clientdata; |
312 |
|
313 |
while (cast) { |
314 |
if (!cast->converter) |
315 |
SWIG_TypeClientData(cast->type, clientdata); |
316 |
cast = cast->next; |
317 |
} |
318 |
} |
319 |
} |
320 |
|
321 |
/* |
322 |
Search for a swig_type_info structure only by mangled name |
323 |
Search is a O(log #types) |
324 |
|
325 |
We start searching at module start, and finish searching when start == end. |
326 |
Note: if start == end at the beginning of the function, we go all the way around |
327 |
the circular list. |
328 |
*/ |
329 |
SWIGRUNTIME swig_type_info * |
330 |
SWIG_MangledTypeQueryModule(swig_module_info *start, |
331 |
swig_module_info *end, |
332 |
const char *name) { |
333 |
swig_module_info *iter = start; |
334 |
do { |
335 |
if (iter->size) { |
336 |
register size_t l = 0; |
337 |
register size_t r = iter->size - 1; |
338 |
do { |
339 |
/* since l+r >= 0, we can (>> 1) instead (/ 2) */ |
340 |
register size_t i = (l + r) >> 1; |
341 |
const char *iname = iter->types[i]->name; |
342 |
if (iname) { |
343 |
register int compare = strcmp(name, iname); |
344 |
if (compare == 0) { |
345 |
return iter->types[i]; |
346 |
} else if (compare < 0) { |
347 |
if (i) { |
348 |
r = i - 1; |
349 |
} else { |
350 |
break; |
351 |
} |
352 |
} else if (compare > 0) { |
353 |
l = i + 1; |
354 |
} |
355 |
} else { |
356 |
break; /* should never happen */ |
357 |
} |
358 |
} while (l <= r); |
359 |
} |
360 |
iter = iter->next; |
361 |
} while (iter != end); |
362 |
return 0; |
363 |
} |
364 |
|
365 |
/* |
366 |
Search for a swig_type_info structure for either a mangled name or a human readable name. |
367 |
It first searches the mangled names of the types, which is a O(log #types) |
368 |
If a type is not found it then searches the human readable names, which is O(#types). |
369 |
|
370 |
We start searching at module start, and finish searching when start == end. |
371 |
Note: if start == end at the beginning of the function, we go all the way around |
372 |
the circular list. |
373 |
*/ |
374 |
SWIGRUNTIME swig_type_info * |
375 |
SWIG_TypeQueryModule(swig_module_info *start, |
376 |
swig_module_info *end, |
377 |
const char *name) { |
378 |
/* STEP 1: Search the name field using binary search */ |
379 |
swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name); |
380 |
if (ret) { |
381 |
return ret; |
382 |
} else { |
383 |
/* STEP 2: If the type hasn't been found, do a complete search |
384 |
of the str field (the human readable name) */ |
385 |
swig_module_info *iter = start; |
386 |
do { |
387 |
register size_t i = 0; |
388 |
for (; i < iter->size; ++i) { |
389 |
if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name))) |
390 |
return iter->types[i]; |
391 |
} |
392 |
iter = iter->next; |
393 |
} while (iter != end); |
394 |
} |
395 |
|
396 |
/* neither found a match */ |
397 |
return 0; |
398 |
} |
399 |
|
400 |
|
401 |
/* |
402 |
Pack binary data into a string |
403 |
*/ |
404 |
SWIGRUNTIME char * |
405 |
SWIG_PackData(char *c, void *ptr, size_t sz) { |
406 |
static const char hex[17] = "0123456789abcdef"; |
407 |
register const unsigned char *u = (unsigned char *) ptr; |
408 |
register const unsigned char *eu = u + sz; |
409 |
for (; u != eu; ++u) { |
410 |
register unsigned char uu = *u; |
411 |
*(c++) = hex[(uu & 0xf0) >> 4]; |
412 |
*(c++) = hex[uu & 0xf]; |
413 |
} |
414 |
return c; |
415 |
} |
416 |
|
417 |
/* |
418 |
Unpack binary data from a string |
419 |
*/ |
420 |
SWIGRUNTIME const char * |
421 |
SWIG_UnpackData(const char *c, void *ptr, size_t sz) { |
422 |
register unsigned char *u = (unsigned char *) ptr; |
423 |
register const unsigned char *eu = u + sz; |
424 |
for (; u != eu; ++u) { |
425 |
register char d = *(c++); |
426 |
register unsigned char uu = 0; |
427 |
if ((d >= '0') && (d <= '9')) |
428 |
uu = ((d - '0') << 4); |
429 |
else if ((d >= 'a') && (d <= 'f')) |
430 |
uu = ((d - ('a'-10)) << 4); |
431 |
else |
432 |
return (char *) 0; |
433 |
d = *(c++); |
434 |
if ((d >= '0') && (d <= '9')) |
435 |
uu |= (d - '0'); |
436 |
else if ((d >= 'a') && (d <= 'f')) |
437 |
uu |= (d - ('a'-10)); |
438 |
else |
439 |
return (char *) 0; |
440 |
*u = uu; |
441 |
} |
442 |
return c; |
443 |
} |
444 |
|
445 |
/* |
446 |
Pack 'void *' into a string buffer. |
447 |
*/ |
448 |
SWIGRUNTIME char * |
449 |
SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) { |
450 |
char *r = buff; |
451 |
if ((2*sizeof(void *) + 2) > bsz) return 0; |
452 |
*(r++) = '_'; |
453 |
r = SWIG_PackData(r,&ptr,sizeof(void *)); |
454 |
if (strlen(name) + 1 > (bsz - (r - buff))) return 0; |
455 |
strcpy(r,name); |
456 |
return buff; |
457 |
} |
458 |
|
459 |
SWIGRUNTIME const char * |
460 |
SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) { |
461 |
if (*c != '_') { |
462 |
if (strcmp(c,"NULL") == 0) { |
463 |
*ptr = (void *) 0; |
464 |
return name; |
465 |
} else { |
466 |
return 0; |
467 |
} |
468 |
} |
469 |
return SWIG_UnpackData(++c,ptr,sizeof(void *)); |
470 |
} |
471 |
|
472 |
SWIGRUNTIME char * |
473 |
SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) { |
474 |
char *r = buff; |
475 |
size_t lname = (name ? strlen(name) : 0); |
476 |
if ((2*sz + 2 + lname) > bsz) return 0; |
477 |
*(r++) = '_'; |
478 |
r = SWIG_PackData(r,ptr,sz); |
479 |
if (lname) { |
480 |
strncpy(r,name,lname+1); |
481 |
} else { |
482 |
*r = 0; |
483 |
} |
484 |
return buff; |
485 |
} |
486 |
|
487 |
SWIGRUNTIME const char * |
488 |
SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { |
489 |
if (*c != '_') { |
490 |
if (strcmp(c,"NULL") == 0) { |
491 |
memset(ptr,0,sz); |
492 |
return name; |
493 |
} else { |
494 |
return 0; |
495 |
} |
496 |
} |
497 |
return SWIG_UnpackData(++c,ptr,sz); |
498 |
} |
499 |
|
500 |
#ifdef __cplusplus |
501 |
} |
502 |
#endif |
503 |
|
504 |
/* ----------------------------------------------------------------------------- |
505 |
* SWIG API. Portion that goes into the runtime |
506 |
* ----------------------------------------------------------------------------- */ |
507 |
|
508 |
#ifdef __cplusplus |
509 |
extern "C" { |
510 |
#endif |
511 |
|
512 |
/* ----------------------------------------------------------------------------- |
513 |
* for internal method declarations |
514 |
* ----------------------------------------------------------------------------- */ |
515 |
|
516 |
#ifndef SWIGINTERN |
517 |
# define SWIGINTERN static SWIGUNUSED |
518 |
#endif |
519 |
|
520 |
#ifndef SWIGINTERNINLINE |
521 |
# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE |
522 |
#endif |
523 |
|
524 |
/* |
525 |
Exception handling in wrappers |
526 |
*/ |
527 |
#define SWIG_fail goto fail |
528 |
#define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg) |
529 |
#define SWIG_append_errmsg(msg) SWIG_Python_AddErrMesg(msg,0) |
530 |
#define SWIG_preppend_errmsg(msg) SWIG_Python_AddErrMesg(msg,1) |
531 |
#define SWIG_type_error(type,obj) SWIG_Python_TypeError(type,obj) |
532 |
#define SWIG_null_ref(type) SWIG_Python_NullRef(type) |
533 |
|
534 |
/* |
535 |
Contract support |
536 |
*/ |
537 |
#define SWIG_contract_assert(expr, msg) \ |
538 |
if (!(expr)) { PyErr_SetString(PyExc_RuntimeError, (char *) msg ); goto fail; } else |
539 |
|
540 |
/* ----------------------------------------------------------------------------- |
541 |
* Constant declarations |
542 |
* ----------------------------------------------------------------------------- */ |
543 |
|
544 |
/* Constant Types */ |
545 |
#define SWIG_PY_INT 1 |
546 |
#define SWIG_PY_FLOAT 2 |
547 |
#define SWIG_PY_STRING 3 |
548 |
#define SWIG_PY_POINTER 4 |
549 |
#define SWIG_PY_BINARY 5 |
550 |
|
551 |
/* Constant information structure */ |
552 |
typedef struct swig_const_info { |
553 |
int type; |
554 |
char *name; |
555 |
long lvalue; |
556 |
double dvalue; |
557 |
void *pvalue; |
558 |
swig_type_info **ptype; |
559 |
} swig_const_info; |
560 |
|
561 |
|
562 |
/* ----------------------------------------------------------------------------- |
563 |
* Alloc. memory flags |
564 |
* ----------------------------------------------------------------------------- */ |
565 |
#define SWIG_OLDOBJ 1 |
566 |
#define SWIG_NEWOBJ SWIG_OLDOBJ + 1 |
567 |
#define SWIG_PYSTR SWIG_NEWOBJ + 1 |
568 |
|
569 |
#ifdef __cplusplus |
570 |
} |
571 |
#endif |
572 |
|
573 |
|
574 |
/*********************************************************************** |
575 |
* pyrun.swg |
576 |
* |
577 |
* This file contains the runtime support for Python modules |
578 |
* and includes code for managing global variables and pointer |
579 |
* type checking. |
580 |
* |
581 |
* Author : David Beazley (beazley@cs.uchicago.edu) |
582 |
************************************************************************/ |
583 |
|
584 |
/* Common SWIG API */ |
585 |
#define SWIG_ConvertPtr(obj, pp, type, flags) SWIG_Python_ConvertPtr(obj, pp, type, flags) |
586 |
#define SWIG_NewPointerObj(p, type, flags) SWIG_Python_NewPointerObj(p, type, flags) |
587 |
#define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags) |
588 |
|
589 |
|
590 |
/* Python-specific SWIG API */ |
591 |
#define SWIG_ConvertPacked(obj, ptr, sz, ty, flags) SWIG_Python_ConvertPacked(obj, ptr, sz, ty, flags) |
592 |
#define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) |
593 |
|
594 |
/* Runtime API */ |
595 |
#define SWIG_GetModule(clientdata) SWIG_Python_GetModule() |
596 |
#define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer) |
597 |
|
598 |
/* ----------------------------------------------------------------------------- |
599 |
* Pointer declarations |
600 |
* ----------------------------------------------------------------------------- */ |
601 |
/* |
602 |
Use SWIG_NO_COBJECT_TYPES to force the use of strings to represent |
603 |
C/C++ pointers in the python side. Very useful for debugging, but |
604 |
not always safe. |
605 |
*/ |
606 |
#if !defined(SWIG_NO_COBJECT_TYPES) && !defined(SWIG_COBJECT_TYPES) |
607 |
# define SWIG_COBJECT_TYPES |
608 |
#endif |
609 |
|
610 |
/* Flags for pointer conversion */ |
611 |
#define SWIG_POINTER_EXCEPTION 0x1 |
612 |
#define SWIG_POINTER_DISOWN 0x2 |
613 |
|
614 |
|
615 |
/* Add PyOS_snprintf for old Pythons */ |
616 |
#if PY_VERSION_HEX < 0x02020000 |
617 |
#define PyOS_snprintf snprintf |
618 |
#endif |
619 |
|
620 |
#ifdef __cplusplus |
621 |
extern "C" { |
622 |
#endif |
623 |
|
624 |
/* ----------------------------------------------------------------------------- |
625 |
* Create a new pointer string |
626 |
* ----------------------------------------------------------------------------- */ |
627 |
#ifndef SWIG_BUFFER_SIZE |
628 |
#define SWIG_BUFFER_SIZE 1024 |
629 |
#endif |
630 |
|
631 |
#if defined(SWIG_COBJECT_TYPES) |
632 |
#if !defined(SWIG_COBJECT_PYTHON) |
633 |
/* ----------------------------------------------------------------------------- |
634 |
* Implements a simple Swig Object type, and use it instead of PyCObject |
635 |
* ----------------------------------------------------------------------------- */ |
636 |
|
637 |
typedef struct { |
638 |
PyObject_HEAD |
639 |
void *ptr; |
640 |
const char *desc; |
641 |
} PySwigObject; |
642 |
|
643 |
/* Declarations for objects of type PySwigObject */ |
644 |
|
645 |
SWIGRUNTIME int |
646 |
PySwigObject_print(PySwigObject *v, FILE *fp, int flags) |
647 |
{ |
648 |
char result[SWIG_BUFFER_SIZE]; |
649 |
flags = flags; |
650 |
if (SWIG_PackVoidPtr(result, v->ptr, v->desc, sizeof(result))) { |
651 |
fputs("<Swig Object at ", fp); fputs(result, fp); fputs(">", fp); |
652 |
return 0; |
653 |
} else { |
654 |
return 1; |
655 |
} |
656 |
} |
657 |
|
658 |
SWIGRUNTIME PyObject * |
659 |
PySwigObject_repr(PySwigObject *v) |
660 |
{ |
661 |
char result[SWIG_BUFFER_SIZE]; |
662 |
return SWIG_PackVoidPtr(result, v->ptr, v->desc, sizeof(result)) ? |
663 |
PyString_FromFormat("<Swig Object at %s>", result) : 0; |
664 |
} |
665 |
|
666 |
SWIGRUNTIME PyObject * |
667 |
PySwigObject_str(PySwigObject *v) |
668 |
{ |
669 |
char result[SWIG_BUFFER_SIZE]; |
670 |
return SWIG_PackVoidPtr(result, v->ptr, v->desc, sizeof(result)) ? |
671 |
PyString_FromString(result) : 0; |
672 |
} |
673 |
|
674 |
SWIGRUNTIME PyObject * |
675 |
PySwigObject_long(PySwigObject *v) |
676 |
{ |
677 |
return PyLong_FromVoidPtr(v->ptr); |
678 |
} |
679 |
|
680 |
SWIGRUNTIME PyObject * |
681 |
PySwigObject_format(const char* fmt, PySwigObject *v) |
682 |
{ |
683 |
PyObject *res = NULL; |
684 |
PyObject *args = PyTuple_New(1); |
685 |
if (args && (PyTuple_SetItem(args, 0, PySwigObject_long(v)) == 0)) { |
686 |
PyObject *ofmt = PyString_FromString(fmt); |
687 |
if (ofmt) { |
688 |
res = PyString_Format(ofmt,args); |
689 |
Py_DECREF(ofmt); |
690 |
} |
691 |
Py_DECREF(args); |
692 |
} |
693 |
return res; |
694 |
} |
695 |
|
696 |
SWIGRUNTIME PyObject * |
697 |
PySwigObject_oct(PySwigObject *v) |
698 |
{ |
699 |
return PySwigObject_format("%o",v); |
700 |
} |
701 |
|
702 |
SWIGRUNTIME PyObject * |
703 |
PySwigObject_hex(PySwigObject *v) |
704 |
{ |
705 |
return PySwigObject_format("%x",v); |
706 |
} |
707 |
|
708 |
SWIGRUNTIME int |
709 |
PySwigObject_compare(PySwigObject *v, PySwigObject *w) |
710 |
{ |
711 |
int c = strcmp(v->desc, w->desc); |
712 |
if (c) { |
713 |
return (c > 0) ? 1 : -1; |
714 |
} else { |
715 |
void *i = v->ptr; |
716 |
void *j = w->ptr; |
717 |
return (i < j) ? -1 : ((i > j) ? 1 : 0); |
718 |
} |
719 |
} |
720 |
|
721 |
SWIGRUNTIME void |
722 |
PySwigObject_dealloc(PySwigObject *self) |
723 |
{ |
724 |
PyObject_DEL(self); |
725 |
} |
726 |
|
727 |
SWIGRUNTIME PyTypeObject* |
728 |
PySwigObject_type(void) { |
729 |
static char pyswigobject_type__doc__[] = |
730 |
"Swig object carries a C/C++ instance pointer"; |
731 |
|
732 |
static PyNumberMethods PySwigObject_as_number = { |
733 |
(binaryfunc)0, /*nb_add*/ |
734 |
(binaryfunc)0, /*nb_subtract*/ |
735 |
(binaryfunc)0, /*nb_multiply*/ |
736 |
(binaryfunc)0, /*nb_divide*/ |
737 |
(binaryfunc)0, /*nb_remainder*/ |
738 |
(binaryfunc)0, /*nb_divmod*/ |
739 |
(ternaryfunc)0,/*nb_power*/ |
740 |
(unaryfunc)0, /*nb_negative*/ |
741 |
(unaryfunc)0, /*nb_positive*/ |
742 |
(unaryfunc)0, /*nb_absolute*/ |
743 |
(inquiry)0, /*nb_nonzero*/ |
744 |
0, /*nb_invert*/ |
745 |
0, /*nb_lshift*/ |
746 |
0, /*nb_rshift*/ |
747 |
0, /*nb_and*/ |
748 |
0, /*nb_xor*/ |
749 |
0, /*nb_or*/ |
750 |
(coercion)0, /*nb_coerce*/ |
751 |
(unaryfunc)PySwigObject_long, /*nb_int*/ |
752 |
(unaryfunc)PySwigObject_long, /*nb_long*/ |
753 |
(unaryfunc)0, /*nb_float*/ |
754 |
(unaryfunc)PySwigObject_oct, /*nb_oct*/ |
755 |
(unaryfunc)PySwigObject_hex, /*nb_hex*/ |
756 |
#if PY_VERSION_HEX >= 0x02000000 |
757 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */ |
758 |
#endif |
759 |
}; |
760 |
|
761 |
static PyTypeObject pyswigobject_type |
762 |
#if !defined(__cplusplus) |
763 |
; |
764 |
static int type_init = 0; |
765 |
if (!type_init) { |
766 |
PyTypeObject tmp |
767 |
#endif |
768 |
= { |
769 |
PyObject_HEAD_INIT(&PyType_Type) |
770 |
0, /*ob_size*/ |
771 |
(char *)"PySwigObject", /*tp_name*/ |
772 |
sizeof(PySwigObject), /*tp_basicsize*/ |
773 |
0, /*tp_itemsize*/ |
774 |
/* methods */ |
775 |
(destructor)PySwigObject_dealloc, /*tp_dealloc*/ |
776 |
(printfunc)PySwigObject_print, /*tp_print*/ |
777 |
(getattrfunc)0, /*tp_getattr*/ |
778 |
(setattrfunc)0, /*tp_setattr*/ |
779 |
(cmpfunc)PySwigObject_compare, /*tp_compare*/ |
780 |
(reprfunc)PySwigObject_repr, /*tp_repr*/ |
781 |
&PySwigObject_as_number, /*tp_as_number*/ |
782 |
0, /*tp_as_sequence*/ |
783 |
0, /*tp_as_mapping*/ |
784 |
(hashfunc)0, /*tp_hash*/ |
785 |
(ternaryfunc)0, /*tp_call*/ |
786 |
(reprfunc)PySwigObject_str, /*tp_str*/ |
787 |
/* Space for future expansion */ |
788 |
0,0,0,0, |
789 |
pyswigobject_type__doc__, /* Documentation string */ |
790 |
#if PY_VERSION_HEX >= 0x02000000 |
791 |
0, /* tp_traverse */ |
792 |
0, /* tp_clear */ |
793 |
#endif |
794 |
#if PY_VERSION_HEX >= 0x02010000 |
795 |
0, /* tp_richcompare */ |
796 |
0, /* tp_weaklistoffset */ |
797 |
#endif |
798 |
#if PY_VERSION_HEX >= 0x02020000 |
799 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */ |
800 |
#endif |
801 |
#if PY_VERSION_HEX >= 0x02030000 |
802 |
0, /* tp_del */ |
803 |
#endif |
804 |
#ifdef COUNT_ALLOCS |
805 |
0,0,0,0 /* tp_alloc -> tp_next */ |
806 |
#endif |
807 |
}; |
808 |
#if !defined(__cplusplus) |
809 |
pyswigobject_type = tmp; |
810 |
type_init = 1; |
811 |
} |
812 |
#endif |
813 |
return &pyswigobject_type; |
814 |
} |
815 |
|
816 |
SWIGRUNTIME PyObject * |
817 |
PySwigObject_FromVoidPtrAndDesc(void *ptr, const char *desc) |
818 |
{ |
819 |
PySwigObject *self = PyObject_NEW(PySwigObject, PySwigObject_type()); |
820 |
if (self) { |
821 |
self->ptr = ptr; |
822 |
self->desc = desc; |
823 |
} |
824 |
return (PyObject *)self; |
825 |
} |
826 |
|
827 |
SWIGRUNTIMEINLINE void * |
828 |
PySwigObject_AsVoidPtr(PyObject *self) |
829 |
{ |
830 |
return ((PySwigObject *)self)->ptr; |
831 |
} |
832 |
|
833 |
SWIGRUNTIMEINLINE const char * |
834 |
PySwigObject_GetDesc(PyObject *self) |
835 |
{ |
836 |
return ((PySwigObject *)self)->desc; |
837 |
} |
838 |
|
839 |
SWIGRUNTIMEINLINE int |
840 |
PySwigObject_Check(PyObject *op) { |
841 |
return ((op)->ob_type == PySwigObject_type()) |
842 |
|| (strcmp((op)->ob_type->tp_name,"PySwigObject") == 0); |
843 |
} |
844 |
|
845 |
/* ----------------------------------------------------------------------------- |
846 |
* Implements a simple Swig Packed type, and use it instead of string |
847 |
* ----------------------------------------------------------------------------- */ |
848 |
|
849 |
typedef struct { |
850 |
PyObject_HEAD |
851 |
void *pack; |
852 |
const char *desc; |
853 |
size_t size; |
854 |
} PySwigPacked; |
855 |
|
856 |
SWIGRUNTIME int |
857 |
PySwigPacked_print(PySwigPacked *v, FILE *fp, int flags) |
858 |
{ |
859 |
char result[SWIG_BUFFER_SIZE]; |
860 |
flags = flags; |
861 |
fputs("<Swig Packed ", fp); |
862 |
if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) { |
863 |
fputs("at ", fp); |
864 |
fputs(result, fp); |
865 |
} |
866 |
fputs(v->desc,fp); |
867 |
fputs(">", fp); |
868 |
return 0; |
869 |
} |
870 |
|
871 |
SWIGRUNTIME PyObject * |
872 |
PySwigPacked_repr(PySwigPacked *v) |
873 |
{ |
874 |
char result[SWIG_BUFFER_SIZE]; |
875 |
if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) { |
876 |
return PyString_FromFormat("<Swig Packed at %s%s>", result, v->desc); |
877 |
} else { |
878 |
return PyString_FromFormat("<Swig Packed %s>", v->desc); |
879 |
} |
880 |
} |
881 |
|
882 |
SWIGRUNTIME PyObject * |
883 |
PySwigPacked_str(PySwigPacked *v) |
884 |
{ |
885 |
char result[SWIG_BUFFER_SIZE]; |
886 |
if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){ |
887 |
return PyString_FromFormat("%s%s", result, v->desc); |
888 |
} else { |
889 |
return PyString_FromFormat("%s", v->desc); |
890 |
} |
891 |
} |
892 |
|
893 |
SWIGRUNTIME int |
894 |
PySwigPacked_compare(PySwigPacked *v, PySwigPacked *w) |
895 |
{ |
896 |
int c = strcmp(v->desc, w->desc); |
897 |
if (c) { |
898 |
return (c > 0) ? 1 : -1; |
899 |
} else { |
900 |
size_t i = v->size; |
901 |
size_t j = w->size; |
902 |
int s = (i < j) ? -1 : ((i > j) ? 1 : 0); |
903 |
return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size); |
904 |
} |
905 |
} |
906 |
|
907 |
SWIGRUNTIME void |
908 |
PySwigPacked_dealloc(PySwigPacked *self) |
909 |
{ |
910 |
free(self->pack); |
911 |
PyObject_DEL(self); |
912 |
} |
913 |
|
914 |
SWIGRUNTIME PyTypeObject* |
915 |
PySwigPacked_type(void) { |
916 |
static char pyswigpacked_type__doc__[] = |
917 |
"Swig object carries a C/C++ instance pointer"; |
918 |
static PyTypeObject pyswigpacked_type |
919 |
#if !defined(__cplusplus) |
920 |
; |
921 |
static int type_init = 0; |
922 |
if (!type_init) { |
923 |
PyTypeObject tmp |
924 |
#endif |
925 |
= { |
926 |
PyObject_HEAD_INIT(&PyType_Type) |
927 |
0, /*ob_size*/ |
928 |
(char *)"PySwigPacked", /*tp_name*/ |
929 |
sizeof(PySwigPacked), /*tp_basicsize*/ |
930 |
0, /*tp_itemsize*/ |
931 |
/* methods */ |
932 |
(destructor)PySwigPacked_dealloc, /*tp_dealloc*/ |
933 |
(printfunc)PySwigPacked_print, /*tp_print*/ |
934 |
(getattrfunc)0, /*tp_getattr*/ |
935 |
(setattrfunc)0, /*tp_setattr*/ |
936 |
(cmpfunc)PySwigPacked_compare, /*tp_compare*/ |
937 |
(reprfunc)PySwigPacked_repr, /*tp_repr*/ |
938 |
0, /*tp_as_number*/ |
939 |
0, /*tp_as_sequence*/ |
940 |
0, /*tp_as_mapping*/ |
941 |
(hashfunc)0, /*tp_hash*/ |
942 |
(ternaryfunc)0, /*tp_call*/ |
943 |
(reprfunc)PySwigPacked_str, /*tp_str*/ |
944 |
/* Space for future expansion */ |
945 |
0,0,0,0, |
946 |
pyswigpacked_type__doc__, /* Documentation string */ |
947 |
#if PY_VERSION_HEX >= 0x02000000 |
948 |
0, /* tp_traverse */ |
949 |
0, /* tp_clear */ |
950 |
#endif |
951 |
#if PY_VERSION_HEX >= 0x02010000 |
952 |
0, /* tp_richcompare */ |
953 |
0, /* tp_weaklistoffset */ |
954 |
#endif |
955 |
#if PY_VERSION_HEX >= 0x02020000 |
956 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */ |
957 |
#endif |
958 |
#if PY_VERSION_HEX >= 0x02030000 |
959 |
0, /* tp_del */ |
960 |
#endif |
961 |
#ifdef COUNT_ALLOCS |
962 |
0,0,0,0 /* tp_alloc -> tp_next */ |
963 |
#endif |
964 |
}; |
965 |
#if !defined(__cplusplus) |
966 |
pyswigpacked_type = tmp; |
967 |
type_init = 1; |
968 |
} |
969 |
#endif |
970 |
return &pyswigpacked_type; |
971 |
} |
972 |
|
973 |
SWIGRUNTIME PyObject * |
974 |
PySwigPacked_FromDataAndDesc(void *ptr, size_t size, const char *desc) |
975 |
{ |
976 |
PySwigPacked *self = PyObject_NEW(PySwigPacked, PySwigPacked_type()); |
977 |
if (self == NULL) { |
978 |
return NULL; |
979 |
} else { |
980 |
void *pack = malloc(size); |
981 |
if (pack) { |
982 |
memcpy(pack, ptr, size); |
983 |
self->pack = pack; |
984 |
self->desc = desc; |
985 |
self->size = size; |
986 |
return (PyObject *) self; |
987 |
} |
988 |
return NULL; |
989 |
} |
990 |
} |
991 |
|
992 |
SWIGRUNTIMEINLINE const char * |
993 |
PySwigPacked_UnpackData(PyObject *obj, void *ptr, size_t size) |
994 |
{ |
995 |
PySwigPacked *self = (PySwigPacked *)obj; |
996 |
if (self->size != size) return 0; |
997 |
memcpy(ptr, self->pack, size); |
998 |
return self->desc; |
999 |
} |
1000 |
|
1001 |
SWIGRUNTIMEINLINE const char * |
1002 |
PySwigPacked_GetDesc(PyObject *self) |
1003 |
{ |
1004 |
return ((PySwigPacked *)self)->desc; |
1005 |
} |
1006 |
|
1007 |
SWIGRUNTIMEINLINE int |
1008 |
PySwigPacked_Check(PyObject *op) { |
1009 |
return ((op)->ob_type == PySwigPacked_type()) |
1010 |
|| (strcmp((op)->ob_type->tp_name,"PySwigPacked") == 0); |
1011 |
} |
1012 |
|
1013 |
#else |
1014 |
/* ----------------------------------------------------------------------------- |
1015 |
* Use the old Python PyCObject instead of PySwigObject |
1016 |
* ----------------------------------------------------------------------------- */ |
1017 |
|
1018 |
#define PySwigObject_GetDesc(obj) PyCObject_GetDesc(obj) |
1019 |
#define PySwigObject_Check(obj) PyCObject_Check(obj) |
1020 |
#define PySwigObject_AsVoidPtr(obj) PyCObject_AsVoidPtr(obj) |
1021 |
#define PySwigObject_FromVoidPtrAndDesc(p, d) PyCObject_FromVoidPtrAndDesc(p, d, NULL) |
1022 |
|
1023 |
#endif |
1024 |
|
1025 |
#endif |
1026 |
|
1027 |
/* ----------------------------------------------------------------------------- |
1028 |
* errors manipulation |
1029 |
* ----------------------------------------------------------------------------- */ |
1030 |
|
1031 |
SWIGRUNTIME void |
1032 |
SWIG_Python_TypeError(const char *type, PyObject *obj) |
1033 |
{ |
1034 |
if (type) { |
1035 |
#if defined(SWIG_COBJECT_TYPES) |
1036 |
if (obj && PySwigObject_Check(obj)) { |
1037 |
const char *otype = (const char *) PySwigObject_GetDesc(obj); |
1038 |
if (otype) { |
1039 |
PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'PySwigObject(%s)' is received", |
1040 |
type, otype); |
1041 |
return; |
1042 |
} |
1043 |
} else |
1044 |
#endif |
1045 |
{ |
1046 |
const char *otype = (obj ? obj->ob_type->tp_name : 0); |
1047 |
if (otype) { |
1048 |
PyObject *str = PyObject_Str(obj); |
1049 |
const char *cstr = str ? PyString_AsString(str) : 0; |
1050 |
if (cstr) { |
1051 |
PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", |
1052 |
type, otype, cstr); |
1053 |
} else { |
1054 |
PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received", |
1055 |
type, otype); |
1056 |
} |
1057 |
Py_XDECREF(str); |
1058 |
return; |
1059 |
} |
1060 |
} |
1061 |
PyErr_Format(PyExc_TypeError, "a '%s' is expected", type); |
1062 |
} else { |
1063 |
PyErr_Format(PyExc_TypeError, "unexpected type is received"); |
1064 |
} |
1065 |
} |
1066 |
|
1067 |
SWIGRUNTIMEINLINE void |
1068 |
SWIG_Python_NullRef(const char *type) |
1069 |
{ |
1070 |
if (type) { |
1071 |
PyErr_Format(PyExc_TypeError, "null reference of type '%s' was received",type); |
1072 |
} else { |
1073 |
PyErr_Format(PyExc_TypeError, "null reference was received"); |
1074 |
} |
1075 |
} |
1076 |
|
1077 |
SWIGRUNTIME int |
1078 |
SWIG_Python_AddErrMesg(const char* mesg, int infront) |
1079 |
{ |
1080 |
if (PyErr_Occurred()) { |
1081 |
PyObject *type = 0; |
1082 |
PyObject *value = 0; |
1083 |
PyObject *traceback = 0; |
1084 |
PyErr_Fetch(&type, &value, &traceback); |
1085 |
if (value) { |
1086 |
PyObject *old_str = PyObject_Str(value); |
1087 |
Py_XINCREF(type); |
1088 |
PyErr_Clear(); |
1089 |
if (infront) { |
1090 |
PyErr_Format(type, "%s %s", mesg, PyString_AsString(old_str)); |
1091 |
} else { |
1092 |
PyErr_Format(type, "%s %s", PyString_AsString(old_str), mesg); |
1093 |
} |
1094 |
Py_DECREF(old_str); |
1095 |
} |
1096 |
return 1; |
1097 |
} else { |
1098 |
return 0; |
1099 |
} |
1100 |
} |
1101 |
|
1102 |
SWIGRUNTIME int |
1103 |
SWIG_Python_ArgFail(int argnum) |
1104 |
{ |
1105 |
if (PyErr_Occurred()) { |
1106 |
/* add information about failing argument */ |
1107 |
char mesg[256]; |
1108 |
PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum); |
1109 |
return SWIG_Python_AddErrMesg(mesg, 1); |
1110 |
} else { |
1111 |
return 0; |
1112 |
} |
1113 |
} |
1114 |
|
1115 |
|
1116 |
/* ----------------------------------------------------------------------------- |
1117 |
* pointers/data manipulation |
1118 |
* ----------------------------------------------------------------------------- */ |
1119 |
|
1120 |
/* Convert a pointer value */ |
1121 |
SWIGRUNTIME int |
1122 |
SWIG_Python_ConvertPtr(PyObject *obj, void **ptr, swig_type_info *ty, int flags) { |
1123 |
swig_cast_info *tc; |
1124 |
const char *c = 0; |
1125 |
static PyObject *SWIG_this = 0; |
1126 |
int newref = 0; |
1127 |
PyObject *pyobj = 0; |
1128 |
void *vptr; |
1129 |
|
1130 |
if (!obj) return 0; |
1131 |
if (obj == Py_None) { |
1132 |
*ptr = 0; |
1133 |
return 0; |
1134 |
} |
1135 |
|
1136 |
#ifdef SWIG_COBJECT_TYPES |
1137 |
if (!(PySwigObject_Check(obj))) { |
1138 |
if (!SWIG_this) |
1139 |
SWIG_this = PyString_FromString("this"); |
1140 |
pyobj = obj; |
1141 |
obj = PyObject_GetAttr(obj,SWIG_this); |
1142 |
newref = 1; |
1143 |
if (!obj) goto type_error; |
1144 |
if (!PySwigObject_Check(obj)) { |
1145 |
Py_DECREF(obj); |
1146 |
goto type_error; |
1147 |
} |
1148 |
} |
1149 |
vptr = PySwigObject_AsVoidPtr(obj); |
1150 |
c = (const char *) PySwigObject_GetDesc(obj); |
1151 |
if (newref) { Py_DECREF(obj); } |
1152 |
goto type_check; |
1153 |
#else |
1154 |
if (!(PyString_Check(obj))) { |
1155 |
if (!SWIG_this) |
1156 |
SWIG_this = PyString_FromString("this"); |
1157 |
pyobj = obj; |
1158 |
obj = PyObject_GetAttr(obj,SWIG_this); |
1159 |
newref = 1; |
1160 |
if (!obj) goto type_error; |
1161 |
if (!PyString_Check(obj)) { |
1162 |
Py_DECREF(obj); |
1163 |
goto type_error; |
1164 |
} |
1165 |
} |
1166 |
c = PyString_AS_STRING(obj); |
1167 |
/* Pointer values must start with leading underscore */ |
1168 |
c = SWIG_UnpackVoidPtr(c, &vptr, ty->name); |
1169 |
if (newref) { Py_DECREF(obj); } |
1170 |
if (!c) goto type_error; |
1171 |
#endif |
1172 |
|
1173 |
type_check: |
1174 |
if (ty) { |
1175 |
tc = SWIG_TypeCheck(c,ty); |
1176 |
if (!tc) goto type_error; |
1177 |
*ptr = SWIG_TypeCast(tc,vptr); |
1178 |
} else { |
1179 |
*ptr = vptr; |
1180 |
} |
1181 |
if ((pyobj) && (flags & SWIG_POINTER_DISOWN)) { |
1182 |
PyObject_SetAttrString(pyobj,(char*)"thisown",Py_False); |
1183 |
} |
1184 |
return 0; |
1185 |
|
1186 |
type_error: |
1187 |
PyErr_Clear(); |
1188 |
if (pyobj && !obj) { |
1189 |
obj = pyobj; |
1190 |
if (PyCFunction_Check(obj)) { |
1191 |
/* here we get the method pointer for callbacks */ |
1192 |
char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc); |
1193 |
c = doc ? strstr(doc, "swig_ptr: ") : 0; |
1194 |
if (c) { |
1195 |
c = ty ? SWIG_UnpackVoidPtr(c + 10, &vptr, ty->name) : 0; |
1196 |
if (!c) goto type_error; |
1197 |
goto type_check; |
1198 |
} |
1199 |
} |
1200 |
} |
1201 |
if (flags & SWIG_POINTER_EXCEPTION) { |
1202 |
if (ty) { |
1203 |
SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj); |
1204 |
} else { |
1205 |
SWIG_Python_TypeError("C/C++ pointer", obj); |
1206 |
} |
1207 |
} |
1208 |
return -1; |
1209 |
} |
1210 |
|
1211 |
/* Convert a pointer value, signal an exception on a type mismatch */ |
1212 |
SWIGRUNTIME void * |
1213 |
SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) { |
1214 |
void *result; |
1215 |
if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) { |
1216 |
PyErr_Clear(); |
1217 |
if (flags & SWIG_POINTER_EXCEPTION) { |
1218 |
SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj); |
1219 |
SWIG_Python_ArgFail(argnum); |
1220 |
} |
1221 |
} |
1222 |
return result; |
1223 |
} |
1224 |
|
1225 |
/* Convert a packed value value */ |
1226 |
SWIGRUNTIME int |
1227 |
SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty, int flags) { |
1228 |
swig_cast_info *tc; |
1229 |
const char *c = 0; |
1230 |
|
1231 |
#if defined(SWIG_COBJECT_TYPES) && !defined(SWIG_COBJECT_PYTHON) |
1232 |
c = PySwigPacked_UnpackData(obj, ptr, sz); |
1233 |
#else |
1234 |
if ((!obj) || (!PyString_Check(obj))) goto type_error; |
1235 |
c = PyString_AS_STRING(obj); |
1236 |
/* Pointer values must start with leading underscore */ |
1237 |
c = SWIG_UnpackDataName(c, ptr, sz, ty->name); |
1238 |
#endif |
1239 |
if (!c) goto type_error; |
1240 |
if (ty) { |
1241 |
tc = SWIG_TypeCheck(c,ty); |
1242 |
if (!tc) goto type_error; |
1243 |
} |
1244 |
return 0; |
1245 |
|
1246 |
type_error: |
1247 |
PyErr_Clear(); |
1248 |
if (flags & SWIG_POINTER_EXCEPTION) { |
1249 |
if (ty) { |
1250 |
SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj); |
1251 |
} else { |
1252 |
SWIG_Python_TypeError("C/C++ packed data", obj); |
1253 |
} |
1254 |
} |
1255 |
return -1; |
1256 |
} |
1257 |
|
1258 |
/* Create a new array object */ |
1259 |
SWIGRUNTIME PyObject * |
1260 |
SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int own) { |
1261 |
PyObject *robj = 0; |
1262 |
if (!type) { |
1263 |
if (!PyErr_Occurred()) { |
1264 |
PyErr_Format(PyExc_TypeError, "Swig: null type passed to NewPointerObj"); |
1265 |
} |
1266 |
return robj; |
1267 |
} |
1268 |
if (!ptr) { |
1269 |
Py_INCREF(Py_None); |
1270 |
return Py_None; |
1271 |
} |
1272 |
#ifdef SWIG_COBJECT_TYPES |
1273 |
robj = PySwigObject_FromVoidPtrAndDesc((void *) ptr, (char *)type->name); |
1274 |
#else |
1275 |
{ |
1276 |
char result[SWIG_BUFFER_SIZE]; |
1277 |
robj = SWIG_PackVoidPtr(result, ptr, type->name, sizeof(result)) ? |
1278 |
PyString_FromString(result) : 0; |
1279 |
} |
1280 |
#endif |
1281 |
if (!robj || (robj == Py_None)) return robj; |
1282 |
if (type->clientdata) { |
1283 |
PyObject *inst; |
1284 |
PyObject *args = Py_BuildValue((char*)"(O)", robj); |
1285 |
Py_DECREF(robj); |
1286 |
inst = PyObject_CallObject((PyObject *) type->clientdata, args); |
1287 |
Py_DECREF(args); |
1288 |
if (inst) { |
1289 |
if (own) { |
1290 |
PyObject_SetAttrString(inst,(char*)"thisown",Py_True); |
1291 |
} |
1292 |
robj = inst; |
1293 |
} |
1294 |
} |
1295 |
return robj; |
1296 |
} |
1297 |
|
1298 |
SWIGRUNTIME PyObject * |
1299 |
SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) { |
1300 |
PyObject *robj = 0; |
1301 |
if (!ptr) { |
1302 |
Py_INCREF(Py_None); |
1303 |
return Py_None; |
1304 |
} |
1305 |
#if defined(SWIG_COBJECT_TYPES) && !defined(SWIG_COBJECT_PYTHON) |
1306 |
robj = PySwigPacked_FromDataAndDesc((void *) ptr, sz, (char *)type->name); |
1307 |
#else |
1308 |
{ |
1309 |
char result[SWIG_BUFFER_SIZE]; |
1310 |
robj = SWIG_PackDataName(result, ptr, sz, type->name, sizeof(result)) ? |
1311 |
PyString_FromString(result) : 0; |
1312 |
} |
1313 |
#endif |
1314 |
return robj; |
1315 |
} |
1316 |
|
1317 |
/* -----------------------------------------------------------------------------* |
1318 |
* Get type list |
1319 |
* -----------------------------------------------------------------------------*/ |
1320 |
|
1321 |
#ifdef SWIG_LINK_RUNTIME |
1322 |
void *SWIG_ReturnGlobalTypeList(void *); |
1323 |
#endif |
1324 |
|
1325 |
SWIGRUNTIME swig_module_info * |
1326 |
SWIG_Python_GetModule(void) { |
1327 |
static void *type_pointer = (void *)0; |
1328 |
/* first check if module already created */ |
1329 |
if (!type_pointer) { |
1330 |
#ifdef SWIG_LINK_RUNTIME |
1331 |
type_pointer = SWIG_ReturnGlobalTypeList((void *)0); |
1332 |
#else |
1333 |
type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, |
1334 |
(char*)"type_pointer" SWIG_TYPE_TABLE_NAME); |
1335 |
if (PyErr_Occurred()) { |
1336 |
PyErr_Clear(); |
1337 |
type_pointer = (void *)0; |
1338 |
} |
1339 |
} |
1340 |
#endif |
1341 |
return (swig_module_info *) type_pointer; |
1342 |
} |
1343 |
|
1344 |
SWIGRUNTIME void |
1345 |
SWIG_Python_SetModule(swig_module_info *swig_module) { |
1346 |
static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} };/* Sentinel */ |
1347 |
|
1348 |
PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, |
1349 |
swig_empty_runtime_method_table); |
1350 |
PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, NULL); |
1351 |
if (pointer && module) { |
1352 |
PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer); |
1353 |
} |
1354 |
} |
1355 |
|
1356 |
#ifdef __cplusplus |
1357 |
} |
1358 |
#endif |
1359 |
|
1360 |
|
1361 |
/* -------- TYPES TABLE (BEGIN) -------- */ |
1362 |
|
1363 |
#define SWIGTYPE_p_char swig_types[0] |
1364 |
#define SWIGTYPE_p_p_char swig_types[1] |
1365 |
#define SWIGTYPE_p_unsigned_int swig_types[2] |
1366 |
#define SWIGTYPE_ptrdiff_t swig_types[3] |
1367 |
#define SWIGTYPE_size_t swig_types[4] |
1368 |
static swig_type_info *swig_types[5]; |
1369 |
static swig_module_info swig_module = {swig_types, 5, 0, 0, 0, 0}; |
1370 |
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) |
1371 |
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) |
1372 |
|
1373 |
/* -------- TYPES TABLE (END) -------- */ |
1374 |
|
1375 |
|
1376 |
/*----------------------------------------------- |
1377 |
@(target):= _xdelta3.so |
1378 |
------------------------------------------------*/ |
1379 |
#define SWIG_init init_xdelta3 |
1380 |
|
1381 |
#define SWIG_name "_xdelta3" |
1382 |
|
1383 |
#include "xdelta3.h" |
1384 |
|
1385 |
int xd3_main_cmdline (int ARGC, char **ARGV); |
1386 |
|
1387 |
#undef SWIG_init |
1388 |
#undef SWIG_name |
1389 |
|
1390 |
#define SWIG_init initxdelta3 |
1391 |
#define SWIG_name "xdelta3" |
1392 |
|
1393 |
|
1394 |
|
1395 |
/* returns SWIG_OLDOBJ if the input is a raw char*, SWIG_PYSTR if is a PyString */ |
1396 |
SWIGINTERN int |
1397 |
SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize) |
1398 |
{ |
1399 |
static swig_type_info* pchar_info = 0; |
1400 |
char* vptr = 0; |
1401 |
if (!pchar_info) pchar_info = SWIG_TypeQuery("char *"); |
1402 |
if (SWIG_ConvertPtr(obj, (void**)&vptr, pchar_info, 0) != -1) { |
1403 |
if (cptr) *cptr = vptr; |
1404 |
if (psize) *psize = vptr ? (strlen(vptr) + 1) : 0; |
1405 |
return SWIG_OLDOBJ; |
1406 |
} else { |
1407 |
PyErr_Clear(); |
1408 |
if (PyString_Check(obj)) { |
1409 |
if (cptr) { |
1410 |
*cptr = PyString_AS_STRING(obj); |
1411 |
if (psize) { |
1412 |
*psize = PyString_GET_SIZE(obj) + 1; |
1413 |
} |
1414 |
} |
1415 |
return SWIG_PYSTR; |
1416 |
} |
1417 |
} |
1418 |
if (cptr) { |
1419 |
SWIG_type_error("char *", obj); |
1420 |
} |
1421 |
return 0; |
1422 |
} |
1423 |
|
1424 |
|
1425 |
#include <limits.h> |
1426 |
|
1427 |
|
1428 |
SWIGINTERN int |
1429 |
SWIG_CheckLongInRange(long value, long min_value, long max_value, |
1430 |
const char *errmsg) |
1431 |
{ |
1432 |
if (value < min_value) { |
1433 |
if (errmsg) { |
1434 |
PyErr_Format(PyExc_OverflowError, |
1435 |
"value %ld is less than '%s' minimum %ld", |
1436 |
value, errmsg, min_value); |
1437 |
} |
1438 |
return 0; |
1439 |
} else if (value > max_value) { |
1440 |
if (errmsg) { |
1441 |
PyErr_Format(PyExc_OverflowError, |
1442 |
"value %ld is greater than '%s' maximum %ld", |
1443 |
value, errmsg, max_value); |
1444 |
} |
1445 |
return 0; |
1446 |
} |
1447 |
return 1; |
1448 |
} |
1449 |
|
1450 |
|
1451 |
SWIGINTERN int |
1452 |
SWIG_AsVal_long(PyObject * obj, long* val) |
1453 |
{ |
1454 |
if (PyInt_Check(obj)) { |
1455 |
if (val) *val = PyInt_AS_LONG(obj); |
1456 |
return 1; |
1457 |
} |
1458 |
if (PyLong_Check(obj)) { |
1459 |
long v = PyLong_AsLong(obj); |
1460 |
if (!PyErr_Occurred()) { |
1461 |
if (val) *val = v; |
1462 |
return 1; |
1463 |
} else { |
1464 |
if (!val) PyErr_Clear(); |
1465 |
return 0; |
1466 |
} |
1467 |
} |
1468 |
if (val) { |
1469 |
SWIG_type_error("long", obj); |
1470 |
} |
1471 |
return 0; |
1472 |
} |
1473 |
|
1474 |
|
1475 |
#if INT_MAX != LONG_MAX |
1476 |
SWIGINTERN int |
1477 |
SWIG_AsVal_int(PyObject *obj, int *val) |
1478 |
{ |
1479 |
const char* errmsg = val ? "int" : (char*)0; |
1480 |
long v; |
1481 |
if (SWIG_AsVal_long(obj, &v)) { |
1482 |
if (SWIG_CheckLongInRange(v, INT_MIN,INT_MAX, errmsg)) { |
1483 |
if (val) *val = (int)(v); |
1484 |
return 1; |
1485 |
} else { |
1486 |
return 0; |
1487 |
} |
1488 |
} else { |
1489 |
PyErr_Clear(); |
1490 |
} |
1491 |
if (val) { |
1492 |
SWIG_type_error(errmsg, obj); |
1493 |
} |
1494 |
return 0; |
1495 |
} |
1496 |
#else |
1497 |
SWIGINTERNINLINE int |
1498 |
SWIG_AsVal_int(PyObject *obj, int *val) |
1499 |
{ |
1500 |
return SWIG_AsVal_long(obj,(long*)val); |
1501 |
} |
1502 |
#endif |
1503 |
|
1504 |
|
1505 |
SWIGINTERNINLINE int |
1506 |
SWIG_As_int(PyObject* obj) |
1507 |
{ |
1508 |
int v; |
1509 |
if (!SWIG_AsVal_int(obj, &v)) { |
1510 |
/* |
1511 |
this is needed to make valgrind/purify happier. |
1512 |
*/ |
1513 |
memset((void*)&v, 0, sizeof(int)); |
1514 |
} |
1515 |
return v; |
1516 |
} |
1517 |
|
1518 |
|
1519 |
SWIGINTERNINLINE int |
1520 |
SWIG_AsCharPtr(PyObject *obj, char **val) |
1521 |
{ |
1522 |
if (SWIG_AsCharPtrAndSize(obj, val, (size_t*)(0))) { |
1523 |
return 1; |
1524 |
} |
1525 |
if (val) { |
1526 |
PyErr_Clear(); |
1527 |
SWIG_type_error("char *", obj); |
1528 |
} |
1529 |
return 0; |
1530 |
} |
1531 |
|
1532 |
|
1533 |
SWIGINTERNINLINE int |
1534 |
SWIG_CheckUnsignedLongInRange(unsigned long value, |
1535 |
unsigned long max_value, |
1536 |
const char *errmsg) |
1537 |
{ |
1538 |
if (value > max_value) { |
1539 |
if (errmsg) { |
1540 |
PyErr_Format(PyExc_OverflowError, |
1541 |
"value %lu is greater than '%s' minimum %lu", |
1542 |
value, errmsg, max_value); |
1543 |
} |
1544 |
return 0; |
1545 |
} |
1546 |
return 1; |
1547 |
} |
1548 |
|
1549 |
|
1550 |
SWIGINTERN int |
1551 |
SWIG_AsVal_unsigned_SS_long(PyObject *obj, unsigned long *val) |
1552 |
{ |
1553 |
if (PyInt_Check(obj)) { |
1554 |
long v = PyInt_AS_LONG(obj); |
1555 |
if (v >= 0) { |
1556 |
if (val) *val = v; |
1557 |
return 1; |
1558 |
} |
1559 |
} |
1560 |
if (PyLong_Check(obj)) { |
1561 |
unsigned long v = PyLong_AsUnsignedLong(obj); |
1562 |
if (!PyErr_Occurred()) { |
1563 |
if (val) *val = v; |
1564 |
return 1; |
1565 |
} else { |
1566 |
if (!val) PyErr_Clear(); |
1567 |
return 0; |
1568 |
} |
1569 |
} |
1570 |
if (val) { |
1571 |
SWIG_type_error("unsigned long", obj); |
1572 |
} |
1573 |
return 0; |
1574 |
} |
1575 |
|
1576 |
|
1577 |
#if UINT_MAX != ULONG_MAX |
1578 |
SWIGINTERN int |
1579 |
SWIG_AsVal_unsigned_SS_int(PyObject *obj, unsigned int *val) |
1580 |
{ |
1581 |
const char* errmsg = val ? "unsigned int" : (char*)0; |
1582 |
unsigned long v; |
1583 |
if (SWIG_AsVal_unsigned_SS_long(obj, &v)) { |
1584 |
if (SWIG_CheckUnsignedLongInRange(v, INT_MAX, errmsg)) { |
1585 |
if (val) *val = (unsigned int)(v); |
1586 |
return 1; |
1587 |
} |
1588 |
} else { |
1589 |
PyErr_Clear(); |
1590 |
} |
1591 |
if (val) { |
1592 |
SWIG_type_error(errmsg, obj); |
1593 |
} |
1594 |
return 0; |
1595 |
} |
1596 |
#else |
1597 |
SWIGINTERNINLINE unsigned int |
1598 |
SWIG_AsVal_unsigned_SS_int(PyObject *obj, unsigned int *val) |
1599 |
{ |
1600 |
return SWIG_AsVal_unsigned_SS_long(obj,(unsigned long *)val); |
1601 |
} |
1602 |
#endif |
1603 |
|
1604 |
|
1605 |
SWIGINTERNINLINE int |
1606 |
SWIG_Check_unsigned_SS_int(PyObject* obj) |
1607 |
{ |
1608 |
return SWIG_AsVal_unsigned_SS_int(obj, (unsigned int*)0); |
1609 |
} |
1610 |
|
1611 |
|
1612 |
SWIGINTERNINLINE int |
1613 |
SWIG_Check_int(PyObject* obj) |
1614 |
{ |
1615 |
return SWIG_AsVal_int(obj, (int*)0); |
1616 |
} |
1617 |
|
1618 |
|
1619 |
SWIGINTERN PyObject* |
1620 |
t_output_helper(PyObject* target, PyObject* o) { |
1621 |
if (!target) { |
1622 |
target = o; |
1623 |
} else if (target == Py_None) { |
1624 |
Py_DECREF(target); |
1625 |
target = o; |
1626 |
} else { |
1627 |
if (!PyList_Check(target)) { |
1628 |
PyObject *o2 = target; |
1629 |
target = PyList_New(1); |
1630 |
PyList_SetItem(target, 0, o2); |
1631 |
} |
1632 |
PyList_Append(target,o); |
1633 |
Py_DECREF(o); |
1634 |
} |
1635 |
return target; |
1636 |
} |
1637 |
|
1638 |
|
1639 |
/*@/usr/share/swig/1.3.25/python/pymacros.swg,66,SWIG_define@*/ |
1640 |
#define SWIG_From_int PyInt_FromLong |
1641 |
/*@@*/ |
1642 |
|
1643 |
|
1644 |
SWIGINTERN char** |
1645 |
SWIG_AsArgcArgv(PyObject* input, |
1646 |
swig_type_info* ppchar_info, |
1647 |
size_t* argc, int* owner) |
1648 |
{ |
1649 |
char **argv = 0; |
1650 |
size_t i = 0; |
1651 |
if (SWIG_ConvertPtr(input, (void **)&argv, ppchar_info, 0) == -1) { |
1652 |
PyErr_Clear(); |
1653 |
int list = PyList_Check(input); |
1654 |
if (list || PyTuple_Check(input)) { |
1655 |
*argc = list ? PyList_Size(input) : PyTuple_Size(input); |
1656 |
argv = ((char**) malloc((*argc + 1)*sizeof(char*))); |
1657 |
*owner = 1; |
1658 |
for (; i < *argc; ++i) { |
1659 |
PyObject *obj = list ? PyList_GetItem(input,i) : PyTuple_GetItem(input,i); |
1660 |
if (!SWIG_AsCharPtr(obj, &(argv[i]))) { |
1661 |
PyErr_Clear(); |
1662 |
PyErr_SetString(PyExc_TypeError,"list or tuple must contain strings only"); |
1663 |
} |
1664 |
} |
1665 |
argv[i] = 0; |
1666 |
return argv; |
1667 |
} else { |
1668 |
*argc = 0; |
1669 |
PyErr_SetString(PyExc_TypeError,"a list or tuple is expected"); |
1670 |
return 0; |
1671 |
} |
1672 |
} else { |
1673 |
/* seems dangerous, but the user asked for it... */ |
1674 |
while (argv[i] != 0) ++i; |
1675 |
*argc = i; |
1676 |
owner = 0; |
1677 |
return argv; |
1678 |
} |
1679 |
} |
1680 |
|
1681 |
#ifdef __cplusplus |
1682 |
extern "C" { |
1683 |
#endif |
1684 |
static PyObject *_wrap_xd3_encode_memory(PyObject *self, PyObject *args) { |
1685 |
PyObject *resultobj = NULL; |
1686 |
char *arg1 = (char *) 0 ; |
1687 |
unsigned int arg2 ; |
1688 |
char *arg3 = (char *) 0 ; |
1689 |
unsigned int arg4 ; |
1690 |
char *arg5 = (char *) 0 ; |
1691 |
unsigned int *arg6 = (unsigned int *) 0 ; |
1692 |
unsigned int arg7 ; |
1693 |
int arg8 ; |
1694 |
int result; |
1695 |
char *buf1 ; |
1696 |
size_t size1 ; |
1697 |
char *buf3 ; |
1698 |
size_t size3 ; |
1699 |
unsigned int alloc_size7 ; |
1700 |
PyObject * obj0 = 0 ; |
1701 |
PyObject * obj1 = 0 ; |
1702 |
PyObject * obj2 = 0 ; |
1703 |
PyObject * obj3 = 0 ; |
1704 |
|
1705 |
{ |
1706 |
arg8 = 0; |
1707 |
} |
1708 |
{ |
1709 |
|
1710 |
} |
1711 |
if(!PyArg_ParseTuple(args,(char *)"OOO|O:xd3_encode_memory",&obj0,&obj1,&obj2,&obj3)) goto fail; |
1712 |
{ |
1713 |
int res = SWIG_AsCharPtrAndSize(obj0, &buf1, &size1); |
1714 |
if (!res) { |
1715 |
SWIG_arg_fail(1);SWIG_fail; |
1716 |
} |
1717 |
arg1 = (char *) buf1; |
1718 |
arg2 = (unsigned int) size1 - 1; |
1719 |
} |
1720 |
{ |
1721 |
int res = SWIG_AsCharPtrAndSize(obj1, &buf3, &size3); |
1722 |
if (!res) { |
1723 |
SWIG_arg_fail(3);SWIG_fail; |
1724 |
} |
1725 |
arg3 = (char *) buf3; |
1726 |
arg4 = (unsigned int) size3 - 1; |
1727 |
} |
1728 |
{ |
1729 |
arg7 = alloc_size7 = PyInt_AsLong(obj2); |
1730 |
} |
1731 |
if (obj3) { |
1732 |
{ |
1733 |
arg8 = (int)(SWIG_As_int(obj3)); |
1734 |
if (SWIG_arg_fail(8)) SWIG_fail; |
1735 |
} |
1736 |
} |
1737 |
{ |
1738 |
// alloc_size input is #7th position in xd3_xxcode_memory() |
1739 |
arg5 = malloc(alloc_size7); |
1740 |
arg6 = &alloc_size7; |
1741 |
} |
1742 |
result = (int)xd3_encode_memory((char const *)arg1,arg2,(char const *)arg3,arg4,arg5,arg6,arg7,arg8); |
1743 |
|
1744 |
{ |
1745 |
resultobj = SWIG_From_int((int)(result)); |
1746 |
} |
1747 |
{ |
1748 |
if (result == 0) { |
1749 |
PyObject *o; |
1750 |
// alloc_size7 now carries actual size |
1751 |
o = PyString_FromStringAndSize(arg5,alloc_size7); |
1752 |
resultobj = t_output_helper(resultobj,o); |
1753 |
} else { |
1754 |
resultobj = t_output_helper(resultobj,Py_None); |
1755 |
} |
1756 |
free(arg5); |
1757 |
} |
1758 |
return resultobj; |
1759 |
fail: |
1760 |
return NULL; |
1761 |
} |
1762 |
|
1763 |
|
1764 |
static PyObject *_wrap_xd3_decode_memory(PyObject *self, PyObject *args) { |
1765 |
PyObject *resultobj = NULL; |
1766 |
char *arg1 = (char *) 0 ; |
1767 |
unsigned int arg2 ; |
1768 |
char *arg3 = (char *) 0 ; |
1769 |
unsigned int arg4 ; |
1770 |
char *arg5 = (char *) 0 ; |
1771 |
unsigned int *arg6 = (unsigned int *) 0 ; |
1772 |
unsigned int arg7 ; |
1773 |
int arg8 ; |
1774 |
int result; |
1775 |
char *buf1 ; |
1776 |
size_t size1 ; |
1777 |
char *buf3 ; |
1778 |
size_t size3 ; |
1779 |
unsigned int alloc_size7 ; |
1780 |
PyObject * obj0 = 0 ; |
1781 |
PyObject * obj1 = 0 ; |
1782 |
PyObject * obj2 = 0 ; |
1783 |
PyObject * obj3 = 0 ; |
1784 |
|
1785 |
{ |
1786 |
arg8 = 0; |
1787 |
} |
1788 |
{ |
1789 |
|
1790 |
} |
1791 |
if(!PyArg_ParseTuple(args,(char *)"OOO|O:xd3_decode_memory",&obj0,&obj1,&obj2,&obj3)) goto fail; |
1792 |
{ |
1793 |
int res = SWIG_AsCharPtrAndSize(obj0, &buf1, &size1); |
1794 |
if (!res) { |
1795 |
SWIG_arg_fail(1);SWIG_fail; |
1796 |
} |
1797 |
arg1 = (char *) buf1; |
1798 |
arg2 = (unsigned int) size1 - 1; |
1799 |
} |
1800 |
{ |
1801 |
int res = SWIG_AsCharPtrAndSize(obj1, &buf3, &size3); |
1802 |
if (!res) { |
1803 |
SWIG_arg_fail(3);SWIG_fail; |
1804 |
} |
1805 |
arg3 = (char *) buf3; |
1806 |
arg4 = (unsigned int) size3 - 1; |
1807 |
} |
1808 |
{ |
1809 |
arg7 = alloc_size7 = PyInt_AsLong(obj2); |
1810 |
} |
1811 |
if (obj3) { |
1812 |
{ |
1813 |
arg8 = (int)(SWIG_As_int(obj3)); |
1814 |
if (SWIG_arg_fail(8)) SWIG_fail; |
1815 |
} |
1816 |
} |
1817 |
{ |
1818 |
// alloc_size input is #7th position in xd3_xxcode_memory() |
1819 |
arg5 = malloc(alloc_size7); |
1820 |
arg6 = &alloc_size7; |
1821 |
} |
1822 |
result = (int)xd3_decode_memory((char const *)arg1,arg2,(char const *)arg3,arg4,arg5,arg6,arg7,arg8); |
1823 |
|
1824 |
{ |
1825 |
resultobj = SWIG_From_int((int)(result)); |
1826 |
} |
1827 |
{ |
1828 |
if (result == 0) { |
1829 |
PyObject *o; |
1830 |
// alloc_size7 now carries actual size |
1831 |
o = PyString_FromStringAndSize(arg5,alloc_size7); |
1832 |
resultobj = t_output_helper(resultobj,o); |
1833 |
} else { |
1834 |
resultobj = t_output_helper(resultobj,Py_None); |
1835 |
} |
1836 |
free(arg5); |
1837 |
} |
1838 |
return resultobj; |
1839 |
fail: |
1840 |
return NULL; |
1841 |
} |
1842 |
|
1843 |
|
1844 |
static PyObject *_wrap_xd3_main_cmdline(PyObject *self, PyObject *args) { |
1845 |
PyObject *resultobj = NULL; |
1846 |
int arg1 ; |
1847 |
char **arg2 = (char **) 0 ; |
1848 |
int result; |
1849 |
int owner1 ; |
1850 |
PyObject * obj0 = 0 ; |
1851 |
|
1852 |
if(!PyArg_ParseTuple(args,(char *)"O:xd3_main_cmdline",&obj0)) goto fail; |
1853 |
{ |
1854 |
size_t argc = 0; |
1855 |
char **argv = SWIG_AsArgcArgv(obj0, SWIGTYPE_p_p_char, &argc, &owner1); |
1856 |
if (PyErr_Occurred()) { |
1857 |
arg1 = 0; arg2 = 0; |
1858 |
if (SWIG_arg_fail(1)) SWIG_fail; |
1859 |
} else { |
1860 |
arg1 = (int) argc; |
1861 |
arg2 = (char **) argv; |
1862 |
} |
1863 |
} |
1864 |
result = (int)xd3_main_cmdline(arg1,arg2); |
1865 |
|
1866 |
{ |
1867 |
resultobj = SWIG_From_int((int)(result)); |
1868 |
} |
1869 |
{ |
1870 |
if (owner1) free((char*)arg2); |
1871 |
} |
1872 |
return resultobj; |
1873 |
fail: |
1874 |
{ |
1875 |
if (owner1) free((char*)arg2); |
1876 |
} |
1877 |
return NULL; |
1878 |
} |
1879 |
|
1880 |
|
1881 |
static PyMethodDef SwigMethods[] = { |
1882 |
{ (char *)"xd3_encode_memory", _wrap_xd3_encode_memory, METH_VARARGS, NULL}, |
1883 |
{ (char *)"xd3_decode_memory", _wrap_xd3_decode_memory, METH_VARARGS, NULL}, |
1884 |
{ (char *)"xd3_main_cmdline", _wrap_xd3_main_cmdline, METH_VARARGS, NULL}, |
1885 |
{ NULL, NULL, 0, NULL } |
1886 |
}; |
1887 |
|
1888 |
|
1889 |
/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ |
1890 |
|
1891 |
static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, 0}; |
1892 |
static swig_type_info _swigt__p_p_char = {"_p_p_char", "char **", 0, 0, 0}; |
1893 |
static swig_type_info _swigt__p_unsigned_int = {"_p_unsigned_int", "unsigned int *", 0, 0, 0}; |
1894 |
static swig_type_info _swigt__ptrdiff_t = {"_ptrdiff_t", "ptrdiff_t", 0, 0, 0}; |
1895 |
static swig_type_info _swigt__size_t = {"_size_t", "size_t", 0, 0, 0}; |
1896 |
|
1897 |
static swig_type_info *swig_type_initial[] = { |
1898 |
&_swigt__p_char, |
1899 |
&_swigt__p_p_char, |
1900 |
&_swigt__p_unsigned_int, |
1901 |
&_swigt__ptrdiff_t, |
1902 |
&_swigt__size_t, |
1903 |
}; |
1904 |
|
1905 |
static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}}; |
1906 |
static swig_cast_info _swigc__p_p_char[] = { {&_swigt__p_p_char, 0, 0, 0},{0, 0, 0, 0}}; |
1907 |
static swig_cast_info _swigc__p_unsigned_int[] = { {&_swigt__p_unsigned_int, 0, 0, 0},{0, 0, 0, 0}}; |
1908 |
static swig_cast_info _swigc__ptrdiff_t[] = { {&_swigt__ptrdiff_t, 0, 0, 0},{0, 0, 0, 0}}; |
1909 |
static swig_cast_info _swigc__size_t[] = { {&_swigt__size_t, 0, 0, 0},{0, 0, 0, 0}}; |
1910 |
|
1911 |
static swig_cast_info *swig_cast_initial[] = { |
1912 |
_swigc__p_char, |
1913 |
_swigc__p_p_char, |
1914 |
_swigc__p_unsigned_int, |
1915 |
_swigc__ptrdiff_t, |
1916 |
_swigc__size_t, |
1917 |
}; |
1918 |
|
1919 |
|
1920 |
/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */ |
1921 |
|
1922 |
static swig_const_info swig_const_table[] = { |
1923 |
{0, 0, 0, 0.0, 0, 0}}; |
1924 |
|
1925 |
#ifdef __cplusplus |
1926 |
} |
1927 |
#endif |
1928 |
/************************************************************************* |
1929 |
* Type initialization: |
1930 |
* This problem is tough by the requirement that no dynamic |
1931 |
* memory is used. Also, since swig_type_info structures store pointers to |
1932 |
* swig_cast_info structures and swig_cast_info structures store pointers back |
1933 |
* to swig_type_info structures, we need some lookup code at initialization. |
1934 |
* The idea is that swig generates all the structures that are needed. |
1935 |
* The runtime then collects these partially filled structures. |
1936 |
* The SWIG_InitializeModule function takes these initial arrays out of |
1937 |
* swig_module, and does all the lookup, filling in the swig_module.types |
1938 |
* array with the correct data and linking the correct swig_cast_info |
1939 |
* structures together. |
1940 |
|
1941 |
* The generated swig_type_info structures are assigned staticly to an initial |
1942 |
* array. We just loop though that array, and handle each type individually. |
1943 |
* First we lookup if this type has been already loaded, and if so, use the |
1944 |
* loaded structure instead of the generated one. Then we have to fill in the |
1945 |
* cast linked list. The cast data is initially stored in something like a |
1946 |
* two-dimensional array. Each row corresponds to a type (there are the same |
1947 |
* number of rows as there are in the swig_type_initial array). Each entry in |
1948 |
* a column is one of the swig_cast_info structures for that type. |
1949 |
* The cast_initial array is actually an array of arrays, because each row has |
1950 |
* a variable number of columns. So to actually build the cast linked list, |
1951 |
* we find the array of casts associated with the type, and loop through it |
1952 |
* adding the casts to the list. The one last trick we need to do is making |
1953 |
* sure the type pointer in the swig_cast_info struct is correct. |
1954 |
|
1955 |
* First off, we lookup the cast->type name to see if it is already loaded. |
1956 |
* There are three cases to handle: |
1957 |
* 1) If the cast->type has already been loaded AND the type we are adding |
1958 |
* casting info to has not been loaded (it is in this module), THEN we |
1959 |
* replace the cast->type pointer with the type pointer that has already |
1960 |
* been loaded. |
1961 |
* 2) If BOTH types (the one we are adding casting info to, and the |
1962 |
* cast->type) are loaded, THEN the cast info has already been loaded by |
1963 |
* the previous module so we just ignore it. |
1964 |
* 3) Finally, if cast->type has not already been loaded, then we add that |
1965 |
* swig_cast_info to the linked list (because the cast->type) pointer will |
1966 |
* be correct. |
1967 |
**/ |
1968 |
|
1969 |
#ifdef __cplusplus |
1970 |
extern "C" { |
1971 |
#endif |
1972 |
|
1973 |
SWIGRUNTIME void |
1974 |
SWIG_InitializeModule(void *clientdata) { |
1975 |
swig_type_info *type, *ret; |
1976 |
swig_cast_info *cast; |
1977 |
size_t i; |
1978 |
swig_module_info *module_head; |
1979 |
static int init_run = 0; |
1980 |
|
1981 |
clientdata = clientdata; |
1982 |
|
1983 |
if (init_run) return; |
1984 |
init_run = 1; |
1985 |
|
1986 |
/* Initialize the swig_module */ |
1987 |
swig_module.type_initial = swig_type_initial; |
1988 |
swig_module.cast_initial = swig_cast_initial; |
1989 |
|
1990 |
/* Try and load any already created modules */ |
1991 |
module_head = SWIG_GetModule(clientdata); |
1992 |
if (module_head) { |
1993 |
swig_module.next = module_head->next; |
1994 |
module_head->next = &swig_module; |
1995 |
} else { |
1996 |
/* This is the first module loaded */ |
1997 |
swig_module.next = &swig_module; |
1998 |
SWIG_SetModule(clientdata, &swig_module); |
1999 |
} |
2000 |
|
2001 |
/* Now work on filling in swig_module.types */ |
2002 |
for (i = 0; i < swig_module.size; ++i) { |
2003 |
type = 0; |
2004 |
|
2005 |
/* if there is another module already loaded */ |
2006 |
if (swig_module.next != &swig_module) { |
2007 |
type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name); |
2008 |
} |
2009 |
if (type) { |
2010 |
/* Overwrite clientdata field */ |
2011 |
if (swig_module.type_initial[i]->clientdata) type->clientdata = swig_module.type_initial[i]->clientdata; |
2012 |
} else { |
2013 |
type = swig_module.type_initial[i]; |
2014 |
} |
2015 |
|
2016 |
/* Insert casting types */ |
2017 |
cast = swig_module.cast_initial[i]; |
2018 |
while (cast->type) { |
2019 |
/* Don't need to add information already in the list */ |
2020 |
ret = 0; |
2021 |
if (swig_module.next != &swig_module) { |
2022 |
ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); |
2023 |
} |
2024 |
if (ret && type == swig_module.type_initial[i]) { |
2025 |
cast->type = ret; |
2026 |
ret = 0; |
2027 |
} |
2028 |
|
2029 |
if (!ret) { |
2030 |
if (type->cast) { |
2031 |
type->cast->prev = cast; |
2032 |
cast->next = type->cast; |
2033 |
} |
2034 |
type->cast = cast; |
2035 |
} |
2036 |
|
2037 |
cast++; |
2038 |
} |
2039 |
|
2040 |
/* Set entry in modules->types array equal to the type */ |
2041 |
swig_module.types[i] = type; |
2042 |
} |
2043 |
} |
2044 |
|
2045 |
/* This function will propagate the clientdata field of type to |
2046 |
* any new swig_type_info structures that have been added into the list |
2047 |
* of equivalent types. It is like calling |
2048 |
* SWIG_TypeClientData(type, clientdata) a second time. |
2049 |
*/ |
2050 |
SWIGRUNTIME void |
2051 |
SWIG_PropagateClientData(void) { |
2052 |
size_t i; |
2053 |
swig_cast_info *equiv; |
2054 |
static int init_run = 0; |
2055 |
|
2056 |
if (init_run) return; |
2057 |
init_run = 1; |
2058 |
|
2059 |
for (i = 0; i < swig_module.size; i++) { |
2060 |
if (swig_module.types[i]->clientdata) { |
2061 |
equiv = swig_module.types[i]->cast; |
2062 |
while (equiv) { |
2063 |
if (!equiv->converter) { |
2064 |
if (equiv->type && !equiv->type->clientdata) |
2065 |
SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); |
2066 |
} |
2067 |
equiv = equiv->next; |
2068 |
} |
2069 |
} |
2070 |
} |
2071 |
} |
2072 |
|
2073 |
#ifdef __cplusplus |
2074 |
} |
2075 |
#endif |
2076 |
|
2077 |
|
2078 |
|
2079 |
#ifdef __cplusplus |
2080 |
extern "C" { |
2081 |
#endif |
2082 |
|
2083 |
/* Python-specific SWIG API */ |
2084 |
#define SWIG_newvarlink() SWIG_Python_newvarlink() |
2085 |
#define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr) |
2086 |
#define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants) |
2087 |
|
2088 |
/* ----------------------------------------------------------------------------- |
2089 |
* global variable support code. |
2090 |
* ----------------------------------------------------------------------------- */ |
2091 |
|
2092 |
typedef struct swig_globalvar { |
2093 |
char *name; /* Name of global variable */ |
2094 |
PyObject *(*get_attr)(void); /* Return the current value */ |
2095 |
int (*set_attr)(PyObject *); /* Set the value */ |
2096 |
struct swig_globalvar *next; |
2097 |
} swig_globalvar; |
2098 |
|
2099 |
typedef struct swig_varlinkobject { |
2100 |
PyObject_HEAD |
2101 |
swig_globalvar *vars; |
2102 |
} swig_varlinkobject; |
2103 |
|
2104 |
SWIGINTERN PyObject * |
2105 |
swig_varlink_repr(swig_varlinkobject *v) { |
2106 |
v = v; |
2107 |
return PyString_FromString("<Swig global variables>"); |
2108 |
} |
2109 |
|
2110 |
SWIGINTERN int |
2111 |
swig_varlink_print(swig_varlinkobject *v, FILE *fp, int flags) { |
2112 |
swig_globalvar *var; |
2113 |
flags = flags; |
2114 |
fprintf(fp,"Swig global variables { "); |
2115 |
for (var = v->vars; var; var=var->next) { |
2116 |
fprintf(fp,"%s", var->name); |
2117 |
if (var->next) fprintf(fp,", "); |
2118 |
} |
2119 |
fprintf(fp," }\n"); |
2120 |
return 0; |
2121 |
} |
2122 |
|
2123 |
SWIGINTERN PyObject * |
2124 |
swig_varlink_getattr(swig_varlinkobject *v, char *n) { |
2125 |
swig_globalvar *var = v->vars; |
2126 |
while (var) { |
2127 |
if (strcmp(var->name,n) == 0) { |
2128 |
return (*var->get_attr)(); |
2129 |
} |
2130 |
var = var->next; |
2131 |
} |
2132 |
PyErr_SetString(PyExc_NameError,"Unknown C global variable"); |
2133 |
return NULL; |
2134 |
} |
2135 |
|
2136 |
SWIGINTERN int |
2137 |
swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) { |
2138 |
swig_globalvar *var = v->vars; |
2139 |
while (var) { |
2140 |
if (strcmp(var->name,n) == 0) { |
2141 |
return (*var->set_attr)(p); |
2142 |
} |
2143 |
var = var->next; |
2144 |
} |
2145 |
PyErr_SetString(PyExc_NameError,"Unknown C global variable"); |
2146 |
return 1; |
2147 |
} |
2148 |
|
2149 |
SWIGINTERN PyTypeObject* |
2150 |
swig_varlink_type(void) { |
2151 |
static char varlink__doc__[] = "Swig var link object"; |
2152 |
static PyTypeObject varlink_type |
2153 |
#if !defined(__cplusplus) |
2154 |
; |
2155 |
static int type_init = 0; |
2156 |
if (!type_init) { |
2157 |
PyTypeObject tmp |
2158 |
#endif |
2159 |
= { |
2160 |
PyObject_HEAD_INIT(&PyType_Type) |
2161 |
0, /* Number of items in variable part (ob_size) */ |
2162 |
(char *)"swigvarlink", /* Type name (tp_name) */ |
2163 |
sizeof(swig_varlinkobject), /* Basic size (tp_basicsize) */ |
2164 |
0, /* Itemsize (tp_itemsize) */ |
2165 |
0, /* Deallocator (tp_dealloc) */ |
2166 |
(printfunc) swig_varlink_print, /* Print (tp_print) */ |
2167 |
(getattrfunc) swig_varlink_getattr, /* get attr (tp_getattr) */ |
2168 |
(setattrfunc) swig_varlink_setattr, /* Set attr (tp_setattr) */ |
2169 |
0, /* tp_compare */ |
2170 |
(reprfunc) swig_varlink_repr, /* tp_repr */ |
2171 |
0, /* tp_as_number */ |
2172 |
0, /* tp_as_sequence */ |
2173 |
0, /* tp_as_mapping */ |
2174 |
0, /* tp_hash */ |
2175 |
0, /* tp_call */ |
2176 |
0, /* tp_str */ |
2177 |
0, /* tp_getattro */ |
2178 |
0, /* tp_setattro */ |
2179 |
0, /* tp_as_buffer */ |
2180 |
0, /* tp_flags */ |
2181 |
varlink__doc__, /* tp_doc */ |
2182 |
#if PY_VERSION_HEX >= 0x02000000 |
2183 |
0, /* tp_traverse */ |
2184 |
0, /* tp_clear */ |
2185 |
#endif |
2186 |
#if PY_VERSION_HEX >= 0x02010000 |
2187 |
0, /* tp_richcompare */ |
2188 |
0, /* tp_weaklistoffset */ |
2189 |
#endif |
2190 |
#if PY_VERSION_HEX >= 0x02020000 |
2191 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */ |
2192 |
#endif |
2193 |
#if PY_VERSION_HEX >= 0x02030000 |
2194 |
0, /* tp_del */ |
2195 |
#endif |
2196 |
#ifdef COUNT_ALLOCS |
2197 |
0,0,0,0 /* tp_alloc -> tp_next */ |
2198 |
#endif |
2199 |
}; |
2200 |
#if !defined(__cplusplus) |
2201 |
varlink_type = tmp; |
2202 |
type_init = 1; |
2203 |
} |
2204 |
#endif |
2205 |
return &varlink_type; |
2206 |
} |
2207 |
|
2208 |
/* Create a variable linking object for use later */ |
2209 |
SWIGINTERN PyObject * |
2210 |
SWIG_Python_newvarlink(void) { |
2211 |
swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type()); |
2212 |
if (result) { |
2213 |
result->vars = 0; |
2214 |
} |
2215 |
return ((PyObject*) result); |
2216 |
} |
2217 |
|
2218 |
SWIGINTERN void |
2219 |
SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) { |
2220 |
swig_varlinkobject *v = (swig_varlinkobject *) p; |
2221 |
swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar)); |
2222 |
if (gv) { |
2223 |
size_t size = strlen(name)+1; |
2224 |
gv->name = (char *)malloc(size); |
2225 |
if (gv->name) { |
2226 |
strncpy(gv->name,name,size); |
2227 |
gv->get_attr = get_attr; |
2228 |
gv->set_attr = set_attr; |
2229 |
gv->next = v->vars; |
2230 |
} |
2231 |
} |
2232 |
v->vars = gv; |
2233 |
} |
2234 |
|
2235 |
/* ----------------------------------------------------------------------------- |
2236 |
* constants/methods manipulation |
2237 |
* ----------------------------------------------------------------------------- */ |
2238 |
|
2239 |
/* Install Constants */ |
2240 |
SWIGINTERN void |
2241 |
SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) { |
2242 |
PyObject *obj = 0; |
2243 |
size_t i; |
2244 |
for (i = 0; constants[i].type; ++i) { |
2245 |
switch(constants[i].type) { |
2246 |
case SWIG_PY_INT: |
2247 |
obj = PyInt_FromLong(constants[i].lvalue); |
2248 |
break; |
2249 |
case SWIG_PY_FLOAT: |
2250 |
obj = PyFloat_FromDouble(constants[i].dvalue); |
2251 |
break; |
2252 |
case SWIG_PY_STRING: |
2253 |
if (constants[i].pvalue) { |
2254 |
obj = PyString_FromString((char *) constants[i].pvalue); |
2255 |
} else { |
2256 |
Py_INCREF(Py_None); |
2257 |
obj = Py_None; |
2258 |
} |
2259 |
break; |
2260 |
case SWIG_PY_POINTER: |
2261 |
obj = SWIG_NewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0); |
2262 |
break; |
2263 |
case SWIG_PY_BINARY: |
2264 |
obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype)); |
2265 |
break; |
2266 |
default: |
2267 |
obj = 0; |
2268 |
break; |
2269 |
} |
2270 |
if (obj) { |
2271 |
PyDict_SetItemString(d,constants[i].name,obj); |
2272 |
Py_DECREF(obj); |
2273 |
} |
2274 |
} |
2275 |
} |
2276 |
|
2277 |
/* -----------------------------------------------------------------------------*/ |
2278 |
/* Fix SwigMethods to carry the callback ptrs when needed */ |
2279 |
/* -----------------------------------------------------------------------------*/ |
2280 |
|
2281 |
SWIGINTERN void |
2282 |
SWIG_Python_FixMethods(PyMethodDef *methods, |
2283 |
swig_const_info *const_table, |
2284 |
swig_type_info **types, |
2285 |
swig_type_info **types_initial) { |
2286 |
size_t i; |
2287 |
for (i = 0; methods[i].ml_name; ++i) { |
2288 |
char *c = methods[i].ml_doc; |
2289 |
if (c && (c = strstr(c, "swig_ptr: "))) { |
2290 |
int j; |
2291 |
swig_const_info *ci = 0; |
2292 |
char *name = c + 10; |
2293 |
for (j = 0; const_table[j].type; ++j) { |
2294 |
if (strncmp(const_table[j].name, name, |
2295 |
strlen(const_table[j].name)) == 0) { |
2296 |
ci = &(const_table[j]); |
2297 |
break; |
2298 |
} |
2299 |
} |
2300 |
if (ci) { |
2301 |
size_t shift = (ci->ptype) - types; |
2302 |
swig_type_info *ty = types_initial[shift]; |
2303 |
size_t ldoc = (c - methods[i].ml_doc); |
2304 |
size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; |
2305 |
char *ndoc = (char*)malloc(ldoc + lptr + 10); |
2306 |
if (ndoc) { |
2307 |
char *buff = ndoc; |
2308 |
void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; |
2309 |
if (ptr) { |
2310 |
strncpy(buff, methods[i].ml_doc, ldoc); |
2311 |
buff += ldoc; |
2312 |
strncpy(buff, "swig_ptr: ", 10); |
2313 |
buff += 10; |
2314 |
SWIG_PackVoidPtr(buff, ptr, ty->name, lptr); |
2315 |
methods[i].ml_doc = ndoc; |
2316 |
} |
2317 |
} |
2318 |
} |
2319 |
} |
2320 |
} |
2321 |
} |
2322 |
|
2323 |
/* -----------------------------------------------------------------------------* |
2324 |
* Initialize type list |
2325 |
* -----------------------------------------------------------------------------*/ |
2326 |
|
2327 |
#if PY_MAJOR_VERSION < 2 |
2328 |
/* PyModule_AddObject function was introduced in Python 2.0. The following function |
2329 |
is copied out of Python/modsupport.c in python version 2.3.4 */ |
2330 |
SWIGINTERN int |
2331 |
PyModule_AddObject(PyObject *m, char *name, PyObject *o) |
2332 |
{ |
2333 |
PyObject *dict; |
2334 |
if (!PyModule_Check(m)) { |
2335 |
PyErr_SetString(PyExc_TypeError, |
2336 |
"PyModule_AddObject() needs module as first arg"); |
2337 |
return -1; |
2338 |
} |
2339 |
if (!o) { |
2340 |
PyErr_SetString(PyExc_TypeError, |
2341 |
"PyModule_AddObject() needs non-NULL value"); |
2342 |
return -1; |
2343 |
} |
2344 |
|
2345 |
dict = PyModule_GetDict(m); |
2346 |
if (dict == NULL) { |
2347 |
/* Internal error -- modules must have a dict! */ |
2348 |
PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__", |
2349 |
PyModule_GetName(m)); |
2350 |
return -1; |
2351 |
} |
2352 |
if (PyDict_SetItemString(dict, name, o)) |
2353 |
return -1; |
2354 |
Py_DECREF(o); |
2355 |
return 0; |
2356 |
} |
2357 |
#endif |
2358 |
|
2359 |
#ifdef __cplusplus |
2360 |
} |
2361 |
#endif |
2362 |
|
2363 |
/* -----------------------------------------------------------------------------* |
2364 |
* Partial Init method |
2365 |
* -----------------------------------------------------------------------------*/ |
2366 |
|
2367 |
#ifdef __cplusplus |
2368 |
extern "C" |
2369 |
#endif |
2370 |
SWIGEXPORT void SWIG_init(void) { |
2371 |
static PyObject *SWIG_globals = 0; |
2372 |
PyObject *m, *d; |
2373 |
if (!SWIG_globals) SWIG_globals = SWIG_newvarlink(); |
2374 |
|
2375 |
/* Fix SwigMethods to carry the callback ptrs when needed */ |
2376 |
SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial); |
2377 |
|
2378 |
m = Py_InitModule((char *) SWIG_name, SwigMethods); |
2379 |
d = PyModule_GetDict(m); |
2380 |
|
2381 |
SWIG_InitializeModule(0); |
2382 |
SWIG_InstallConstants(d,swig_const_table); |
2383 |
|
2384 |
{ |
2385 |
PyDict_SetItemString(d,"XD3_SEC_DJW", SWIG_From_int((int)(XD3_SEC_DJW))); |
2386 |
} |
2387 |
{ |
2388 |
PyDict_SetItemString(d,"XD3_SEC_FGK", SWIG_From_int((int)(XD3_SEC_FGK))); |
2389 |
} |
2390 |
{ |
2391 |
PyDict_SetItemString(d,"XD3_SEC_NODATA", SWIG_From_int((int)(XD3_SEC_NODATA))); |
2392 |
} |
2393 |
{ |
2394 |
PyDict_SetItemString(d,"XD3_SEC_NOINST", SWIG_From_int((int)(XD3_SEC_NOINST))); |
2395 |
} |
2396 |
{ |
2397 |
PyDict_SetItemString(d,"XD3_SEC_NOADDR", SWIG_From_int((int)(XD3_SEC_NOADDR))); |
2398 |
} |
2399 |
{ |
2400 |
PyDict_SetItemString(d,"XD3_ADLER32", SWIG_From_int((int)(XD3_ADLER32))); |
2401 |
} |
2402 |
{ |
2403 |
PyDict_SetItemString(d,"XD3_ADLER32_NOVER", SWIG_From_int((int)(XD3_ADLER32_NOVER))); |
2404 |
} |
2405 |
{ |
2406 |
PyDict_SetItemString(d,"XD3_ALT_CODE_TABLE", SWIG_From_int((int)(XD3_ALT_CODE_TABLE))); |
2407 |
} |
2408 |
{ |
2409 |
PyDict_SetItemString(d,"XD3_NOCOMPRESS", SWIG_From_int((int)(XD3_NOCOMPRESS))); |
2410 |
} |
2411 |
{ |
2412 |
PyDict_SetItemString(d,"XD3_BEGREEDY", SWIG_From_int((int)(XD3_BEGREEDY))); |
2413 |
} |
2414 |
{ |
2415 |
PyDict_SetItemString(d,"XD3_COMPLEVEL_SHIFT", SWIG_From_int((int)(XD3_COMPLEVEL_SHIFT))); |
2416 |
} |
2417 |
{ |
2418 |
PyDict_SetItemString(d,"XD3_COMPLEVEL_MASK", SWIG_From_int((int)(XD3_COMPLEVEL_MASK))); |
2419 |
} |
2420 |
{ |
2421 |
PyDict_SetItemString(d,"XD3_COMPLEVEL_1", SWIG_From_int((int)(XD3_COMPLEVEL_1))); |
2422 |
} |
2423 |
{ |
2424 |
PyDict_SetItemString(d,"XD3_COMPLEVEL_3", SWIG_From_int((int)(XD3_COMPLEVEL_3))); |
2425 |
} |
2426 |
{ |
2427 |
PyDict_SetItemString(d,"XD3_COMPLEVEL_6", SWIG_From_int((int)(XD3_COMPLEVEL_6))); |
2428 |
} |
2429 |
{ |
2430 |
PyDict_SetItemString(d,"XD3_COMPLEVEL_9", SWIG_From_int((int)(XD3_COMPLEVEL_9))); |
2431 |
} |
2432 |
} |
2433 |
|