/[ascend]/trunk/models/johnpye/fprops/python/fprops_wrap.c
ViewVC logotype

Annotation of /trunk/models/johnpye/fprops/python/fprops_wrap.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2117 - (hide annotations) (download) (as text)
Wed Dec 9 04:30:18 2009 UTC (10 years, 8 months ago) by jpye
File MIME type: text/x-csrc
File size: 200231 byte(s)
Improving Python build of FPROPS.
Added spinodal.py for visualisation of spinodal points.
Added placeholder critical and triple point data for the other fluids (needs to be filled in).
Allow peering inside helmholtz data form Python (eg to access critical point data).
1 jpye 2007 /* ----------------------------------------------------------------------------
2     * This file was automatically generated by SWIG (http://www.swig.org).
3 jpye 2117 * Version 1.3.31
4 jpye 2007 *
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     #define SWIG_PYTHON_DIRECTOR_NO_VTABLE
13     /* -----------------------------------------------------------------------------
14     * This section contains generic SWIG labels for method/variable
15     * declarations/attributes, and other compiler dependent labels.
16     * ----------------------------------------------------------------------------- */
17    
18     /* template workaround for compilers that cannot correctly implement the C++ standard */
19     #ifndef SWIGTEMPLATEDISAMBIGUATOR
20 jpye 2117 # if defined(__SUNPRO_CC)
21     # if (__SUNPRO_CC <= 0x560)
22     # define SWIGTEMPLATEDISAMBIGUATOR template
23     # else
24     # define SWIGTEMPLATEDISAMBIGUATOR
25     # endif
26 jpye 2007 # else
27 jpye 2117 # define SWIGTEMPLATEDISAMBIGUATOR
28 jpye 2007 # endif
29     #endif
30    
31     /* inline attribute */
32     #ifndef SWIGINLINE
33     # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
34     # define SWIGINLINE inline
35     # else
36     # define SWIGINLINE
37     # endif
38     #endif
39    
40     /* attribute recognised by some compilers to avoid 'unused' warnings */
41     #ifndef SWIGUNUSED
42     # if defined(__GNUC__)
43     # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
44     # define SWIGUNUSED __attribute__ ((__unused__))
45     # else
46     # define SWIGUNUSED
47     # endif
48     # elif defined(__ICC)
49     # define SWIGUNUSED __attribute__ ((__unused__))
50     # else
51     # define SWIGUNUSED
52     # endif
53     #endif
54    
55     #ifndef SWIGUNUSEDPARM
56     # ifdef __cplusplus
57     # define SWIGUNUSEDPARM(p)
58     # else
59     # define SWIGUNUSEDPARM(p) p SWIGUNUSED
60     # endif
61     #endif
62    
63     /* internal SWIG method */
64     #ifndef SWIGINTERN
65     # define SWIGINTERN static SWIGUNUSED
66     #endif
67    
68     /* internal inline SWIG method */
69     #ifndef SWIGINTERNINLINE
70     # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
71     #endif
72    
73     /* exporting methods */
74     #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
75     # ifndef GCC_HASCLASSVISIBILITY
76     # define GCC_HASCLASSVISIBILITY
77     # endif
78     #endif
79    
80     #ifndef SWIGEXPORT
81     # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
82     # if defined(STATIC_LINKED)
83     # define SWIGEXPORT
84     # else
85     # define SWIGEXPORT __declspec(dllexport)
86     # endif
87     # else
88     # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
89     # define SWIGEXPORT __attribute__ ((visibility("default")))
90     # else
91     # define SWIGEXPORT
92     # endif
93     # endif
94     #endif
95    
96     /* calling conventions for Windows */
97     #ifndef SWIGSTDCALL
98     # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
99     # define SWIGSTDCALL __stdcall
100     # else
101     # define SWIGSTDCALL
102     # endif
103     #endif
104    
105     /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
106     #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
107     # define _CRT_SECURE_NO_DEPRECATE
108     #endif
109    
110    
111     /* Python.h has to appear first */
112     #include <Python.h>
113    
114     /* -----------------------------------------------------------------------------
115     * swigrun.swg
116     *
117     * This file contains generic CAPI SWIG runtime support for pointer
118     * type checking.
119     * ----------------------------------------------------------------------------- */
120    
121     /* This should only be incremented when either the layout of swig_type_info changes,
122     or for whatever reason, the runtime changes incompatibly */
123 jpye 2117 #define SWIG_RUNTIME_VERSION "3"
124 jpye 2007
125     /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
126     #ifdef SWIG_TYPE_TABLE
127     # define SWIG_QUOTE_STRING(x) #x
128     # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
129     # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
130     #else
131     # define SWIG_TYPE_TABLE_NAME
132     #endif
133    
134     /*
135     You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
136     creating a static or dynamic library from the swig runtime code.
137     In 99.9% of the cases, swig just needs to declare them as 'static'.
138    
139     But only do this if is strictly necessary, ie, if you have problems
140     with your compiler or so.
141     */
142    
143     #ifndef SWIGRUNTIME
144     # define SWIGRUNTIME SWIGINTERN
145     #endif
146    
147     #ifndef SWIGRUNTIMEINLINE
148     # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
149     #endif
150    
151     /* Generic buffer size */
152     #ifndef SWIG_BUFFER_SIZE
153     # define SWIG_BUFFER_SIZE 1024
154     #endif
155    
156     /* Flags for pointer conversions */
157     #define SWIG_POINTER_DISOWN 0x1
158    
159     /* Flags for new pointer objects */
160     #define SWIG_POINTER_OWN 0x1
161    
162    
163     /*
164     Flags/methods for returning states.
165    
166     The swig conversion methods, as ConvertPtr, return and integer
167     that tells if the conversion was successful or not. And if not,
168     an error code can be returned (see swigerrors.swg for the codes).
169    
170     Use the following macros/flags to set or process the returning
171     states.
172    
173     In old swig versions, you usually write code as:
174    
175     if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
176     // success code
177     } else {
178     //fail code
179     }
180    
181     Now you can be more explicit as:
182    
183     int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
184     if (SWIG_IsOK(res)) {
185     // success code
186     } else {
187     // fail code
188     }
189    
190     that seems to be the same, but now you can also do
191    
192     Type *ptr;
193     int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
194     if (SWIG_IsOK(res)) {
195     // success code
196     if (SWIG_IsNewObj(res) {
197     ...
198     delete *ptr;
199     } else {
200     ...
201     }
202     } else {
203     // fail code
204     }
205    
206     I.e., now SWIG_ConvertPtr can return new objects and you can
207     identify the case and take care of the deallocation. Of course that
208     requires also to SWIG_ConvertPtr to return new result values, as
209    
210     int SWIG_ConvertPtr(obj, ptr,...) {
211     if (<obj is ok>) {
212     if (<need new object>) {
213     *ptr = <ptr to new allocated object>;
214     return SWIG_NEWOBJ;
215     } else {
216     *ptr = <ptr to old object>;
217     return SWIG_OLDOBJ;
218     }
219     } else {
220     return SWIG_BADOBJ;
221     }
222     }
223    
224     Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
225     more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
226     swig errors code.
227    
228     Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
229     allows to return the 'cast rank', for example, if you have this
230    
231     int food(double)
232     int fooi(int);
233    
234     and you call
235    
236     food(1) // cast rank '1' (1 -> 1.0)
237     fooi(1) // cast rank '0'
238    
239     just use the SWIG_AddCast()/SWIG_CheckState()
240    
241    
242     */
243     #define SWIG_OK (0)
244     #define SWIG_ERROR (-1)
245     #define SWIG_IsOK(r) (r >= 0)
246     #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
247    
248     /* The CastRankLimit says how many bits are used for the cast rank */
249     #define SWIG_CASTRANKLIMIT (1 << 8)
250     /* The NewMask denotes the object was created (using new/malloc) */
251     #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1)
252     /* The TmpMask is for in/out typemaps that use temporal objects */
253     #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1)
254     /* Simple returning values */
255     #define SWIG_BADOBJ (SWIG_ERROR)
256     #define SWIG_OLDOBJ (SWIG_OK)
257     #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK)
258     #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK)
259     /* Check, add and del mask methods */
260     #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
261     #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
262     #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
263     #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
264     #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
265     #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
266    
267    
268     /* Cast-Rank Mode */
269     #if defined(SWIG_CASTRANK_MODE)
270     # ifndef SWIG_TypeRank
271     # define SWIG_TypeRank unsigned long
272     # endif
273     # ifndef SWIG_MAXCASTRANK /* Default cast allowed */
274     # define SWIG_MAXCASTRANK (2)
275     # endif
276     # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
277     # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
278     SWIGINTERNINLINE int SWIG_AddCast(int r) {
279     return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
280     }
281     SWIGINTERNINLINE int SWIG_CheckState(int r) {
282     return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
283     }
284     #else /* no cast-rank mode */
285     # define SWIG_AddCast
286     # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
287     #endif
288    
289    
290    
291    
292     #include <string.h>
293    
294     #ifdef __cplusplus
295     extern "C" {
296     #endif
297    
298 jpye 2117 typedef void *(*swig_converter_func)(void *);
299 jpye 2007 typedef struct swig_type_info *(*swig_dycast_func)(void **);
300    
301 jpye 2117 /* Structure to store inforomation on one type */
302 jpye 2007 typedef struct swig_type_info {
303     const char *name; /* mangled name of this type */
304     const char *str; /* human readable name of this type */
305     swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
306     struct swig_cast_info *cast; /* linked list of types that can cast into this type */
307     void *clientdata; /* language specific type data */
308     int owndata; /* flag if the structure owns the clientdata */
309     } swig_type_info;
310    
311     /* Structure to store a type and conversion function used for casting */
312     typedef struct swig_cast_info {
313     swig_type_info *type; /* pointer to type that is equivalent to this type */
314     swig_converter_func converter; /* function to cast the void pointers */
315     struct swig_cast_info *next; /* pointer to next cast in linked list */
316     struct swig_cast_info *prev; /* pointer to the previous cast */
317     } swig_cast_info;
318    
319     /* Structure used to store module information
320     * Each module generates one structure like this, and the runtime collects
321     * all of these structures and stores them in a circularly linked list.*/
322     typedef struct swig_module_info {
323     swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
324     size_t size; /* Number of types in this module */
325     struct swig_module_info *next; /* Pointer to next element in circularly linked list */
326     swig_type_info **type_initial; /* Array of initially generated type structures */
327     swig_cast_info **cast_initial; /* Array of initially generated casting structures */
328     void *clientdata; /* Language specific module data */
329     } swig_module_info;
330    
331     /*
332     Compare two type names skipping the space characters, therefore
333     "char*" == "char *" and "Class<int>" == "Class<int >", etc.
334    
335     Return 0 when the two name types are equivalent, as in
336     strncmp, but skipping ' '.
337     */
338     SWIGRUNTIME int
339     SWIG_TypeNameComp(const char *f1, const char *l1,
340     const char *f2, const char *l2) {
341     for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
342     while ((*f1 == ' ') && (f1 != l1)) ++f1;
343     while ((*f2 == ' ') && (f2 != l2)) ++f2;
344     if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
345     }
346 jpye 2117 return (l1 - f1) - (l2 - f2);
347 jpye 2007 }
348    
349     /*
350     Check type equivalence in a name list like <name1>|<name2>|...
351     Return 0 if not equal, 1 if equal
352     */
353     SWIGRUNTIME int
354     SWIG_TypeEquiv(const char *nb, const char *tb) {
355     int equiv = 0;
356     const char* te = tb + strlen(tb);
357     const char* ne = nb;
358     while (!equiv && *ne) {
359     for (nb = ne; *ne; ++ne) {
360     if (*ne == '|') break;
361     }
362     equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
363     if (*ne) ++ne;
364     }
365     return equiv;
366     }
367    
368     /*
369     Check type equivalence in a name list like <name1>|<name2>|...
370     Return 0 if equal, -1 if nb < tb, 1 if nb > tb
371     */
372     SWIGRUNTIME int
373     SWIG_TypeCompare(const char *nb, const char *tb) {
374     int equiv = 0;
375     const char* te = tb + strlen(tb);
376     const char* ne = nb;
377     while (!equiv && *ne) {
378     for (nb = ne; *ne; ++ne) {
379     if (*ne == '|') break;
380     }
381     equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
382     if (*ne) ++ne;
383     }
384     return equiv;
385     }
386    
387    
388     /* think of this as a c++ template<> or a scheme macro */
389     #define SWIG_TypeCheck_Template(comparison, ty) \
390     if (ty) { \
391     swig_cast_info *iter = ty->cast; \
392     while (iter) { \
393     if (comparison) { \
394     if (iter == ty->cast) return iter; \
395     /* Move iter to the top of the linked list */ \
396     iter->prev->next = iter->next; \
397     if (iter->next) \
398     iter->next->prev = iter->prev; \
399     iter->next = ty->cast; \
400     iter->prev = 0; \
401     if (ty->cast) ty->cast->prev = iter; \
402     ty->cast = iter; \
403     return iter; \
404     } \
405     iter = iter->next; \
406     } \
407     } \
408     return 0
409    
410     /*
411     Check the typename
412     */
413     SWIGRUNTIME swig_cast_info *
414     SWIG_TypeCheck(const char *c, swig_type_info *ty) {
415     SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
416     }
417    
418     /* Same as previous function, except strcmp is replaced with a pointer comparison */
419     SWIGRUNTIME swig_cast_info *
420     SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
421     SWIG_TypeCheck_Template(iter->type == from, into);
422     }
423    
424     /*
425     Cast a pointer up an inheritance hierarchy
426     */
427     SWIGRUNTIMEINLINE void *
428 jpye 2117 SWIG_TypeCast(swig_cast_info *ty, void *ptr) {
429     return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr);
430 jpye 2007 }
431    
432     /*
433     Dynamic pointer casting. Down an inheritance hierarchy
434     */
435     SWIGRUNTIME swig_type_info *
436     SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
437     swig_type_info *lastty = ty;
438     if (!ty || !ty->dcast) return ty;
439     while (ty && (ty->dcast)) {
440     ty = (*ty->dcast)(ptr);
441     if (ty) lastty = ty;
442     }
443     return lastty;
444     }
445    
446     /*
447     Return the name associated with this type
448     */
449     SWIGRUNTIMEINLINE const char *
450     SWIG_TypeName(const swig_type_info *ty) {
451     return ty->name;
452     }
453    
454     /*
455     Return the pretty name associated with this type,
456     that is an unmangled type name in a form presentable to the user.
457     */
458     SWIGRUNTIME const char *
459     SWIG_TypePrettyName(const swig_type_info *type) {
460     /* The "str" field contains the equivalent pretty names of the
461     type, separated by vertical-bar characters. We choose
462     to print the last name, as it is often (?) the most
463     specific. */
464     if (!type) return NULL;
465     if (type->str != NULL) {
466     const char *last_name = type->str;
467     const char *s;
468     for (s = type->str; *s; s++)
469     if (*s == '|') last_name = s+1;
470     return last_name;
471     }
472     else
473     return type->name;
474     }
475    
476     /*
477     Set the clientdata field for a type
478     */
479     SWIGRUNTIME void
480     SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
481     swig_cast_info *cast = ti->cast;
482     /* if (ti->clientdata == clientdata) return; */
483     ti->clientdata = clientdata;
484    
485     while (cast) {
486     if (!cast->converter) {
487     swig_type_info *tc = cast->type;
488     if (!tc->clientdata) {
489     SWIG_TypeClientData(tc, clientdata);
490     }
491     }
492     cast = cast->next;
493     }
494     }
495     SWIGRUNTIME void
496     SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
497     SWIG_TypeClientData(ti, clientdata);
498     ti->owndata = 1;
499     }
500    
501     /*
502     Search for a swig_type_info structure only by mangled name
503     Search is a O(log #types)
504    
505     We start searching at module start, and finish searching when start == end.
506     Note: if start == end at the beginning of the function, we go all the way around
507     the circular list.
508     */
509     SWIGRUNTIME swig_type_info *
510     SWIG_MangledTypeQueryModule(swig_module_info *start,
511     swig_module_info *end,
512     const char *name) {
513     swig_module_info *iter = start;
514     do {
515     if (iter->size) {
516     register size_t l = 0;
517     register size_t r = iter->size - 1;
518     do {
519     /* since l+r >= 0, we can (>> 1) instead (/ 2) */
520     register size_t i = (l + r) >> 1;
521     const char *iname = iter->types[i]->name;
522     if (iname) {
523     register int compare = strcmp(name, iname);
524     if (compare == 0) {
525     return iter->types[i];
526     } else if (compare < 0) {
527     if (i) {
528     r = i - 1;
529     } else {
530     break;
531     }
532     } else if (compare > 0) {
533     l = i + 1;
534     }
535     } else {
536     break; /* should never happen */
537     }
538     } while (l <= r);
539     }
540     iter = iter->next;
541     } while (iter != end);
542     return 0;
543     }
544    
545     /*
546     Search for a swig_type_info structure for either a mangled name or a human readable name.
547     It first searches the mangled names of the types, which is a O(log #types)
548     If a type is not found it then searches the human readable names, which is O(#types).
549    
550     We start searching at module start, and finish searching when start == end.
551     Note: if start == end at the beginning of the function, we go all the way around
552     the circular list.
553     */
554     SWIGRUNTIME swig_type_info *
555     SWIG_TypeQueryModule(swig_module_info *start,
556     swig_module_info *end,
557     const char *name) {
558     /* STEP 1: Search the name field using binary search */
559     swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
560     if (ret) {
561     return ret;
562     } else {
563     /* STEP 2: If the type hasn't been found, do a complete search
564     of the str field (the human readable name) */
565     swig_module_info *iter = start;
566     do {
567     register size_t i = 0;
568     for (; i < iter->size; ++i) {
569     if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
570     return iter->types[i];
571     }
572     iter = iter->next;
573     } while (iter != end);
574     }
575    
576     /* neither found a match */
577     return 0;
578     }
579    
580     /*
581     Pack binary data into a string
582     */
583     SWIGRUNTIME char *
584     SWIG_PackData(char *c, void *ptr, size_t sz) {
585     static const char hex[17] = "0123456789abcdef";
586     register const unsigned char *u = (unsigned char *) ptr;
587     register const unsigned char *eu = u + sz;
588     for (; u != eu; ++u) {
589     register unsigned char uu = *u;
590     *(c++) = hex[(uu & 0xf0) >> 4];
591     *(c++) = hex[uu & 0xf];
592     }
593     return c;
594     }
595    
596     /*
597     Unpack binary data from a string
598     */
599     SWIGRUNTIME const char *
600     SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
601     register unsigned char *u = (unsigned char *) ptr;
602     register const unsigned char *eu = u + sz;
603     for (; u != eu; ++u) {
604     register char d = *(c++);
605     register unsigned char uu;
606     if ((d >= '0') && (d <= '9'))
607     uu = ((d - '0') << 4);
608     else if ((d >= 'a') && (d <= 'f'))
609     uu = ((d - ('a'-10)) << 4);
610     else
611     return (char *) 0;
612     d = *(c++);
613     if ((d >= '0') && (d <= '9'))
614     uu |= (d - '0');
615     else if ((d >= 'a') && (d <= 'f'))
616     uu |= (d - ('a'-10));
617     else
618     return (char *) 0;
619     *u = uu;
620     }
621     return c;
622     }
623    
624     /*
625     Pack 'void *' into a string buffer.
626     */
627     SWIGRUNTIME char *
628     SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
629     char *r = buff;
630     if ((2*sizeof(void *) + 2) > bsz) return 0;
631     *(r++) = '_';
632     r = SWIG_PackData(r,&ptr,sizeof(void *));
633     if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
634     strcpy(r,name);
635     return buff;
636     }
637    
638     SWIGRUNTIME const char *
639     SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
640     if (*c != '_') {
641     if (strcmp(c,"NULL") == 0) {
642     *ptr = (void *) 0;
643     return name;
644     } else {
645     return 0;
646     }
647     }
648     return SWIG_UnpackData(++c,ptr,sizeof(void *));
649     }
650    
651     SWIGRUNTIME char *
652     SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
653     char *r = buff;
654     size_t lname = (name ? strlen(name) : 0);
655     if ((2*sz + 2 + lname) > bsz) return 0;
656     *(r++) = '_';
657     r = SWIG_PackData(r,ptr,sz);
658     if (lname) {
659     strncpy(r,name,lname+1);
660     } else {
661     *r = 0;
662     }
663     return buff;
664     }
665    
666     SWIGRUNTIME const char *
667     SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
668     if (*c != '_') {
669     if (strcmp(c,"NULL") == 0) {
670     memset(ptr,0,sz);
671     return name;
672     } else {
673     return 0;
674     }
675     }
676     return SWIG_UnpackData(++c,ptr,sz);
677     }
678    
679     #ifdef __cplusplus
680     }
681     #endif
682    
683     /* Errors in SWIG */
684     #define SWIG_UnknownError -1
685     #define SWIG_IOError -2
686     #define SWIG_RuntimeError -3
687     #define SWIG_IndexError -4
688     #define SWIG_TypeError -5
689     #define SWIG_DivisionByZero -6
690     #define SWIG_OverflowError -7
691     #define SWIG_SyntaxError -8
692     #define SWIG_ValueError -9
693     #define SWIG_SystemError -10
694     #define SWIG_AttributeError -11
695     #define SWIG_MemoryError -12
696     #define SWIG_NullReferenceError -13
697    
698    
699    
700    
701     /* Add PyOS_snprintf for old Pythons */
702     #if PY_VERSION_HEX < 0x02020000
703     # if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_WATCOM)
704     # define PyOS_snprintf _snprintf
705     # else
706     # define PyOS_snprintf snprintf
707     # endif
708     #endif
709    
710     /* A crude PyString_FromFormat implementation for old Pythons */
711     #if PY_VERSION_HEX < 0x02020000
712    
713     #ifndef SWIG_PYBUFFER_SIZE
714     # define SWIG_PYBUFFER_SIZE 1024
715     #endif
716    
717     static PyObject *
718     PyString_FromFormat(const char *fmt, ...) {
719     va_list ap;
720     char buf[SWIG_PYBUFFER_SIZE * 2];
721     int res;
722     va_start(ap, fmt);
723     res = vsnprintf(buf, sizeof(buf), fmt, ap);
724     va_end(ap);
725     return (res < 0 || res >= (int)sizeof(buf)) ? 0 : PyString_FromString(buf);
726     }
727     #endif
728    
729     /* Add PyObject_Del for old Pythons */
730     #if PY_VERSION_HEX < 0x01060000
731     # define PyObject_Del(op) PyMem_DEL((op))
732     #endif
733     #ifndef PyObject_DEL
734     # define PyObject_DEL PyObject_Del
735     #endif
736    
737     /* A crude PyExc_StopIteration exception for old Pythons */
738     #if PY_VERSION_HEX < 0x02020000
739     # ifndef PyExc_StopIteration
740     # define PyExc_StopIteration PyExc_RuntimeError
741     # endif
742     # ifndef PyObject_GenericGetAttr
743     # define PyObject_GenericGetAttr 0
744     # endif
745     #endif
746     /* Py_NotImplemented is defined in 2.1 and up. */
747     #if PY_VERSION_HEX < 0x02010000
748     # ifndef Py_NotImplemented
749     # define Py_NotImplemented PyExc_RuntimeError
750     # endif
751     #endif
752    
753    
754     /* A crude PyString_AsStringAndSize implementation for old Pythons */
755     #if PY_VERSION_HEX < 0x02010000
756     # ifndef PyString_AsStringAndSize
757     # define PyString_AsStringAndSize(obj, s, len) {*s = PyString_AsString(obj); *len = *s ? strlen(*s) : 0;}
758     # endif
759     #endif
760    
761     /* PySequence_Size for old Pythons */
762     #if PY_VERSION_HEX < 0x02000000
763     # ifndef PySequence_Size
764     # define PySequence_Size PySequence_Length
765     # endif
766     #endif
767    
768    
769     /* PyBool_FromLong for old Pythons */
770     #if PY_VERSION_HEX < 0x02030000
771     static
772     PyObject *PyBool_FromLong(long ok)
773     {
774     PyObject *result = ok ? Py_True : Py_False;
775     Py_INCREF(result);
776     return result;
777     }
778     #endif
779    
780     /* Py_ssize_t for old Pythons */
781     /* This code is as recommended by: */
782     /* http://www.python.org/dev/peps/pep-0353/#conversion-guidelines */
783     #if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
784     typedef int Py_ssize_t;
785     # define PY_SSIZE_T_MAX INT_MAX
786     # define PY_SSIZE_T_MIN INT_MIN
787     #endif
788    
789     /* -----------------------------------------------------------------------------
790     * error manipulation
791     * ----------------------------------------------------------------------------- */
792    
793     SWIGRUNTIME PyObject*
794     SWIG_Python_ErrorType(int code) {
795     PyObject* type = 0;
796     switch(code) {
797     case SWIG_MemoryError:
798     type = PyExc_MemoryError;
799     break;
800     case SWIG_IOError:
801     type = PyExc_IOError;
802     break;
803     case SWIG_RuntimeError:
804     type = PyExc_RuntimeError;
805     break;
806     case SWIG_IndexError:
807     type = PyExc_IndexError;
808     break;
809     case SWIG_TypeError:
810     type = PyExc_TypeError;
811     break;
812     case SWIG_DivisionByZero:
813     type = PyExc_ZeroDivisionError;
814     break;
815     case SWIG_OverflowError:
816     type = PyExc_OverflowError;
817     break;
818     case SWIG_SyntaxError:
819     type = PyExc_SyntaxError;
820     break;
821     case SWIG_ValueError:
822     type = PyExc_ValueError;
823     break;
824     case SWIG_SystemError:
825     type = PyExc_SystemError;
826     break;
827     case SWIG_AttributeError:
828     type = PyExc_AttributeError;
829     break;
830     default:
831     type = PyExc_RuntimeError;
832     }
833     return type;
834     }
835    
836    
837     SWIGRUNTIME void
838     SWIG_Python_AddErrorMsg(const char* mesg)
839     {
840     PyObject *type = 0;
841     PyObject *value = 0;
842     PyObject *traceback = 0;
843    
844     if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback);
845     if (value) {
846     PyObject *old_str = PyObject_Str(value);
847     PyErr_Clear();
848     Py_XINCREF(type);
849     PyErr_Format(type, "%s %s", PyString_AsString(old_str), mesg);
850     Py_DECREF(old_str);
851     Py_DECREF(value);
852     } else {
853 jpye 2117 PyErr_Format(PyExc_RuntimeError, mesg);
854 jpye 2007 }
855     }
856    
857    
858    
859     #if defined(SWIG_PYTHON_NO_THREADS)
860     # if defined(SWIG_PYTHON_THREADS)
861     # undef SWIG_PYTHON_THREADS
862     # endif
863     #endif
864     #if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */
865     # if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL)
866     # if (PY_VERSION_HEX >= 0x02030000) /* For 2.3 or later, use the PyGILState calls */
867     # define SWIG_PYTHON_USE_GIL
868     # endif
869     # endif
870     # if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */
871     # ifndef SWIG_PYTHON_INITIALIZE_THREADS
872     # define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads()
873     # endif
874     # ifdef __cplusplus /* C++ code */
875     class SWIG_Python_Thread_Block {
876     bool status;
877     PyGILState_STATE state;
878     public:
879     void end() { if (status) { PyGILState_Release(state); status = false;} }
880     SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {}
881     ~SWIG_Python_Thread_Block() { end(); }
882     };
883     class SWIG_Python_Thread_Allow {
884     bool status;
885     PyThreadState *save;
886     public:
887     void end() { if (status) { PyEval_RestoreThread(save); status = false; }}
888     SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {}
889     ~SWIG_Python_Thread_Allow() { end(); }
890     };
891     # define SWIG_PYTHON_THREAD_BEGIN_BLOCK SWIG_Python_Thread_Block _swig_thread_block
892     # define SWIG_PYTHON_THREAD_END_BLOCK _swig_thread_block.end()
893     # define SWIG_PYTHON_THREAD_BEGIN_ALLOW SWIG_Python_Thread_Allow _swig_thread_allow
894     # define SWIG_PYTHON_THREAD_END_ALLOW _swig_thread_allow.end()
895     # else /* C code */
896     # define SWIG_PYTHON_THREAD_BEGIN_BLOCK PyGILState_STATE _swig_thread_block = PyGILState_Ensure()
897     # define SWIG_PYTHON_THREAD_END_BLOCK PyGILState_Release(_swig_thread_block)
898     # define SWIG_PYTHON_THREAD_BEGIN_ALLOW PyThreadState *_swig_thread_allow = PyEval_SaveThread()
899     # define SWIG_PYTHON_THREAD_END_ALLOW PyEval_RestoreThread(_swig_thread_allow)
900     # endif
901     # else /* Old thread way, not implemented, user must provide it */
902     # if !defined(SWIG_PYTHON_INITIALIZE_THREADS)
903     # define SWIG_PYTHON_INITIALIZE_THREADS
904     # endif
905     # if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK)
906     # define SWIG_PYTHON_THREAD_BEGIN_BLOCK
907     # endif
908     # if !defined(SWIG_PYTHON_THREAD_END_BLOCK)
909     # define SWIG_PYTHON_THREAD_END_BLOCK
910     # endif
911     # if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW)
912     # define SWIG_PYTHON_THREAD_BEGIN_ALLOW
913     # endif
914     # if !defined(SWIG_PYTHON_THREAD_END_ALLOW)
915     # define SWIG_PYTHON_THREAD_END_ALLOW
916     # endif
917     # endif
918     #else /* No thread support */
919     # define SWIG_PYTHON_INITIALIZE_THREADS
920     # define SWIG_PYTHON_THREAD_BEGIN_BLOCK
921     # define SWIG_PYTHON_THREAD_END_BLOCK
922     # define SWIG_PYTHON_THREAD_BEGIN_ALLOW
923     # define SWIG_PYTHON_THREAD_END_ALLOW
924     #endif
925    
926     /* -----------------------------------------------------------------------------
927     * Python API portion that goes into the runtime
928     * ----------------------------------------------------------------------------- */
929    
930     #ifdef __cplusplus
931     extern "C" {
932     #if 0
933     } /* cc-mode */
934     #endif
935     #endif
936    
937     /* -----------------------------------------------------------------------------
938     * Constant declarations
939     * ----------------------------------------------------------------------------- */
940    
941     /* Constant Types */
942     #define SWIG_PY_POINTER 4
943     #define SWIG_PY_BINARY 5
944    
945     /* Constant information structure */
946     typedef struct swig_const_info {
947     int type;
948     char *name;
949     long lvalue;
950     double dvalue;
951     void *pvalue;
952     swig_type_info **ptype;
953     } swig_const_info;
954    
955     #ifdef __cplusplus
956     #if 0
957     { /* cc-mode */
958     #endif
959     }
960     #endif
961    
962    
963     /* -----------------------------------------------------------------------------
964     * See the LICENSE file for information on copyright, usage and redistribution
965     * of SWIG, and the README file for authors - http://www.swig.org/release.html.
966     *
967     * pyrun.swg
968     *
969     * This file contains the runtime support for Python modules
970     * and includes code for managing global variables and pointer
971     * type checking.
972     *
973     * ----------------------------------------------------------------------------- */
974    
975     /* Common SWIG API */
976    
977     /* for raw pointers */
978     #define SWIG_Python_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
979     #define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags)
980     #define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own)
981     #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(ptr, type, flags)
982     #define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty)
983     #define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src)
984     #define swig_owntype int
985    
986     /* for raw packed data */
987     #define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
988     #define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type)
989    
990     /* for class or struct pointers */
991     #define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags)
992     #define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags)
993    
994     /* for C or C++ function pointers */
995     #define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_Python_ConvertFunctionPtr(obj, pptr, type)
996     #define SWIG_NewFunctionPtrObj(ptr, type) SWIG_Python_NewPointerObj(ptr, type, 0)
997    
998     /* for C++ member pointers, ie, member methods */
999     #define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
1000     #define SWIG_NewMemberObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type)
1001    
1002    
1003     /* Runtime API */
1004    
1005     #define SWIG_GetModule(clientdata) SWIG_Python_GetModule()
1006     #define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer)
1007     #define SWIG_NewClientData(obj) PySwigClientData_New(obj)
1008    
1009     #define SWIG_SetErrorObj SWIG_Python_SetErrorObj
1010     #define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg
1011     #define SWIG_ErrorType(code) SWIG_Python_ErrorType(code)
1012     #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg)
1013     #define SWIG_fail goto fail
1014    
1015    
1016     /* Runtime API implementation */
1017    
1018     /* Error manipulation */
1019    
1020     SWIGINTERN void
1021     SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) {
1022     SWIG_PYTHON_THREAD_BEGIN_BLOCK;
1023     PyErr_SetObject(errtype, obj);
1024     Py_DECREF(obj);
1025     SWIG_PYTHON_THREAD_END_BLOCK;
1026     }
1027    
1028     SWIGINTERN void
1029     SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) {
1030     SWIG_PYTHON_THREAD_BEGIN_BLOCK;
1031     PyErr_SetString(errtype, (char *) msg);
1032     SWIG_PYTHON_THREAD_END_BLOCK;
1033     }
1034    
1035     #define SWIG_Python_Raise(obj, type, desc) SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj)
1036    
1037     /* Set a constant value */
1038    
1039     SWIGINTERN void
1040     SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) {
1041     PyDict_SetItemString(d, (char*) name, obj);
1042     Py_DECREF(obj);
1043     }
1044    
1045     /* Append a value to the result obj */
1046    
1047     SWIGINTERN PyObject*
1048     SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) {
1049     #if !defined(SWIG_PYTHON_OUTPUT_TUPLE)
1050     if (!result) {
1051     result = obj;
1052     } else if (result == Py_None) {
1053     Py_DECREF(result);
1054     result = obj;
1055     } else {
1056     if (!PyList_Check(result)) {
1057     PyObject *o2 = result;
1058     result = PyList_New(1);
1059     PyList_SetItem(result, 0, o2);
1060     }
1061     PyList_Append(result,obj);
1062     Py_DECREF(obj);
1063     }
1064     return result;
1065     #else
1066     PyObject* o2;
1067     PyObject* o3;
1068     if (!result) {
1069     result = obj;
1070     } else if (result == Py_None) {
1071     Py_DECREF(result);
1072     result = obj;
1073     } else {
1074     if (!PyTuple_Check(result)) {
1075     o2 = result;
1076     result = PyTuple_New(1);
1077     PyTuple_SET_ITEM(result, 0, o2);
1078     }
1079     o3 = PyTuple_New(1);
1080     PyTuple_SET_ITEM(o3, 0, obj);
1081     o2 = result;
1082     result = PySequence_Concat(o2, o3);
1083     Py_DECREF(o2);
1084     Py_DECREF(o3);
1085     }
1086     return result;
1087     #endif
1088     }
1089    
1090     /* Unpack the argument tuple */
1091    
1092     SWIGINTERN int
1093 jpye 2117 SWIG_Python_UnpackTuple(PyObject *args, const char *name, int min, int max, PyObject **objs)
1094 jpye 2007 {
1095     if (!args) {
1096     if (!min && !max) {
1097     return 1;
1098     } else {
1099     PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none",
1100 jpye 2117 name, (min == max ? "" : "at least "), min);
1101 jpye 2007 return 0;
1102     }
1103     }
1104     if (!PyTuple_Check(args)) {
1105     PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple");
1106     return 0;
1107     } else {
1108 jpye 2117 register int l = PyTuple_GET_SIZE(args);
1109 jpye 2007 if (l < min) {
1110     PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d",
1111 jpye 2117 name, (min == max ? "" : "at least "), min, l);
1112 jpye 2007 return 0;
1113     } else if (l > max) {
1114     PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d",
1115 jpye 2117 name, (min == max ? "" : "at most "), max, l);
1116 jpye 2007 return 0;
1117     } else {
1118     register int i;
1119     for (i = 0; i < l; ++i) {
1120     objs[i] = PyTuple_GET_ITEM(args, i);
1121     }
1122     for (; l < max; ++l) {
1123     objs[l] = 0;
1124     }
1125     return i + 1;
1126     }
1127     }
1128     }
1129    
1130     /* A functor is a function object with one single object argument */
1131     #if PY_VERSION_HEX >= 0x02020000
1132     #define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL);
1133     #else
1134     #define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunction(functor, "O", obj);
1135     #endif
1136    
1137     /*
1138     Helper for static pointer initialization for both C and C++ code, for example
1139     static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...);
1140     */
1141     #ifdef __cplusplus
1142     #define SWIG_STATIC_POINTER(var) var
1143     #else
1144     #define SWIG_STATIC_POINTER(var) var = 0; if (!var) var
1145     #endif
1146    
1147     /* -----------------------------------------------------------------------------
1148     * Pointer declarations
1149     * ----------------------------------------------------------------------------- */
1150    
1151     /* Flags for new pointer objects */
1152     #define SWIG_POINTER_NOSHADOW (SWIG_POINTER_OWN << 1)
1153     #define SWIG_POINTER_NEW (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN)
1154    
1155     #define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1)
1156    
1157     #ifdef __cplusplus
1158     extern "C" {
1159     #if 0
1160     } /* cc-mode */
1161     #endif
1162     #endif
1163    
1164     /* How to access Py_None */
1165     #if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
1166     # ifndef SWIG_PYTHON_NO_BUILD_NONE
1167     # ifndef SWIG_PYTHON_BUILD_NONE
1168     # define SWIG_PYTHON_BUILD_NONE
1169     # endif
1170     # endif
1171     #endif
1172    
1173     #ifdef SWIG_PYTHON_BUILD_NONE
1174     # ifdef Py_None
1175     # undef Py_None
1176     # define Py_None SWIG_Py_None()
1177     # endif
1178     SWIGRUNTIMEINLINE PyObject *
1179     _SWIG_Py_None(void)
1180     {
1181     PyObject *none = Py_BuildValue((char*)"");
1182     Py_DECREF(none);
1183     return none;
1184     }
1185     SWIGRUNTIME PyObject *
1186     SWIG_Py_None(void)
1187     {
1188     static PyObject *SWIG_STATIC_POINTER(none) = _SWIG_Py_None();
1189     return none;
1190     }
1191     #endif
1192    
1193     /* The python void return value */
1194    
1195     SWIGRUNTIMEINLINE PyObject *
1196     SWIG_Py_Void(void)
1197     {
1198     PyObject *none = Py_None;
1199     Py_INCREF(none);
1200     return none;
1201     }
1202    
1203     /* PySwigClientData */
1204    
1205     typedef struct {
1206     PyObject *klass;
1207     PyObject *newraw;
1208     PyObject *newargs;
1209     PyObject *destroy;
1210     int delargs;
1211     int implicitconv;
1212     } PySwigClientData;
1213    
1214     SWIGRUNTIMEINLINE int
1215     SWIG_Python_CheckImplicit(swig_type_info *ty)
1216     {
1217     PySwigClientData *data = (PySwigClientData *)ty->clientdata;
1218     return data ? data->implicitconv : 0;
1219     }
1220    
1221     SWIGRUNTIMEINLINE PyObject *
1222     SWIG_Python_ExceptionType(swig_type_info *desc) {
1223     PySwigClientData *data = desc ? (PySwigClientData *) desc->clientdata : 0;
1224     PyObject *klass = data ? data->klass : 0;
1225     return (klass ? klass : PyExc_RuntimeError);
1226     }
1227    
1228    
1229     SWIGRUNTIME PySwigClientData *
1230     PySwigClientData_New(PyObject* obj)
1231     {
1232     if (!obj) {
1233     return 0;
1234     } else {
1235     PySwigClientData *data = (PySwigClientData *)malloc(sizeof(PySwigClientData));
1236     /* the klass element */
1237     data->klass = obj;
1238     Py_INCREF(data->klass);
1239     /* the newraw method and newargs arguments used to create a new raw instance */
1240     if (PyClass_Check(obj)) {
1241     data->newraw = 0;
1242     data->newargs = obj;
1243     Py_INCREF(obj);
1244     } else {
1245     #if (PY_VERSION_HEX < 0x02020000)
1246     data->newraw = 0;
1247     #else
1248     data->newraw = PyObject_GetAttrString(data->klass, (char *)"__new__");
1249     #endif
1250     if (data->newraw) {
1251     Py_INCREF(data->newraw);
1252     data->newargs = PyTuple_New(1);
1253     PyTuple_SetItem(data->newargs, 0, obj);
1254     } else {
1255     data->newargs = obj;
1256     }
1257     Py_INCREF(data->newargs);
1258     }
1259     /* the destroy method, aka as the C++ delete method */
1260     data->destroy = PyObject_GetAttrString(data->klass, (char *)"__swig_destroy__");
1261     if (PyErr_Occurred()) {
1262     PyErr_Clear();
1263     data->destroy = 0;
1264     }
1265     if (data->destroy) {
1266     int flags;
1267     Py_INCREF(data->destroy);
1268     flags = PyCFunction_GET_FLAGS(data->destroy);
1269     #ifdef METH_O
1270     data->delargs = !(flags & (METH_O));
1271     #else
1272     data->delargs = 0;
1273     #endif
1274     } else {
1275     data->delargs = 0;
1276     }
1277     data->implicitconv = 0;
1278     return data;
1279     }
1280     }
1281    
1282     SWIGRUNTIME void
1283     PySwigClientData_Del(PySwigClientData* data)
1284     {
1285     Py_XDECREF(data->newraw);
1286     Py_XDECREF(data->newargs);
1287     Py_XDECREF(data->destroy);
1288     }
1289    
1290     /* =============== PySwigObject =====================*/
1291    
1292     typedef struct {
1293     PyObject_HEAD
1294     void *ptr;
1295     swig_type_info *ty;
1296     int own;
1297     PyObject *next;
1298     } PySwigObject;
1299    
1300     SWIGRUNTIME PyObject *
1301     PySwigObject_long(PySwigObject *v)
1302     {
1303     return PyLong_FromVoidPtr(v->ptr);
1304     }
1305    
1306     SWIGRUNTIME PyObject *
1307     PySwigObject_format(const char* fmt, PySwigObject *v)
1308     {
1309     PyObject *res = NULL;
1310     PyObject *args = PyTuple_New(1);
1311     if (args) {
1312     if (PyTuple_SetItem(args, 0, PySwigObject_long(v)) == 0) {
1313     PyObject *ofmt = PyString_FromString(fmt);
1314     if (ofmt) {
1315     res = PyString_Format(ofmt,args);
1316     Py_DECREF(ofmt);
1317     }
1318     Py_DECREF(args);
1319     }
1320     }
1321     return res;
1322     }
1323    
1324     SWIGRUNTIME PyObject *
1325     PySwigObject_oct(PySwigObject *v)
1326     {
1327     return PySwigObject_format("%o",v);
1328     }
1329    
1330     SWIGRUNTIME PyObject *
1331     PySwigObject_hex(PySwigObject *v)
1332     {
1333     return PySwigObject_format("%x",v);
1334     }
1335    
1336     SWIGRUNTIME PyObject *
1337     #ifdef METH_NOARGS
1338     PySwigObject_repr(PySwigObject *v)
1339     #else
1340     PySwigObject_repr(PySwigObject *v, PyObject *args)
1341     #endif
1342     {
1343     const char *name = SWIG_TypePrettyName(v->ty);
1344     PyObject *hex = PySwigObject_hex(v);
1345     PyObject *repr = PyString_FromFormat("<Swig Object of type '%s' at 0x%s>", name, PyString_AsString(hex));
1346     Py_DECREF(hex);
1347     if (v->next) {
1348     #ifdef METH_NOARGS
1349     PyObject *nrep = PySwigObject_repr((PySwigObject *)v->next);
1350     #else
1351     PyObject *nrep = PySwigObject_repr((PySwigObject *)v->next, args);
1352     #endif
1353     PyString_ConcatAndDel(&repr,nrep);
1354     }
1355     return repr;
1356     }
1357    
1358     SWIGRUNTIME int
1359     PySwigObject_print(PySwigObject *v, FILE *fp, int SWIGUNUSEDPARM(flags))
1360     {
1361     #ifdef METH_NOARGS
1362     PyObject *repr = PySwigObject_repr(v);
1363     #else
1364     PyObject *repr = PySwigObject_repr(v, NULL);
1365     #endif
1366     if (repr) {
1367     fputs(PyString_AsString(repr), fp);
1368     Py_DECREF(repr);
1369     return 0;
1370     } else {
1371     return 1;
1372     }
1373     }
1374    
1375     SWIGRUNTIME PyObject *
1376     PySwigObject_str(PySwigObject *v)
1377     {
1378     char result[SWIG_BUFFER_SIZE];
1379     return SWIG_PackVoidPtr(result, v->ptr, v->ty->name, sizeof(result)) ?
1380     PyString_FromString(result) : 0;
1381     }
1382    
1383     SWIGRUNTIME int
1384     PySwigObject_compare(PySwigObject *v, PySwigObject *w)
1385     {
1386     void *i = v->ptr;
1387     void *j = w->ptr;
1388     return (i < j) ? -1 : ((i > j) ? 1 : 0);
1389     }
1390    
1391     SWIGRUNTIME PyTypeObject* _PySwigObject_type(void);
1392    
1393     SWIGRUNTIME PyTypeObject*
1394     PySwigObject_type(void) {
1395     static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigObject_type();
1396     return type;
1397     }
1398    
1399     SWIGRUNTIMEINLINE int
1400     PySwigObject_Check(PyObject *op) {
1401     return ((op)->ob_type == PySwigObject_type())
1402     || (strcmp((op)->ob_type->tp_name,"PySwigObject") == 0);
1403     }
1404    
1405     SWIGRUNTIME PyObject *
1406     PySwigObject_New(void *ptr, swig_type_info *ty, int own);
1407    
1408     SWIGRUNTIME void
1409     PySwigObject_dealloc(PyObject *v)
1410     {
1411     PySwigObject *sobj = (PySwigObject *) v;
1412     PyObject *next = sobj->next;
1413 jpye 2117 if (sobj->own) {
1414 jpye 2007 swig_type_info *ty = sobj->ty;
1415     PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
1416     PyObject *destroy = data ? data->destroy : 0;
1417     if (destroy) {
1418     /* destroy is always a VARARGS method */
1419     PyObject *res;
1420     if (data->delargs) {
1421     /* we need to create a temporal object to carry the destroy operation */
1422     PyObject *tmp = PySwigObject_New(sobj->ptr, ty, 0);
1423     res = SWIG_Python_CallFunctor(destroy, tmp);
1424     Py_DECREF(tmp);
1425     } else {
1426     PyCFunction meth = PyCFunction_GET_FUNCTION(destroy);
1427     PyObject *mself = PyCFunction_GET_SELF(destroy);
1428     res = ((*meth)(mself, v));
1429     }
1430     Py_XDECREF(res);
1431 jpye 2117 } else {
1432     const char *name = SWIG_TypePrettyName(ty);
1433 jpye 2007 #if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
1434 jpye 2117 printf("swig/python detected a memory leak of type '%s', no destructor found.\n", name);
1435     #endif
1436 jpye 2007 }
1437     }
1438     Py_XDECREF(next);
1439     PyObject_DEL(v);
1440     }
1441    
1442     SWIGRUNTIME PyObject*
1443     PySwigObject_append(PyObject* v, PyObject* next)
1444     {
1445     PySwigObject *sobj = (PySwigObject *) v;
1446     #ifndef METH_O
1447     PyObject *tmp = 0;
1448     if (!PyArg_ParseTuple(next,(char *)"O:append", &tmp)) return NULL;
1449     next = tmp;
1450     #endif
1451     if (!PySwigObject_Check(next)) {
1452     return NULL;
1453     }
1454     sobj->next = next;
1455     Py_INCREF(next);
1456     return SWIG_Py_Void();
1457     }
1458    
1459     SWIGRUNTIME PyObject*
1460     #ifdef METH_NOARGS
1461     PySwigObject_next(PyObject* v)
1462     #else
1463     PySwigObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
1464     #endif
1465     {
1466     PySwigObject *sobj = (PySwigObject *) v;
1467     if (sobj->next) {
1468     Py_INCREF(sobj->next);
1469     return sobj->next;
1470     } else {
1471     return SWIG_Py_Void();
1472     }
1473     }
1474    
1475     SWIGINTERN PyObject*
1476     #ifdef METH_NOARGS
1477     PySwigObject_disown(PyObject *v)
1478     #else
1479     PySwigObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
1480     #endif
1481     {
1482     PySwigObject *sobj = (PySwigObject *)v;
1483     sobj->own = 0;
1484     return SWIG_Py_Void();
1485     }
1486    
1487     SWIGINTERN PyObject*
1488     #ifdef METH_NOARGS
1489     PySwigObject_acquire(PyObject *v)
1490     #else
1491     PySwigObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
1492     #endif
1493     {
1494     PySwigObject *sobj = (PySwigObject *)v;
1495     sobj->own = SWIG_POINTER_OWN;
1496     return SWIG_Py_Void();
1497     }
1498    
1499     SWIGINTERN PyObject*
1500     PySwigObject_own(PyObject *v, PyObject *args)
1501     {
1502     PyObject *val = 0;
1503     #if (PY_VERSION_HEX < 0x02020000)
1504     if (!PyArg_ParseTuple(args,(char *)"|O:own",&val))
1505     #else
1506     if (!PyArg_UnpackTuple(args, (char *)"own", 0, 1, &val))
1507     #endif
1508     {
1509     return NULL;
1510     }
1511     else
1512     {
1513     PySwigObject *sobj = (PySwigObject *)v;
1514     PyObject *obj = PyBool_FromLong(sobj->own);
1515     if (val) {
1516     #ifdef METH_NOARGS
1517     if (PyObject_IsTrue(val)) {
1518     PySwigObject_acquire(v);
1519     } else {
1520     PySwigObject_disown(v);
1521     }
1522     #else
1523     if (PyObject_IsTrue(val)) {
1524     PySwigObject_acquire(v,args);
1525     } else {
1526     PySwigObject_disown(v,args);
1527     }
1528     #endif
1529     }
1530     return obj;
1531     }
1532     }
1533    
1534     #ifdef METH_O
1535     static PyMethodDef
1536     swigobject_methods[] = {
1537     {(char *)"disown", (PyCFunction)PySwigObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"},
1538     {(char *)"acquire", (PyCFunction)PySwigObject_acquire, METH_NOARGS, (char *)"aquires ownership of the pointer"},
1539     {(char *)"own", (PyCFunction)PySwigObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
1540     {(char *)"append", (PyCFunction)PySwigObject_append, METH_O, (char *)"appends another 'this' object"},
1541     {(char *)"next", (PyCFunction)PySwigObject_next, METH_NOARGS, (char *)"returns the next 'this' object"},
1542     {(char *)"__repr__",(PyCFunction)PySwigObject_repr, METH_NOARGS, (char *)"returns object representation"},
1543     {0, 0, 0, 0}
1544     };
1545     #else
1546     static PyMethodDef
1547     swigobject_methods[] = {
1548     {(char *)"disown", (PyCFunction)PySwigObject_disown, METH_VARARGS, (char *)"releases ownership of the pointer"},
1549     {(char *)"acquire", (PyCFunction)PySwigObject_acquire, METH_VARARGS, (char *)"aquires ownership of the pointer"},
1550     {(char *)"own", (PyCFunction)PySwigObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
1551     {(char *)"append", (PyCFunction)PySwigObject_append, METH_VARARGS, (char *)"appends another 'this' object"},
1552     {(char *)"next", (PyCFunction)PySwigObject_next, METH_VARARGS, (char *)"returns the next 'this' object"},
1553     {(char *)"__repr__",(PyCFunction)PySwigObject_repr, METH_VARARGS, (char *)"returns object representation"},
1554     {0, 0, 0, 0}
1555     };
1556     #endif
1557    
1558     #if PY_VERSION_HEX < 0x02020000
1559     SWIGINTERN PyObject *
1560     PySwigObject_getattr(PySwigObject *sobj,char *name)
1561     {
1562     return Py_FindMethod(swigobject_methods, (PyObject *)sobj, name);
1563     }
1564     #endif
1565    
1566     SWIGRUNTIME PyTypeObject*
1567     _PySwigObject_type(void) {
1568     static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer";
1569    
1570     static PyNumberMethods PySwigObject_as_number = {
1571     (binaryfunc)0, /*nb_add*/
1572     (binaryfunc)0, /*nb_subtract*/
1573     (binaryfunc)0, /*nb_multiply*/
1574     (binaryfunc)0, /*nb_divide*/
1575     (binaryfunc)0, /*nb_remainder*/
1576     (binaryfunc)0, /*nb_divmod*/
1577     (ternaryfunc)0,/*nb_power*/
1578     (unaryfunc)0, /*nb_negative*/
1579     (unaryfunc)0, /*nb_positive*/
1580     (unaryfunc)0, /*nb_absolute*/
1581     (inquiry)0, /*nb_nonzero*/
1582     0, /*nb_invert*/
1583     0, /*nb_lshift*/
1584     0, /*nb_rshift*/
1585     0, /*nb_and*/
1586     0, /*nb_xor*/
1587     0, /*nb_or*/
1588     (coercion)0, /*nb_coerce*/
1589     (unaryfunc)PySwigObject_long, /*nb_int*/
1590     (unaryfunc)PySwigObject_long, /*nb_long*/
1591     (unaryfunc)0, /*nb_float*/
1592     (unaryfunc)PySwigObject_oct, /*nb_oct*/
1593     (unaryfunc)PySwigObject_hex, /*nb_hex*/
1594 jpye 2117 #if PY_VERSION_HEX >= 0x02020000
1595     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */
1596     #elif PY_VERSION_HEX >= 0x02000000
1597 jpye 2007 0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */
1598     #endif
1599     };
1600    
1601     static PyTypeObject pyswigobject_type;
1602     static int type_init = 0;
1603     if (!type_init) {
1604     const PyTypeObject tmp
1605     = {
1606     PyObject_HEAD_INIT(NULL)
1607     0, /* ob_size */
1608     (char *)"PySwigObject", /* tp_name */
1609     sizeof(PySwigObject), /* tp_basicsize */
1610     0, /* tp_itemsize */
1611     (destructor)PySwigObject_dealloc, /* tp_dealloc */
1612     (printfunc)PySwigObject_print, /* tp_print */
1613     #if PY_VERSION_HEX < 0x02020000
1614     (getattrfunc)PySwigObject_getattr, /* tp_getattr */
1615     #else
1616     (getattrfunc)0, /* tp_getattr */
1617     #endif
1618     (setattrfunc)0, /* tp_setattr */
1619     (cmpfunc)PySwigObject_compare, /* tp_compare */
1620     (reprfunc)PySwigObject_repr, /* tp_repr */
1621     &PySwigObject_as_number, /* tp_as_number */
1622     0, /* tp_as_sequence */
1623     0, /* tp_as_mapping */
1624     (hashfunc)0, /* tp_hash */
1625     (ternaryfunc)0, /* tp_call */
1626     (reprfunc)PySwigObject_str, /* tp_str */
1627     PyObject_GenericGetAttr, /* tp_getattro */
1628     0, /* tp_setattro */
1629     0, /* tp_as_buffer */
1630     Py_TPFLAGS_DEFAULT, /* tp_flags */
1631     swigobject_doc, /* tp_doc */
1632     0, /* tp_traverse */
1633     0, /* tp_clear */
1634     0, /* tp_richcompare */
1635     0, /* tp_weaklistoffset */
1636     #if PY_VERSION_HEX >= 0x02020000
1637     0, /* tp_iter */
1638     0, /* tp_iternext */
1639     swigobject_methods, /* tp_methods */
1640     0, /* tp_members */
1641     0, /* tp_getset */
1642     0, /* tp_base */
1643     0, /* tp_dict */
1644     0, /* tp_descr_get */
1645     0, /* tp_descr_set */
1646     0, /* tp_dictoffset */
1647     0, /* tp_init */
1648     0, /* tp_alloc */
1649     0, /* tp_new */
1650     0, /* tp_free */
1651     0, /* tp_is_gc */
1652     0, /* tp_bases */
1653     0, /* tp_mro */
1654     0, /* tp_cache */
1655     0, /* tp_subclasses */
1656     0, /* tp_weaklist */
1657     #endif
1658     #if PY_VERSION_HEX >= 0x02030000
1659     0, /* tp_del */
1660     #endif
1661     #ifdef COUNT_ALLOCS
1662     0,0,0,0 /* tp_alloc -> tp_next */
1663     #endif
1664     };
1665     pyswigobject_type = tmp;
1666     pyswigobject_type.ob_type = &PyType_Type;
1667     type_init = 1;
1668     }
1669     return &pyswigobject_type;
1670     }
1671    
1672     SWIGRUNTIME PyObject *
1673     PySwigObject_New(void *ptr, swig_type_info *ty, int own)
1674     {
1675     PySwigObject *sobj = PyObject_NEW(PySwigObject, PySwigObject_type());
1676     if (sobj) {
1677     sobj->ptr = ptr;
1678     sobj->ty = ty;
1679     sobj->own = own;
1680     sobj->next = 0;
1681     }
1682     return (PyObject *)sobj;
1683     }
1684    
1685     /* -----------------------------------------------------------------------------
1686     * Implements a simple Swig Packed type, and use it instead of string
1687     * ----------------------------------------------------------------------------- */
1688    
1689     typedef struct {
1690     PyObject_HEAD
1691     void *pack;
1692     swig_type_info *ty;
1693     size_t size;
1694     } PySwigPacked;
1695    
1696     SWIGRUNTIME int
1697     PySwigPacked_print(PySwigPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags))
1698     {
1699     char result[SWIG_BUFFER_SIZE];
1700     fputs("<Swig Packed ", fp);
1701     if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
1702     fputs("at ", fp);
1703     fputs(result, fp);
1704     }
1705     fputs(v->ty->name,fp);
1706     fputs(">", fp);
1707     return 0;
1708     }
1709    
1710     SWIGRUNTIME PyObject *
1711     PySwigPacked_repr(PySwigPacked *v)
1712     {
1713     char result[SWIG_BUFFER_SIZE];
1714     if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
1715     return PyString_FromFormat("<Swig Packed at %s%s>", result, v->ty->name);
1716     } else {
1717     return PyString_FromFormat("<Swig Packed %s>", v->ty->name);
1718     }
1719     }
1720    
1721     SWIGRUNTIME PyObject *
1722     PySwigPacked_str(PySwigPacked *v)
1723     {
1724     char result[SWIG_BUFFER_SIZE];
1725     if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){
1726     return PyString_FromFormat("%s%s", result, v->ty->name);
1727     } else {
1728     return PyString_FromString(v->ty->name);
1729     }
1730     }
1731    
1732     SWIGRUNTIME int
1733     PySwigPacked_compare(PySwigPacked *v, PySwigPacked *w)
1734     {
1735     size_t i = v->size;
1736     size_t j = w->size;
1737     int s = (i < j) ? -1 : ((i > j) ? 1 : 0);
1738     return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size);
1739     }
1740    
1741     SWIGRUNTIME PyTypeObject* _PySwigPacked_type(void);
1742    
1743     SWIGRUNTIME PyTypeObject*
1744     PySwigPacked_type(void) {
1745     static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigPacked_type();
1746     return type;
1747     }
1748    
1749     SWIGRUNTIMEINLINE int
1750     PySwigPacked_Check(PyObject *op) {
1751     return ((op)->ob_type == _PySwigPacked_type())
1752     || (strcmp((op)->ob_type->tp_name,"PySwigPacked") == 0);
1753     }
1754    
1755     SWIGRUNTIME void
1756     PySwigPacked_dealloc(PyObject *v)
1757     {
1758     if (PySwigPacked_Check(v)) {
1759     PySwigPacked *sobj = (PySwigPacked *) v;
1760     free(sobj->pack);
1761     }
1762     PyObject_DEL(v);
1763     }
1764    
1765     SWIGRUNTIME PyTypeObject*
1766     _PySwigPacked_type(void) {
1767     static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer";
1768     static PyTypeObject pyswigpacked_type;
1769     static int type_init = 0;
1770     if (!type_init) {
1771     const PyTypeObject tmp
1772     = {
1773     PyObject_HEAD_INIT(NULL)
1774     0, /* ob_size */
1775     (char *)"PySwigPacked", /* tp_name */
1776     sizeof(PySwigPacked), /* tp_basicsize */
1777     0, /* tp_itemsize */
1778     (destructor)PySwigPacked_dealloc, /* tp_dealloc */
1779     (printfunc)PySwigPacked_print, /* tp_print */
1780     (getattrfunc)0, /* tp_getattr */
1781     (setattrfunc)0, /* tp_setattr */
1782     (cmpfunc)PySwigPacked_compare, /* tp_compare */
1783     (reprfunc)PySwigPacked_repr, /* tp_repr */
1784     0, /* tp_as_number */
1785     0, /* tp_as_sequence */
1786     0, /* tp_as_mapping */
1787     (hashfunc)0, /* tp_hash */
1788     (ternaryfunc)0, /* tp_call */
1789     (reprfunc)PySwigPacked_str, /* tp_str */
1790     PyObject_GenericGetAttr, /* tp_getattro */
1791     0, /* tp_setattro */
1792     0, /* tp_as_buffer */
1793     Py_TPFLAGS_DEFAULT, /* tp_flags */
1794     swigpacked_doc, /* tp_doc */
1795     0, /* tp_traverse */
1796     0, /* tp_clear */
1797     0, /* tp_richcompare */
1798     0, /* tp_weaklistoffset */
1799     #if PY_VERSION_HEX >= 0x02020000
1800     0, /* tp_iter */
1801     0, /* tp_iternext */
1802     0, /* tp_methods */
1803     0, /* tp_members */
1804     0, /* tp_getset */
1805     0, /* tp_base */
1806     0, /* tp_dict */
1807     0, /* tp_descr_get */
1808     0, /* tp_descr_set */
1809     0, /* tp_dictoffset */
1810     0, /* tp_init */
1811     0, /* tp_alloc */
1812     0, /* tp_new */
1813     0, /* tp_free */
1814     0, /* tp_is_gc */
1815     0, /* tp_bases */
1816     0, /* tp_mro */
1817     0, /* tp_cache */
1818     0, /* tp_subclasses */
1819     0, /* tp_weaklist */
1820     #endif
1821     #if PY_VERSION_HEX >= 0x02030000
1822     0, /* tp_del */
1823     #endif
1824     #ifdef COUNT_ALLOCS
1825     0,0,0,0 /* tp_alloc -> tp_next */
1826     #endif
1827     };
1828     pyswigpacked_type = tmp;
1829     pyswigpacked_type.ob_type = &PyType_Type;
1830     type_init = 1;
1831     }
1832     return &pyswigpacked_type;
1833     }
1834    
1835     SWIGRUNTIME PyObject *
1836     PySwigPacked_New(void *ptr, size_t size, swig_type_info *ty)
1837     {
1838     PySwigPacked *sobj = PyObject_NEW(PySwigPacked, PySwigPacked_type());
1839     if (sobj) {
1840     void *pack = malloc(size);
1841     if (pack) {
1842     memcpy(pack, ptr, size);
1843     sobj->pack = pack;
1844     sobj->ty = ty;
1845     sobj->size = size;
1846     } else {
1847     PyObject_DEL((PyObject *) sobj);
1848     sobj = 0;
1849     }
1850     }
1851     return (PyObject *) sobj;
1852     }
1853    
1854     SWIGRUNTIME swig_type_info *
1855     PySwigPacked_UnpackData(PyObject *obj, void *ptr, size_t size)
1856     {
1857     if (PySwigPacked_Check(obj)) {
1858     PySwigPacked *sobj = (PySwigPacked *)obj;
1859     if (sobj->size != size) return 0;
1860     memcpy(ptr, sobj->pack, size);
1861     return sobj->ty;
1862     } else {
1863     return 0;
1864     }
1865     }
1866    
1867     /* -----------------------------------------------------------------------------
1868     * pointers/data manipulation
1869     * ----------------------------------------------------------------------------- */
1870    
1871     SWIGRUNTIMEINLINE PyObject *
1872     _SWIG_This(void)
1873     {
1874     return PyString_FromString("this");
1875     }
1876    
1877     SWIGRUNTIME PyObject *
1878     SWIG_This(void)
1879     {
1880     static PyObject *SWIG_STATIC_POINTER(swig_this) = _SWIG_This();
1881     return swig_this;
1882     }
1883    
1884     /* #define SWIG_PYTHON_SLOW_GETSET_THIS */
1885    
1886     SWIGRUNTIME PySwigObject *
1887     SWIG_Python_GetSwigThis(PyObject *pyobj)
1888     {
1889     if (PySwigObject_Check(pyobj)) {
1890     return (PySwigObject *) pyobj;
1891     } else {
1892     PyObject *obj = 0;
1893     #if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000))
1894     if (PyInstance_Check(pyobj)) {
1895     obj = _PyInstance_Lookup(pyobj, SWIG_This());
1896     } else {
1897     PyObject **dictptr = _PyObject_GetDictPtr(pyobj);
1898     if (dictptr != NULL) {
1899     PyObject *dict = *dictptr;
1900     obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0;
1901     } else {
1902     #ifdef PyWeakref_CheckProxy
1903     if (PyWeakref_CheckProxy(pyobj)) {
1904     PyObject *wobj = PyWeakref_GET_OBJECT(pyobj);
1905     return wobj ? SWIG_Python_GetSwigThis(wobj) : 0;
1906     }
1907     #endif
1908     obj = PyObject_GetAttr(pyobj,SWIG_This());
1909     if (obj) {
1910     Py_DECREF(obj);
1911     } else {
1912     if (PyErr_Occurred()) PyErr_Clear();
1913     return 0;
1914     }
1915     }
1916     }
1917     #else
1918     obj = PyObject_GetAttr(pyobj,SWIG_This());
1919     if (obj) {
1920     Py_DECREF(obj);
1921     } else {
1922     if (PyErr_Occurred()) PyErr_Clear();
1923     return 0;
1924     }
1925     #endif
1926     if (obj && !PySwigObject_Check(obj)) {
1927     /* a PyObject is called 'this', try to get the 'real this'
1928     PySwigObject from it */
1929     return SWIG_Python_GetSwigThis(obj);
1930     }
1931     return (PySwigObject *)obj;
1932     }
1933     }
1934    
1935     /* Acquire a pointer value */
1936    
1937     SWIGRUNTIME int
1938     SWIG_Python_AcquirePtr(PyObject *obj, int own) {
1939 jpye 2117 if (own) {
1940 jpye 2007 PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
1941     if (sobj) {
1942     int oldown = sobj->own;
1943     sobj->own = own;
1944     return oldown;
1945     }
1946     }
1947     return 0;
1948     }
1949    
1950     /* Convert a pointer value */
1951    
1952     SWIGRUNTIME int
1953     SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) {
1954     if (!obj) return SWIG_ERROR;
1955     if (obj == Py_None) {
1956     if (ptr) *ptr = 0;
1957     return SWIG_OK;
1958     } else {
1959     PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
1960     while (sobj) {
1961     void *vptr = sobj->ptr;
1962     if (ty) {
1963     swig_type_info *to = sobj->ty;
1964     if (to == ty) {
1965     /* no type cast needed */
1966     if (ptr) *ptr = vptr;
1967     break;
1968     } else {
1969     swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
1970     if (!tc) {
1971     sobj = (PySwigObject *)sobj->next;
1972     } else {
1973 jpye 2117 if (ptr) *ptr = SWIG_TypeCast(tc,vptr);
1974 jpye 2007 break;
1975     }
1976     }
1977     } else {
1978     if (ptr) *ptr = vptr;
1979     break;
1980     }
1981     }
1982     if (sobj) {
1983 jpye 2117 if (own) *own = sobj->own;
1984 jpye 2007 if (flags & SWIG_POINTER_DISOWN) {
1985     sobj->own = 0;
1986     }
1987     return SWIG_OK;
1988     } else {
1989     int res = SWIG_ERROR;
1990     if (flags & SWIG_POINTER_IMPLICIT_CONV) {
1991     PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
1992     if (data && !data->implicitconv) {
1993     PyObject *klass = data->klass;
1994     if (klass) {
1995     PyObject *impconv;
1996     data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/
1997     impconv = SWIG_Python_CallFunctor(klass, obj);
1998     data->implicitconv = 0;
1999     if (PyErr_Occurred()) {
2000     PyErr_Clear();
2001     impconv = 0;
2002     }
2003     if (impconv) {
2004     PySwigObject *iobj = SWIG_Python_GetSwigThis(impconv);
2005     if (iobj) {
2006     void *vptr;
2007     res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0);
2008     if (SWIG_IsOK(res)) {
2009     if (ptr) {
2010     *ptr = vptr;
2011     /* transfer the ownership to 'ptr' */
2012     iobj->own = 0;
2013     res = SWIG_AddCast(res);
2014     res = SWIG_AddNewMask(res);
2015     } else {
2016     res = SWIG_AddCast(res);
2017     }
2018     }
2019     }
2020     Py_DECREF(impconv);
2021     }
2022     }
2023     }
2024     }
2025     return res;
2026     }
2027     }
2028     }
2029    
2030     /* Convert a function ptr value */
2031    
2032     SWIGRUNTIME int
2033     SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) {
2034     if (!PyCFunction_Check(obj)) {
2035     return SWIG_ConvertPtr(obj, ptr, ty, 0);
2036     } else {
2037     void *vptr = 0;
2038    
2039     /* here we get the method pointer for callbacks */
2040     const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
2041     const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0;
2042     if (desc) {
2043     desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0;
2044     if (!desc) return SWIG_ERROR;
2045     }
2046     if (ty) {
2047     swig_cast_info *tc = SWIG_TypeCheck(desc,ty);
2048 jpye 2117 if (!tc) return SWIG_ERROR;
2049     *ptr = SWIG_TypeCast(tc,vptr);
2050 jpye 2007 } else {
2051     *ptr = vptr;
2052     }
2053     return SWIG_OK;
2054     }
2055     }
2056    
2057     /* Convert a packed value value */
2058    
2059     SWIGRUNTIME int
2060     SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) {
2061     swig_type_info *to = PySwigPacked_UnpackData(obj, ptr, sz);
2062     if (!to) return SWIG_ERROR;
2063     if (ty) {
2064     if (to != ty) {
2065     /* check type cast? */
2066     swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
2067     if (!tc) return SWIG_ERROR;
2068     }
2069     }
2070     return SWIG_OK;
2071     }
2072    
2073     /* -----------------------------------------------------------------------------
2074     * Create a new pointer object
2075     * ----------------------------------------------------------------------------- */
2076    
2077     /*
2078     Create a new instance object, whitout calling __init__, and set the
2079     'this' attribute.
2080     */
2081    
2082     SWIGRUNTIME PyObject*
2083     SWIG_Python_NewShadowInstance(PySwigClientData *data, PyObject *swig_this)
2084     {
2085     #if (PY_VERSION_HEX >= 0x02020000)
2086     PyObject *inst = 0;
2087     PyObject *newraw = data->newraw;
2088     if (newraw) {
2089     inst = PyObject_Call(newraw, data->newargs, NULL);
2090     if (inst) {
2091     #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
2092     PyObject **dictptr = _PyObject_GetDictPtr(inst);
2093     if (dictptr != NULL) {
2094     PyObject *dict = *dictptr;
2095     if (dict == NULL) {
2096     dict = PyDict_New();
2097     *dictptr = dict;
2098     PyDict_SetItem(dict, SWIG_This(), swig_this);
2099     }
2100     }
2101     #else
2102     PyObject *key = SWIG_This();
2103     PyObject_SetAttr(inst, key, swig_this);
2104     #endif
2105     }
2106     } else {
2107     PyObject *dict = PyDict_New();
2108     PyDict_SetItem(dict, SWIG_This(), swig_this);
2109     inst = PyInstance_NewRaw(data->newargs, dict);
2110     Py_DECREF(dict);
2111     }
2112     return inst;
2113     #else
2114     #if (PY_VERSION_HEX >= 0x02010000)
2115     PyObject *inst;
2116     PyObject *dict = PyDict_New();
2117     PyDict_SetItem(dict, SWIG_This(), swig_this);
2118     inst = PyInstance_NewRaw(data->newargs, dict);
2119     Py_DECREF(dict);
2120     return (PyObject *) inst;
2121     #else
2122     PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type);
2123     if (inst == NULL) {
2124     return NULL;
2125     }
2126     inst->in_class = (PyClassObject *)data->newargs;
2127     Py_INCREF(inst->in_class);
2128     inst->in_dict = PyDict_New();
2129     if (inst->in_dict == NULL) {
2130     Py_DECREF(inst);
2131     return NULL;
2132     }
2133     #ifdef Py_TPFLAGS_HAVE_WEAKREFS
2134     inst->in_weakreflist = NULL;
2135     #endif
2136     #ifdef Py_TPFLAGS_GC
2137     PyObject_GC_Init(inst);
2138     #endif
2139     PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this);
2140     return (PyObject *) inst;
2141     #endif
2142     #endif
2143     }
2144    
2145     SWIGRUNTIME void
2146     SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this)
2147     {
2148     PyObject *dict;
2149     #if (PY_VERSION_HEX >= 0x02020000) && !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
2150     PyObject **dictptr = _PyObject_GetDictPtr(inst);
2151     if (dictptr != NULL) {
2152     dict = *dictptr;
2153     if (dict == NULL) {
2154     dict = PyDict_New();
2155     *dictptr = dict;
2156     }
2157     PyDict_SetItem(dict, SWIG_This(), swig_this);
2158     return;
2159     }
2160     #endif
2161     dict = PyObject_GetAttrString(inst, (char*)"__dict__");
2162     PyDict_SetItem(dict, SWIG_This(), swig_this);
2163     Py_DECREF(dict);
2164     }
2165    
2166    
2167     SWIGINTERN PyObject *
2168     SWIG_Python_InitShadowInstance(PyObject *args) {
2169     PyObject *obj[2];
2170     if (!SWIG_Python_UnpackTuple(args,(char*)"swiginit", 2, 2, obj)) {
2171     return NULL;
2172     } else {
2173     PySwigObject *sthis = SWIG_Python_GetSwigThis(obj[0]);
2174     if (sthis) {
2175     PySwigObject_append((PyObject*) sthis, obj[1]);
2176     } else {
2177     SWIG_Python_SetSwigThis(obj[0], obj[1]);
2178     }
2179     return SWIG_Py_Void();
2180     }
2181     }
2182    
2183     /* Create a new pointer object */
2184    
2185     SWIGRUNTIME PyObject *
2186     SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int flags) {
2187     if (!ptr) {
2188     return SWIG_Py_Void();
2189     } else {
2190     int own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0;
2191     PyObject *robj = PySwigObject_New(ptr, type, own);
2192     PySwigClientData *clientdata = type ? (PySwigClientData *)(type->clientdata) : 0;
2193     if (clientdata && !(flags & SWIG_POINTER_NOSHADOW)) {
2194     PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj);
2195     if (inst) {
2196     Py_DECREF(robj);
2197     robj = inst;
2198     }
2199     }
2200     return robj;
2201     }
2202     }
2203    
2204     /* Create a new packed object */
2205    
2206     SWIGRUNTIMEINLINE PyObject *
2207     SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) {
2208     return ptr ? PySwigPacked_New((void *) ptr, sz, type) : SWIG_Py_Void();
2209     }
2210    
2211     /* -----------------------------------------------------------------------------*
2212     * Get type list
2213     * -----------------------------------------------------------------------------*/
2214    
2215     #ifdef SWIG_LINK_RUNTIME
2216     void *SWIG_ReturnGlobalTypeList(void *);
2217     #endif
2218    
2219     SWIGRUNTIME swig_module_info *
2220     SWIG_Python_GetModule(void) {
2221     static void *type_pointer = (void *)0;
2222     /* first check if module already created */
2223     if (!type_pointer) {
2224     #ifdef SWIG_LINK_RUNTIME
2225     type_pointer = SWIG_ReturnGlobalTypeList((void *)0);
2226     #else
2227     type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
2228     (char*)"type_pointer" SWIG_TYPE_TABLE_NAME);
2229     if (PyErr_Occurred()) {
2230     PyErr_Clear();
2231     type_pointer = (void *)0;
2232     }
2233     #endif
2234     }
2235     return (swig_module_info *) type_pointer;
2236     }
2237    
2238     #if PY_MAJOR_VERSION < 2
2239     /* PyModule_AddObject function was introduced in Python 2.0. The following function
2240     is copied out of Python/modsupport.c in python version 2.3.4 */
2241     SWIGINTERN int
2242     PyModule_AddObject(PyObject *m, char *name, PyObject *o)
2243     {
2244     PyObject *dict;
2245     if (!PyModule_Check(m)) {
2246     PyErr_SetString(PyExc_TypeError,
2247     "PyModule_AddObject() needs module as first arg");
2248     return SWIG_ERROR;
2249     }
2250     if (!o) {
2251     PyErr_SetString(PyExc_TypeError,
2252     "PyModule_AddObject() needs non-NULL value");
2253     return SWIG_ERROR;
2254     }
2255    
2256     dict = PyModule_GetDict(m);
2257     if (dict == NULL) {
2258     /* Internal error -- modules must have a dict! */
2259     PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__",
2260     PyModule_GetName(m));
2261     return SWIG_ERROR;
2262     }
2263     if (PyDict_SetItemString(dict, name, o))
2264     return SWIG_ERROR;
2265     Py_DECREF(o);
2266     return SWIG_OK;
2267     }
2268     #endif
2269    
2270     SWIGRUNTIME void
2271     SWIG_Python_DestroyModule(void *vptr)
2272     {
2273     swig_module_info *swig_module = (swig_module_info *) vptr;
2274     swig_type_info **types = swig_module->types;
2275     size_t i;
2276     for (i =0; i < swig_module->size; ++i) {
2277     swig_type_info *ty = types[i];
2278     if (ty->owndata) {
2279     PySwigClientData *data = (PySwigClientData *) ty->clientdata;
2280     if (data) PySwigClientData_Del(data);
2281     }
2282     }
2283     Py_DECREF(SWIG_This());
2284     }
2285    
2286     SWIGRUNTIME void
2287     SWIG_Python_SetModule(swig_module_info *swig_module) {
2288     static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} };/* Sentinel */
2289    
2290     PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
2291     swig_empty_runtime_method_table);
2292     PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule);
2293     if (pointer && module) {
2294     PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer);
2295     } else {
2296     Py_XDECREF(pointer);
2297     }
2298     }
2299    
2300     /* The python cached type query */
2301     SWIGRUNTIME PyObject *
2302     SWIG_Python_TypeCache(void) {
2303     static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New();
2304     return cache;
2305     }
2306    
2307     SWIGRUNTIME swig_type_info *
2308     SWIG_Python_TypeQuery(const char *type)
2309     {
2310     PyObject *cache = SWIG_Python_TypeCache();
2311     PyObject *key = PyString_FromString(type);
2312     PyObject *obj = PyDict_GetItem(cache, key);
2313     swig_type_info *descriptor;
2314     if (obj) {
2315     descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
2316     } else {
2317     swig_module_info *swig_module = SWIG_Python_GetModule();
2318     descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type);
2319     if (descriptor) {
2320     obj = PyCObject_FromVoidPtr(descriptor, NULL);
2321     PyDict_SetItem(cache, key, obj);
2322     Py_DECREF(obj);
2323     }
2324     }
2325     Py_DECREF(key);
2326     return descriptor;
2327     }
2328    
2329     /*
2330     For backward compatibility only
2331     */
2332     #define SWIG_POINTER_EXCEPTION 0
2333     #define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg)
2334     #define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags)
2335    
2336     SWIGRUNTIME int
2337     SWIG_Python_AddErrMesg(const char* mesg, int infront)
2338     {
2339     if (PyErr_Occurred()) {
2340     PyObject *type = 0;
2341     PyObject *value = 0;
2342     PyObject *traceback = 0;
2343     PyErr_Fetch(&type, &value, &traceback);
2344     if (value) {
2345     PyObject *old_str = PyObject_Str(value);
2346     Py_XINCREF(type);
2347     PyErr_Clear();
2348     if (infront) {
2349     PyErr_Format(type, "%s %s", mesg, PyString_AsString(old_str));
2350     } else {
2351     PyErr_Format(type, "%s %s", PyString_AsString(old_str), mesg);
2352     }
2353     Py_DECREF(old_str);
2354     }
2355     return 1;
2356     } else {
2357     return 0;
2358     }
2359     }
2360    
2361     SWIGRUNTIME int
2362     SWIG_Python_ArgFail(int argnum)
2363     {
2364     if (PyErr_Occurred()) {
2365     /* add information about failing argument */
2366     char mesg[256];
2367     PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum);
2368     return SWIG_Python_AddErrMesg(mesg, 1);
2369     } else {
2370     return 0;
2371     }
2372     }
2373    
2374     SWIGRUNTIMEINLINE const char *
2375     PySwigObject_GetDesc(PyObject *self)
2376     {
2377     PySwigObject *v = (PySwigObject *)self;
2378     swig_type_info *ty = v ? v->ty : 0;
2379     return ty ? ty->str : (char*)"";
2380     }
2381    
2382     SWIGRUNTIME void
2383     SWIG_Python_TypeError(const char *type, PyObject *obj)
2384     {
2385     if (type) {
2386     #if defined(SWIG_COBJECT_TYPES)
2387     if (obj && PySwigObject_Check(obj)) {
2388     const char *otype = (const char *) PySwigObject_GetDesc(obj);
2389     if (otype) {
2390     PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'PySwigObject(%s)' is received",
2391     type, otype);
2392     return;
2393     }
2394     } else
2395     #endif
2396     {
2397     const char *otype = (obj ? obj->ob_type->tp_name : 0);
2398     if (otype) {
2399     PyObject *str = PyObject_Str(obj);
2400     const char *cstr = str ? PyString_AsString(str) : 0;
2401     if (cstr) {
2402     PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received",
2403     type, otype, cstr);
2404     } else {
2405     PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received",
2406     type, otype);
2407     }
2408     Py_XDECREF(str);
2409     return;
2410     }
2411     }
2412     PyErr_Format(PyExc_TypeError, "a '%s' is expected", type);
2413     } else {
2414     PyErr_Format(PyExc_TypeError, "unexpected type is received");
2415     }
2416     }
2417    
2418    
2419     /* Convert a pointer value, signal an exception on a type mismatch */
2420     SWIGRUNTIME void *
2421     SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) {
2422     void *result;
2423     if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) {
2424     PyErr_Clear();
2425     if (flags & SWIG_POINTER_EXCEPTION) {
2426     SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj);
2427     SWIG_Python_ArgFail(argnum);
2428     }
2429     }
2430     return result;
2431     }
2432    
2433    
2434     #ifdef __cplusplus
2435     #if 0
2436     { /* cc-mode */
2437     #endif
2438     }
2439     #endif
2440    
2441    
2442    
2443     #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0)
2444    
2445     #define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else
2446    
2447    
2448    
2449     /* -------- TYPES TABLE (BEGIN) -------- */
2450    
2451     #define SWIGTYPE_p_HelmholtzCritTerm_struct swig_types[0]
2452     #define SWIGTYPE_p_HelmholtzData_struct swig_types[1]
2453     #define SWIGTYPE_p_HelmholtzGausTerm_struct swig_types[2]
2454     #define SWIGTYPE_p_HelmholtzPowTerm_struct swig_types[3]
2455     #define SWIGTYPE_p_IdealData swig_types[4]
2456     #define SWIGTYPE_p_char swig_types[5]
2457 jpye 2117 #define SWIGTYPE_p_double swig_types[6]
2458     static swig_type_info *swig_types[8];
2459     static swig_module_info swig_module = {swig_types, 7, 0, 0, 0, 0};
2460 jpye 2007 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
2461     #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
2462    
2463     /* -------- TYPES TABLE (END) -------- */
2464    
2465     #if (PY_VERSION_HEX <= 0x02000000)
2466     # if !defined(SWIG_PYTHON_CLASSIC)
2467     # error "This python version requires swig to be run with the '-classic' option"
2468     # endif
2469     #endif
2470    
2471     /*-----------------------------------------------
2472     @(target):= _fprops.so
2473     ------------------------------------------------*/
2474     #define SWIG_init init_fprops
2475    
2476     #define SWIG_name "_fprops"
2477    
2478 jpye 2117 #define SWIGVERSION 0x010331
2479 jpye 2007 #define SWIG_VERSION SWIGVERSION
2480    
2481    
2482     #define SWIG_as_voidptr(a) (void *)((const void *)(a))
2483     #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a))
2484    
2485    
2486 jpye 2117 #include "../carbondioxide.h"
2487     #include "../water.h"
2488     #include "../ammonia.h"
2489     #include "../hydrogen.h"
2490     #include "../nitrogen.h"
2491 jpye 2007 #include "../helmholtz.h"
2492    
2493    
2494     SWIGINTERN int
2495     SWIG_AsVal_double (PyObject *obj, double *val)
2496     {
2497     int res = SWIG_TypeError;
2498     if (PyFloat_Check(obj)) {
2499     if (val) *val = PyFloat_AsDouble(obj);
2500     return SWIG_OK;
2501     } else if (PyInt_Check(obj)) {
2502     if (val) *val = PyInt_AsLong(obj);
2503     return SWIG_OK;
2504     } else if (PyLong_Check(obj)) {
2505     double v = PyLong_AsDouble(obj);
2506     if (!PyErr_Occurred()) {
2507     if (val) *val = v;
2508     return SWIG_OK;
2509     } else {
2510     PyErr_Clear();
2511     }
2512     }
2513     #ifdef SWIG_PYTHON_CAST_MODE
2514     {
2515     int dispatch = 0;
2516     double d = PyFloat_AsDouble(obj);
2517     if (!PyErr_Occurred()) {
2518     if (val) *val = d;
2519     return SWIG_AddCast(SWIG_OK);
2520     } else {
2521     PyErr_Clear();
2522     }
2523     if (!dispatch) {
2524     long v = PyLong_AsLong(obj);
2525     if (!PyErr_Occurred()) {
2526     if (val) *val = v;
2527     return SWIG_AddCast(SWIG_AddCast(SWIG_OK));
2528     } else {
2529     PyErr_Clear();
2530     }
2531     }
2532     }
2533     #endif
2534     return res;
2535     }
2536    
2537    
2538     #define SWIG_From_double PyFloat_FromDouble
2539    
2540    
2541     #include <limits.h>
2542 jpye 2117 #ifndef LLONG_MIN
2543     # define LLONG_MIN LONG_LONG_MIN
2544 jpye 2007 #endif
2545 jpye 2117 #ifndef LLONG_MAX
2546     # define LLONG_MAX LONG_LONG_MAX
2547     #endif
2548     #ifndef ULLONG_MAX
2549     # define ULLONG_MAX ULONG_LONG_MAX
2550     #endif
2551 jpye 2007
2552    
2553     #include <float.h>
2554    
2555    
2556     #include <math.h>
2557    
2558    
2559     SWIGINTERNINLINE int
2560     SWIG_CanCastAsInteger(double *d, double min, double max) {
2561     double x = *d;
2562     if ((min <= x && x <= max)) {
2563     double fx = floor(x);
2564     double cx = ceil(x);
2565     double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */
2566     if ((errno == EDOM) || (errno == ERANGE)) {
2567     errno = 0;
2568     } else {
2569     double summ, reps, diff;
2570     if (rd < x) {
2571     diff = x - rd;
2572     } else if (rd > x) {
2573     diff = rd - x;
2574     } else {
2575     return 1;
2576     }
2577     summ = rd + x;
2578     reps = diff/summ;
2579     if (reps < 8*DBL_EPSILON) {
2580     *d = rd;
2581     return 1;
2582     }
2583     }
2584     }
2585     return 0;
2586     }
2587    
2588    
2589     SWIGINTERN int
2590     SWIG_AsVal_long (PyObject *obj, long* val)
2591     {
2592     if (PyInt_Check(obj)) {
2593     if (val) *val = PyInt_AsLong(obj);
2594     return SWIG_OK;
2595     } else if (PyLong_Check(obj)) {
2596     long v = PyLong_AsLong(obj);
2597     if (!PyErr_Occurred()) {
2598     if (val) *val = v;
2599     return SWIG_OK;
2600     } else {
2601     PyErr_Clear();
2602     }
2603     }
2604     #ifdef SWIG_PYTHON_CAST_MODE
2605     {
2606     int dispatch = 0;
2607     long v = PyInt_AsLong(obj);
2608     if (!PyErr_Occurred()) {
2609     if (val) *val = v;
2610     return SWIG_AddCast(SWIG_OK);
2611     } else {
2612     PyErr_Clear();
2613     }
2614     if (!dispatch) {
2615     double d;
2616     int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d));
2617     if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) {
2618     if (val) *val = (long)(d);
2619     return res;
2620     }
2621     }
2622     }
2623     #endif
2624     return SWIG_TypeError;
2625     }
2626    
2627    
2628     SWIGINTERN int
2629     SWIG_AsVal_int (PyObject * obj, int *val)
2630     {
2631     long v;
2632     int res = SWIG_AsVal_long (obj, &v);
2633     if (SWIG_IsOK(res)) {
2634     if ((v < INT_MIN || v > INT_MAX)) {
2635     return SWIG_OverflowError;
2636     } else {
2637     if (val) *val = (int)(v);
2638     }
2639     }
2640     return res;
2641     }
2642    
2643    
2644     #define SWIG_From_long PyInt_FromLong
2645    
2646    
2647     SWIGINTERNINLINE PyObject *
2648     SWIG_From_int (int value)
2649     {
2650     return SWIG_From_long (value);
2651     }
2652    
2653    
2654     SWIGINTERN int
2655     SWIG_AsVal_unsigned_SS_long (PyObject *obj, unsigned long *val)
2656     {
2657     if (PyInt_Check(obj)) {
2658     long v = PyInt_AsLong(obj);
2659     if (v >= 0) {
2660     if (val) *val = v;
2661     return SWIG_OK;
2662     } else {
2663     return SWIG_OverflowError;
2664     }
2665     } else if (PyLong_Check(obj)) {
2666     unsigned long v = PyLong_AsUnsignedLong(obj);
2667     if (!PyErr_Occurred()) {
2668     if (val) *val = v;
2669     return SWIG_OK;
2670     } else {
2671     PyErr_Clear();
2672     }
2673     }
2674     #ifdef SWIG_PYTHON_CAST_MODE
2675     {
2676     int dispatch = 0;
2677     unsigned long v = PyLong_AsUnsignedLong(obj);
2678     if (!PyErr_Occurred()) {
2679     if (val) *val = v;
2680     return SWIG_AddCast(SWIG_OK);
2681     } else {
2682     PyErr_Clear();
2683     }
2684     if (!dispatch) {
2685     double d;
2686     int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d));
2687     if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULONG_MAX)) {
2688     if (val) *val = (unsigned long)(d);
2689     return res;
2690     }
2691     }
2692     }
2693     #endif
2694     return SWIG_TypeError;
2695     }
2696    
2697    
2698     SWIGINTERN int
2699     SWIG_AsVal_unsigned_SS_int (PyObject * obj, unsigned int *val)
2700     {
2701     unsigned long v;
2702     int res = SWIG_AsVal_unsigned_SS_long (obj, &v);
2703     if (SWIG_IsOK(res)) {
2704     if ((v > UINT_MAX)) {
2705     return SWIG_OverflowError;
2706     } else {
2707     if (val) *val = (unsigned int)(v);
2708     }
2709     }
2710     return res;
2711     }
2712    
2713    
2714     SWIGINTERNINLINE PyObject*
2715     SWIG_From_unsigned_SS_long (unsigned long value)
2716     {
2717     return (value > LONG_MAX) ?
2718     PyLong_FromUnsignedLong(value) : PyInt_FromLong((long)(value));
2719     }
2720    
2721    
2722     SWIGINTERNINLINE PyObject *
2723     SWIG_From_unsigned_SS_int (unsigned int value)
2724     {
2725     return SWIG_From_unsigned_SS_long (value);
2726     }
2727    
2728     #ifdef __cplusplus
2729     extern "C" {
2730     #endif
2731     SWIGINTERN PyObject *_wrap_HelmholtzPowTerm_a_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
2732     PyObject *resultobj = 0;
2733     HelmholtzPowTerm *arg1 = (HelmholtzPowTerm *) 0 ;
2734     double arg2 ;
2735     void *argp1 = 0 ;
2736     int res1 = 0 ;
2737     double val2 ;
2738     int ecode2 = 0 ;
2739     PyObject * obj0 = 0 ;
2740     PyObject * obj1 = 0 ;
2741    
2742     if (!PyArg_ParseTuple(args,(char *)"OO:HelmholtzPowTerm_a_set",&obj0,&obj1)) SWIG_fail;
2743     res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_HelmholtzPowTerm_struct, 0 | 0 );
2744     if (!SWIG_IsOK(res1)) {
2745     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "HelmholtzPowTerm_a_set" "', argument " "1"" of type '" "HelmholtzPowTerm *""'");
2746     }
2747     arg1 = (HelmholtzPowTerm *)(argp1);
2748     ecode2 = SWIG_AsVal_double(obj1, &val2);
2749     if (!SWIG_IsOK(ecode2)) {
2750     SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "HelmholtzPowTerm_a_set" "', argument " "2"" of type '" "double""'");
2751     }
2752     arg2 = (double)(val2);
2753