Imported Upstream version 2.6.1
[debian/amanda] / perl / Amanda / Xfer.c
1 /* ----------------------------------------------------------------------------
2  * This file was automatically generated by SWIG (http://www.swig.org).
3  * Version 1.3.35
4  * 
5  * This file is not intended to be easily readable and contains a number of 
6  * coding conventions designed to improve portability and efficiency. Do not make
7  * changes to this file unless you know what you are doing--modify the SWIG 
8  * interface file instead. 
9  * ----------------------------------------------------------------------------- */
10
11 #define SWIGPERL
12 #define SWIG_CASTRANK_MODE
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 # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
21 #  define SWIGTEMPLATEDISAMBIGUATOR template
22 # elif defined(__HP_aCC)
23 /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
24 /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
25 #  define SWIGTEMPLATEDISAMBIGUATOR template
26 # else
27 #  define SWIGTEMPLATEDISAMBIGUATOR
28 # 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 /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
111 #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
112 # define _SCL_SECURE_NO_DEPRECATE
113 #endif
114
115
116 /* -----------------------------------------------------------------------------
117  * swigrun.swg
118  *
119  * This file contains generic CAPI SWIG runtime support for pointer
120  * type checking.
121  * ----------------------------------------------------------------------------- */
122
123 /* This should only be incremented when either the layout of swig_type_info changes,
124    or for whatever reason, the runtime changes incompatibly */
125 #define SWIG_RUNTIME_VERSION "4"
126
127 /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
128 #ifdef SWIG_TYPE_TABLE
129 # define SWIG_QUOTE_STRING(x) #x
130 # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
131 # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
132 #else
133 # define SWIG_TYPE_TABLE_NAME
134 #endif
135
136 /*
137   You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
138   creating a static or dynamic library from the swig runtime code.
139   In 99.9% of the cases, swig just needs to declare them as 'static'.
140   
141   But only do this if is strictly necessary, ie, if you have problems
142   with your compiler or so.
143 */
144
145 #ifndef SWIGRUNTIME
146 # define SWIGRUNTIME SWIGINTERN
147 #endif
148
149 #ifndef SWIGRUNTIMEINLINE
150 # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
151 #endif
152
153 /*  Generic buffer size */
154 #ifndef SWIG_BUFFER_SIZE
155 # define SWIG_BUFFER_SIZE 1024
156 #endif
157
158 /* Flags for pointer conversions */
159 #define SWIG_POINTER_DISOWN        0x1
160 #define SWIG_CAST_NEW_MEMORY       0x2
161
162 /* Flags for new pointer objects */
163 #define SWIG_POINTER_OWN           0x1
164
165
166 /* 
167    Flags/methods for returning states.
168    
169    The swig conversion methods, as ConvertPtr, return and integer 
170    that tells if the conversion was successful or not. And if not,
171    an error code can be returned (see swigerrors.swg for the codes).
172    
173    Use the following macros/flags to set or process the returning
174    states.
175    
176    In old swig versions, you usually write code as:
177
178      if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
179        // success code
180      } else {
181        //fail code
182      }
183
184    Now you can be more explicit as:
185
186     int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
187     if (SWIG_IsOK(res)) {
188       // success code
189     } else {
190       // fail code
191     }
192
193    that seems to be the same, but now you can also do
194
195     Type *ptr;
196     int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
197     if (SWIG_IsOK(res)) {
198       // success code
199       if (SWIG_IsNewObj(res) {
200         ...
201         delete *ptr;
202       } else {
203         ...
204       }
205     } else {
206       // fail code
207     }
208     
209    I.e., now SWIG_ConvertPtr can return new objects and you can
210    identify the case and take care of the deallocation. Of course that
211    requires also to SWIG_ConvertPtr to return new result values, as
212
213       int SWIG_ConvertPtr(obj, ptr,...) {         
214         if (<obj is ok>) {                             
215           if (<need new object>) {                     
216             *ptr = <ptr to new allocated object>; 
217             return SWIG_NEWOBJ;                
218           } else {                                     
219             *ptr = <ptr to old object>;        
220             return SWIG_OLDOBJ;                
221           }                                    
222         } else {                                       
223           return SWIG_BADOBJ;                  
224         }                                              
225       }
226
227    Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
228    more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
229    swig errors code.
230
231    Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
232    allows to return the 'cast rank', for example, if you have this
233
234        int food(double)
235        int fooi(int);
236
237    and you call
238  
239       food(1)   // cast rank '1'  (1 -> 1.0)
240       fooi(1)   // cast rank '0'
241
242    just use the SWIG_AddCast()/SWIG_CheckState()
243
244
245  */
246 #define SWIG_OK                    (0) 
247 #define SWIG_ERROR                 (-1)
248 #define SWIG_IsOK(r)               (r >= 0)
249 #define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)  
250
251 /* The CastRankLimit says how many bits are used for the cast rank */
252 #define SWIG_CASTRANKLIMIT         (1 << 8)
253 /* The NewMask denotes the object was created (using new/malloc) */
254 #define SWIG_NEWOBJMASK            (SWIG_CASTRANKLIMIT  << 1)
255 /* The TmpMask is for in/out typemaps that use temporal objects */
256 #define SWIG_TMPOBJMASK            (SWIG_NEWOBJMASK << 1)
257 /* Simple returning values */
258 #define SWIG_BADOBJ                (SWIG_ERROR)
259 #define SWIG_OLDOBJ                (SWIG_OK)
260 #define SWIG_NEWOBJ                (SWIG_OK | SWIG_NEWOBJMASK)
261 #define SWIG_TMPOBJ                (SWIG_OK | SWIG_TMPOBJMASK)
262 /* Check, add and del mask methods */
263 #define SWIG_AddNewMask(r)         (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
264 #define SWIG_DelNewMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
265 #define SWIG_IsNewObj(r)           (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
266 #define SWIG_AddTmpMask(r)         (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
267 #define SWIG_DelTmpMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
268 #define SWIG_IsTmpObj(r)           (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
269
270
271 /* Cast-Rank Mode */
272 #if defined(SWIG_CASTRANK_MODE)
273 #  ifndef SWIG_TypeRank
274 #    define SWIG_TypeRank             unsigned long
275 #  endif
276 #  ifndef SWIG_MAXCASTRANK            /* Default cast allowed */
277 #    define SWIG_MAXCASTRANK          (2)
278 #  endif
279 #  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
280 #  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
281 SWIGINTERNINLINE int SWIG_AddCast(int r) { 
282   return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
283 }
284 SWIGINTERNINLINE int SWIG_CheckState(int r) { 
285   return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; 
286 }
287 #else /* no cast-rank mode */
288 #  define SWIG_AddCast
289 #  define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
290 #endif
291
292
293
294
295 #include <string.h>
296
297 #ifdef __cplusplus
298 extern "C" {
299 #endif
300
301 typedef void *(*swig_converter_func)(void *, int *);
302 typedef struct swig_type_info *(*swig_dycast_func)(void **);
303
304 /* Structure to store information on one type */
305 typedef struct swig_type_info {
306   const char             *name;                 /* mangled name of this type */
307   const char             *str;                  /* human readable name of this type */
308   swig_dycast_func        dcast;                /* dynamic cast function down a hierarchy */
309   struct swig_cast_info  *cast;                 /* linked list of types that can cast into this type */
310   void                   *clientdata;           /* language specific type data */
311   int                    owndata;               /* flag if the structure owns the clientdata */
312 } swig_type_info;
313
314 /* Structure to store a type and conversion function used for casting */
315 typedef struct swig_cast_info {
316   swig_type_info         *type;                 /* pointer to type that is equivalent to this type */
317   swig_converter_func     converter;            /* function to cast the void pointers */
318   struct swig_cast_info  *next;                 /* pointer to next cast in linked list */
319   struct swig_cast_info  *prev;                 /* pointer to the previous cast */
320 } swig_cast_info;
321
322 /* Structure used to store module information
323  * Each module generates one structure like this, and the runtime collects
324  * all of these structures and stores them in a circularly linked list.*/
325 typedef struct swig_module_info {
326   swig_type_info         **types;               /* Array of pointers to swig_type_info structures that are in this module */
327   size_t                 size;                  /* Number of types in this module */
328   struct swig_module_info *next;                /* Pointer to next element in circularly linked list */
329   swig_type_info         **type_initial;        /* Array of initially generated type structures */
330   swig_cast_info         **cast_initial;        /* Array of initially generated casting structures */
331   void                    *clientdata;          /* Language specific module data */
332 } swig_module_info;
333
334 /* 
335   Compare two type names skipping the space characters, therefore
336   "char*" == "char *" and "Class<int>" == "Class<int >", etc.
337
338   Return 0 when the two name types are equivalent, as in
339   strncmp, but skipping ' '.
340 */
341 SWIGRUNTIME int
342 SWIG_TypeNameComp(const char *f1, const char *l1,
343                   const char *f2, const char *l2) {
344   for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
345     while ((*f1 == ' ') && (f1 != l1)) ++f1;
346     while ((*f2 == ' ') && (f2 != l2)) ++f2;
347     if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
348   }
349   return (int)((l1 - f1) - (l2 - f2));
350 }
351
352 /*
353   Check type equivalence in a name list like <name1>|<name2>|...
354   Return 0 if not equal, 1 if equal
355 */
356 SWIGRUNTIME int
357 SWIG_TypeEquiv(const char *nb, const char *tb) {
358   int equiv = 0;
359   const char* te = tb + strlen(tb);
360   const char* ne = nb;
361   while (!equiv && *ne) {
362     for (nb = ne; *ne; ++ne) {
363       if (*ne == '|') break;
364     }
365     equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
366     if (*ne) ++ne;
367   }
368   return equiv;
369 }
370
371 /*
372   Check type equivalence in a name list like <name1>|<name2>|...
373   Return 0 if equal, -1 if nb < tb, 1 if nb > tb
374 */
375 SWIGRUNTIME int
376 SWIG_TypeCompare(const char *nb, const char *tb) {
377   int equiv = 0;
378   const char* te = tb + strlen(tb);
379   const char* ne = nb;
380   while (!equiv && *ne) {
381     for (nb = ne; *ne; ++ne) {
382       if (*ne == '|') break;
383     }
384     equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
385     if (*ne) ++ne;
386   }
387   return equiv;
388 }
389
390
391 /* think of this as a c++ template<> or a scheme macro */
392 #define SWIG_TypeCheck_Template(comparison, ty)         \
393   if (ty) {                                             \
394     swig_cast_info *iter = ty->cast;                    \
395     while (iter) {                                      \
396       if (comparison) {                                 \
397         if (iter == ty->cast) return iter;              \
398         /* Move iter to the top of the linked list */   \
399         iter->prev->next = iter->next;                  \
400         if (iter->next)                                 \
401           iter->next->prev = iter->prev;                \
402         iter->next = ty->cast;                          \
403         iter->prev = 0;                                 \
404         if (ty->cast) ty->cast->prev = iter;            \
405         ty->cast = iter;                                \
406         return iter;                                    \
407       }                                                 \
408       iter = iter->next;                                \
409     }                                                   \
410   }                                                     \
411   return 0
412
413 /*
414   Check the typename
415 */
416 SWIGRUNTIME swig_cast_info *
417 SWIG_TypeCheck(const char *c, swig_type_info *ty) {
418   SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
419 }
420
421 /* Same as previous function, except strcmp is replaced with a pointer comparison */
422 SWIGRUNTIME swig_cast_info *
423 SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
424   SWIG_TypeCheck_Template(iter->type == from, into);
425 }
426
427 /*
428   Cast a pointer up an inheritance hierarchy
429 */
430 SWIGRUNTIMEINLINE void *
431 SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
432   return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
433 }
434
435 /* 
436    Dynamic pointer casting. Down an inheritance hierarchy
437 */
438 SWIGRUNTIME swig_type_info *
439 SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
440   swig_type_info *lastty = ty;
441   if (!ty || !ty->dcast) return ty;
442   while (ty && (ty->dcast)) {
443     ty = (*ty->dcast)(ptr);
444     if (ty) lastty = ty;
445   }
446   return lastty;
447 }
448
449 /*
450   Return the name associated with this type
451 */
452 SWIGRUNTIMEINLINE const char *
453 SWIG_TypeName(const swig_type_info *ty) {
454   return ty->name;
455 }
456
457 /*
458   Return the pretty name associated with this type,
459   that is an unmangled type name in a form presentable to the user.
460 */
461 SWIGRUNTIME const char *
462 SWIG_TypePrettyName(const swig_type_info *type) {
463   /* The "str" field contains the equivalent pretty names of the
464      type, separated by vertical-bar characters.  We choose
465      to print the last name, as it is often (?) the most
466      specific. */
467   if (!type) return NULL;
468   if (type->str != NULL) {
469     const char *last_name = type->str;
470     const char *s;
471     for (s = type->str; *s; s++)
472       if (*s == '|') last_name = s+1;
473     return last_name;
474   }
475   else
476     return type->name;
477 }
478
479 /* 
480    Set the clientdata field for a type
481 */
482 SWIGRUNTIME void
483 SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
484   swig_cast_info *cast = ti->cast;
485   /* if (ti->clientdata == clientdata) return; */
486   ti->clientdata = clientdata;
487   
488   while (cast) {
489     if (!cast->converter) {
490       swig_type_info *tc = cast->type;
491       if (!tc->clientdata) {
492         SWIG_TypeClientData(tc, clientdata);
493       }
494     }    
495     cast = cast->next;
496   }
497 }
498 SWIGRUNTIME void
499 SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
500   SWIG_TypeClientData(ti, clientdata);
501   ti->owndata = 1;
502 }
503   
504 /*
505   Search for a swig_type_info structure only by mangled name
506   Search is a O(log #types)
507   
508   We start searching at module start, and finish searching when start == end.  
509   Note: if start == end at the beginning of the function, we go all the way around
510   the circular list.
511 */
512 SWIGRUNTIME swig_type_info *
513 SWIG_MangledTypeQueryModule(swig_module_info *start, 
514                             swig_module_info *end, 
515                             const char *name) {
516   swig_module_info *iter = start;
517   do {
518     if (iter->size) {
519       register size_t l = 0;
520       register size_t r = iter->size - 1;
521       do {
522         /* since l+r >= 0, we can (>> 1) instead (/ 2) */
523         register size_t i = (l + r) >> 1; 
524         const char *iname = iter->types[i]->name;
525         if (iname) {
526           register int compare = strcmp(name, iname);
527           if (compare == 0) {       
528             return iter->types[i];
529           } else if (compare < 0) {
530             if (i) {
531               r = i - 1;
532             } else {
533               break;
534             }
535           } else if (compare > 0) {
536             l = i + 1;
537           }
538         } else {
539           break; /* should never happen */
540         }
541       } while (l <= r);
542     }
543     iter = iter->next;
544   } while (iter != end);
545   return 0;
546 }
547
548 /*
549   Search for a swig_type_info structure for either a mangled name or a human readable name.
550   It first searches the mangled names of the types, which is a O(log #types)
551   If a type is not found it then searches the human readable names, which is O(#types).
552   
553   We start searching at module start, and finish searching when start == end.  
554   Note: if start == end at the beginning of the function, we go all the way around
555   the circular list.
556 */
557 SWIGRUNTIME swig_type_info *
558 SWIG_TypeQueryModule(swig_module_info *start, 
559                      swig_module_info *end, 
560                      const char *name) {
561   /* STEP 1: Search the name field using binary search */
562   swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
563   if (ret) {
564     return ret;
565   } else {
566     /* STEP 2: If the type hasn't been found, do a complete search
567        of the str field (the human readable name) */
568     swig_module_info *iter = start;
569     do {
570       register size_t i = 0;
571       for (; i < iter->size; ++i) {
572         if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
573           return iter->types[i];
574       }
575       iter = iter->next;
576     } while (iter != end);
577   }
578   
579   /* neither found a match */
580   return 0;
581 }
582
583 /* 
584    Pack binary data into a string
585 */
586 SWIGRUNTIME char *
587 SWIG_PackData(char *c, void *ptr, size_t sz) {
588   static const char hex[17] = "0123456789abcdef";
589   register const unsigned char *u = (unsigned char *) ptr;
590   register const unsigned char *eu =  u + sz;
591   for (; u != eu; ++u) {
592     register unsigned char uu = *u;
593     *(c++) = hex[(uu & 0xf0) >> 4];
594     *(c++) = hex[uu & 0xf];
595   }
596   return c;
597 }
598
599 /* 
600    Unpack binary data from a string
601 */
602 SWIGRUNTIME const char *
603 SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
604   register unsigned char *u = (unsigned char *) ptr;
605   register const unsigned char *eu = u + sz;
606   for (; u != eu; ++u) {
607     register char d = *(c++);
608     register unsigned char uu;
609     if ((d >= '0') && (d <= '9'))
610       uu = ((d - '0') << 4);
611     else if ((d >= 'a') && (d <= 'f'))
612       uu = ((d - ('a'-10)) << 4);
613     else 
614       return (char *) 0;
615     d = *(c++);
616     if ((d >= '0') && (d <= '9'))
617       uu |= (d - '0');
618     else if ((d >= 'a') && (d <= 'f'))
619       uu |= (d - ('a'-10));
620     else 
621       return (char *) 0;
622     *u = uu;
623   }
624   return c;
625 }
626
627 /* 
628    Pack 'void *' into a string buffer.
629 */
630 SWIGRUNTIME char *
631 SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
632   char *r = buff;
633   if ((2*sizeof(void *) + 2) > bsz) return 0;
634   *(r++) = '_';
635   r = SWIG_PackData(r,&ptr,sizeof(void *));
636   if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
637   strcpy(r,name);
638   return buff;
639 }
640
641 SWIGRUNTIME const char *
642 SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
643   if (*c != '_') {
644     if (strcmp(c,"NULL") == 0) {
645       *ptr = (void *) 0;
646       return name;
647     } else {
648       return 0;
649     }
650   }
651   return SWIG_UnpackData(++c,ptr,sizeof(void *));
652 }
653
654 SWIGRUNTIME char *
655 SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
656   char *r = buff;
657   size_t lname = (name ? strlen(name) : 0);
658   if ((2*sz + 2 + lname) > bsz) return 0;
659   *(r++) = '_';
660   r = SWIG_PackData(r,ptr,sz);
661   if (lname) {
662     strncpy(r,name,lname+1);
663   } else {
664     *r = 0;
665   }
666   return buff;
667 }
668
669 SWIGRUNTIME const char *
670 SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
671   if (*c != '_') {
672     if (strcmp(c,"NULL") == 0) {
673       memset(ptr,0,sz);
674       return name;
675     } else {
676       return 0;
677     }
678   }
679   return SWIG_UnpackData(++c,ptr,sz);
680 }
681
682 #ifdef __cplusplus
683 }
684 #endif
685
686 /*  Errors in SWIG */
687 #define  SWIG_UnknownError         -1 
688 #define  SWIG_IOError              -2 
689 #define  SWIG_RuntimeError         -3 
690 #define  SWIG_IndexError           -4 
691 #define  SWIG_TypeError            -5 
692 #define  SWIG_DivisionByZero       -6 
693 #define  SWIG_OverflowError        -7 
694 #define  SWIG_SyntaxError          -8 
695 #define  SWIG_ValueError           -9 
696 #define  SWIG_SystemError          -10
697 #define  SWIG_AttributeError       -11
698 #define  SWIG_MemoryError          -12 
699 #define  SWIG_NullReferenceError   -13
700
701
702
703 #ifdef __cplusplus
704 /* Needed on some windows machines---since MS plays funny games with the header files under C++ */
705 #include <math.h>
706 #include <stdlib.h>
707 extern "C" {
708 #endif
709 #include "EXTERN.h"
710 #include "perl.h"
711 #include "XSUB.h"
712
713 /* Add in functionality missing in older versions of Perl. Much of this is based on Devel-PPPort on cpan. */
714
715 /* Add PERL_REVISION, PERL_VERSION, PERL_SUBVERSION if missing */
716 #ifndef PERL_REVISION
717 #  if !defined(__PATCHLEVEL_H_INCLUDED__) && !(defined(PATCHLEVEL) && defined(SUBVERSION))
718 #    define PERL_PATCHLEVEL_H_IMPLICIT
719 #    include <patchlevel.h>
720 #  endif
721 #  if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL)))
722 #    include <could_not_find_Perl_patchlevel.h>
723 #  endif
724 #  ifndef PERL_REVISION
725 #    define PERL_REVISION       (5)
726 #    define PERL_VERSION        PATCHLEVEL
727 #    define PERL_SUBVERSION     SUBVERSION
728 #  endif
729 #endif
730
731 #if defined(WIN32) && defined(PERL_OBJECT) && !defined(PerlIO_exportFILE)
732 #define PerlIO_exportFILE(fh,fl) (FILE*)(fh)
733 #endif
734
735 #ifndef SvIOK_UV
736 # define SvIOK_UV(sv)       (SvIOK(sv) && (SvUVX(sv) == SvIVX(sv)))
737 #endif
738
739 #ifndef SvUOK
740 # define SvUOK(sv)           SvIOK_UV(sv)
741 #endif
742
743 #if ((PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 5)))
744 #  define PL_sv_undef               sv_undef
745 #  define PL_na                     na
746 #  define PL_errgv                  errgv
747 #  define PL_sv_no                  sv_no
748 #  define PL_sv_yes                 sv_yes
749 #  define PL_markstack_ptr          markstack_ptr
750 #endif
751
752 #ifndef IVSIZE
753 #  ifdef LONGSIZE
754 #    define IVSIZE LONGSIZE
755 #  else
756 #    define IVSIZE 4 /* A bold guess, but the best we can make. */
757 #  endif
758 #endif
759
760 #ifndef INT2PTR
761 #  if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE)
762 #    define PTRV                  UV
763 #    define INT2PTR(any,d)        (any)(d)
764 #  else
765 #    if PTRSIZE == LONGSIZE
766 #      define PTRV                unsigned long
767 #    else
768 #      define PTRV                unsigned
769 #    endif
770 #    define INT2PTR(any,d)        (any)(PTRV)(d)
771 #  endif
772
773 #  define NUM2PTR(any,d)  (any)(PTRV)(d)
774 #  define PTR2IV(p)       INT2PTR(IV,p)
775 #  define PTR2UV(p)       INT2PTR(UV,p)
776 #  define PTR2NV(p)       NUM2PTR(NV,p)
777
778 #  if PTRSIZE == LONGSIZE
779 #    define PTR2ul(p)     (unsigned long)(p)
780 #  else
781 #    define PTR2ul(p)     INT2PTR(unsigned long,p)
782 #  endif
783 #endif /* !INT2PTR */
784
785 #ifndef SvPV_nolen
786 # define SvPV_nolen(x) SvPV(x,PL_na)
787 #endif
788
789 #ifndef get_sv
790 #  define get_sv perl_get_sv
791 #endif
792
793 #ifndef ERRSV
794 #  define ERRSV get_sv("@",FALSE)
795 #endif
796
797 #ifndef pTHX_
798 #define pTHX_
799 #endif   
800
801 #include <string.h>
802 #ifdef __cplusplus
803 }
804 #endif
805
806 /* -----------------------------------------------------------------------------
807  * error manipulation
808  * ----------------------------------------------------------------------------- */
809
810 SWIGINTERN const char*
811 SWIG_Perl_ErrorType(int code) {
812   const char* type = 0;
813   switch(code) {
814   case SWIG_MemoryError:
815     type = "MemoryError";
816     break;
817   case SWIG_IOError:
818     type = "IOError";
819     break;
820   case SWIG_RuntimeError:
821     type = "RuntimeError";
822     break;
823   case SWIG_IndexError:
824     type = "IndexError";
825     break;
826   case SWIG_TypeError:
827     type = "TypeError";
828     break;
829   case SWIG_DivisionByZero:
830     type = "ZeroDivisionError";
831     break;
832   case SWIG_OverflowError:
833     type = "OverflowError";
834     break;
835   case SWIG_SyntaxError:
836     type = "SyntaxError";
837     break;
838   case SWIG_ValueError:
839     type = "ValueError";
840     break;
841   case SWIG_SystemError:
842     type = "SystemError";
843     break;
844   case SWIG_AttributeError:
845     type = "AttributeError";
846     break;
847   default:
848     type = "RuntimeError";
849   }
850   return type;
851 }
852
853
854
855
856 /* -----------------------------------------------------------------------------
857  * perlrun.swg
858  *
859  * This file contains the runtime support for Perl modules
860  * and includes code for managing global variables and pointer
861  * type checking.
862  * ----------------------------------------------------------------------------- */
863
864 #ifdef PERL_OBJECT
865 #define SWIG_PERL_OBJECT_DECL CPerlObj *SWIGUNUSEDPARM(pPerl),
866 #define SWIG_PERL_OBJECT_CALL pPerl,
867 #else
868 #define SWIG_PERL_OBJECT_DECL
869 #define SWIG_PERL_OBJECT_CALL
870 #endif
871
872 /* Common SWIG API */
873
874 /* for raw pointers */
875 #define SWIG_ConvertPtr(obj, pp, type, flags)           SWIG_Perl_ConvertPtr(SWIG_PERL_OBJECT_CALL obj, pp, type, flags)
876 #define SWIG_NewPointerObj(p, type, flags)              SWIG_Perl_NewPointerObj(SWIG_PERL_OBJECT_CALL p, type, flags)
877
878 /* for raw packed data */
879 #define SWIG_ConvertPacked(obj, p, s, type)             SWIG_Perl_ConvertPacked(SWIG_PERL_OBJECT_CALL obj, p, s, type)
880 #define SWIG_NewPackedObj(p, s, type)                   SWIG_Perl_NewPackedObj(SWIG_PERL_OBJECT_CALL p, s, type)
881
882 /* for class or struct pointers */
883 #define SWIG_ConvertInstance(obj, pptr, type, flags)    SWIG_ConvertPtr(obj, pptr, type, flags)
884 #define SWIG_NewInstanceObj(ptr, type, flags)           SWIG_NewPointerObj(ptr, type, flags)
885
886 /* for C or C++ function pointers */
887 #define SWIG_ConvertFunctionPtr(obj, pptr, type)        SWIG_ConvertPtr(obj, pptr, type, 0)
888 #define SWIG_NewFunctionPtrObj(ptr, type)               SWIG_NewPointerObj(ptr, type, 0)
889
890 /* for C++ member pointers, ie, member methods */
891 #define SWIG_ConvertMember(obj, ptr, sz, ty)            SWIG_ConvertPacked(obj, ptr, sz, ty)
892 #define SWIG_NewMemberObj(ptr, sz, type)                SWIG_NewPackedObj(ptr, sz, type)
893
894
895 /* Runtime API */
896
897 #define SWIG_GetModule(clientdata)                      SWIG_Perl_GetModule()
898 #define SWIG_SetModule(clientdata, pointer)             SWIG_Perl_SetModule(pointer)
899
900
901 /* Error manipulation */
902
903 #define SWIG_ErrorType(code)                            SWIG_Perl_ErrorType(code)               
904 #define SWIG_Error(code, msg)                           sv_setpvf(GvSV(PL_errgv),"%s %s\n", SWIG_ErrorType(code), msg)
905 #define SWIG_fail                                       goto fail                                                   
906
907 /* Perl-specific SWIG API */
908
909 #define SWIG_MakePtr(sv, ptr, type, flags)              SWIG_Perl_MakePtr(SWIG_PERL_OBJECT_CALL sv, ptr, type, flags)
910 #define SWIG_MakePackedObj(sv, p, s, type)              SWIG_Perl_MakePackedObj(SWIG_PERL_OBJECT_CALL sv, p, s, type)
911 #define SWIG_SetError(str)                              SWIG_Error(SWIG_RuntimeError, str)
912
913
914 #define SWIG_PERL_DECL_ARGS_1(arg1)                     (SWIG_PERL_OBJECT_DECL arg1)
915 #define SWIG_PERL_CALL_ARGS_1(arg1)                     (SWIG_PERL_OBJECT_CALL arg1)
916 #define SWIG_PERL_DECL_ARGS_2(arg1, arg2)               (SWIG_PERL_OBJECT_DECL arg1, arg2)
917 #define SWIG_PERL_CALL_ARGS_2(arg1, arg2)               (SWIG_PERL_OBJECT_CALL arg1, arg2)
918
919 /* -----------------------------------------------------------------------------
920  * pointers/data manipulation
921  * ----------------------------------------------------------------------------- */
922
923 /* For backward compatibility only */
924 #define SWIG_POINTER_EXCEPTION  0
925
926 #ifdef __cplusplus
927 extern "C" {
928 #endif
929
930 #define SWIG_OWNER   SWIG_POINTER_OWN
931 #define SWIG_SHADOW  SWIG_OWNER << 1
932
933 #define SWIG_MAYBE_PERL_OBJECT SWIG_PERL_OBJECT_DECL
934
935 /* SWIG Perl macros */
936
937 /* Macro to declare an XS function */
938 #ifndef XSPROTO
939 #   define XSPROTO(name) void name(pTHX_ CV* cv)
940 #endif
941
942 /* Macro to call an XS function */
943 #ifdef PERL_OBJECT 
944 #  define SWIG_CALLXS(_name) _name(cv,pPerl) 
945 #else 
946 #  ifndef MULTIPLICITY 
947 #    define SWIG_CALLXS(_name) _name(cv) 
948 #  else 
949 #    define SWIG_CALLXS(_name) _name(PERL_GET_THX, cv) 
950 #  endif 
951 #endif 
952
953 #ifdef PERL_OBJECT
954 #define MAGIC_PPERL  CPerlObj *pPerl = (CPerlObj *) this;
955
956 #ifdef __cplusplus
957 extern "C" {
958 #endif
959 typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *);
960 #ifdef __cplusplus
961 }
962 #endif
963
964 #define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
965 #define SWIGCLASS_STATIC
966
967 #else /* PERL_OBJECT */
968
969 #define MAGIC_PPERL
970 #define SWIGCLASS_STATIC static SWIGUNUSED
971
972 #ifndef MULTIPLICITY
973 #define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
974
975 #ifdef __cplusplus
976 extern "C" {
977 #endif
978 typedef int (*SwigMagicFunc)(SV *, MAGIC *);
979 #ifdef __cplusplus
980 }
981 #endif
982
983 #else /* MULTIPLICITY */
984
985 #define SWIG_MAGIC(a,b) (struct interpreter *interp, SV *a, MAGIC *b)
986
987 #ifdef __cplusplus
988 extern "C" {
989 #endif
990 typedef int (*SwigMagicFunc)(struct interpreter *, SV *, MAGIC *);
991 #ifdef __cplusplus
992 }
993 #endif
994
995 #endif /* MULTIPLICITY */
996 #endif /* PERL_OBJECT */
997
998 /* Workaround for bug in perl 5.6.x croak and earlier */
999 #if (PERL_VERSION < 8)
1000 #  ifdef PERL_OBJECT
1001 #    define SWIG_croak_null() SWIG_Perl_croak_null(pPerl)
1002 static void SWIG_Perl_croak_null(CPerlObj *pPerl)
1003 #  else
1004 static void SWIG_croak_null()
1005 #  endif
1006 {
1007   SV *err=ERRSV;
1008 #  if (PERL_VERSION < 6)
1009   croak("%_", err);
1010 #  else
1011   if (SvOK(err) && !SvROK(err)) croak("%_", err);
1012   croak(Nullch);
1013 #  endif
1014 }
1015 #else
1016 #  define SWIG_croak_null() croak(Nullch)
1017 #endif
1018
1019
1020 /* 
1021    Define how strict is the cast between strings and integers/doubles
1022    when overloading between these types occurs.
1023    
1024    The default is making it as strict as possible by using SWIG_AddCast
1025    when needed.
1026    
1027    You can use -DSWIG_PERL_NO_STRICT_STR2NUM at compilation time to
1028    disable the SWIG_AddCast, making the casting between string and
1029    numbers less strict.
1030
1031    In the end, we try to solve the overloading between strings and
1032    numerical types in the more natural way, but if you can avoid it,
1033    well, avoid it using %rename, for example.
1034 */
1035 #ifndef SWIG_PERL_NO_STRICT_STR2NUM
1036 # ifndef SWIG_PERL_STRICT_STR2NUM
1037 #  define SWIG_PERL_STRICT_STR2NUM
1038 # endif
1039 #endif
1040 #ifdef SWIG_PERL_STRICT_STR2NUM
1041 /* string takes precedence */
1042 #define SWIG_Str2NumCast(x) SWIG_AddCast(x)  
1043 #else
1044 /* number takes precedence */
1045 #define SWIG_Str2NumCast(x) x
1046 #endif
1047
1048
1049
1050 #include <stdlib.h>
1051
1052 SWIGRUNTIME const char *
1053 SWIG_Perl_TypeProxyName(const swig_type_info *type) {
1054   if (!type) return NULL;
1055   if (type->clientdata != NULL) {
1056     return (const char*) type->clientdata;
1057   } 
1058   else {
1059     return type->name;
1060   }
1061 }
1062
1063 SWIGRUNTIME swig_cast_info *
1064 SWIG_TypeProxyCheck(const char *c, swig_type_info *ty) {
1065   SWIG_TypeCheck_Template(( (!iter->type->clientdata && (strcmp(iter->type->name, c) == 0)) 
1066                             || (iter->type->clientdata && (strcmp((char*)iter->type->clientdata, c) == 0))), ty);
1067 }
1068
1069
1070 /* Function for getting a pointer value */
1071
1072 SWIGRUNTIME int
1073 SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *_t, int flags) {
1074   swig_cast_info *tc;
1075   void *voidptr = (void *)0;
1076   SV *tsv = 0;
1077   /* If magical, apply more magic */
1078   if (SvGMAGICAL(sv))
1079     mg_get(sv);
1080
1081   /* Check to see if this is an object */
1082   if (sv_isobject(sv)) {
1083     IV tmp = 0;
1084     tsv = (SV*) SvRV(sv);
1085     if ((SvTYPE(tsv) == SVt_PVHV)) {
1086       MAGIC *mg;
1087       if (SvMAGICAL(tsv)) {
1088         mg = mg_find(tsv,'P');
1089         if (mg) {
1090           sv = mg->mg_obj;
1091           if (sv_isobject(sv)) {
1092             tsv = (SV*)SvRV(sv);
1093             tmp = SvIV(tsv);
1094           }
1095         }
1096       } else {
1097         return SWIG_ERROR;
1098       }
1099     } else {
1100       tmp = SvIV(tsv);
1101     }
1102     voidptr = INT2PTR(void *,tmp);
1103   } else if (! SvOK(sv)) {            /* Check for undef */
1104     *(ptr) = (void *) 0;
1105     return SWIG_OK;
1106   } else if (SvTYPE(sv) == SVt_RV) {  /* Check for NULL pointer */
1107     if (!SvROK(sv)) {
1108       *(ptr) = (void *) 0;
1109       return SWIG_OK;
1110     } else {
1111       return SWIG_ERROR;
1112     }
1113   } else {                            /* Don't know what it is */
1114     return SWIG_ERROR;
1115   }
1116   if (_t) {
1117     /* Now see if the types match */
1118     char *_c = HvNAME(SvSTASH(SvRV(sv)));
1119     tc = SWIG_TypeProxyCheck(_c,_t);
1120     if (!tc) {
1121       return SWIG_ERROR;
1122     }
1123     {
1124       int newmemory = 0;
1125       *ptr = SWIG_TypeCast(tc,voidptr,&newmemory);
1126       assert(!newmemory); /* newmemory handling not yet implemented */
1127     }
1128   } else {
1129     *ptr = voidptr;
1130   }
1131
1132   /* 
1133    *  DISOWN implementation: we need a perl guru to check this one.
1134    */
1135   if (tsv && (flags & SWIG_POINTER_DISOWN)) {
1136     /* 
1137      *  almost copy paste code from below SWIG_POINTER_OWN setting
1138      */
1139     SV *obj = sv;
1140     HV *stash = SvSTASH(SvRV(obj));
1141     GV *gv = *(GV**) hv_fetch(stash, "OWNER", 5, TRUE);
1142     if (isGV(gv)) {
1143       HV *hv = GvHVn(gv);
1144       /*
1145        * To set ownership (see below), a newSViv(1) entry is added. 
1146        * Hence, to remove ownership, we delete the entry.
1147        */
1148       if (hv_exists_ent(hv, obj, 0)) {
1149         hv_delete_ent(hv, obj, 0, 0);
1150       }
1151     }
1152   }
1153   return SWIG_OK;
1154 }
1155
1156 SWIGRUNTIME void
1157 SWIG_Perl_MakePtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, swig_type_info *t, int flags) {
1158   if (ptr && (flags & SWIG_SHADOW)) {
1159     SV *self;
1160     SV *obj=newSV(0);
1161     HV *hash=newHV();
1162     HV *stash;
1163     sv_setref_pv(obj, (char *) SWIG_Perl_TypeProxyName(t), ptr);
1164     stash=SvSTASH(SvRV(obj));
1165     if (flags & SWIG_POINTER_OWN) {
1166       HV *hv;
1167       GV *gv=*(GV**)hv_fetch(stash, "OWNER", 5, TRUE);
1168       if (!isGV(gv))
1169         gv_init(gv, stash, "OWNER", 5, FALSE);
1170       hv=GvHVn(gv);
1171       hv_store_ent(hv, obj, newSViv(1), 0);
1172     }
1173     sv_magic((SV *)hash, (SV *)obj, 'P', Nullch, 0);
1174     SvREFCNT_dec(obj);
1175     self=newRV_noinc((SV *)hash);
1176     sv_setsv(sv, self);
1177     SvREFCNT_dec((SV *)self);
1178     sv_bless(sv, stash);
1179   }
1180   else {
1181     sv_setref_pv(sv, (char *) SWIG_Perl_TypeProxyName(t), ptr);
1182   }
1183 }
1184
1185 SWIGRUNTIMEINLINE SV *
1186 SWIG_Perl_NewPointerObj(SWIG_MAYBE_PERL_OBJECT void *ptr, swig_type_info *t, int flags) {
1187   SV *result = sv_newmortal();
1188   SWIG_MakePtr(result, ptr, t, flags);
1189   return result;
1190 }
1191
1192 SWIGRUNTIME void
1193 SWIG_Perl_MakePackedObj(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, int sz, swig_type_info *type) {
1194   char result[1024];
1195   char *r = result;
1196   if ((2*sz + 1 + strlen(SWIG_Perl_TypeProxyName(type))) > 1000) return;
1197   *(r++) = '_';
1198   r = SWIG_PackData(r,ptr,sz);
1199   strcpy(r,SWIG_Perl_TypeProxyName(type));
1200   sv_setpv(sv, result);
1201 }
1202
1203 SWIGRUNTIME SV *
1204 SWIG_Perl_NewPackedObj(SWIG_MAYBE_PERL_OBJECT void *ptr, int sz, swig_type_info *type) {
1205   SV *result = sv_newmortal();
1206   SWIG_Perl_MakePackedObj(result, ptr, sz, type);
1207   return result;
1208 }
1209
1210 /* Convert a packed value value */
1211 SWIGRUNTIME int
1212 SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV *obj, void *ptr, int sz, swig_type_info *ty) {
1213   swig_cast_info *tc;
1214   const char  *c = 0;
1215
1216   if ((!obj) || (!SvOK(obj))) return SWIG_ERROR;
1217   c = SvPV_nolen(obj);
1218   /* Pointer values must start with leading underscore */
1219   if (*c != '_') return SWIG_ERROR;
1220   c++;
1221   c = SWIG_UnpackData(c,ptr,sz);
1222   if (ty) {
1223     tc = SWIG_TypeCheck(c,ty);
1224     if (!tc) return SWIG_ERROR;
1225   }
1226   return SWIG_OK;
1227 }
1228
1229
1230 /* Macros for low-level exception handling */
1231 #define SWIG_croak(x)    { SWIG_Error(SWIG_RuntimeError, x); SWIG_fail; }
1232
1233
1234 typedef XSPROTO(SwigPerlWrapper);
1235 typedef SwigPerlWrapper *SwigPerlWrapperPtr;
1236
1237 /* Structure for command table */
1238 typedef struct {
1239   const char         *name;
1240   SwigPerlWrapperPtr  wrapper;
1241 } swig_command_info;
1242
1243 /* Information for constant table */
1244
1245 #define SWIG_INT     1
1246 #define SWIG_FLOAT   2
1247 #define SWIG_STRING  3
1248 #define SWIG_POINTER 4
1249 #define SWIG_BINARY  5
1250
1251 /* Constant information structure */
1252 typedef struct swig_constant_info {
1253     int              type;
1254     const char      *name;
1255     long             lvalue;
1256     double           dvalue;
1257     void            *pvalue;
1258     swig_type_info **ptype;
1259 } swig_constant_info;
1260
1261
1262 /* Structure for variable table */
1263 typedef struct {
1264   const char   *name;
1265   SwigMagicFunc   set;
1266   SwigMagicFunc   get;
1267   swig_type_info  **type;
1268 } swig_variable_info;
1269
1270 /* Magic variable code */
1271 #ifndef PERL_OBJECT
1272 #define swig_create_magic(s,a,b,c) _swig_create_magic(s,a,b,c)
1273   #ifndef MULTIPLICITY
1274      SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(SV *, MAGIC *), int (*get)(SV *,MAGIC *)) 
1275   #else
1276      SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(struct interpreter*, SV *, MAGIC *), int (*get)(struct interpreter*, SV *,MAGIC *)) 
1277   #endif
1278 #else
1279 #  define swig_create_magic(s,a,b,c) _swig_create_magic(pPerl,s,a,b,c)
1280 SWIGRUNTIME void _swig_create_magic(CPerlObj *pPerl, SV *sv, const char *name, int (CPerlObj::*set)(SV *, MAGIC *), int (CPerlObj::*get)(SV *, MAGIC *)) 
1281 #endif
1282 {
1283   MAGIC *mg;
1284   sv_magic(sv,sv,'U',(char *) name,strlen(name));
1285   mg = mg_find(sv,'U');
1286   mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL));
1287   mg->mg_virtual->svt_get = (SwigMagicFunc) get;
1288   mg->mg_virtual->svt_set = (SwigMagicFunc) set;
1289   mg->mg_virtual->svt_len = 0;
1290   mg->mg_virtual->svt_clear = 0;
1291   mg->mg_virtual->svt_free = 0;
1292 }
1293
1294
1295 SWIGRUNTIME swig_module_info *
1296 SWIG_Perl_GetModule(void) {
1297   static void *type_pointer = (void *)0;
1298   SV *pointer;
1299
1300   /* first check if pointer already created */
1301   if (!type_pointer) {
1302     pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE | GV_ADDMULTI);
1303     if (pointer && SvOK(pointer)) {
1304       type_pointer = INT2PTR(swig_type_info **, SvIV(pointer));
1305     }
1306   }
1307
1308   return (swig_module_info *) type_pointer;
1309 }
1310
1311 SWIGRUNTIME void
1312 SWIG_Perl_SetModule(swig_module_info *module) {
1313   SV *pointer;
1314
1315   /* create a new pointer */
1316   pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE | GV_ADDMULTI);
1317   sv_setiv(pointer, PTR2IV(module));
1318 }
1319
1320 #ifdef __cplusplus
1321 }
1322 #endif
1323
1324 /* Workaround perl5 global namespace pollution. Note that undefining library
1325  * functions like fopen will not solve the problem on all platforms as fopen
1326  * might be a macro on Windows but not necessarily on other operating systems. */
1327 #ifdef do_open
1328   #undef do_open
1329 #endif
1330 #ifdef do_close
1331   #undef do_close
1332 #endif
1333 #ifdef scalar
1334   #undef scalar
1335 #endif
1336 #ifdef list
1337   #undef list
1338 #endif
1339 #ifdef apply
1340   #undef apply
1341 #endif
1342 #ifdef convert
1343   #undef convert
1344 #endif
1345 #ifdef Error
1346   #undef Error
1347 #endif
1348 #ifdef form
1349   #undef form
1350 #endif
1351 #ifdef vform
1352   #undef vform
1353 #endif
1354 #ifdef LABEL
1355   #undef LABEL
1356 #endif
1357 #ifdef METHOD
1358   #undef METHOD
1359 #endif
1360 #ifdef Move
1361   #undef Move
1362 #endif
1363 #ifdef yylex
1364   #undef yylex
1365 #endif
1366 #ifdef yyparse
1367   #undef yyparse
1368 #endif
1369 #ifdef yyerror
1370   #undef yyerror
1371 #endif
1372 #ifdef invert
1373   #undef invert
1374 #endif
1375 #ifdef ref
1376   #undef ref
1377 #endif
1378 #ifdef read
1379   #undef read
1380 #endif
1381 #ifdef write
1382   #undef write
1383 #endif
1384 #ifdef eof
1385   #undef eof
1386 #endif
1387 #ifdef bool
1388   #undef bool
1389 #endif
1390 #ifdef close
1391   #undef close
1392 #endif
1393 #ifdef rewind
1394   #undef rewind
1395 #endif
1396 #ifdef free
1397   #undef free
1398 #endif
1399 #ifdef malloc
1400   #undef malloc
1401 #endif
1402 #ifdef calloc
1403   #undef calloc
1404 #endif
1405 #ifdef Stat
1406   #undef Stat
1407 #endif
1408 #ifdef check
1409   #undef check
1410 #endif
1411 #ifdef seekdir
1412   #undef seekdir
1413 #endif
1414 #ifdef open
1415   #undef open
1416 #endif
1417
1418
1419
1420 #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
1421
1422 #define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else 
1423
1424
1425
1426   #define SWIG_exception(code, msg) do { SWIG_Error(code, msg); SWIG_fail;; } while(0) 
1427
1428
1429 /* -------- TYPES TABLE (BEGIN) -------- */
1430
1431 #define SWIGTYPE_p_Device swig_types[0]
1432 #define SWIGTYPE_p_Xfer swig_types[1]
1433 #define SWIGTYPE_p_XferElement swig_types[2]
1434 #define SWIGTYPE_p_a_STRMAX__char swig_types[3]
1435 #define SWIGTYPE_p_amglue_Source swig_types[4]
1436 #define SWIGTYPE_p_char swig_types[5]
1437 #define SWIGTYPE_p_double swig_types[6]
1438 #define SWIGTYPE_p_float swig_types[7]
1439 #define SWIGTYPE_p_guint32 swig_types[8]
1440 #define SWIGTYPE_p_guint64 swig_types[9]
1441 #define SWIGTYPE_p_int swig_types[10]
1442 #define SWIGTYPE_p_p_XferElement swig_types[11]
1443 #define SWIGTYPE_p_queue_fd_t swig_types[12]
1444 #define SWIGTYPE_p_unsigned_char swig_types[13]
1445 static swig_type_info *swig_types[15];
1446 static swig_module_info swig_module = {swig_types, 14, 0, 0, 0, 0};
1447 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
1448 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
1449
1450 /* -------- TYPES TABLE (END) -------- */
1451
1452 #define SWIG_init    boot_Amanda__Xfer
1453
1454 #define SWIG_name   "Amanda::Xferc::boot_Amanda__Xfer"
1455 #define SWIG_prefix "Amanda::Xferc::"
1456
1457 #define SWIGVERSION 0x010335 
1458 #define SWIG_VERSION SWIGVERSION
1459
1460
1461 #define SWIG_as_voidptr(a) (void *)((const void *)(a)) 
1462 #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a)) 
1463
1464
1465 #ifdef __cplusplus
1466 extern "C"
1467 #endif
1468 #ifndef PERL_OBJECT
1469 #ifndef MULTIPLICITY
1470 SWIGEXPORT void SWIG_init (CV* cv);
1471 #else
1472 SWIGEXPORT void SWIG_init (pTHXo_ CV* cv);
1473 #endif
1474 #else
1475 SWIGEXPORT void SWIG_init (CV *cv, CPerlObj *);
1476 #endif
1477
1478
1479 #include "amglue.h"
1480
1481
1482 #include "amglue.h"
1483
1484
1485 #include "amglue.h"
1486
1487
1488 #include "glib-util.h"
1489 #include "amxfer.h"
1490
1491
1492 SWIGINTERNINLINE SV *
1493 SWIG_From_long  SWIG_PERL_DECL_ARGS_1(long value)
1494 {    
1495   SV *obj = sv_newmortal();
1496   sv_setiv(obj, (IV) value);
1497   return obj;
1498 }
1499
1500
1501 SWIGINTERNINLINE SV *
1502 SWIG_From_int  SWIG_PERL_DECL_ARGS_1(int value)
1503 {    
1504   return SWIG_From_long  SWIG_PERL_CALL_ARGS_1(value);
1505 }
1506
1507
1508 /* Return a new SV with refcount 1 representing the given C object
1509  * with the given class.
1510  *
1511  * @param c_obj: the object to represent
1512  * @param perl_class: the perl with which to bless and tie the SV
1513  */
1514 static SV *
1515 new_sv_for_c_obj(
1516     gpointer c_obj,
1517     const char *perl_class)
1518 {
1519     SV *sv = newSV(0);
1520
1521     /* Make an SV that contains a pointer to the object, and bless it
1522      * with the appropriate class. */
1523     sv_setref_pv(sv, perl_class, c_obj);
1524
1525     return sv;
1526 }
1527
1528 /* Return a new SV representing a transfer.
1529  *
1530  * @param xfer: the transfer to represent
1531  */
1532 static SV *
1533 new_sv_for_xfer(
1534     Xfer *xfer)
1535 {
1536     if (!xfer) return &PL_sv_undef;
1537
1538     xfer_ref(xfer);
1539     return new_sv_for_c_obj(xfer, "Amanda::Xfer::Xfer");
1540 }
1541
1542 /* Return a new SV representing a transfer element.
1543  *
1544  * @param xe: the transfer element to represent
1545  */
1546 static SV *
1547 new_sv_for_xfer_element(
1548     XferElement *xe)
1549 {
1550     const char *perl_class;
1551
1552     if (!xe) return &PL_sv_undef;
1553
1554     perl_class = XFER_ELEMENT_GET_CLASS(xe)->perl_class;
1555     if (!perl_class) die("Attempt to wrap an XferElementClass with no perl class!");
1556     g_object_ref(xe);
1557     return new_sv_for_c_obj(xe, perl_class);
1558 }
1559
1560 /* Return the C object buried in an SV, asserting that the perl SV is
1561  * derived from derived_from.  Returns NULL for undefined perl values.
1562  *
1563  * This function is based on SWIG's SWIG_Perl_ConvertPtr.  The INT2PTR
1564  * situation certainly looks strange, but is documented in perlxs.
1565  *
1566  * @param sv: the SV to convert
1567  * @param derived_from: perl class from which the SV should be derived
1568  * @return: underlying pointer
1569  */
1570 static gpointer
1571 c_obj_from_sv(
1572     SV *sv,
1573     const char *derived_from)
1574 {
1575     SV *referent;
1576     IV tmp;
1577
1578     if (!sv) return NULL;
1579     if (!SvOK(sv)) return NULL;
1580
1581     /* Peel back the layers.  The sv should be a blessed reference to a PV,
1582      * and we check the class against derived_from to ensure we have the right
1583      * stuff. */
1584     if (!sv_isobject(sv) || !sv_derived_from(sv, derived_from)) {
1585         croak("Value is not an object of type %s", derived_from);
1586         return NULL;
1587     }
1588
1589     referent = (SV *)SvRV(sv);
1590     tmp = SvIV(referent);
1591     return INT2PTR(gpointer, tmp);
1592 }
1593
1594 /* Convert an SV to an Xfer.  The Xfer's reference count is not
1595  * incremented -- this is a "borrowed" reference.
1596  *
1597  * @param sv: the perl value
1598  * @returns: pointer to the corresponding transfer, or NULL
1599  */
1600 static Xfer *
1601 xfer_from_sv(
1602     SV *sv)
1603 {
1604     return (Xfer *)c_obj_from_sv(sv, "Amanda::Xfer::Xfer");
1605 }
1606
1607 /* Convert an SV to an XferElement.  The element's reference count is
1608  * not incremented -- this is a "borrowed" reference.
1609  *
1610  * @param sv: the perl value
1611  * @returns: pointer to the corresponding transfer element, or NULL.
1612  */
1613 static XferElement *
1614 xfer_element_from_sv(
1615     SV *sv)
1616 {
1617     return (XferElement *)c_obj_from_sv(sv, "Amanda::Xfer::Element");
1618 }
1619
1620 /* Given an XMsg, return a hashref representing the message as a pure-perl
1621  * object.  The object is new, has refcount 1, and is totally independent of
1622  * the underlying XMsg.
1623  *
1624  * Reflecting the XMsg directly into Perl avoids the need to reference-count
1625  * the XMsg objects themselves, which can simply be freed after a callback
1626  * completes.  The overhead of creating a hash is likely equivalent to or
1627  * less than the overhead that would be consumed with SWIG's swig_$field_get
1628  * accessors, assuming that perl code examines most of the fields in a message.
1629  *
1630  * @param msg: the message to represent
1631  * @returns: a perl SV
1632  */
1633 static SV *
1634 new_sv_for_xmsg(
1635     XMsg *msg)
1636 {
1637     static HV *amanda_xfer_msg_stash = NULL;
1638     HV *hash = newHV();
1639     SV *rv = newRV_noinc((SV *)hash);
1640
1641     /* bless the rv as an Amanda::Xfer::Msg object */
1642     if (!amanda_xfer_msg_stash) {
1643         amanda_xfer_msg_stash = gv_stashpv("Amanda::Xfer::Msg", GV_ADD);
1644     }
1645     sv_bless(rv, amanda_xfer_msg_stash);
1646
1647     /* TODO: consider optimizing by precomputing the hash values of
1648      * the keys? */
1649
1650     /* elt */
1651     hv_store(hash, "elt", 3, new_sv_for_xfer_element(msg->elt), 0);
1652
1653     /* type */
1654     hv_store(hash, "type", 4, newSViv(msg->type), 0);
1655
1656     /* type */
1657     hv_store(hash, "version", 7, newSViv(msg->version), 0);
1658
1659     /* message */
1660     if (msg->message)
1661         hv_store(hash, "message", 7, newSVpv(msg->message, 0), 0);
1662
1663     return rv;
1664 }
1665
1666
1667 #include <limits.h>
1668 #if !defined(SWIG_NO_LLONG_MAX)
1669 # if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
1670 #   define LLONG_MAX __LONG_LONG_MAX__
1671 #   define LLONG_MIN (-LLONG_MAX - 1LL)
1672 #   define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
1673 # endif
1674 #endif
1675
1676
1677 SWIGINTERN int
1678 SWIG_AsVal_double SWIG_PERL_DECL_ARGS_2(SV *obj, double *val)
1679 {
1680   if (SvNIOK(obj)) {
1681     if (val) *val = SvNV(obj);
1682     return SWIG_OK;
1683   } else if (SvIOK(obj)) {
1684     if (val) *val = (double) SvIV(obj);
1685     return SWIG_AddCast(SWIG_OK);
1686   } else {
1687     const char *nptr = SvPV_nolen(obj);
1688     if (nptr) {
1689       char *endptr;
1690       double v = strtod(nptr, &endptr);
1691       if (errno == ERANGE) {
1692         errno = 0;
1693         return SWIG_OverflowError;
1694       } else {
1695         if (*endptr == '\0') {
1696           if (val) *val = v;
1697           return SWIG_Str2NumCast(SWIG_OK);
1698         }
1699       }
1700     }
1701   }
1702   return SWIG_TypeError;
1703 }
1704
1705
1706 #include <float.h>
1707
1708
1709 #include <math.h>
1710
1711
1712 SWIGINTERNINLINE int
1713 SWIG_CanCastAsInteger(double *d, double min, double max) {
1714   double x = *d;
1715   if ((min <= x && x <= max)) {
1716    double fx = floor(x);
1717    double cx = ceil(x);
1718    double rd =  ((x - fx) < 0.5) ? fx : cx; /* simple rint */
1719    if ((errno == EDOM) || (errno == ERANGE)) {
1720      errno = 0;
1721    } else {
1722      double summ, reps, diff;
1723      if (rd < x) {
1724        diff = x - rd;
1725      } else if (rd > x) {
1726        diff = rd - x;
1727      } else {
1728        return 1;
1729      }
1730      summ = rd + x;
1731      reps = diff/summ;
1732      if (reps < 8*DBL_EPSILON) {
1733        *d = rd;
1734        return 1;
1735      }
1736    }
1737   }
1738   return 0;
1739 }
1740
1741
1742 SWIGINTERN int
1743 SWIG_AsVal_unsigned_SS_long SWIG_PERL_DECL_ARGS_2(SV *obj, unsigned long *val) 
1744 {
1745   if (SvUOK(obj)) {
1746     if (val) *val = SvUV(obj);
1747     return SWIG_OK;
1748   } else  if (SvIOK(obj)) {
1749     long v = SvIV(obj);
1750     if (v >= 0) {
1751       if (val) *val = v;
1752       return SWIG_OK;
1753     } else {
1754       return SWIG_OverflowError;
1755     }
1756   } else {
1757     int dispatch = 0;
1758     const char *nptr = SvPV_nolen(obj);
1759     if (nptr) {
1760       char *endptr;
1761       unsigned long v;
1762       errno = 0;
1763       v = strtoul(nptr, &endptr,0);
1764       if (errno == ERANGE) {
1765         errno = 0;
1766         return SWIG_OverflowError;
1767       } else {
1768         if (*endptr == '\0') {
1769           if (val) *val = v;
1770           return SWIG_Str2NumCast(SWIG_OK);
1771         }
1772       }
1773     }
1774     if (!dispatch) {
1775       double d;
1776       int res = SWIG_AddCast(SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(obj,&d));
1777       if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULONG_MAX)) {
1778         if (val) *val = (unsigned long)(d);
1779         return res;
1780       }
1781     }
1782   }
1783   return SWIG_TypeError;
1784 }
1785
1786
1787 SWIGINTERN int
1788 SWIG_AsVal_unsigned_SS_int SWIG_PERL_DECL_ARGS_2(SV * obj, unsigned int *val)
1789 {
1790   unsigned long v;
1791   int res = SWIG_AsVal_unsigned_SS_long SWIG_PERL_CALL_ARGS_2(obj, &v);
1792   if (SWIG_IsOK(res)) {
1793     if ((v > UINT_MAX)) {
1794       return SWIG_OverflowError;
1795     } else {
1796       if (val) *val = (unsigned int)(v);
1797     }
1798   }  
1799   return res;
1800 }
1801
1802
1803 SWIGINTERNINLINE SV *
1804 SWIG_FromCharPtrAndSize(const char* carray, size_t size)
1805 {
1806   SV *obj = sv_newmortal();
1807   if (carray) {
1808     sv_setpvn(obj, carray, size);
1809   } else {
1810     sv_setsv(obj, &PL_sv_undef);
1811   }
1812   return obj;
1813 }
1814
1815
1816 SWIGINTERNINLINE SV * 
1817 SWIG_FromCharPtr(const char *cptr)
1818
1819   return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
1820 }
1821
1822
1823 /* SWIG wants to treat this as a function */
1824 #define xfer_get_status(xfer) ((xfer)->status)
1825
1826
1827 SWIGINTERNINLINE int
1828 SWIG_AsVal_size_t SWIG_PERL_DECL_ARGS_2(SV * obj, size_t *val)
1829 {
1830   unsigned long v;
1831   int res = SWIG_AsVal_unsigned_SS_long SWIG_PERL_CALL_ARGS_2(obj, val ? &v : 0);
1832   if (SWIG_IsOK(res) && val) *val = (size_t)(v);
1833   return res;
1834 }
1835
1836
1837 SWIGINTERN int
1838 SWIG_AsVal_long SWIG_PERL_DECL_ARGS_2(SV *obj, long* val)
1839 {
1840   if (SvIOK(obj)) {
1841     if (val) *val = SvIV(obj);
1842     return SWIG_OK;
1843   } else {
1844     int dispatch = 0;
1845     const char *nptr = SvPV_nolen(obj);
1846     if (nptr) {
1847       char *endptr;
1848       long v;
1849       errno = 0;
1850       v = strtol(nptr, &endptr,0);
1851       if (errno == ERANGE) {
1852         errno = 0;
1853         return SWIG_OverflowError;
1854       } else {
1855         if (*endptr == '\0') {
1856           if (val) *val = v;
1857           return SWIG_Str2NumCast(SWIG_OK);
1858         }
1859       }
1860     }
1861     if (!dispatch) {
1862       double d;
1863       int res = SWIG_AddCast(SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(obj,&d));
1864       if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) {
1865         if (val) *val = (long)(d);
1866         return res;
1867       }
1868     }
1869   }
1870   return SWIG_TypeError;
1871 }
1872
1873
1874 SWIGINTERN int
1875 SWIG_AsVal_int SWIG_PERL_DECL_ARGS_2(SV * obj, int *val)
1876 {
1877   long v;
1878   int res = SWIG_AsVal_long SWIG_PERL_CALL_ARGS_2(obj, &v);
1879   if (SWIG_IsOK(res)) {
1880     if ((v < INT_MIN || v > INT_MAX)) {
1881       return SWIG_OverflowError;
1882     } else {
1883       if (val) *val = (int)(v);
1884     }
1885   }  
1886   return res;
1887 }
1888
1889
1890 SWIGINTERN int
1891 SWIG_AsVal_unsigned_SS_char SWIG_PERL_DECL_ARGS_2(SV * obj, unsigned char *val)
1892 {
1893   unsigned long v;
1894   int res = SWIG_AsVal_unsigned_SS_long SWIG_PERL_CALL_ARGS_2(obj, &v);
1895   if (SWIG_IsOK(res)) {
1896     if ((v > UCHAR_MAX)) {
1897       return SWIG_OverflowError;
1898     } else {
1899       if (val) *val = (unsigned char)(v);
1900     }
1901   }  
1902   return res;
1903 }
1904
1905
1906 static gboolean
1907 xmsgsource_perl_callback(
1908     gpointer data,
1909     struct XMsg *msg,
1910     Xfer *xfer)
1911 {
1912     dSP;
1913     amglue_Source *src = (amglue_Source *)data;
1914     SV *src_sv = NULL;
1915
1916     g_assert(src->callback_sv != NULL);
1917
1918     ENTER;
1919     SAVETMPS;
1920
1921     /* create a new SV pointing to 'src', and increase its refcount
1922      * accordingly.  The SV is mortal, so FREETMPS will decrease the 
1923      * refcount, unless the callee keeps a copy of it somewhere */
1924     amglue_source_ref(src);
1925     src_sv = SWIG_NewPointerObj(src, SWIGTYPE_p_amglue_Source,
1926                                  SWIG_OWNER | SWIG_SHADOW);
1927
1928     PUSHMARK(SP);
1929     XPUSHs(src_sv);
1930     XPUSHs(sv_2mortal(new_sv_for_xmsg(msg)));
1931     XPUSHs(sv_2mortal(new_sv_for_xfer(xfer)));
1932     PUTBACK;
1933
1934     call_sv(src->callback_sv, G_EVAL|G_DISCARD);
1935
1936     FREETMPS;
1937     LEAVE;
1938
1939     /* these may have been freed, so don't use them after this point */
1940     src_sv = NULL;
1941     src = NULL;
1942
1943     /* check for an uncaught 'die'.  If we don't do this, then Perl will longjmp()
1944      * over the GMainLoop mechanics, leaving GMainLoop in an inconsistent (locked)
1945      * state. */
1946     if (SvTRUE(ERRSV)) {
1947         /* We handle this just the way the default 'die' handler in Amanda::Debug 
1948          * does, but since Amanda's debug support may not yet be running, we back
1949          * it up with an exit() */
1950         g_critical("%s", SvPV_nolen(ERRSV));
1951         exit(1);
1952     }
1953
1954     return TRUE;
1955 }
1956
1957
1958 amglue_Source *
1959 xfer_get_amglue_source(
1960     Xfer *xfer)
1961 {
1962     return amglue_source_get(xfer_get_source(xfer),
1963         (GSourceFunc)xmsgsource_perl_callback);
1964 }
1965
1966 #ifdef __cplusplus
1967 extern "C" {
1968 #endif
1969
1970 #ifdef PERL_OBJECT
1971 #define MAGIC_CLASS _wrap_Amanda::Xfer_var::
1972 class _wrap_Amanda::Xfer_var : public CPerlObj {
1973 public:
1974 #else
1975 #define MAGIC_CLASS
1976 #endif
1977 SWIGCLASS_STATIC int swig_magic_readonly(pTHX_ SV *SWIGUNUSEDPARM(sv), MAGIC *SWIGUNUSEDPARM(mg)) {
1978     MAGIC_PPERL
1979     croak("Value is read-only.");
1980     return 0;
1981 }
1982
1983
1984 #ifdef PERL_OBJECT
1985 };
1986 #endif
1987
1988 #ifdef __cplusplus
1989 }
1990 #endif
1991
1992 #ifdef __cplusplus
1993 extern "C" {
1994 #endif
1995 XS(_wrap_xfer_new) {
1996   {
1997     XferElement **arg1 = (XferElement **) 0 ;
1998     unsigned int arg2 ;
1999     Xfer *result = 0 ;
2000     int argvi = 0;
2001     dXSARGS;
2002     
2003     if ((items < 1) || (items > 1)) {
2004       SWIG_croak("Usage: xfer_new(elementlist,nelements);");
2005     }
2006     {
2007       AV *av;
2008       unsigned int i;
2009       
2010       /* check that it's an arrayref */
2011       if (!SvROK(ST(0)) || SvTYPE(SvRV(ST(0))) != SVt_PVAV) {
2012         SWIG_exception(SWIG_TypeError, "Expected an arrayref");
2013       }
2014       av = (AV *)SvRV(ST(0));
2015       
2016       /* allocate memory for arg1 */
2017       arg2 = av_len(av)+1; /* av_len(av) is like $#av */
2018       arg1 = g_new(XferElement *, arg2);
2019       
2020       /* extract the underlying XferElement objects and add pointers to
2021            * them, "borrowing" the caller's references for the moment. */
2022       for (i = 0; i < arg2; i++) {
2023         SV **sv = av_fetch(av, i, 0);
2024         XferElement *elt = sv? xfer_element_from_sv(*sv):NULL;
2025         
2026         if (!elt) {
2027           SWIG_exception(SWIG_TypeError, "Expected an arrayref of Amanda::Xfer::Element objects");
2028         }
2029         arg1[i] = elt;
2030       }
2031     }
2032     result = (Xfer *)xfer_new(arg1,arg2);
2033     {
2034       ST(argvi) = sv_2mortal(new_sv_for_xfer(result));
2035       argvi++;
2036     }
2037     {
2038       /* free the element vector allocated in the (in) typemap */
2039       g_free(arg1);
2040     }
2041     {
2042       xfer_unref(result);
2043     }
2044     XSRETURN(argvi);
2045   fail:
2046     {
2047       /* free the element vector allocated in the (in) typemap */
2048       g_free(arg1);
2049     }
2050     SWIG_croak_null();
2051   }
2052 }
2053
2054
2055 XS(_wrap_xfer_unref) {
2056   {
2057     Xfer *arg1 = (Xfer *) 0 ;
2058     int argvi = 0;
2059     dXSARGS;
2060     
2061     if ((items < 1) || (items > 1)) {
2062       SWIG_croak("Usage: xfer_unref(Xfer *);");
2063     }
2064     {
2065       arg1 = xfer_from_sv(ST(0));
2066     }
2067     xfer_unref(arg1);
2068     
2069     
2070     XSRETURN(argvi);
2071   fail:
2072     
2073     SWIG_croak_null();
2074   }
2075 }
2076
2077
2078 XS(_wrap_xfer_get_status) {
2079   {
2080     Xfer *arg1 = (Xfer *) 0 ;
2081     xfer_status result;
2082     int argvi = 0;
2083     dXSARGS;
2084     
2085     if ((items < 1) || (items > 1)) {
2086       SWIG_croak("Usage: xfer_get_status(xfer);");
2087     }
2088     {
2089       arg1 = xfer_from_sv(ST(0));
2090     }
2091     result = (xfer_status)xfer_get_status(arg1);
2092     {
2093       ST(argvi) = sv_2mortal(amglue_newSVi64(result));
2094       argvi++;
2095     }
2096     
2097     XSRETURN(argvi);
2098   fail:
2099     
2100     SWIG_croak_null();
2101   }
2102 }
2103
2104
2105 XS(_wrap_xfer_repr) {
2106   {
2107     Xfer *arg1 = (Xfer *) 0 ;
2108     char *result = 0 ;
2109     int argvi = 0;
2110     dXSARGS;
2111     
2112     if ((items < 1) || (items > 1)) {
2113       SWIG_croak("Usage: xfer_repr(xfer);");
2114     }
2115     {
2116       arg1 = xfer_from_sv(ST(0));
2117     }
2118     result = (char *)xfer_repr(arg1);
2119     ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
2120     
2121     XSRETURN(argvi);
2122   fail:
2123     
2124     SWIG_croak_null();
2125   }
2126 }
2127
2128
2129 XS(_wrap_xfer_start) {
2130   {
2131     Xfer *arg1 = (Xfer *) 0 ;
2132     int argvi = 0;
2133     dXSARGS;
2134     
2135     if ((items < 1) || (items > 1)) {
2136       SWIG_croak("Usage: xfer_start(xfer);");
2137     }
2138     {
2139       arg1 = xfer_from_sv(ST(0));
2140     }
2141     xfer_start(arg1);
2142     
2143     
2144     XSRETURN(argvi);
2145   fail:
2146     
2147     SWIG_croak_null();
2148   }
2149 }
2150
2151
2152 XS(_wrap_xfer_cancel) {
2153   {
2154     Xfer *arg1 = (Xfer *) 0 ;
2155     int argvi = 0;
2156     dXSARGS;
2157     
2158     if ((items < 1) || (items > 1)) {
2159       SWIG_croak("Usage: xfer_cancel(xfer);");
2160     }
2161     {
2162       arg1 = xfer_from_sv(ST(0));
2163     }
2164     xfer_cancel(arg1);
2165     
2166     
2167     XSRETURN(argvi);
2168   fail:
2169     
2170     SWIG_croak_null();
2171   }
2172 }
2173
2174
2175 XS(_wrap_xfer_element_unref) {
2176   {
2177     XferElement *arg1 = (XferElement *) 0 ;
2178     int argvi = 0;
2179     dXSARGS;
2180     
2181     if ((items < 1) || (items > 1)) {
2182       SWIG_croak("Usage: xfer_element_unref(elt);");
2183     }
2184     {
2185       arg1 = xfer_element_from_sv(ST(0));
2186     }
2187     xfer_element_unref(arg1);
2188     
2189     
2190     XSRETURN(argvi);
2191   fail:
2192     
2193     SWIG_croak_null();
2194   }
2195 }
2196
2197
2198 XS(_wrap_xfer_element_repr) {
2199   {
2200     XferElement *arg1 = (XferElement *) 0 ;
2201     char *result = 0 ;
2202     int argvi = 0;
2203     dXSARGS;
2204     
2205     if ((items < 1) || (items > 1)) {
2206       SWIG_croak("Usage: xfer_element_repr(elt);");
2207     }
2208     {
2209       arg1 = xfer_element_from_sv(ST(0));
2210     }
2211     result = (char *)xfer_element_repr(arg1);
2212     ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
2213     
2214     XSRETURN(argvi);
2215   fail:
2216     
2217     SWIG_croak_null();
2218   }
2219 }
2220
2221
2222 XS(_wrap_xfer_source_device) {
2223   {
2224     Device *arg1 = (Device *) 0 ;
2225     XferElement *result = 0 ;
2226     void *argp1 = 0 ;
2227     int res1 = 0 ;
2228     int argvi = 0;
2229     dXSARGS;
2230     
2231     if ((items < 1) || (items > 1)) {
2232       SWIG_croak("Usage: xfer_source_device(device);");
2233     }
2234     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
2235     if (!SWIG_IsOK(res1)) {
2236       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "xfer_source_device" "', argument " "1"" of type '" "Device *""'"); 
2237     }
2238     arg1 = (Device *)(argp1);
2239     result = (XferElement *)xfer_source_device(arg1);
2240     {
2241       ST(argvi) = sv_2mortal(new_sv_for_xfer_element(result));
2242       argvi++;
2243     }
2244     
2245     {
2246       xfer_element_unref(result);
2247     }
2248     XSRETURN(argvi);
2249   fail:
2250     
2251     SWIG_croak_null();
2252   }
2253 }
2254
2255
2256 XS(_wrap_xfer_source_random) {
2257   {
2258     guint64 arg1 ;
2259     guint32 arg2 ;
2260     XferElement *result = 0 ;
2261     int argvi = 0;
2262     dXSARGS;
2263     
2264     if ((items < 2) || (items > 2)) {
2265       SWIG_croak("Usage: xfer_source_random(length,seed);");
2266     }
2267     {
2268       arg1 = amglue_SvU64(ST(0));
2269     }
2270     {
2271       arg2 = amglue_SvU32(ST(1));
2272     }
2273     result = (XferElement *)xfer_source_random(arg1,arg2);
2274     {
2275       ST(argvi) = sv_2mortal(new_sv_for_xfer_element(result));
2276       argvi++;
2277     }
2278     {
2279       xfer_element_unref(result);
2280     }
2281     XSRETURN(argvi);
2282   fail:
2283     SWIG_croak_null();
2284   }
2285 }
2286
2287
2288 XS(_wrap_xfer_source_pattern) {
2289   {
2290     guint64 arg1 ;
2291     void *arg2 = (void *) 0 ;
2292     size_t arg3 ;
2293     XferElement *result = 0 ;
2294     int argvi = 0;
2295     dXSARGS;
2296     
2297     if ((items < 2) || (items > 2)) {
2298       SWIG_croak("Usage: xfer_source_pattern(length,pattern,pattern_length);");
2299     }
2300     {
2301       arg1 = amglue_SvU64(ST(0));
2302     }
2303     {
2304       size_t len;
2305       char * pat;
2306       
2307       pat = SvPV(ST(1), len);
2308       arg2 = g_memdup(pat, len);
2309       arg3 = len;
2310     }
2311     result = (XferElement *)xfer_source_pattern(arg1,arg2,arg3);
2312     {
2313       ST(argvi) = sv_2mortal(new_sv_for_xfer_element(result));
2314       argvi++;
2315     }
2316     XSRETURN(argvi);
2317   fail:
2318     SWIG_croak_null();
2319   }
2320 }
2321
2322
2323 XS(_wrap_xfer_source_fd) {
2324   {
2325     int arg1 ;
2326     XferElement *result = 0 ;
2327     int argvi = 0;
2328     dXSARGS;
2329     
2330     if ((items < 1) || (items > 1)) {
2331       SWIG_croak("Usage: xfer_source_fd(fd);");
2332     }
2333     {
2334       if (sizeof(signed int) == 1) {
2335         arg1 = amglue_SvI8(ST(0));
2336       } else if (sizeof(signed int) == 2) {
2337         arg1 = amglue_SvI16(ST(0));
2338       } else if (sizeof(signed int) == 4) {
2339         arg1 = amglue_SvI32(ST(0));
2340       } else if (sizeof(signed int) == 8) {
2341         arg1 = amglue_SvI64(ST(0));
2342       } else {
2343         g_critical("Unexpected signed int >64 bits?"); /* should be optimized out unless sizeof(signed int) > 8 */
2344       }
2345     }
2346     result = (XferElement *)xfer_source_fd(arg1);
2347     {
2348       ST(argvi) = sv_2mortal(new_sv_for_xfer_element(result));
2349       argvi++;
2350     }
2351     
2352     {
2353       xfer_element_unref(result);
2354     }
2355     XSRETURN(argvi);
2356   fail:
2357     
2358     SWIG_croak_null();
2359   }
2360 }
2361
2362
2363 XS(_wrap_xfer_filter_xor) {
2364   {
2365     unsigned char arg1 ;
2366     XferElement *result = 0 ;
2367     unsigned char val1 ;
2368     int ecode1 = 0 ;
2369     int argvi = 0;
2370     dXSARGS;
2371     
2372     if ((items < 1) || (items > 1)) {
2373       SWIG_croak("Usage: xfer_filter_xor(xor_key);");
2374     }
2375     ecode1 = SWIG_AsVal_unsigned_SS_char SWIG_PERL_CALL_ARGS_2(ST(0), &val1);
2376     if (!SWIG_IsOK(ecode1)) {
2377       SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "xfer_filter_xor" "', argument " "1"" of type '" "unsigned char""'");
2378     } 
2379     arg1 = (unsigned char)(val1);
2380     result = (XferElement *)xfer_filter_xor(arg1);
2381     {
2382       ST(argvi) = sv_2mortal(new_sv_for_xfer_element(result));
2383       argvi++;
2384     }
2385     
2386     {
2387       xfer_element_unref(result);
2388     }
2389     XSRETURN(argvi);
2390   fail:
2391     
2392     SWIG_croak_null();
2393   }
2394 }
2395
2396
2397 XS(_wrap_xfer_dest_device) {
2398   {
2399     Device *arg1 = (Device *) 0 ;
2400     size_t arg2 ;
2401     XferElement *result = 0 ;
2402     void *argp1 = 0 ;
2403     int res1 = 0 ;
2404     int argvi = 0;
2405     dXSARGS;
2406     
2407     if ((items < 2) || (items > 2)) {
2408       SWIG_croak("Usage: xfer_dest_device(device,max_memory);");
2409     }
2410     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
2411     if (!SWIG_IsOK(res1)) {
2412       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "xfer_dest_device" "', argument " "1"" of type '" "Device *""'"); 
2413     }
2414     arg1 = (Device *)(argp1);
2415     {
2416       if (sizeof(size_t) == 1) {
2417         arg2 = amglue_SvU8(ST(1));
2418       } else if (sizeof(size_t) == 2) {
2419         arg2 = amglue_SvU16(ST(1));
2420       } else if (sizeof(size_t) == 4) {
2421         arg2 = amglue_SvU32(ST(1));
2422       } else if (sizeof(size_t) == 8) {
2423         arg2 = amglue_SvU64(ST(1));
2424       } else {
2425         croak("Unexpected size_t >64 bits?"); /* should be optimized out unless sizeof(size_t) > 8 */
2426       }
2427     }
2428     result = (XferElement *)xfer_dest_device(arg1,arg2);
2429     {
2430       ST(argvi) = sv_2mortal(new_sv_for_xfer_element(result));
2431       argvi++;
2432     }
2433     
2434     
2435     {
2436       xfer_element_unref(result);
2437     }
2438     XSRETURN(argvi);
2439   fail:
2440     
2441     
2442     SWIG_croak_null();
2443   }
2444 }
2445
2446
2447 XS(_wrap_xfer_dest_null) {
2448   {
2449     guint32 arg1 ;
2450     XferElement *result = 0 ;
2451     int argvi = 0;
2452     dXSARGS;
2453     
2454     if ((items < 1) || (items > 1)) {
2455       SWIG_croak("Usage: xfer_dest_null(prng_seed);");
2456     }
2457     {
2458       arg1 = amglue_SvU32(ST(0));
2459     }
2460     result = (XferElement *)xfer_dest_null(arg1);
2461     {
2462       ST(argvi) = sv_2mortal(new_sv_for_xfer_element(result));
2463       argvi++;
2464     }
2465     {
2466       xfer_element_unref(result);
2467     }
2468     XSRETURN(argvi);
2469   fail:
2470     SWIG_croak_null();
2471   }
2472 }
2473
2474
2475 XS(_wrap_xfer_dest_fd) {
2476   {
2477     int arg1 ;
2478     XferElement *result = 0 ;
2479     int argvi = 0;
2480     dXSARGS;
2481     
2482     if ((items < 1) || (items > 1)) {
2483       SWIG_croak("Usage: xfer_dest_fd(fd);");
2484     }
2485     {
2486       if (sizeof(signed int) == 1) {
2487         arg1 = amglue_SvI8(ST(0));
2488       } else if (sizeof(signed int) == 2) {
2489         arg1 = amglue_SvI16(ST(0));
2490       } else if (sizeof(signed int) == 4) {
2491         arg1 = amglue_SvI32(ST(0));
2492       } else if (sizeof(signed int) == 8) {
2493         arg1 = amglue_SvI64(ST(0));
2494       } else {
2495         g_critical("Unexpected signed int >64 bits?"); /* should be optimized out unless sizeof(signed int) > 8 */
2496       }
2497     }
2498     result = (XferElement *)xfer_dest_fd(arg1);
2499     {
2500       ST(argvi) = sv_2mortal(new_sv_for_xfer_element(result));
2501       argvi++;
2502     }
2503     
2504     {
2505       xfer_element_unref(result);
2506     }
2507     XSRETURN(argvi);
2508   fail:
2509     
2510     SWIG_croak_null();
2511   }
2512 }
2513
2514
2515 XS(_wrap_xfer_get_amglue_source) {
2516   {
2517     Xfer *arg1 = (Xfer *) 0 ;
2518     amglue_Source *result = 0 ;
2519     int argvi = 0;
2520     dXSARGS;
2521     
2522     if ((items < 1) || (items > 1)) {
2523       SWIG_croak("Usage: xfer_get_amglue_source(xfer);");
2524     }
2525     {
2526       arg1 = xfer_from_sv(ST(0));
2527     }
2528     result = (amglue_Source *)xfer_get_amglue_source(arg1);
2529     ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_amglue_Source, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
2530     
2531     XSRETURN(argvi);
2532   fail:
2533     
2534     SWIG_croak_null();
2535   }
2536 }
2537
2538
2539
2540 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
2541
2542 static swig_type_info _swigt__p_Device = {"_p_Device", "struct Device *|Device *", 0, 0, (void*)"Amanda::Device::Device", 0};
2543 static swig_type_info _swigt__p_Xfer = {"_p_Xfer", "Xfer *", 0, 0, (void*)0, 0};
2544 static swig_type_info _swigt__p_XferElement = {"_p_XferElement", "XferElement *", 0, 0, (void*)0, 0};
2545 static swig_type_info _swigt__p_a_STRMAX__char = {"_p_a_STRMAX__char", "char (*)[STRMAX]|string_t *", 0, 0, (void*)0, 0};
2546 static swig_type_info _swigt__p_amglue_Source = {"_p_amglue_Source", "struct amglue_Source *|amglue_Source *", 0, 0, (void*)"Amanda::MainLoop::Source", 0};
2547 static swig_type_info _swigt__p_char = {"_p_char", "gchar *|char *", 0, 0, (void*)0, 0};
2548 static swig_type_info _swigt__p_double = {"_p_double", "double *|gdouble *", 0, 0, (void*)0, 0};
2549 static swig_type_info _swigt__p_float = {"_p_float", "float *|gfloat *", 0, 0, (void*)0, 0};
2550 static swig_type_info _swigt__p_guint32 = {"_p_guint32", "guint32 *", 0, 0, (void*)0, 0};
2551 static swig_type_info _swigt__p_guint64 = {"_p_guint64", "guint64 *", 0, 0, (void*)0, 0};
2552 static swig_type_info _swigt__p_int = {"_p_int", "SizeAccuracy *|xmsg_type *|int *|DeviceAccessMode *|MediaAccessMode *|ConcurrencyParadigm *|filetype_t *|gboolean *|GIOCondition *|PropertySource *|DeviceStatusFlags *|PropertyAccessFlags *|PropertyPhaseFlags *|xfer_status *|PropertySurety *|StreamingRequirement *", 0, 0, (void*)0, 0};
2553 static swig_type_info _swigt__p_p_XferElement = {"_p_p_XferElement", "XferElement **", 0, 0, (void*)0, 0};
2554 static swig_type_info _swigt__p_queue_fd_t = {"_p_queue_fd_t", "struct queue_fd_t *|queue_fd_t *", 0, 0, (void*)"Amanda::Device::queue_fd_t", 0};
2555 static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "guchar *|unsigned char *", 0, 0, (void*)0, 0};
2556
2557 static swig_type_info *swig_type_initial[] = {
2558   &_swigt__p_Device,
2559   &_swigt__p_Xfer,
2560   &_swigt__p_XferElement,
2561   &_swigt__p_a_STRMAX__char,
2562   &_swigt__p_amglue_Source,
2563   &_swigt__p_char,
2564   &_swigt__p_double,
2565   &_swigt__p_float,
2566   &_swigt__p_guint32,
2567   &_swigt__p_guint64,
2568   &_swigt__p_int,
2569   &_swigt__p_p_XferElement,
2570   &_swigt__p_queue_fd_t,
2571   &_swigt__p_unsigned_char,
2572 };
2573
2574 static swig_cast_info _swigc__p_Device[] = {  {&_swigt__p_Device, 0, 0, 0},{0, 0, 0, 0}};
2575 static swig_cast_info _swigc__p_Xfer[] = {  {&_swigt__p_Xfer, 0, 0, 0},{0, 0, 0, 0}};
2576 static swig_cast_info _swigc__p_XferElement[] = {  {&_swigt__p_XferElement, 0, 0, 0},{0, 0, 0, 0}};
2577 static swig_cast_info _swigc__p_a_STRMAX__char[] = {  {&_swigt__p_a_STRMAX__char, 0, 0, 0},{0, 0, 0, 0}};
2578 static swig_cast_info _swigc__p_amglue_Source[] = {  {&_swigt__p_amglue_Source, 0, 0, 0},{0, 0, 0, 0}};
2579 static swig_cast_info _swigc__p_char[] = {  {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
2580 static swig_cast_info _swigc__p_double[] = {  {&_swigt__p_double, 0, 0, 0},{0, 0, 0, 0}};
2581 static swig_cast_info _swigc__p_float[] = {  {&_swigt__p_float, 0, 0, 0},{0, 0, 0, 0}};
2582 static swig_cast_info _swigc__p_guint32[] = {  {&_swigt__p_guint32, 0, 0, 0},{0, 0, 0, 0}};
2583 static swig_cast_info _swigc__p_guint64[] = {  {&_swigt__p_guint64, 0, 0, 0},{0, 0, 0, 0}};
2584 static swig_cast_info _swigc__p_int[] = {  {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};
2585 static swig_cast_info _swigc__p_p_XferElement[] = {  {&_swigt__p_p_XferElement, 0, 0, 0},{0, 0, 0, 0}};
2586 static swig_cast_info _swigc__p_queue_fd_t[] = {  {&_swigt__p_queue_fd_t, 0, 0, 0},{0, 0, 0, 0}};
2587 static swig_cast_info _swigc__p_unsigned_char[] = {  {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}};
2588
2589 static swig_cast_info *swig_cast_initial[] = {
2590   _swigc__p_Device,
2591   _swigc__p_Xfer,
2592   _swigc__p_XferElement,
2593   _swigc__p_a_STRMAX__char,
2594   _swigc__p_amglue_Source,
2595   _swigc__p_char,
2596   _swigc__p_double,
2597   _swigc__p_float,
2598   _swigc__p_guint32,
2599   _swigc__p_guint64,
2600   _swigc__p_int,
2601   _swigc__p_p_XferElement,
2602   _swigc__p_queue_fd_t,
2603   _swigc__p_unsigned_char,
2604 };
2605
2606
2607 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
2608
2609 static swig_constant_info swig_constants[] = {
2610 {0,0,0,0,0,0}
2611 };
2612 #ifdef __cplusplus
2613 }
2614 #endif
2615 static swig_variable_info swig_variables[] = {
2616 {0,0,0,0}
2617 };
2618 static swig_command_info swig_commands[] = {
2619 {"Amanda::Xferc::xfer_new", _wrap_xfer_new},
2620 {"Amanda::Xferc::xfer_unref", _wrap_xfer_unref},
2621 {"Amanda::Xferc::xfer_get_status", _wrap_xfer_get_status},
2622 {"Amanda::Xferc::xfer_repr", _wrap_xfer_repr},
2623 {"Amanda::Xferc::xfer_start", _wrap_xfer_start},
2624 {"Amanda::Xferc::xfer_cancel", _wrap_xfer_cancel},
2625 {"Amanda::Xferc::xfer_element_unref", _wrap_xfer_element_unref},
2626 {"Amanda::Xferc::xfer_element_repr", _wrap_xfer_element_repr},
2627 {"Amanda::Xferc::xfer_source_device", _wrap_xfer_source_device},
2628 {"Amanda::Xferc::xfer_source_random", _wrap_xfer_source_random},
2629 {"Amanda::Xferc::xfer_source_pattern", _wrap_xfer_source_pattern},
2630 {"Amanda::Xferc::xfer_source_fd", _wrap_xfer_source_fd},
2631 {"Amanda::Xferc::xfer_filter_xor", _wrap_xfer_filter_xor},
2632 {"Amanda::Xferc::xfer_dest_device", _wrap_xfer_dest_device},
2633 {"Amanda::Xferc::xfer_dest_null", _wrap_xfer_dest_null},
2634 {"Amanda::Xferc::xfer_dest_fd", _wrap_xfer_dest_fd},
2635 {"Amanda::Xferc::xfer_get_amglue_source", _wrap_xfer_get_amglue_source},
2636 {0,0}
2637 };
2638 /* -----------------------------------------------------------------------------
2639  * Type initialization:
2640  * This problem is tough by the requirement that no dynamic 
2641  * memory is used. Also, since swig_type_info structures store pointers to 
2642  * swig_cast_info structures and swig_cast_info structures store pointers back
2643  * to swig_type_info structures, we need some lookup code at initialization. 
2644  * The idea is that swig generates all the structures that are needed. 
2645  * The runtime then collects these partially filled structures. 
2646  * The SWIG_InitializeModule function takes these initial arrays out of 
2647  * swig_module, and does all the lookup, filling in the swig_module.types
2648  * array with the correct data and linking the correct swig_cast_info
2649  * structures together.
2650  *
2651  * The generated swig_type_info structures are assigned staticly to an initial 
2652  * array. We just loop through that array, and handle each type individually.
2653  * First we lookup if this type has been already loaded, and if so, use the
2654  * loaded structure instead of the generated one. Then we have to fill in the
2655  * cast linked list. The cast data is initially stored in something like a
2656  * two-dimensional array. Each row corresponds to a type (there are the same
2657  * number of rows as there are in the swig_type_initial array). Each entry in
2658  * a column is one of the swig_cast_info structures for that type.
2659  * The cast_initial array is actually an array of arrays, because each row has
2660  * a variable number of columns. So to actually build the cast linked list,
2661  * we find the array of casts associated with the type, and loop through it 
2662  * adding the casts to the list. The one last trick we need to do is making
2663  * sure the type pointer in the swig_cast_info struct is correct.
2664  *
2665  * First off, we lookup the cast->type name to see if it is already loaded. 
2666  * There are three cases to handle:
2667  *  1) If the cast->type has already been loaded AND the type we are adding
2668  *     casting info to has not been loaded (it is in this module), THEN we
2669  *     replace the cast->type pointer with the type pointer that has already
2670  *     been loaded.
2671  *  2) If BOTH types (the one we are adding casting info to, and the 
2672  *     cast->type) are loaded, THEN the cast info has already been loaded by
2673  *     the previous module so we just ignore it.
2674  *  3) Finally, if cast->type has not already been loaded, then we add that
2675  *     swig_cast_info to the linked list (because the cast->type) pointer will
2676  *     be correct.
2677  * ----------------------------------------------------------------------------- */
2678
2679 #ifdef __cplusplus
2680 extern "C" {
2681 #if 0
2682 } /* c-mode */
2683 #endif
2684 #endif
2685
2686 #if 0
2687 #define SWIGRUNTIME_DEBUG
2688 #endif
2689
2690
2691 SWIGRUNTIME void
2692 SWIG_InitializeModule(void *clientdata) {
2693   size_t i;
2694   swig_module_info *module_head, *iter;
2695   int found, init;
2696   
2697   clientdata = clientdata;
2698   
2699   /* check to see if the circular list has been setup, if not, set it up */
2700   if (swig_module.next==0) {
2701     /* Initialize the swig_module */
2702     swig_module.type_initial = swig_type_initial;
2703     swig_module.cast_initial = swig_cast_initial;
2704     swig_module.next = &swig_module;
2705     init = 1;
2706   } else {
2707     init = 0;
2708   }
2709   
2710   /* Try and load any already created modules */
2711   module_head = SWIG_GetModule(clientdata);
2712   if (!module_head) {
2713     /* This is the first module loaded for this interpreter */
2714     /* so set the swig module into the interpreter */
2715     SWIG_SetModule(clientdata, &swig_module);
2716     module_head = &swig_module;
2717   } else {
2718     /* the interpreter has loaded a SWIG module, but has it loaded this one? */
2719     found=0;
2720     iter=module_head;
2721     do {
2722       if (iter==&swig_module) {
2723         found=1;
2724         break;
2725       }
2726       iter=iter->next;
2727     } while (iter!= module_head);
2728     
2729     /* if the is found in the list, then all is done and we may leave */
2730     if (found) return;
2731     /* otherwise we must add out module into the list */
2732     swig_module.next = module_head->next;
2733     module_head->next = &swig_module;
2734   }
2735   
2736   /* When multiple interpeters are used, a module could have already been initialized in
2737        a different interpreter, but not yet have a pointer in this interpreter.
2738        In this case, we do not want to continue adding types... everything should be
2739        set up already */
2740   if (init == 0) return;
2741   
2742   /* Now work on filling in swig_module.types */
2743 #ifdef SWIGRUNTIME_DEBUG
2744   printf("SWIG_InitializeModule: size %d\n", swig_module.size);
2745 #endif
2746   for (i = 0; i < swig_module.size; ++i) {
2747     swig_type_info *type = 0;
2748     swig_type_info *ret;
2749     swig_cast_info *cast;
2750     
2751 #ifdef SWIGRUNTIME_DEBUG
2752     printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
2753 #endif
2754     
2755     /* if there is another module already loaded */
2756     if (swig_module.next != &swig_module) {
2757       type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
2758     }
2759     if (type) {
2760       /* Overwrite clientdata field */
2761 #ifdef SWIGRUNTIME_DEBUG
2762       printf("SWIG_InitializeModule: found type %s\n", type->name);
2763 #endif
2764       if (swig_module.type_initial[i]->clientdata) {
2765         type->clientdata = swig_module.type_initial[i]->clientdata;
2766 #ifdef SWIGRUNTIME_DEBUG
2767         printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
2768 #endif
2769       }
2770     } else {
2771       type = swig_module.type_initial[i];
2772     }
2773     
2774     /* Insert casting types */
2775     cast = swig_module.cast_initial[i];
2776     while (cast->type) {
2777       /* Don't need to add information already in the list */
2778       ret = 0;
2779 #ifdef SWIGRUNTIME_DEBUG
2780       printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
2781 #endif
2782       if (swig_module.next != &swig_module) {
2783         ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
2784 #ifdef SWIGRUNTIME_DEBUG
2785         if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
2786 #endif
2787       }
2788       if (ret) {
2789         if (type == swig_module.type_initial[i]) {
2790 #ifdef SWIGRUNTIME_DEBUG
2791           printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
2792 #endif
2793           cast->type = ret;
2794           ret = 0;
2795         } else {
2796           /* Check for casting already in the list */
2797           swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
2798 #ifdef SWIGRUNTIME_DEBUG
2799           if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
2800 #endif
2801           if (!ocast) ret = 0;
2802         }
2803       }
2804       
2805       if (!ret) {
2806 #ifdef SWIGRUNTIME_DEBUG
2807         printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
2808 #endif
2809         if (type->cast) {
2810           type->cast->prev = cast;
2811           cast->next = type->cast;
2812         }
2813         type->cast = cast;
2814       }
2815       cast++;
2816     }
2817     /* Set entry in modules->types array equal to the type */
2818     swig_module.types[i] = type;
2819   }
2820   swig_module.types[i] = 0;
2821   
2822 #ifdef SWIGRUNTIME_DEBUG
2823   printf("**** SWIG_InitializeModule: Cast List ******\n");
2824   for (i = 0; i < swig_module.size; ++i) {
2825     int j = 0;
2826     swig_cast_info *cast = swig_module.cast_initial[i];
2827     printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
2828     while (cast->type) {
2829       printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
2830       cast++;
2831       ++j;
2832     }
2833     printf("---- Total casts: %d\n",j);
2834   }
2835   printf("**** SWIG_InitializeModule: Cast List ******\n");
2836 #endif
2837 }
2838
2839 /* This function will propagate the clientdata field of type to
2840 * any new swig_type_info structures that have been added into the list
2841 * of equivalent types.  It is like calling
2842 * SWIG_TypeClientData(type, clientdata) a second time.
2843 */
2844 SWIGRUNTIME void
2845 SWIG_PropagateClientData(void) {
2846   size_t i;
2847   swig_cast_info *equiv;
2848   static int init_run = 0;
2849   
2850   if (init_run) return;
2851   init_run = 1;
2852   
2853   for (i = 0; i < swig_module.size; i++) {
2854     if (swig_module.types[i]->clientdata) {
2855       equiv = swig_module.types[i]->cast;
2856       while (equiv) {
2857         if (!equiv->converter) {
2858           if (equiv->type && !equiv->type->clientdata)
2859           SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
2860         }
2861         equiv = equiv->next;
2862       }
2863     }
2864   }
2865 }
2866
2867 #ifdef __cplusplus
2868 #if 0
2869 {
2870   /* c-mode */
2871 #endif
2872 }
2873 #endif
2874
2875
2876
2877 #ifdef __cplusplus
2878 extern "C"
2879 #endif
2880
2881 XS(SWIG_init) {
2882   dXSARGS;
2883   int i;
2884   
2885   SWIG_InitializeModule(0);
2886   
2887   /* Install commands */
2888   for (i = 0; swig_commands[i].name; i++) {
2889     newXS((char*) swig_commands[i].name,swig_commands[i].wrapper, (char*)__FILE__);
2890   }
2891   
2892   /* Install variables */
2893   for (i = 0; swig_variables[i].name; i++) {
2894     SV *sv;
2895     sv = get_sv((char*) swig_variables[i].name, TRUE | 0x2 | GV_ADDMULTI);
2896     if (swig_variables[i].type) {
2897       SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0);
2898     } else {
2899       sv_setiv(sv,(IV) 0);
2900     }
2901     swig_create_magic(sv, (char *) swig_variables[i].name, swig_variables[i].set, swig_variables[i].get); 
2902   }
2903   
2904   /* Install constant */
2905   for (i = 0; swig_constants[i].type; i++) {
2906     SV *sv;
2907     sv = get_sv((char*)swig_constants[i].name, TRUE | 0x2 | GV_ADDMULTI);
2908     switch(swig_constants[i].type) {
2909     case SWIG_INT:
2910       sv_setiv(sv, (IV) swig_constants[i].lvalue);
2911       break;
2912     case SWIG_FLOAT:
2913       sv_setnv(sv, (double) swig_constants[i].dvalue);
2914       break;
2915     case SWIG_STRING:
2916       sv_setpv(sv, (char *) swig_constants[i].pvalue);
2917       break;
2918     case SWIG_POINTER:
2919       SWIG_MakePtr(sv, swig_constants[i].pvalue, *(swig_constants[i].ptype),0);
2920       break;
2921     case SWIG_BINARY:
2922       SWIG_MakePackedObj(sv, swig_constants[i].pvalue, swig_constants[i].lvalue, *(swig_constants[i].ptype));
2923       break;
2924     default:
2925       break;
2926     }
2927     SvREADONLY_on(sv);
2928   }
2929   
2930   
2931   /* We need GType and GThread initialized to use xfers */
2932   glib_init();
2933   
2934   /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
2935     SV *sv = get_sv((char*) SWIG_prefix "XFER_INIT", TRUE | 0x2 | GV_ADDMULTI);
2936     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(XFER_INIT)));
2937     SvREADONLY_on(sv);
2938   } while(0) /*@SWIG@*/;
2939   /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
2940     SV *sv = get_sv((char*) SWIG_prefix "XFER_START", TRUE | 0x2 | GV_ADDMULTI);
2941     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(XFER_START)));
2942     SvREADONLY_on(sv);
2943   } while(0) /*@SWIG@*/;
2944   /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
2945     SV *sv = get_sv((char*) SWIG_prefix "XFER_RUNNING", TRUE | 0x2 | GV_ADDMULTI);
2946     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(XFER_RUNNING)));
2947     SvREADONLY_on(sv);
2948   } while(0) /*@SWIG@*/;
2949   /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
2950     SV *sv = get_sv((char*) SWIG_prefix "XFER_DONE", TRUE | 0x2 | GV_ADDMULTI);
2951     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(XFER_DONE)));
2952     SvREADONLY_on(sv);
2953   } while(0) /*@SWIG@*/;
2954   /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
2955     SV *sv = get_sv((char*) SWIG_prefix "XMSG_INFO", TRUE | 0x2 | GV_ADDMULTI);
2956     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(XMSG_INFO)));
2957     SvREADONLY_on(sv);
2958   } while(0) /*@SWIG@*/;
2959   /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
2960     SV *sv = get_sv((char*) SWIG_prefix "XMSG_ERROR", TRUE | 0x2 | GV_ADDMULTI);
2961     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(XMSG_ERROR)));
2962     SvREADONLY_on(sv);
2963   } while(0) /*@SWIG@*/;
2964   /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
2965     SV *sv = get_sv((char*) SWIG_prefix "XMSG_DONE", TRUE | 0x2 | GV_ADDMULTI);
2966     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(XMSG_DONE)));
2967     SvREADONLY_on(sv);
2968   } while(0) /*@SWIG@*/;
2969   /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
2970     SV *sv = get_sv((char*) SWIG_prefix "XMSG_CANCEL", TRUE | 0x2 | GV_ADDMULTI);
2971     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(XMSG_CANCEL)));
2972     SvREADONLY_on(sv);
2973   } while(0) /*@SWIG@*/;
2974   ST(0) = &PL_sv_yes;
2975   XSRETURN(1);
2976 }
2977