1 /* ----------------------------------------------------------------------------
2 * This file was automatically generated by SWIG (http://www.swig.org).
3 * Version 3.0.7
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 #include "../config/config.h"
12
13
14 #define SWIGPERL
15 #define SWIG_CASTRANK_MODE
16
17 /* -----------------------------------------------------------------------------
18 * This section contains generic SWIG labels for method/variable
19 * declarations/attributes, and other compiler dependent labels.
20 * ----------------------------------------------------------------------------- */
21
22 /* template workaround for compilers that cannot correctly implement the C++ standard */
23 #ifndef SWIGTEMPLATEDISAMBIGUATOR
24 # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
25 # define SWIGTEMPLATEDISAMBIGUATOR template
26 # elif defined(__HP_aCC)
27 /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
28 /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
29 # define SWIGTEMPLATEDISAMBIGUATOR template
30 # else
31 # define SWIGTEMPLATEDISAMBIGUATOR
32 # endif
33 #endif
34
35 /* inline attribute */
36 #ifndef SWIGINLINE
37 # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
38 # define SWIGINLINE inline
39 # else
40 # define SWIGINLINE
41 # endif
42 #endif
43
44 /* attribute recognised by some compilers to avoid 'unused' warnings */
45 #ifndef SWIGUNUSED
46 # if defined(__GNUC__)
47 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
48 # define SWIGUNUSED __attribute__ ((__unused__))
49 # else
50 # define SWIGUNUSED
51 # endif
52 # elif defined(__ICC)
53 # define SWIGUNUSED __attribute__ ((__unused__))
54 # else
55 # define SWIGUNUSED
56 # endif
57 #endif
58
59 #ifndef SWIG_MSC_UNSUPPRESS_4505
60 # if defined(_MSC_VER)
61 # pragma warning(disable : 4505) /* unreferenced local function has been removed */
62 # endif
63 #endif
64
65 #ifndef SWIGUNUSEDPARM
66 # ifdef __cplusplus
67 # define SWIGUNUSEDPARM(p)
68 # else
69 # define SWIGUNUSEDPARM(p) p SWIGUNUSED
70 # endif
71 #endif
72
73 /* internal SWIG method */
74 #ifndef SWIGINTERN
75 # define SWIGINTERN static SWIGUNUSED
76 #endif
77
78 /* internal inline SWIG method */
79 #ifndef SWIGINTERNINLINE
80 # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
81 #endif
82
83 /* exporting methods */
84 #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
85 # ifndef GCC_HASCLASSVISIBILITY
86 # define GCC_HASCLASSVISIBILITY
87 # endif
88 #endif
89
90 #ifndef SWIGEXPORT
91 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
92 # if defined(STATIC_LINKED)
93 # define SWIGEXPORT
94 # else
95 # define SWIGEXPORT __declspec(dllexport)
96 # endif
97 # else
98 # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
99 # define SWIGEXPORT __attribute__ ((visibility("default")))
100 # else
101 # define SWIGEXPORT
102 # endif
103 # endif
104 #endif
105
106 /* calling conventions for Windows */
107 #ifndef SWIGSTDCALL
108 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
109 # define SWIGSTDCALL __stdcall
110 # else
111 # define SWIGSTDCALL
112 # endif
113 #endif
114
115 /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
116 #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
117 # define _CRT_SECURE_NO_DEPRECATE
118 #endif
119
120 /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
121 #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
122 # define _SCL_SECURE_NO_DEPRECATE
123 #endif
124
125 /* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */
126 #if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES)
127 # define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
128 #endif
129
130 /* Intel's compiler complains if a variable which was never initialised is
131 * cast to void, which is a common idiom which we use to indicate that we
132 * are aware a variable isn't used. So we just silence that warning.
133 * See: https://github.com/swig/swig/issues/192 for more discussion.
134 */
135 #ifdef __INTEL_COMPILER
136 # pragma warning disable 592
137 #endif
138
139 /* -----------------------------------------------------------------------------
140 * swigrun.swg
141 *
142 * This file contains generic C API SWIG runtime support for pointer
143 * type checking.
144 * ----------------------------------------------------------------------------- */
145
146 /* This should only be incremented when either the layout of swig_type_info changes,
147 or for whatever reason, the runtime changes incompatibly */
148 #define SWIG_RUNTIME_VERSION "4"
149
150 /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
151 #ifdef SWIG_TYPE_TABLE
152 # define SWIG_QUOTE_STRING(x) #x
153 # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
154 # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
155 #else
156 # define SWIG_TYPE_TABLE_NAME
157 #endif
158
159 /*
160 You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
161 creating a static or dynamic library from the SWIG runtime code.
162 In 99.9% of the cases, SWIG just needs to declare them as 'static'.
163
164 But only do this if strictly necessary, ie, if you have problems
165 with your compiler or suchlike.
166 */
167
168 #ifndef SWIGRUNTIME
169 # define SWIGRUNTIME SWIGINTERN
170 #endif
171
172 #ifndef SWIGRUNTIMEINLINE
173 # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
174 #endif
175
176 /* Generic buffer size */
177 #ifndef SWIG_BUFFER_SIZE
178 # define SWIG_BUFFER_SIZE 1024
179 #endif
180
181 /* Flags for pointer conversions */
182 #define SWIG_POINTER_DISOWN 0x1
183 #define SWIG_CAST_NEW_MEMORY 0x2
184
185 /* Flags for new pointer objects */
186 #define SWIG_POINTER_OWN 0x1
187
188
189 /*
190 Flags/methods for returning states.
191
192 The SWIG conversion methods, as ConvertPtr, return an integer
193 that tells if the conversion was successful or not. And if not,
194 an error code can be returned (see swigerrors.swg for the codes).
195
196 Use the following macros/flags to set or process the returning
197 states.
198
199 In old versions of SWIG, code such as the following was usually written:
200
201 if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
202 // success code
203 } else {
204 //fail code
205 }
206
207 Now you can be more explicit:
208
209 int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
210 if (SWIG_IsOK(res)) {
211 // success code
212 } else {
213 // fail code
214 }
215
216 which is the same really, but now you can also do
217
218 Type *ptr;
219 int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
220 if (SWIG_IsOK(res)) {
221 // success code
222 if (SWIG_IsNewObj(res) {
223 ...
224 delete *ptr;
225 } else {
226 ...
227 }
228 } else {
229 // fail code
230 }
231
232 I.e., now SWIG_ConvertPtr can return new objects and you can
233 identify the case and take care of the deallocation. Of course that
234 also requires SWIG_ConvertPtr to return new result values, such as
235
236 int SWIG_ConvertPtr(obj, ptr,...) {
237 if (<obj is ok>) {
238 if (<need new object>) {
239 *ptr = <ptr to new allocated object>;
240 return SWIG_NEWOBJ;
241 } else {
242 *ptr = <ptr to old object>;
243 return SWIG_OLDOBJ;
244 }
245 } else {
246 return SWIG_BADOBJ;
247 }
248 }
249
250 Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
251 more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
252 SWIG errors code.
253
254 Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
255 allows to return the 'cast rank', for example, if you have this
256
257 int food(double)
258 int fooi(int);
259
260 and you call
261
262 food(1) // cast rank '1' (1 -> 1.0)
263 fooi(1) // cast rank '0'
264
265 just use the SWIG_AddCast()/SWIG_CheckState()
266 */
267
268 #define SWIG_OK (0)
269 #define SWIG_ERROR (-1)
270 #define SWIG_IsOK(r) (r >= 0)
271 #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
272
273 /* The CastRankLimit says how many bits are used for the cast rank */
274 #define SWIG_CASTRANKLIMIT (1 << 8)
275 /* The NewMask denotes the object was created (using new/malloc) */
276 #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1)
277 /* The TmpMask is for in/out typemaps that use temporal objects */
278 #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1)
279 /* Simple returning values */
280 #define SWIG_BADOBJ (SWIG_ERROR)
281 #define SWIG_OLDOBJ (SWIG_OK)
282 #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK)
283 #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK)
284 /* Check, add and del mask methods */
285 #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
286 #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
287 #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
288 #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
289 #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
290 #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
291
292 /* Cast-Rank Mode */
293 #if defined(SWIG_CASTRANK_MODE)
294 # ifndef SWIG_TypeRank
295 # define SWIG_TypeRank unsigned long
296 # endif
297 # ifndef SWIG_MAXCASTRANK /* Default cast allowed */
298 # define SWIG_MAXCASTRANK (2)
299 # endif
300 # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
301 # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
SWIG_AddCast(int r)302 SWIGINTERNINLINE int SWIG_AddCast(int r) {
303 return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
304 }
SWIG_CheckState(int r)305 SWIGINTERNINLINE int SWIG_CheckState(int r) {
306 return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
307 }
308 #else /* no cast-rank mode */
309 # define SWIG_AddCast(r) (r)
310 # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
311 #endif
312
313
314 #include <string.h>
315
316 #ifdef __cplusplus
317 extern "C" {
318 #endif
319
320 typedef void *(*swig_converter_func)(void *, int *);
321 typedef struct swig_type_info *(*swig_dycast_func)(void **);
322
323 /* Structure to store information on one type */
324 typedef struct swig_type_info {
325 const char *name; /* mangled name of this type */
326 const char *str; /* human readable name of this type */
327 swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
328 struct swig_cast_info *cast; /* linked list of types that can cast into this type */
329 void *clientdata; /* language specific type data */
330 int owndata; /* flag if the structure owns the clientdata */
331 } swig_type_info;
332
333 /* Structure to store a type and conversion function used for casting */
334 typedef struct swig_cast_info {
335 swig_type_info *type; /* pointer to type that is equivalent to this type */
336 swig_converter_func converter; /* function to cast the void pointers */
337 struct swig_cast_info *next; /* pointer to next cast in linked list */
338 struct swig_cast_info *prev; /* pointer to the previous cast */
339 } swig_cast_info;
340
341 /* Structure used to store module information
342 * Each module generates one structure like this, and the runtime collects
343 * all of these structures and stores them in a circularly linked list.*/
344 typedef struct swig_module_info {
345 swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
346 size_t size; /* Number of types in this module */
347 struct swig_module_info *next; /* Pointer to next element in circularly linked list */
348 swig_type_info **type_initial; /* Array of initially generated type structures */
349 swig_cast_info **cast_initial; /* Array of initially generated casting structures */
350 void *clientdata; /* Language specific module data */
351 } swig_module_info;
352
353 /*
354 Compare two type names skipping the space characters, therefore
355 "char*" == "char *" and "Class<int>" == "Class<int >", etc.
356
357 Return 0 when the two name types are equivalent, as in
358 strncmp, but skipping ' '.
359 */
360 SWIGRUNTIME int
SWIG_TypeNameComp(const char * f1,const char * l1,const char * f2,const char * l2)361 SWIG_TypeNameComp(const char *f1, const char *l1,
362 const char *f2, const char *l2) {
363 for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
364 while ((*f1 == ' ') && (f1 != l1)) ++f1;
365 while ((*f2 == ' ') && (f2 != l2)) ++f2;
366 if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
367 }
368 return (int)((l1 - f1) - (l2 - f2));
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
SWIG_TypeCmp(const char * nb,const char * tb)376 SWIG_TypeCmp(const char *nb, const char *tb) {
377 int equiv = 1;
378 const char* te = tb + strlen(tb);
379 const char* ne = nb;
380 while (equiv != 0 && *ne) {
381 for (nb = ne; *ne; ++ne) {
382 if (*ne == '|') break;
383 }
384 equiv = SWIG_TypeNameComp(nb, ne, tb, te);
385 if (*ne) ++ne;
386 }
387 return equiv;
388 }
389
390 /*
391 Check type equivalence in a name list like <name1>|<name2>|...
392 Return 0 if not equal, 1 if equal
393 */
394 SWIGRUNTIME int
SWIG_TypeEquiv(const char * nb,const char * tb)395 SWIG_TypeEquiv(const char *nb, const char *tb) {
396 return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
397 }
398
399 /*
400 Check the typename
401 */
402 SWIGRUNTIME swig_cast_info *
SWIG_TypeCheck(const char * c,swig_type_info * ty)403 SWIG_TypeCheck(const char *c, swig_type_info *ty) {
404 if (ty) {
405 swig_cast_info *iter = ty->cast;
406 while (iter) {
407 if (strcmp(iter->type->name, c) == 0) {
408 if (iter == ty->cast)
409 return iter;
410 /* Move iter to the top of the linked list */
411 iter->prev->next = iter->next;
412 if (iter->next)
413 iter->next->prev = iter->prev;
414 iter->next = ty->cast;
415 iter->prev = 0;
416 if (ty->cast) ty->cast->prev = iter;
417 ty->cast = iter;
418 return iter;
419 }
420 iter = iter->next;
421 }
422 }
423 return 0;
424 }
425
426 /*
427 Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
428 */
429 SWIGRUNTIME swig_cast_info *
SWIG_TypeCheckStruct(swig_type_info * from,swig_type_info * ty)430 SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
431 if (ty) {
432 swig_cast_info *iter = ty->cast;
433 while (iter) {
434 if (iter->type == from) {
435 if (iter == ty->cast)
436 return iter;
437 /* Move iter to the top of the linked list */
438 iter->prev->next = iter->next;
439 if (iter->next)
440 iter->next->prev = iter->prev;
441 iter->next = ty->cast;
442 iter->prev = 0;
443 if (ty->cast) ty->cast->prev = iter;
444 ty->cast = iter;
445 return iter;
446 }
447 iter = iter->next;
448 }
449 }
450 return 0;
451 }
452
453 /*
454 Cast a pointer up an inheritance hierarchy
455 */
456 SWIGRUNTIMEINLINE void *
SWIG_TypeCast(swig_cast_info * ty,void * ptr,int * newmemory)457 SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
458 return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
459 }
460
461 /*
462 Dynamic pointer casting. Down an inheritance hierarchy
463 */
464 SWIGRUNTIME swig_type_info *
SWIG_TypeDynamicCast(swig_type_info * ty,void ** ptr)465 SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
466 swig_type_info *lastty = ty;
467 if (!ty || !ty->dcast) return ty;
468 while (ty && (ty->dcast)) {
469 ty = (*ty->dcast)(ptr);
470 if (ty) lastty = ty;
471 }
472 return lastty;
473 }
474
475 /*
476 Return the name associated with this type
477 */
478 SWIGRUNTIMEINLINE const char *
SWIG_TypeName(const swig_type_info * ty)479 SWIG_TypeName(const swig_type_info *ty) {
480 return ty->name;
481 }
482
483 /*
484 Return the pretty name associated with this type,
485 that is an unmangled type name in a form presentable to the user.
486 */
487 SWIGRUNTIME const char *
SWIG_TypePrettyName(const swig_type_info * type)488 SWIG_TypePrettyName(const swig_type_info *type) {
489 /* The "str" field contains the equivalent pretty names of the
490 type, separated by vertical-bar characters. We choose
491 to print the last name, as it is often (?) the most
492 specific. */
493 if (!type) return NULL;
494 if (type->str != NULL) {
495 const char *last_name = type->str;
496 const char *s;
497 for (s = type->str; *s; s++)
498 if (*s == '|') last_name = s+1;
499 return last_name;
500 }
501 else
502 return type->name;
503 }
504
505 /*
506 Set the clientdata field for a type
507 */
508 SWIGRUNTIME void
SWIG_TypeClientData(swig_type_info * ti,void * clientdata)509 SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
510 swig_cast_info *cast = ti->cast;
511 /* if (ti->clientdata == clientdata) return; */
512 ti->clientdata = clientdata;
513
514 while (cast) {
515 if (!cast->converter) {
516 swig_type_info *tc = cast->type;
517 if (!tc->clientdata) {
518 SWIG_TypeClientData(tc, clientdata);
519 }
520 }
521 cast = cast->next;
522 }
523 }
524 SWIGRUNTIME void
SWIG_TypeNewClientData(swig_type_info * ti,void * clientdata)525 SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
526 SWIG_TypeClientData(ti, clientdata);
527 ti->owndata = 1;
528 }
529
530 /*
531 Search for a swig_type_info structure only by mangled name
532 Search is a O(log #types)
533
534 We start searching at module start, and finish searching when start == end.
535 Note: if start == end at the beginning of the function, we go all the way around
536 the circular list.
537 */
538 SWIGRUNTIME swig_type_info *
SWIG_MangledTypeQueryModule(swig_module_info * start,swig_module_info * end,const char * name)539 SWIG_MangledTypeQueryModule(swig_module_info *start,
540 swig_module_info *end,
541 const char *name) {
542 swig_module_info *iter = start;
543 do {
544 if (iter->size) {
545 size_t l = 0;
546 size_t r = iter->size - 1;
547 do {
548 /* since l+r >= 0, we can (>> 1) instead (/ 2) */
549 size_t i = (l + r) >> 1;
550 const char *iname = iter->types[i]->name;
551 if (iname) {
552 int compare = strcmp(name, iname);
553 if (compare == 0) {
554 return iter->types[i];
555 } else if (compare < 0) {
556 if (i) {
557 r = i - 1;
558 } else {
559 break;
560 }
561 } else if (compare > 0) {
562 l = i + 1;
563 }
564 } else {
565 break; /* should never happen */
566 }
567 } while (l <= r);
568 }
569 iter = iter->next;
570 } while (iter != end);
571 return 0;
572 }
573
574 /*
575 Search for a swig_type_info structure for either a mangled name or a human readable name.
576 It first searches the mangled names of the types, which is a O(log #types)
577 If a type is not found it then searches the human readable names, which is O(#types).
578
579 We start searching at module start, and finish searching when start == end.
580 Note: if start == end at the beginning of the function, we go all the way around
581 the circular list.
582 */
583 SWIGRUNTIME swig_type_info *
SWIG_TypeQueryModule(swig_module_info * start,swig_module_info * end,const char * name)584 SWIG_TypeQueryModule(swig_module_info *start,
585 swig_module_info *end,
586 const char *name) {
587 /* STEP 1: Search the name field using binary search */
588 swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
589 if (ret) {
590 return ret;
591 } else {
592 /* STEP 2: If the type hasn't been found, do a complete search
593 of the str field (the human readable name) */
594 swig_module_info *iter = start;
595 do {
596 size_t i = 0;
597 for (; i < iter->size; ++i) {
598 if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
599 return iter->types[i];
600 }
601 iter = iter->next;
602 } while (iter != end);
603 }
604
605 /* neither found a match */
606 return 0;
607 }
608
609 /*
610 Pack binary data into a string
611 */
612 SWIGRUNTIME char *
SWIG_PackData(char * c,void * ptr,size_t sz)613 SWIG_PackData(char *c, void *ptr, size_t sz) {
614 static const char hex[17] = "0123456789abcdef";
615 const unsigned char *u = (unsigned char *) ptr;
616 const unsigned char *eu = u + sz;
617 for (; u != eu; ++u) {
618 unsigned char uu = *u;
619 *(c++) = hex[(uu & 0xf0) >> 4];
620 *(c++) = hex[uu & 0xf];
621 }
622 return c;
623 }
624
625 /*
626 Unpack binary data from a string
627 */
628 SWIGRUNTIME const char *
SWIG_UnpackData(const char * c,void * ptr,size_t sz)629 SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
630 unsigned char *u = (unsigned char *) ptr;
631 const unsigned char *eu = u + sz;
632 for (; u != eu; ++u) {
633 char d = *(c++);
634 unsigned char uu;
635 if ((d >= '0') && (d <= '9'))
636 uu = ((d - '0') << 4);
637 else if ((d >= 'a') && (d <= 'f'))
638 uu = ((d - ('a'-10)) << 4);
639 else
640 return (char *) 0;
641 d = *(c++);
642 if ((d >= '0') && (d <= '9'))
643 uu |= (d - '0');
644 else if ((d >= 'a') && (d <= 'f'))
645 uu |= (d - ('a'-10));
646 else
647 return (char *) 0;
648 *u = uu;
649 }
650 return c;
651 }
652
653 /*
654 Pack 'void *' into a string buffer.
655 */
656 SWIGRUNTIME char *
SWIG_PackVoidPtr(char * buff,void * ptr,const char * name,size_t bsz)657 SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
658 char *r = buff;
659 if ((2*sizeof(void *) + 2) > bsz) return 0;
660 *(r++) = '_';
661 r = SWIG_PackData(r,&ptr,sizeof(void *));
662 if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
663 strcpy(r,name);
664 return buff;
665 }
666
667 SWIGRUNTIME const char *
SWIG_UnpackVoidPtr(const char * c,void ** ptr,const char * name)668 SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
669 if (*c != '_') {
670 if (strcmp(c,"NULL") == 0) {
671 *ptr = (void *) 0;
672 return name;
673 } else {
674 return 0;
675 }
676 }
677 return SWIG_UnpackData(++c,ptr,sizeof(void *));
678 }
679
680 SWIGRUNTIME char *
SWIG_PackDataName(char * buff,void * ptr,size_t sz,const char * name,size_t bsz)681 SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
682 char *r = buff;
683 size_t lname = (name ? strlen(name) : 0);
684 if ((2*sz + 2 + lname) > bsz) return 0;
685 *(r++) = '_';
686 r = SWIG_PackData(r,ptr,sz);
687 if (lname) {
688 strncpy(r,name,lname+1);
689 } else {
690 *r = 0;
691 }
692 return buff;
693 }
694
695 SWIGRUNTIME const char *
SWIG_UnpackDataName(const char * c,void * ptr,size_t sz,const char * name)696 SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
697 if (*c != '_') {
698 if (strcmp(c,"NULL") == 0) {
699 memset(ptr,0,sz);
700 return name;
701 } else {
702 return 0;
703 }
704 }
705 return SWIG_UnpackData(++c,ptr,sz);
706 }
707
708 #ifdef __cplusplus
709 }
710 #endif
711
712 /* Errors in SWIG */
713 #define SWIG_UnknownError -1
714 #define SWIG_IOError -2
715 #define SWIG_RuntimeError -3
716 #define SWIG_IndexError -4
717 #define SWIG_TypeError -5
718 #define SWIG_DivisionByZero -6
719 #define SWIG_OverflowError -7
720 #define SWIG_SyntaxError -8
721 #define SWIG_ValueError -9
722 #define SWIG_SystemError -10
723 #define SWIG_AttributeError -11
724 #define SWIG_MemoryError -12
725 #define SWIG_NullReferenceError -13
726
727
728
729 #ifdef __cplusplus
730 /* Needed on some windows machines---since MS plays funny games with the header files under C++ */
731 #include <math.h>
732 #include <stdlib.h>
733 extern "C" {
734 #endif
735 #include "EXTERN.h"
736 #include "perl.h"
737 #include "XSUB.h"
738
739 /* Add in functionality missing in older versions of Perl. Much of this is based on Devel-PPPort on cpan. */
740
741 /* Add PERL_REVISION, PERL_VERSION, PERL_SUBVERSION if missing */
742 #ifndef PERL_REVISION
743 # if !defined(__PATCHLEVEL_H_INCLUDED__) && !(defined(PATCHLEVEL) && defined(SUBVERSION))
744 # define PERL_PATCHLEVEL_H_IMPLICIT
745 # include <patchlevel.h>
746 # endif
747 # if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL)))
748 # include <could_not_find_Perl_patchlevel.h>
749 # endif
750 # ifndef PERL_REVISION
751 # define PERL_REVISION (5)
752 # define PERL_VERSION PATCHLEVEL
753 # define PERL_SUBVERSION SUBVERSION
754 # endif
755 #endif
756
757 #if defined(WIN32) && defined(PERL_OBJECT) && !defined(PerlIO_exportFILE)
758 #define PerlIO_exportFILE(fh,fl) (FILE*)(fh)
759 #endif
760
761 #ifndef SvIOK_UV
762 # define SvIOK_UV(sv) (SvIOK(sv) && (SvUVX(sv) == SvIVX(sv)))
763 #endif
764
765 #ifndef SvUOK
766 # define SvUOK(sv) SvIOK_UV(sv)
767 #endif
768
769 #if ((PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 5)))
770 # define PL_sv_undef sv_undef
771 # define PL_na na
772 # define PL_errgv errgv
773 # define PL_sv_no sv_no
774 # define PL_sv_yes sv_yes
775 # define PL_markstack_ptr markstack_ptr
776 #endif
777
778 #ifndef IVSIZE
779 # ifdef LONGSIZE
780 # define IVSIZE LONGSIZE
781 # else
782 # define IVSIZE 4 /* A bold guess, but the best we can make. */
783 # endif
784 #endif
785
786 #ifndef INT2PTR
787 # if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE)
788 # define PTRV UV
789 # define INT2PTR(any,d) (any)(d)
790 # else
791 # if PTRSIZE == LONGSIZE
792 # define PTRV unsigned long
793 # else
794 # define PTRV unsigned
795 # endif
796 # define INT2PTR(any,d) (any)(PTRV)(d)
797 # endif
798
799 # define NUM2PTR(any,d) (any)(PTRV)(d)
800 # define PTR2IV(p) INT2PTR(IV,p)
801 # define PTR2UV(p) INT2PTR(UV,p)
802 # define PTR2NV(p) NUM2PTR(NV,p)
803
804 # if PTRSIZE == LONGSIZE
805 # define PTR2ul(p) (unsigned long)(p)
806 # else
807 # define PTR2ul(p) INT2PTR(unsigned long,p)
808 # endif
809 #endif /* !INT2PTR */
810
811 #ifndef SvPV_nolen
812 # define SvPV_nolen(x) SvPV(x,PL_na)
813 #endif
814
815 #ifndef get_sv
816 # define get_sv perl_get_sv
817 #endif
818
819 #ifndef ERRSV
820 # define ERRSV get_sv("@",FALSE)
821 #endif
822
823 #ifndef pTHX_
824 #define pTHX_
825 #endif
826
827 #include <string.h>
828 #ifdef __cplusplus
829 }
830 #endif
831
832 /* -----------------------------------------------------------------------------
833 * error manipulation
834 * ----------------------------------------------------------------------------- */
835
836 SWIGINTERN const char*
SWIG_Perl_ErrorType(int code)837 SWIG_Perl_ErrorType(int code) {
838 switch(code) {
839 case SWIG_MemoryError:
840 return "MemoryError";
841 case SWIG_IOError:
842 return "IOError";
843 case SWIG_RuntimeError:
844 return "RuntimeError";
845 case SWIG_IndexError:
846 return "IndexError";
847 case SWIG_TypeError:
848 return "TypeError";
849 case SWIG_DivisionByZero:
850 return "ZeroDivisionError";
851 case SWIG_OverflowError:
852 return "OverflowError";
853 case SWIG_SyntaxError:
854 return "SyntaxError";
855 case SWIG_ValueError:
856 return "ValueError";
857 case SWIG_SystemError:
858 return "SystemError";
859 case SWIG_AttributeError:
860 return "AttributeError";
861 default:
862 return "RuntimeError";
863 }
864 }
865
866
867 /* -----------------------------------------------------------------------------
868 * perlrun.swg
869 *
870 * This file contains the runtime support for Perl modules
871 * and includes code for managing global variables and pointer
872 * type checking.
873 * ----------------------------------------------------------------------------- */
874
875 #ifdef PERL_OBJECT
876 #define SWIG_PERL_OBJECT_DECL CPerlObj *SWIGUNUSEDPARM(pPerl),
877 #define SWIG_PERL_OBJECT_CALL pPerl,
878 #else
879 #define SWIG_PERL_OBJECT_DECL
880 #define SWIG_PERL_OBJECT_CALL
881 #endif
882
883 /* Common SWIG API */
884
885 /* for raw pointers */
886 #define SWIG_ConvertPtr(obj, pp, type, flags) SWIG_Perl_ConvertPtr(SWIG_PERL_OBJECT_CALL obj, pp, type, flags)
887 #define SWIG_ConvertPtrAndOwn(obj, pp, type, flags,own) SWIG_Perl_ConvertPtrAndOwn(SWIG_PERL_OBJECT_CALL obj, pp, type, flags, own)
888 #define SWIG_NewPointerObj(p, type, flags) SWIG_Perl_NewPointerObj(SWIG_PERL_OBJECT_CALL p, type, flags)
889 #define swig_owntype int
890
891 /* for raw packed data */
892 #define SWIG_ConvertPacked(obj, p, s, type) SWIG_Perl_ConvertPacked(SWIG_PERL_OBJECT_CALL obj, p, s, type)
893 #define SWIG_NewPackedObj(p, s, type) SWIG_Perl_NewPackedObj(SWIG_PERL_OBJECT_CALL p, s, type)
894
895 /* for class or struct pointers */
896 #define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags)
897 #define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags)
898
899 /* for C or C++ function pointers */
900 #define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_ConvertPtr(obj, pptr, type, 0)
901 #define SWIG_NewFunctionPtrObj(ptr, type) SWIG_NewPointerObj(ptr, type, 0)
902
903 /* for C++ member pointers, ie, member methods */
904 #define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_ConvertPacked(obj, ptr, sz, ty)
905 #define SWIG_NewMemberObj(ptr, sz, type) SWIG_NewPackedObj(ptr, sz, type)
906
907
908 /* Runtime API */
909
910 #define SWIG_GetModule(clientdata) SWIG_Perl_GetModule(clientdata)
911 #define SWIG_SetModule(clientdata, pointer) SWIG_Perl_SetModule(pointer)
912
913
914 /* Error manipulation */
915
916 #define SWIG_ErrorType(code) SWIG_Perl_ErrorType(code)
917 #define SWIG_Error(code, msg) sv_setpvf(get_sv("@", GV_ADD), "%s %s", SWIG_ErrorType(code), msg)
918 #define SWIG_fail goto fail
919
920 /* Perl-specific SWIG API */
921
922 #define SWIG_MakePtr(sv, ptr, type, flags) SWIG_Perl_MakePtr(SWIG_PERL_OBJECT_CALL sv, ptr, type, flags)
923 #define SWIG_MakePackedObj(sv, p, s, type) SWIG_Perl_MakePackedObj(SWIG_PERL_OBJECT_CALL sv, p, s, type)
924 #define SWIG_SetError(str) SWIG_Error(SWIG_RuntimeError, str)
925
926
927 #define SWIG_PERL_DECL_ARGS_1(arg1) (SWIG_PERL_OBJECT_DECL arg1)
928 #define SWIG_PERL_CALL_ARGS_1(arg1) (SWIG_PERL_OBJECT_CALL arg1)
929 #define SWIG_PERL_DECL_ARGS_2(arg1, arg2) (SWIG_PERL_OBJECT_DECL arg1, arg2)
930 #define SWIG_PERL_CALL_ARGS_2(arg1, arg2) (SWIG_PERL_OBJECT_CALL arg1, arg2)
931
932 /* -----------------------------------------------------------------------------
933 * pointers/data manipulation
934 * ----------------------------------------------------------------------------- */
935
936 /* For backward compatibility only */
937 #define SWIG_POINTER_EXCEPTION 0
938
939 #ifdef __cplusplus
940 extern "C" {
941 #endif
942
943 #define SWIG_OWNER SWIG_POINTER_OWN
944 #define SWIG_SHADOW SWIG_OWNER << 1
945
946 #define SWIG_MAYBE_PERL_OBJECT SWIG_PERL_OBJECT_DECL
947
948 /* SWIG Perl macros */
949
950 /* Macro to declare an XS function */
951 #ifndef XSPROTO
952 # define XSPROTO(name) void name(pTHX_ CV* cv)
953 #endif
954
955 /* Macro to call an XS function */
956 #ifdef PERL_OBJECT
957 # define SWIG_CALLXS(_name) _name(cv,pPerl)
958 #else
959 # ifndef MULTIPLICITY
960 # define SWIG_CALLXS(_name) _name(cv)
961 # else
962 # define SWIG_CALLXS(_name) _name(PERL_GET_THX, cv)
963 # endif
964 #endif
965
966 #ifdef PERL_OBJECT
967 #define MAGIC_PPERL CPerlObj *pPerl = (CPerlObj *) this;
968
969 #ifdef __cplusplus
970 extern "C" {
971 #endif
972 typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *);
973 #ifdef __cplusplus
974 }
975 #endif
976
977 #define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
978 #define SWIGCLASS_STATIC
979
980 #else /* PERL_OBJECT */
981
982 #define MAGIC_PPERL
983 #define SWIGCLASS_STATIC static SWIGUNUSED
984
985 #ifndef MULTIPLICITY
986 #define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
987
988 #ifdef __cplusplus
989 extern "C" {
990 #endif
991 typedef int (*SwigMagicFunc)(SV *, MAGIC *);
992 #ifdef __cplusplus
993 }
994 #endif
995
996 #else /* MULTIPLICITY */
997
998 #define SWIG_MAGIC(a,b) (struct interpreter *interp, SV *a, MAGIC *b)
999
1000 #ifdef __cplusplus
1001 extern "C" {
1002 #endif
1003 typedef int (*SwigMagicFunc)(struct interpreter *, SV *, MAGIC *);
1004 #ifdef __cplusplus
1005 }
1006 #endif
1007
1008 #endif /* MULTIPLICITY */
1009 #endif /* PERL_OBJECT */
1010
1011 # ifdef PERL_OBJECT
1012 # define SWIG_croak_null() SWIG_Perl_croak_null(pPerl)
SWIG_Perl_croak_null(CPerlObj * pPerl)1013 static void SWIG_Perl_croak_null(CPerlObj *pPerl)
1014 # else
1015 static void SWIG_croak_null()
1016 # endif
1017 {
1018 SV *err = get_sv("@", GV_ADD);
1019 # if (PERL_VERSION < 6)
1020 croak("%_", err);
1021 # else
1022 if (sv_isobject(err))
1023 croak(0);
1024 else
1025 croak("%s", SvPV_nolen(err));
1026 # endif
1027 }
1028
1029
1030 /*
1031 Define how strict is the cast between strings and integers/doubles
1032 when overloading between these types occurs.
1033
1034 The default is making it as strict as possible by using SWIG_AddCast
1035 when needed.
1036
1037 You can use -DSWIG_PERL_NO_STRICT_STR2NUM at compilation time to
1038 disable the SWIG_AddCast, making the casting between string and
1039 numbers less strict.
1040
1041 In the end, we try to solve the overloading between strings and
1042 numerical types in the more natural way, but if you can avoid it,
1043 well, avoid it using %rename, for example.
1044 */
1045 #ifndef SWIG_PERL_NO_STRICT_STR2NUM
1046 # ifndef SWIG_PERL_STRICT_STR2NUM
1047 # define SWIG_PERL_STRICT_STR2NUM
1048 # endif
1049 #endif
1050 #ifdef SWIG_PERL_STRICT_STR2NUM
1051 /* string takes precedence */
1052 #define SWIG_Str2NumCast(x) SWIG_AddCast(x)
1053 #else
1054 /* number takes precedence */
1055 #define SWIG_Str2NumCast(x) x
1056 #endif
1057
1058
1059
1060 #include <stdlib.h>
1061
1062 SWIGRUNTIME const char *
SWIG_Perl_TypeProxyName(const swig_type_info * type)1063 SWIG_Perl_TypeProxyName(const swig_type_info *type) {
1064 if (!type) return NULL;
1065 if (type->clientdata != NULL) {
1066 return (const char*) type->clientdata;
1067 }
1068 else {
1069 return type->name;
1070 }
1071 }
1072
1073 /* Identical to SWIG_TypeCheck, except for strcmp comparison */
1074 SWIGRUNTIME swig_cast_info *
SWIG_TypeProxyCheck(const char * c,swig_type_info * ty)1075 SWIG_TypeProxyCheck(const char *c, swig_type_info *ty) {
1076 if (ty) {
1077 swig_cast_info *iter = ty->cast;
1078 while (iter) {
1079 if (strcmp(SWIG_Perl_TypeProxyName(iter->type), c) == 0) {
1080 if (iter == ty->cast)
1081 return iter;
1082 /* Move iter to the top of the linked list */
1083 iter->prev->next = iter->next;
1084 if (iter->next)
1085 iter->next->prev = iter->prev;
1086 iter->next = ty->cast;
1087 iter->prev = 0;
1088 if (ty->cast) ty->cast->prev = iter;
1089 ty->cast = iter;
1090 return iter;
1091 }
1092 iter = iter->next;
1093 }
1094 }
1095 return 0;
1096 }
1097
1098 /* Function for getting a pointer value */
1099
1100 SWIGRUNTIME int
SWIG_Perl_ConvertPtrAndOwn(SWIG_MAYBE_PERL_OBJECT SV * sv,void ** ptr,swig_type_info * _t,int flags,int * own)1101 SWIG_Perl_ConvertPtrAndOwn(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *_t, int flags, int *own) {
1102 swig_cast_info *tc;
1103 void *voidptr = (void *)0;
1104 SV *tsv = 0;
1105
1106 if (own)
1107 *own = 0;
1108
1109 /* If magical, apply more magic */
1110 if (SvGMAGICAL(sv))
1111 mg_get(sv);
1112
1113 /* Check to see if this is an object */
1114 if (sv_isobject(sv)) {
1115 IV tmp = 0;
1116 tsv = (SV*) SvRV(sv);
1117 if ((SvTYPE(tsv) == SVt_PVHV)) {
1118 MAGIC *mg;
1119 if (SvMAGICAL(tsv)) {
1120 mg = mg_find(tsv,'P');
1121 if (mg) {
1122 sv = mg->mg_obj;
1123 if (sv_isobject(sv)) {
1124 tsv = (SV*)SvRV(sv);
1125 tmp = SvIV(tsv);
1126 }
1127 }
1128 } else {
1129 return SWIG_ERROR;
1130 }
1131 } else {
1132 tmp = SvIV(tsv);
1133 }
1134 voidptr = INT2PTR(void *,tmp);
1135 } else if (! SvOK(sv)) { /* Check for undef */
1136 *(ptr) = (void *) 0;
1137 return SWIG_OK;
1138 } else if (SvTYPE(sv) == SVt_RV) { /* Check for NULL pointer */
1139 if (!SvROK(sv)) {
1140 /* In Perl 5.12 and later, SVt_RV == SVt_IV, so sv could be a valid integer value. */
1141 if (SvIOK(sv)) {
1142 return SWIG_ERROR;
1143 } else {
1144 /* NULL pointer (reference to undef). */
1145 *(ptr) = (void *) 0;
1146 return SWIG_OK;
1147 }
1148 } else {
1149 return SWIG_ERROR;
1150 }
1151 } else { /* Don't know what it is */
1152 return SWIG_ERROR;
1153 }
1154 if (_t) {
1155 /* Now see if the types match */
1156 char *_c = HvNAME(SvSTASH(SvRV(sv)));
1157 tc = SWIG_TypeProxyCheck(_c,_t);
1158 #ifdef SWIG_DIRECTORS
1159 if (!tc && !sv_derived_from(sv,SWIG_Perl_TypeProxyName(_t))) {
1160 #else
1161 if (!tc) {
1162 #endif
1163 return SWIG_ERROR;
1164 }
1165 {
1166 int newmemory = 0;
1167 *ptr = SWIG_TypeCast(tc,voidptr,&newmemory);
1168 if (newmemory == SWIG_CAST_NEW_MEMORY) {
1169 assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */
1170 if (own)
1171 *own = *own | SWIG_CAST_NEW_MEMORY;
1172 }
1173 }
1174 } else {
1175 *ptr = voidptr;
1176 }
1177
1178 /*
1179 * DISOWN implementation: we need a perl guru to check this one.
1180 */
1181 if (tsv && (flags & SWIG_POINTER_DISOWN)) {
1182 /*
1183 * almost copy paste code from below SWIG_POINTER_OWN setting
1184 */
1185 SV *obj = sv;
1186 HV *stash = SvSTASH(SvRV(obj));
1187 GV *gv = *(GV**)hv_fetch(stash, "OWNER", 5, TRUE);
1188 if (isGV(gv)) {
1189 HV *hv = GvHVn(gv);
1190 /*
1191 * To set ownership (see below), a newSViv(1) entry is added.
1192 * Hence, to remove ownership, we delete the entry.
1193 */
1194 if (hv_exists_ent(hv, obj, 0)) {
1195 hv_delete_ent(hv, obj, 0, 0);
1196 }
1197 }
1198 }
1199 return SWIG_OK;
1200 }
1201
1202 SWIGRUNTIME int
1203 SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *_t, int flags) {
1204 return SWIG_Perl_ConvertPtrAndOwn(sv, ptr, _t, flags, 0);
1205 }
1206
1207 SWIGRUNTIME void
1208 SWIG_Perl_MakePtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, swig_type_info *t, int flags) {
1209 if (ptr && (flags & (SWIG_SHADOW | SWIG_POINTER_OWN))) {
1210 SV *self;
1211 SV *obj=newSV(0);
1212 HV *hash=newHV();
1213 HV *stash;
1214 sv_setref_pv(obj, SWIG_Perl_TypeProxyName(t), ptr);
1215 stash=SvSTASH(SvRV(obj));
1216 if (flags & SWIG_POINTER_OWN) {
1217 HV *hv;
1218 GV *gv = *(GV**)hv_fetch(stash, "OWNER", 5, TRUE);
1219 if (!isGV(gv))
1220 gv_init(gv, stash, "OWNER", 5, FALSE);
1221 hv=GvHVn(gv);
1222 hv_store_ent(hv, obj, newSViv(1), 0);
1223 }
1224 sv_magic((SV *)hash, (SV *)obj, 'P', Nullch, 0);
1225 SvREFCNT_dec(obj);
1226 self=newRV_noinc((SV *)hash);
1227 sv_setsv(sv, self);
1228 SvREFCNT_dec((SV *)self);
1229 sv_bless(sv, stash);
1230 }
1231 else {
1232 sv_setref_pv(sv, SWIG_Perl_TypeProxyName(t), ptr);
1233 }
1234 }
1235
1236 SWIGRUNTIMEINLINE SV *
1237 SWIG_Perl_NewPointerObj(SWIG_MAYBE_PERL_OBJECT void *ptr, swig_type_info *t, int flags) {
1238 SV *result = sv_newmortal();
1239 SWIG_MakePtr(result, ptr, t, flags);
1240 return result;
1241 }
1242
1243 SWIGRUNTIME void
1244 SWIG_Perl_MakePackedObj(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, int sz, swig_type_info *type) {
1245 char result[1024];
1246 char *r = result;
1247 if ((2*sz + 1 + strlen(SWIG_Perl_TypeProxyName(type))) > 1000) return;
1248 *(r++) = '_';
1249 r = SWIG_PackData(r,ptr,sz);
1250 strcpy(r,SWIG_Perl_TypeProxyName(type));
1251 sv_setpv(sv, result);
1252 }
1253
1254 SWIGRUNTIME SV *
1255 SWIG_Perl_NewPackedObj(SWIG_MAYBE_PERL_OBJECT void *ptr, int sz, swig_type_info *type) {
1256 SV *result = sv_newmortal();
1257 SWIG_Perl_MakePackedObj(result, ptr, sz, type);
1258 return result;
1259 }
1260
1261 /* Convert a packed value value */
1262 SWIGRUNTIME int
1263 SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV *obj, void *ptr, int sz, swig_type_info *ty) {
1264 swig_cast_info *tc;
1265 const char *c = 0;
1266
1267 if ((!obj) || (!SvOK(obj))) return SWIG_ERROR;
1268 c = SvPV_nolen(obj);
1269 /* Pointer values must start with leading underscore */
1270 if (*c != '_') return SWIG_ERROR;
1271 c++;
1272 c = SWIG_UnpackData(c,ptr,sz);
1273 if (ty) {
1274 tc = SWIG_TypeCheck(c,ty);
1275 if (!tc) return SWIG_ERROR;
1276 }
1277 return SWIG_OK;
1278 }
1279
1280
1281 /* Macros for low-level exception handling */
1282 #define SWIG_croak(x) { SWIG_Error(SWIG_RuntimeError, x); SWIG_fail; }
1283
1284
1285 typedef XSPROTO(SwigPerlWrapper);
1286 typedef SwigPerlWrapper *SwigPerlWrapperPtr;
1287
1288 /* Structure for command table */
1289 typedef struct {
1290 const char *name;
1291 SwigPerlWrapperPtr wrapper;
1292 } swig_command_info;
1293
1294 /* Information for constant table */
1295
1296 #define SWIG_INT 1
1297 #define SWIG_FLOAT 2
1298 #define SWIG_STRING 3
1299 #define SWIG_POINTER 4
1300 #define SWIG_BINARY 5
1301
1302 /* Constant information structure */
1303 typedef struct swig_constant_info {
1304 int type;
1305 const char *name;
1306 long lvalue;
1307 double dvalue;
1308 void *pvalue;
1309 swig_type_info **ptype;
1310 } swig_constant_info;
1311
1312
1313 /* Structure for variable table */
1314 typedef struct {
1315 const char *name;
1316 SwigMagicFunc set;
1317 SwigMagicFunc get;
1318 swig_type_info **type;
1319 } swig_variable_info;
1320
1321 /* Magic variable code */
1322 #ifndef PERL_OBJECT
1323 # ifdef __cplusplus
1324 # define swig_create_magic(s,a,b,c) _swig_create_magic(s,const_cast<char*>(a),b,c)
1325 # else
1326 # define swig_create_magic(s,a,b,c) _swig_create_magic(s,(char*)(a),b,c)
1327 # endif
1328 # ifndef MULTIPLICITY
1329 SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(SV *, MAGIC *), int (*get)(SV *,MAGIC *))
1330 # else
1331 SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(struct interpreter*, SV *, MAGIC *), int (*get)(struct interpreter*, SV *,MAGIC *))
1332 # endif
1333 #else
1334 # define swig_create_magic(s,a,b,c) _swig_create_magic(pPerl,s,a,b,c)
1335 SWIGRUNTIME void _swig_create_magic(CPerlObj *pPerl, SV *sv, const char *name, int (CPerlObj::*set)(SV *, MAGIC *), int (CPerlObj::*get)(SV *, MAGIC *))
1336 #endif
1337 {
1338 MAGIC *mg;
1339 sv_magic(sv,sv,'U',name,strlen(name));
1340 mg = mg_find(sv,'U');
1341 mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL));
1342 mg->mg_virtual->svt_get = (SwigMagicFunc) get;
1343 mg->mg_virtual->svt_set = (SwigMagicFunc) set;
1344 mg->mg_virtual->svt_len = 0;
1345 mg->mg_virtual->svt_clear = 0;
1346 mg->mg_virtual->svt_free = 0;
1347 }
1348
1349
1350 SWIGRUNTIME swig_module_info *
1351 SWIG_Perl_GetModule(void *SWIGUNUSEDPARM(clientdata)) {
1352 static void *type_pointer = (void *)0;
1353 SV *pointer;
1354
1355 /* first check if pointer already created */
1356 if (!type_pointer) {
1357 pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE | GV_ADDMULTI);
1358 if (pointer && SvOK(pointer)) {
1359 type_pointer = INT2PTR(swig_type_info **, SvIV(pointer));
1360 }
1361 }
1362
1363 return (swig_module_info *) type_pointer;
1364 }
1365
1366 SWIGRUNTIME void
1367 SWIG_Perl_SetModule(swig_module_info *module) {
1368 SV *pointer;
1369
1370 /* create a new pointer */
1371 pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE | GV_ADDMULTI);
1372 sv_setiv(pointer, PTR2IV(module));
1373 }
1374
1375 #ifdef __cplusplus
1376 }
1377 #endif
1378
1379 /* Workaround perl5 global namespace pollution. Note that undefining library
1380 * functions like fopen will not solve the problem on all platforms as fopen
1381 * might be a macro on Windows but not necessarily on other operating systems. */
1382 #ifdef do_open
1383 #undef do_open
1384 #endif
1385 #ifdef do_close
1386 #undef do_close
1387 #endif
1388 #ifdef do_exec
1389 #undef do_exec
1390 #endif
1391 #ifdef scalar
1392 #undef scalar
1393 #endif
1394 #ifdef list
1395 #undef list
1396 #endif
1397 #ifdef apply
1398 #undef apply
1399 #endif
1400 #ifdef convert
1401 #undef convert
1402 #endif
1403 #ifdef Error
1404 #undef Error
1405 #endif
1406 #ifdef form
1407 #undef form
1408 #endif
1409 #ifdef vform
1410 #undef vform
1411 #endif
1412 #ifdef LABEL
1413 #undef LABEL
1414 #endif
1415 #ifdef METHOD
1416 #undef METHOD
1417 #endif
1418 #ifdef Move
1419 #undef Move
1420 #endif
1421 #ifdef yylex
1422 #undef yylex
1423 #endif
1424 #ifdef yyparse
1425 #undef yyparse
1426 #endif
1427 #ifdef yyerror
1428 #undef yyerror
1429 #endif
1430 #ifdef invert
1431 #undef invert
1432 #endif
1433 #ifdef ref
1434 #undef ref
1435 #endif
1436 #ifdef read
1437 #undef read
1438 #endif
1439 #ifdef write
1440 #undef write
1441 #endif
1442 #ifdef eof
1443 #undef eof
1444 #endif
1445 #ifdef close
1446 #undef close
1447 #endif
1448 #ifdef rewind
1449 #undef rewind
1450 #endif
1451 #ifdef free
1452 #undef free
1453 #endif
1454 #ifdef malloc
1455 #undef malloc
1456 #endif
1457 #ifdef calloc
1458 #undef calloc
1459 #endif
1460 #ifdef Stat
1461 #undef Stat
1462 #endif
1463 #ifdef check
1464 #undef check
1465 #endif
1466 #ifdef seekdir
1467 #undef seekdir
1468 #endif
1469 #ifdef open
1470 #undef open
1471 #endif
1472 #ifdef readdir
1473 #undef readdir
1474 #endif
1475 #ifdef bind
1476 #undef bind
1477 #endif
1478 #ifdef access
1479 #undef access
1480 #endif
1481 #ifdef stat
1482 #undef stat
1483 #endif
1484 #ifdef seed
1485 #undef seed
1486 #endif
1487
1488 #ifdef bool
1489 /* Leave if macro is from C99 stdbool.h */
1490 #ifndef __bool_true_false_are_defined
1491
1492 #endif
1493 #endif
1494
1495
1496
1497
1498 #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0)
1499
1500 #define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else
1501
1502
1503
1504 #define SWIG_exception(code, msg) do { SWIG_Error(code, msg); SWIG_fail;; } while(0)
1505
1506
1507 /* -------- TYPES TABLE (BEGIN) -------- */
1508
1509 #define SWIGTYPE_p_GPtrArray swig_types[0]
1510 #define SWIGTYPE_p_char swig_types[1]
1511 #define SWIGTYPE_p_crc_t swig_types[2]
1512 #define SWIGTYPE_p_double swig_types[3]
1513 #define SWIGTYPE_p_file_lock swig_types[4]
1514 #define SWIGTYPE_p_float swig_types[5]
1515 #define SWIGTYPE_p_fs_usage swig_types[6]
1516 #define SWIGTYPE_p_in_port_t swig_types[7]
1517 #define SWIGTYPE_p_int swig_types[8]
1518 #define SWIGTYPE_p_uint32_t swig_types[9]
1519 #define SWIGTYPE_p_uint8_t swig_types[10]
1520 #define SWIGTYPE_p_unsigned_char swig_types[11]
1521 static swig_type_info *swig_types[13];
1522 static swig_module_info swig_module = {swig_types, 12, 0, 0, 0, 0};
1523 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
1524 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
1525
1526 /* -------- TYPES TABLE (END) -------- */
1527
1528 #define SWIG_init boot_Amanda__Util
1529
1530 #define SWIG_name "Amanda::Utilc::boot_Amanda__Util"
1531 #define SWIG_prefix "Amanda::Utilc::"
1532
1533 #define SWIGVERSION 0x030007
1534 #define SWIG_VERSION SWIGVERSION
1535
1536
1537 #define SWIG_as_voidptr(a) (void *)((const void *)(a))
1538 #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a))
1539
1540
1541 #ifdef __cplusplus
1542 extern "C"
1543 #endif
1544 #ifndef PERL_OBJECT
1545 #ifndef MULTIPLICITY
1546 SWIGEXPORT void SWIG_init (CV* cv);
1547 #else
1548 SWIGEXPORT void SWIG_init (pTHXo_ CV* cv);
1549 #endif
1550 #else
1551 SWIGEXPORT void SWIG_init (CV *cv, CPerlObj *);
1552 #endif
1553
1554
1555 #include "amglue.h"
1556
1557
1558 #include "amglue.h"
1559
1560
1561 #include "amglue.h"
1562
1563
1564 #include <unistd.h>
1565 #include "amglue.h"
1566 #include "debug.h"
1567 #include "full-read.h"
1568 #include "full-write.h"
1569 #include "fsusage.h"
1570 #include "stream.h"
1571 /* use a relative path here to avoid conflicting with Perl's util.h. */
1572 #include "../common-src/util.h"
1573 #include "file.h"
1574 #include "sockaddr-util.h"
1575 #include "match.h"
1576
1577
1578 SWIGINTERNINLINE SV *
SWIG_FromCharPtrAndSize(const char * carray,size_t size)1579 SWIG_FromCharPtrAndSize(const char* carray, size_t size)
1580 {
1581 SV *obj = sv_newmortal();
1582 if (carray) {
1583 sv_setpvn(obj, carray, size);
1584 } else {
1585 sv_setsv(obj, &PL_sv_undef);
1586 }
1587 return obj;
1588 }
1589
1590
1591 SWIGINTERNINLINE SV *
SWIG_FromCharPtr(const char * cptr)1592 SWIG_FromCharPtr(const char *cptr)
1593 {
1594 return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
1595 }
1596
1597
1598 SWIGINTERNINLINE SV *
SWIG_PERL_DECL_ARGS_1(long value)1599 SWIG_From_long SWIG_PERL_DECL_ARGS_1(long value)
1600 {
1601 SV *sv;
1602 if (value >= IV_MIN && value <= IV_MAX)
1603 sv = newSViv(value);
1604 else
1605 sv = newSVpvf("%ld", value);
1606 return sv_2mortal(sv);
1607 }
1608
1609
1610 SWIGINTERNINLINE SV *
SWIG_PERL_DECL_ARGS_1(int value)1611 SWIG_From_int SWIG_PERL_DECL_ARGS_1(int value)
1612 {
1613 return SWIG_From_long SWIG_PERL_CALL_ARGS_1(value);
1614 }
1615
1616
1617 SWIGINTERN swig_type_info*
SWIG_pchar_descriptor(void)1618 SWIG_pchar_descriptor(void)
1619 {
1620 static int init = 0;
1621 static swig_type_info* info = 0;
1622 if (!init) {
1623 info = SWIG_TypeQuery("_p_char");
1624 init = 1;
1625 }
1626 return info;
1627 }
1628
1629
1630 SWIGINTERN int
SWIG_AsCharPtrAndSize(SV * obj,char ** cptr,size_t * psize,int * alloc)1631 SWIG_AsCharPtrAndSize(SV *obj, char** cptr, size_t* psize, int *alloc)
1632 {
1633 if (SvMAGICAL(obj)) {
1634 SV *tmp = sv_newmortal();
1635 SvSetSV(tmp, obj);
1636 obj = tmp;
1637 }
1638 if (SvPOK(obj)) {
1639 STRLEN len = 0;
1640 char *cstr = SvPV(obj, len);
1641 size_t size = len + 1;
1642 if (cptr) {
1643 if (alloc) {
1644 if (*alloc == SWIG_NEWOBJ) {
1645 *cptr = (char *)memcpy((char *)malloc((size)*sizeof(char)), cstr, sizeof(char)*(size));
1646 } else {
1647 *cptr = cstr;
1648 *alloc = SWIG_OLDOBJ;
1649 }
1650 }
1651 }
1652 if (psize) *psize = size;
1653 return SWIG_OK;
1654 } else {
1655 swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
1656 if (pchar_descriptor) {
1657 char* vptr = 0;
1658 if (SWIG_ConvertPtr(obj, (void**)&vptr, pchar_descriptor, 0) == SWIG_OK) {
1659 if (cptr) *cptr = vptr;
1660 if (psize) *psize = vptr ? (strlen(vptr) + 1) : 0;
1661 if (alloc) *alloc = SWIG_OLDOBJ;
1662 return SWIG_OK;
1663 }
1664 }
1665 }
1666 return SWIG_TypeError;
1667 }
1668
1669
1670
1671
1672
perl_hexdecode_string(const char * str)1673 char *perl_hexdecode_string(const char *str) {
1674 GError *err = NULL;
1675 char *tmp;
1676 tmp = hexdecode_string(str, &err);
1677 if (err) {
1678 g_free(tmp);
1679 croak_gerror("Amanda util: hexdecode", &err);
1680 }
1681 return tmp;
1682 }
1683
1684
get_fs_usage_(const char * file,struct fs_usage * fsp)1685 void get_fs_usage_(const char *file, struct fs_usage *fsp)
1686 {
1687 int rv = get_fs_usage(file, NULL, fsp);
1688 if (rv == -1)
1689 /* signal an error to the typemap */
1690 fsp->fsu_blocksize = 0;
1691 }
1692
1693
1694 #include <limits.h>
1695 #if !defined(SWIG_NO_LLONG_MAX)
1696 # if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
1697 # define LLONG_MAX __LONG_LONG_MAX__
1698 # define LLONG_MIN (-LLONG_MAX - 1LL)
1699 # define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
1700 # endif
1701 #endif
1702
1703
1704 SWIGINTERN int
SWIG_PERL_DECL_ARGS_2(SV * obj,double * val)1705 SWIG_AsVal_double SWIG_PERL_DECL_ARGS_2(SV *obj, double *val)
1706 {
1707 if (SvNIOK(obj)) {
1708 if (val) *val = SvNV(obj);
1709 return SWIG_OK;
1710 } else if (SvIOK(obj)) {
1711 if (val) *val = (double) SvIV(obj);
1712 return SWIG_AddCast(SWIG_OK);
1713 } else {
1714 const char *nptr = SvPV_nolen(obj);
1715 if (nptr) {
1716 char *endptr;
1717 double v;
1718 errno = 0;
1719 v = strtod(nptr, &endptr);
1720 if (errno == ERANGE) {
1721 errno = 0;
1722 return SWIG_OverflowError;
1723 } else {
1724 if (*endptr == '\0') {
1725 if (val) *val = v;
1726 return SWIG_Str2NumCast(SWIG_OK);
1727 }
1728 }
1729 }
1730 }
1731 return SWIG_TypeError;
1732 }
1733
1734
1735 #include <float.h>
1736
1737
1738 #include <math.h>
1739
1740
1741 SWIGINTERNINLINE int
SWIG_CanCastAsInteger(double * d,double min,double max)1742 SWIG_CanCastAsInteger(double *d, double min, double max) {
1743 double x = *d;
1744 if ((min <= x && x <= max)) {
1745 double fx = floor(x);
1746 double cx = ceil(x);
1747 double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */
1748 if ((errno == EDOM) || (errno == ERANGE)) {
1749 errno = 0;
1750 } else {
1751 double summ, reps, diff;
1752 if (rd < x) {
1753 diff = x - rd;
1754 } else if (rd > x) {
1755 diff = rd - x;
1756 } else {
1757 return 1;
1758 }
1759 summ = rd + x;
1760 reps = diff/summ;
1761 if (reps < 8*DBL_EPSILON) {
1762 *d = rd;
1763 return 1;
1764 }
1765 }
1766 }
1767 return 0;
1768 }
1769
1770
1771 SWIGINTERN int
SWIG_PERL_DECL_ARGS_2(SV * obj,long * val)1772 SWIG_AsVal_long SWIG_PERL_DECL_ARGS_2(SV *obj, long* val)
1773 {
1774 if (SvUOK(obj)) {
1775 UV v = SvUV(obj);
1776 if (v <= LONG_MAX) {
1777 if (val) *val = v;
1778 return SWIG_OK;
1779 }
1780 return SWIG_OverflowError;
1781 } else if (SvIOK(obj)) {
1782 IV v = SvIV(obj);
1783 if (v >= LONG_MIN && v <= LONG_MAX) {
1784 if(val) *val = v;
1785 return SWIG_OK;
1786 }
1787 return SWIG_OverflowError;
1788 } else {
1789 int dispatch = 0;
1790 const char *nptr = SvPV_nolen(obj);
1791 if (nptr) {
1792 char *endptr;
1793 long v;
1794 errno = 0;
1795 v = strtol(nptr, &endptr,0);
1796 if (errno == ERANGE) {
1797 errno = 0;
1798 return SWIG_OverflowError;
1799 } else {
1800 if (*endptr == '\0') {
1801 if (val) *val = v;
1802 return SWIG_Str2NumCast(SWIG_OK);
1803 }
1804 }
1805 }
1806 if (!dispatch) {
1807 double d;
1808 int res = SWIG_AddCast(SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(obj,&d));
1809 if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) {
1810 if (val) *val = (long)(d);
1811 return res;
1812 }
1813 }
1814 }
1815 return SWIG_TypeError;
1816 }
1817
1818
1819 SWIGINTERN int
SWIG_PERL_DECL_ARGS_2(SV * obj,int * val)1820 SWIG_AsVal_int SWIG_PERL_DECL_ARGS_2(SV * obj, int *val)
1821 {
1822 long v;
1823 int res = SWIG_AsVal_long SWIG_PERL_CALL_ARGS_2(obj, &v);
1824 if (SWIG_IsOK(res)) {
1825 if ((v < INT_MIN || v > INT_MAX)) {
1826 return SWIG_OverflowError;
1827 } else {
1828 if (val) *val = (int)(v);
1829 }
1830 }
1831 return res;
1832 }
1833
1834
1835 int
set_blocking(int fd,gboolean blocking)1836 set_blocking(int fd, gboolean blocking)
1837 {
1838 int flags = fcntl(fd, F_GETFL, 0);
1839 if (flags < 0)
1840 return flags;
1841 if (blocking)
1842 flags &= ~O_NONBLOCK;
1843 else
1844 flags |= O_NONBLOCK;
1845 flags = fcntl(fd, F_SETFL, flags);
1846 if (flags < 0)
1847 return flags;
1848 return 0;
1849 }
1850
new_file_lock(char const * filename)1851 SWIGINTERN file_lock *new_file_lock(char const *filename){
1852 return file_lock_new(filename);
1853 }
delete_file_lock(file_lock * self)1854 SWIGINTERN void delete_file_lock(file_lock *self){
1855 file_lock_free(self);
1856 }
1857
1858 SWIGINTERN int
SWIG_PERL_DECL_ARGS_2(SV * obj,unsigned long * val)1859 SWIG_AsVal_unsigned_SS_long SWIG_PERL_DECL_ARGS_2(SV *obj, unsigned long *val)
1860 {
1861 if (SvUOK(obj)) {
1862 UV v = SvUV(obj);
1863 if (v <= ULONG_MAX) {
1864 if (val) *val = v;
1865 return SWIG_OK;
1866 }
1867 return SWIG_OverflowError;
1868 } else if (SvIOK(obj)) {
1869 IV v = SvIV(obj);
1870 if (v >= 0 && v <= ULONG_MAX) {
1871 if (val) *val = v;
1872 return SWIG_OK;
1873 }
1874 return SWIG_OverflowError;
1875 } else {
1876 int dispatch = 0;
1877 const char *nptr = SvPV_nolen(obj);
1878 if (nptr) {
1879 char *endptr;
1880 unsigned long v;
1881 errno = 0;
1882 v = strtoul(nptr, &endptr,0);
1883 if (errno == ERANGE) {
1884 errno = 0;
1885 return SWIG_OverflowError;
1886 } else {
1887 if (*endptr == '\0') {
1888 if (val) *val = v;
1889 return SWIG_Str2NumCast(SWIG_OK);
1890 }
1891 }
1892 }
1893 if (!dispatch) {
1894 double d;
1895 int res = SWIG_AddCast(SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(obj,&d));
1896 if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULONG_MAX)) {
1897 if (val) *val = (unsigned long)(d);
1898 return res;
1899 }
1900 }
1901 }
1902 return SWIG_TypeError;
1903 }
1904
1905
1906 SWIGINTERNINLINE int
SWIG_PERL_DECL_ARGS_2(SV * obj,size_t * val)1907 SWIG_AsVal_size_t SWIG_PERL_DECL_ARGS_2(SV * obj, size_t *val)
1908 {
1909 unsigned long v;
1910 int res = SWIG_AsVal_unsigned_SS_long SWIG_PERL_CALL_ARGS_2(obj, val ? &v : 0);
1911 if (SWIG_IsOK(res) && val) *val = (size_t)(v);
1912 return res;
1913 }
1914
file_lock_data(file_lock * self)1915 SWIGINTERN SV *file_lock_data(file_lock *self){
1916 if (self->data) {
1917 return sv_2mortal(newSVpvn(self->data, self->len));
1918 } else {
1919 return &PL_sv_undef;
1920 }
1921 }
1922
weaken_ref(SV * rv)1923 void weaken_ref(SV *rv) {
1924 sv_rvweaken(rv);
1925 }
1926
1927
gettimeofday_for_perl(void)1928 static guint64 gettimeofday_for_perl(void)
1929 {
1930 GTimeVal t;
1931 g_get_current_time(&t);
1932 return (guint64)t.tv_sec * G_USEC_PER_SEC + (guint64)t.tv_usec;
1933 }
1934
1935 typedef int socketfd;
1936
check_security_fd(int fd,char * userstr,char * service)1937 char *check_security_fd(int fd, char *userstr, char *service)
1938 {
1939 socklen_t_equiv i;
1940 struct sockaddr_in addr;
1941 char *errstr;
1942
1943 /* get the remote address */
1944 i = SIZEOF(addr);
1945 if (getpeername(fd, (struct sockaddr *)&addr, &i) == -1) {
1946 return g_strdup_printf("getpeername: %s", strerror(errno));
1947 }
1948
1949 /* require IPv4 and not port 20 -- apparently this was a common attack
1950 * vector for much older Amandas */
1951 if ((addr.sin_family != (sa_family_t)AF_INET)
1952 || (ntohs(addr.sin_port) == 20)) {
1953 return g_strdup_printf("connection rejected from %s family %d port %d",
1954 inet_ntoa(addr.sin_addr), addr.sin_family, htons(addr.sin_port));
1955 }
1956
1957 /* call out to check_security */
1958 if (!check_security((sockaddr_union *)&addr, userstr, 0, &errstr, service))
1959 return errstr;
1960
1961 return NULL;
1962 }
1963
1964 #ifdef __cplusplus
1965 extern "C" {
1966 #endif
1967
1968 #ifdef PERL_OBJECT
1969 #define MAGIC_CLASS _wrap_Amanda__Util_var::
1970 class _wrap_Amanda__Util_var : public CPerlObj {
1971 public:
1972 #else
1973 #define MAGIC_CLASS
1974 #endif
swig_magic_readonly(pTHX_ SV * SWIGUNUSEDPARM (sv),MAGIC * SWIGUNUSEDPARM (mg))1975 SWIGCLASS_STATIC int swig_magic_readonly(pTHX_ SV *SWIGUNUSEDPARM(sv), MAGIC *SWIGUNUSEDPARM(mg)) {
1976 MAGIC_PPERL
1977 croak("Value is read-only.");
1978 return 0;
1979 }
1980
1981
1982 #ifdef PERL_OBJECT
1983 };
1984 #endif
1985
1986 #ifdef __cplusplus
1987 }
1988 #endif
1989
1990 #ifdef __cplusplus
1991 extern "C" {
1992 #endif
XS(_wrap_glib_init)1993 XS(_wrap_glib_init) {
1994 {
1995 int argvi = 0;
1996 dXSARGS;
1997
1998 if ((items < 0) || (items > 0)) {
1999 SWIG_croak("Usage: glib_init();");
2000 }
2001 glib_init();
2002 ST(argvi) = sv_newmortal();
2003 XSRETURN(argvi);
2004 fail:
2005 SWIG_croak_null();
2006 }
2007 }
2008
2009
XS(_wrap_get_original_cwd)2010 XS(_wrap_get_original_cwd) {
2011 {
2012 int argvi = 0;
2013 char *result = 0 ;
2014 dXSARGS;
2015
2016 if ((items < 0) || (items > 0)) {
2017 SWIG_croak("Usage: get_original_cwd();");
2018 }
2019 result = (char *)get_original_cwd();
2020 ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
2021 XSRETURN(argvi);
2022 fail:
2023 SWIG_croak_null();
2024 }
2025 }
2026
2027
XS(_wrap_hexencode)2028 XS(_wrap_hexencode) {
2029 {
2030 char *arg1 = (char *) 0 ;
2031 int res1 ;
2032 char *buf1 = 0 ;
2033 int alloc1 = 0 ;
2034 int argvi = 0;
2035 char *result = 0 ;
2036 dXSARGS;
2037
2038 if ((items < 1) || (items > 1)) {
2039 SWIG_croak("Usage: hexencode(char *);");
2040 }
2041 res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
2042 if (!SWIG_IsOK(res1)) {
2043 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "hexencode" "', argument " "1"" of type '" "char *""'");
2044 }
2045 arg1 = (char *)(buf1);
2046 result = (char *)hexencode_string(arg1);
2047 ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
2048 if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
2049 XSRETURN(argvi);
2050 fail:
2051 if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
2052 SWIG_croak_null();
2053 }
2054 }
2055
2056
XS(_wrap_hexdecode)2057 XS(_wrap_hexdecode) {
2058 {
2059 char *arg1 = (char *) 0 ;
2060 int res1 ;
2061 char *buf1 = 0 ;
2062 int alloc1 = 0 ;
2063 int argvi = 0;
2064 char *result = 0 ;
2065 dXSARGS;
2066
2067 if ((items < 1) || (items > 1)) {
2068 SWIG_croak("Usage: hexdecode(char *);");
2069 }
2070 res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
2071 if (!SWIG_IsOK(res1)) {
2072 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "hexdecode" "', argument " "1"" of type '" "char *""'");
2073 }
2074 arg1 = (char *)(buf1);
2075 result = (char *)perl_hexdecode_string(arg1);
2076 ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
2077 if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
2078 XSRETURN(argvi);
2079 fail:
2080 if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
2081 SWIG_croak_null();
2082 }
2083 }
2084
2085
XS(_wrap_sanitise_filename)2086 XS(_wrap_sanitise_filename) {
2087 {
2088 char *arg1 = (char *) 0 ;
2089 int res1 ;
2090 char *buf1 = 0 ;
2091 int alloc1 = 0 ;
2092 int argvi = 0;
2093 char *result = 0 ;
2094 dXSARGS;
2095
2096 if ((items < 1) || (items > 1)) {
2097 SWIG_croak("Usage: sanitise_filename(inp);");
2098 }
2099 res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
2100 if (!SWIG_IsOK(res1)) {
2101 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sanitise_filename" "', argument " "1"" of type '" "char *""'");
2102 }
2103 arg1 = (char *)(buf1);
2104 result = (char *)sanitise_filename(arg1);
2105 ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
2106 if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
2107 free((char*)result);
2108 XSRETURN(argvi);
2109 fail:
2110 if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
2111 SWIG_croak_null();
2112 }
2113 }
2114
2115
XS(_wrap_quote_string)2116 XS(_wrap_quote_string) {
2117 {
2118 char *arg1 = (char *) 0 ;
2119 int res1 ;
2120 char *buf1 = 0 ;
2121 int alloc1 = 0 ;
2122 int argvi = 0;
2123 char *result = 0 ;
2124 dXSARGS;
2125
2126 if ((items < 1) || (items > 1)) {
2127 SWIG_croak("Usage: quote_string(char *);");
2128 }
2129 res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
2130 if (!SWIG_IsOK(res1)) {
2131 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "quote_string" "', argument " "1"" of type '" "char *""'");
2132 }
2133 arg1 = (char *)(buf1);
2134 result = (char *)quote_string(arg1);
2135 ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
2136 if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
2137 free((char*)result);
2138 XSRETURN(argvi);
2139 fail:
2140 if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
2141 SWIG_croak_null();
2142 }
2143 }
2144
2145
XS(_wrap_unquote_string)2146 XS(_wrap_unquote_string) {
2147 {
2148 char *arg1 = (char *) 0 ;
2149 int res1 ;
2150 char *buf1 = 0 ;
2151 int alloc1 = 0 ;
2152 int argvi = 0;
2153 char *result = 0 ;
2154 dXSARGS;
2155
2156 if ((items < 1) || (items > 1)) {
2157 SWIG_croak("Usage: unquote_string(char *);");
2158 }
2159 res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
2160 if (!SWIG_IsOK(res1)) {
2161 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "unquote_string" "', argument " "1"" of type '" "char *""'");
2162 }
2163 arg1 = (char *)(buf1);
2164 result = (char *)unquote_string(arg1);
2165 ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
2166 if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
2167 free((char*)result);
2168 XSRETURN(argvi);
2169 fail:
2170 if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
2171 SWIG_croak_null();
2172 }
2173 }
2174
2175
XS(_wrap_expand_braced_alternates)2176 XS(_wrap_expand_braced_alternates) {
2177 {
2178 char *arg1 = (char *) 0 ;
2179 int res1 ;
2180 char *buf1 = 0 ;
2181 int alloc1 = 0 ;
2182 int argvi = 0;
2183 GPtrArray *result = 0 ;
2184 dXSARGS;
2185
2186 if ((items < 1) || (items > 1)) {
2187 SWIG_croak("Usage: expand_braced_alternates(char *);");
2188 }
2189 res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
2190 if (!SWIG_IsOK(res1)) {
2191 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "expand_braced_alternates" "', argument " "1"" of type '" "char *""'");
2192 }
2193 arg1 = (char *)(buf1);
2194 result = (GPtrArray *)expand_braced_alternates(arg1);
2195 {
2196 if (result) {
2197 guint i;
2198 gpointer *pdata;
2199
2200 EXTEND(sp, result->len);
2201 for (i = 0, pdata = result->pdata; i < result->len; i++) {
2202 char *str = *pdata++;
2203 ST(argvi) = sv_2mortal(newSVpv(str, 0));
2204 g_free(str);
2205 argvi++;
2206 }
2207 g_ptr_array_free(result, TRUE);
2208 } else {
2209 ST(argvi) = &PL_sv_undef;
2210 argvi++;
2211 }
2212 }
2213 if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
2214 XSRETURN(argvi);
2215 fail:
2216 if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
2217 SWIG_croak_null();
2218 }
2219 }
2220
2221
XS(_wrap_collapse_braced_alternates)2222 XS(_wrap_collapse_braced_alternates) {
2223 {
2224 GPtrArray *arg1 = (GPtrArray *) 0 ;
2225 int argvi = 0;
2226 char *result = 0 ;
2227 dXSARGS;
2228
2229 if ((items < 1) || (items > 1)) {
2230 SWIG_croak("Usage: collapse_braced_alternates(source);");
2231 }
2232 {
2233 AV *av;
2234 guint len;
2235 int i;
2236
2237 if (!SvROK(ST(0)) || SvTYPE(SvRV(ST(0))) != SVt_PVAV) {
2238 SWIG_exception(SWIG_TypeError, "Expected an arrayref");
2239 }
2240 av = (AV *)SvRV(ST(0));
2241
2242 len = av_len(av)+1; /* av_len(av) is like $#av */
2243 arg1 = g_ptr_array_sized_new(len);
2244 for (i = 0; i < len; i++) {
2245 SV **elt = av_fetch(av, i, 0);
2246 if (!elt || !SvPOK(*elt)) {
2247 SWIG_exception(SWIG_TypeError, "Non-string in arrayref");
2248 }
2249 g_ptr_array_add(arg1, SvPV_nolen(*elt)); /* TODO: handle unicode here */
2250 }
2251 }
2252 result = (char *)collapse_braced_alternates(arg1);
2253 ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
2254 {
2255 g_ptr_array_free(arg1, FALSE);
2256 }
2257 free((char*)result);
2258 XSRETURN(argvi);
2259 fail:
2260 {
2261 g_ptr_array_free(arg1, FALSE);
2262 }
2263 SWIG_croak_null();
2264 }
2265 }
2266
2267
XS(_wrap_split_quoted_strings)2268 XS(_wrap_split_quoted_strings) {
2269 {
2270 gchar *arg1 = (gchar *) 0 ;
2271 int res1 ;
2272 char *buf1 = 0 ;
2273 int alloc1 = 0 ;
2274 int argvi = 0;
2275 gchar **result = 0 ;
2276 dXSARGS;
2277
2278 if ((items < 1) || (items > 1)) {
2279 SWIG_croak("Usage: split_quoted_strings(string);");
2280 }
2281 res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
2282 if (!SWIG_IsOK(res1)) {
2283 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "split_quoted_strings" "', argument " "1"" of type '" "gchar const *""'");
2284 }
2285 arg1 = (gchar *)(buf1);
2286 result = (gchar **)split_quoted_strings((char const *)arg1);
2287 {
2288 gchar **iter;
2289
2290 if (result) {
2291 /* Count the DeviceProperties */
2292 EXTEND(SP, g_strv_length(result)); /* make room for return values */
2293
2294 /* Note that we set ST(argvi) several times. the nature of
2295 * SWIG's wrapping is such that incrementing argvi points
2296 * ST(argvi) to the next location in perl's argument stack.
2297 */
2298
2299 for (iter = result; *iter; iter++) {
2300 ST(argvi) = sv_2mortal(newSVpv(*iter, 0));
2301 g_free(*iter);
2302 argvi++;
2303 }
2304 g_free(result);
2305 }
2306 }
2307 if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
2308 XSRETURN(argvi);
2309 fail:
2310 if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
2311 SWIG_croak_null();
2312 }
2313 }
2314
2315
XS(_wrap_get_fs_usage)2316 XS(_wrap_get_fs_usage) {
2317 {
2318 char *arg1 = (char *) 0 ;
2319 struct fs_usage *arg2 = (struct fs_usage *) 0 ;
2320 int res1 ;
2321 char *buf1 = 0 ;
2322 int alloc1 = 0 ;
2323 struct fs_usage fsu2 ;
2324 int argvi = 0;
2325 dXSARGS;
2326
2327 {
2328 bzero(&fsu2, sizeof(fsu2));
2329 arg2 = &fsu2;
2330 }
2331 if ((items < 1) || (items > 1)) {
2332 SWIG_croak("Usage: get_fs_usage(file);");
2333 }
2334 res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
2335 if (!SWIG_IsOK(res1)) {
2336 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "get_fs_usage" "', argument " "1"" of type '" "char const *""'");
2337 }
2338 arg1 = (char *)(buf1);
2339 get_fs_usage_((char const *)arg1,arg2);
2340 ST(argvi) = sv_newmortal();
2341 {
2342 SV *sv;
2343 HV *hv;
2344
2345 /* if there was an error, assume that fsu_blocksize isn't changed,
2346 * and return undef. */
2347 if (arg2->fsu_blocksize) {
2348 SP += argvi; PUTBACK; /* save the perl stack so amglue_newSVi64 doesn't kill it */
2349 hv = (HV *)sv_2mortal((SV *)newHV());
2350 hv_store(hv, "blocksize", 9, amglue_newSVi64(arg2->fsu_blocksize), 0);
2351 hv_store(hv, "blocks", 6, amglue_newSVi64(arg2->fsu_blocks), 0);
2352 hv_store(hv, "bfree", 5, amglue_newSVi64(arg2->fsu_bfree), 0);
2353 hv_store(hv, "bavail", 6, amglue_newSVi64(arg2->fsu_bavail), 0);
2354 hv_store(hv, "bavail_top_bit_set", 18, newSViv(arg2->fsu_bavail_top_bit_set), 0);
2355 hv_store(hv, "files", 5, amglue_newSVi64(arg2->fsu_files), 0);
2356 hv_store(hv, "ffree", 5, amglue_newSVi64(arg2->fsu_ffree), 0);
2357
2358 ST(argvi) = newRV((SV *)hv);
2359 SPAGAIN; SP -= argvi;
2360 argvi++;
2361 }
2362 }
2363 if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
2364
2365 XSRETURN(argvi);
2366 fail:
2367 if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
2368
2369 SWIG_croak_null();
2370 }
2371 }
2372
2373
XS(_wrap_fsync)2374 XS(_wrap_fsync) {
2375 {
2376 int arg1 ;
2377 int argvi = 0;
2378 int result;
2379 dXSARGS;
2380
2381 if ((items < 1) || (items > 1)) {
2382 SWIG_croak("Usage: fsync(fd);");
2383 }
2384 {
2385 IO *io = NULL;
2386 PerlIO *pio = NULL;
2387 int fd = -1;
2388
2389 if (SvIOK(ST(0))) {
2390 /* plain old integer */
2391 arg1 = SvIV(ST(0));
2392 } else {
2393 /* try extracting as filehandle */
2394
2395 /* note: sv_2io may call die() */
2396 io = sv_2io(ST(0));
2397 if (io) {
2398 pio = IoIFP(io);
2399 }
2400 if (pio) {
2401 fd = PerlIO_fileno(pio);
2402 }
2403 if (fd >= 0) {
2404 arg1 = fd;
2405 } else {
2406 SWIG_exception(SWIG_TypeError, "Expected integer file descriptor "
2407 "or file handle for argument 1");
2408 }
2409 }
2410 }
2411 result = (int)fsync(arg1);
2412 {
2413 SV *for_stack;
2414 SP += argvi; PUTBACK;
2415 for_stack = sv_2mortal(amglue_newSVi64(result));
2416 SPAGAIN; SP -= argvi;
2417 ST(argvi) = for_stack;
2418 argvi++;
2419 }
2420
2421 XSRETURN(argvi);
2422 fail:
2423
2424 SWIG_croak_null();
2425 }
2426 }
2427
2428
XS(_wrap_set_blocking)2429 XS(_wrap_set_blocking) {
2430 {
2431 int arg1 ;
2432 gboolean arg2 ;
2433 int argvi = 0;
2434 int result;
2435 dXSARGS;
2436
2437 if ((items < 2) || (items > 2)) {
2438 SWIG_croak("Usage: set_blocking(fd,blocking);");
2439 }
2440 {
2441 IO *io = NULL;
2442 PerlIO *pio = NULL;
2443 int fd = -1;
2444
2445 if (SvIOK(ST(0))) {
2446 /* plain old integer */
2447 arg1 = SvIV(ST(0));
2448 } else {
2449 /* try extracting as filehandle */
2450
2451 /* note: sv_2io may call die() */
2452 io = sv_2io(ST(0));
2453 if (io) {
2454 pio = IoIFP(io);
2455 }
2456 if (pio) {
2457 fd = PerlIO_fileno(pio);
2458 }
2459 if (fd >= 0) {
2460 arg1 = fd;
2461 } else {
2462 SWIG_exception(SWIG_TypeError, "Expected integer file descriptor "
2463 "or file handle for argument 1");
2464 }
2465 }
2466 }
2467 {
2468 arg2 = SvTRUE(ST(1));
2469 }
2470 result = (int)set_blocking(arg1,arg2);
2471 {
2472 SV *for_stack;
2473 SP += argvi; PUTBACK;
2474 for_stack = sv_2mortal(amglue_newSVi64(result));
2475 SPAGAIN; SP -= argvi;
2476 ST(argvi) = for_stack;
2477 argvi++;
2478 }
2479
2480
2481 XSRETURN(argvi);
2482 fail:
2483
2484
2485 SWIG_croak_null();
2486 }
2487 }
2488
2489
XS(_wrap_new_file_lock)2490 XS(_wrap_new_file_lock) {
2491 {
2492 char *arg1 = (char *) 0 ;
2493 int res1 ;
2494 char *buf1 = 0 ;
2495 int alloc1 = 0 ;
2496 int argvi = 0;
2497 file_lock *result = 0 ;
2498 dXSARGS;
2499
2500 if ((items < 1) || (items > 1)) {
2501 SWIG_croak("Usage: new_file_lock(filename);");
2502 }
2503 res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
2504 if (!SWIG_IsOK(res1)) {
2505 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_file_lock" "', argument " "1"" of type '" "char const *""'");
2506 }
2507 arg1 = (char *)(buf1);
2508 result = (file_lock *)new_file_lock((char const *)arg1);
2509 ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_file_lock, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
2510 if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
2511 XSRETURN(argvi);
2512 fail:
2513 if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
2514 SWIG_croak_null();
2515 }
2516 }
2517
2518
XS(_wrap_delete_file_lock)2519 XS(_wrap_delete_file_lock) {
2520 {
2521 file_lock *arg1 = (file_lock *) 0 ;
2522 void *argp1 = 0 ;
2523 int res1 = 0 ;
2524 int argvi = 0;
2525 dXSARGS;
2526
2527 if ((items < 1) || (items > 1)) {
2528 SWIG_croak("Usage: delete_file_lock(self);");
2529 }
2530 res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_file_lock, SWIG_POINTER_DISOWN | 0 );
2531 if (!SWIG_IsOK(res1)) {
2532 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_file_lock" "', argument " "1"" of type '" "file_lock *""'");
2533 }
2534 arg1 = (file_lock *)(argp1);
2535 delete_file_lock(arg1);
2536 ST(argvi) = sv_newmortal();
2537
2538 XSRETURN(argvi);
2539 fail:
2540
2541 SWIG_croak_null();
2542 }
2543 }
2544
2545
XS(_wrap_file_lock_lock)2546 XS(_wrap_file_lock_lock) {
2547 {
2548 file_lock *arg1 = (file_lock *) 0 ;
2549 void *argp1 = 0 ;
2550 int res1 = 0 ;
2551 int argvi = 0;
2552 int result;
2553 dXSARGS;
2554
2555 if ((items < 1) || (items > 1)) {
2556 SWIG_croak("Usage: file_lock_lock(self);");
2557 }
2558 res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_file_lock, 0 | 0 );
2559 if (!SWIG_IsOK(res1)) {
2560 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "file_lock_lock" "', argument " "1"" of type '" "file_lock *""'");
2561 }
2562 arg1 = (file_lock *)(argp1);
2563 result = (int)file_lock_lock(arg1);
2564 {
2565 SV *for_stack;
2566 SP += argvi; PUTBACK;
2567 for_stack = sv_2mortal(amglue_newSVi64(result));
2568 SPAGAIN; SP -= argvi;
2569 ST(argvi) = for_stack;
2570 argvi++;
2571 }
2572
2573 XSRETURN(argvi);
2574 fail:
2575
2576 SWIG_croak_null();
2577 }
2578 }
2579
2580
XS(_wrap_file_lock_lock_wr)2581 XS(_wrap_file_lock_lock_wr) {
2582 {
2583 file_lock *arg1 = (file_lock *) 0 ;
2584 void *argp1 = 0 ;
2585 int res1 = 0 ;
2586 int argvi = 0;
2587 int result;
2588 dXSARGS;
2589
2590 if ((items < 1) || (items > 1)) {
2591 SWIG_croak("Usage: file_lock_lock_wr(self);");
2592 }
2593 res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_file_lock, 0 | 0 );
2594 if (!SWIG_IsOK(res1)) {
2595 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "file_lock_lock_wr" "', argument " "1"" of type '" "file_lock *""'");
2596 }
2597 arg1 = (file_lock *)(argp1);
2598 result = (int)file_lock_lock_wr(arg1);
2599 {
2600 SV *for_stack;
2601 SP += argvi; PUTBACK;
2602 for_stack = sv_2mortal(amglue_newSVi64(result));
2603 SPAGAIN; SP -= argvi;
2604 ST(argvi) = for_stack;
2605 argvi++;
2606 }
2607
2608 XSRETURN(argvi);
2609 fail:
2610
2611 SWIG_croak_null();
2612 }
2613 }
2614
2615
XS(_wrap_file_lock_lock_rd)2616 XS(_wrap_file_lock_lock_rd) {
2617 {
2618 file_lock *arg1 = (file_lock *) 0 ;
2619 void *argp1 = 0 ;
2620 int res1 = 0 ;
2621 int argvi = 0;
2622 int result;
2623 dXSARGS;
2624
2625 if ((items < 1) || (items > 1)) {
2626 SWIG_croak("Usage: file_lock_lock_rd(self);");
2627 }
2628 res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_file_lock, 0 | 0 );
2629 if (!SWIG_IsOK(res1)) {
2630 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "file_lock_lock_rd" "', argument " "1"" of type '" "file_lock *""'");
2631 }
2632 arg1 = (file_lock *)(argp1);
2633 result = (int)file_lock_lock_rd(arg1);
2634 {
2635 SV *for_stack;
2636 SP += argvi; PUTBACK;
2637 for_stack = sv_2mortal(amglue_newSVi64(result));
2638 SPAGAIN; SP -= argvi;
2639 ST(argvi) = for_stack;
2640 argvi++;
2641 }
2642
2643 XSRETURN(argvi);
2644 fail:
2645
2646 SWIG_croak_null();
2647 }
2648 }
2649
2650
XS(_wrap_file_lock_unlock)2651 XS(_wrap_file_lock_unlock) {
2652 {
2653 file_lock *arg1 = (file_lock *) 0 ;
2654 void *argp1 = 0 ;
2655 int res1 = 0 ;
2656 int argvi = 0;
2657 int result;
2658 dXSARGS;
2659
2660 if ((items < 1) || (items > 1)) {
2661 SWIG_croak("Usage: file_lock_unlock(self);");
2662 }
2663 res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_file_lock, 0 | 0 );
2664 if (!SWIG_IsOK(res1)) {
2665 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "file_lock_unlock" "', argument " "1"" of type '" "file_lock *""'");
2666 }
2667 arg1 = (file_lock *)(argp1);
2668 result = (int)file_lock_unlock(arg1);
2669 {
2670 SV *for_stack;
2671 SP += argvi; PUTBACK;
2672 for_stack = sv_2mortal(amglue_newSVi64(result));
2673 SPAGAIN; SP -= argvi;
2674 ST(argvi) = for_stack;
2675 argvi++;
2676 }
2677
2678 XSRETURN(argvi);
2679 fail:
2680
2681 SWIG_croak_null();
2682 }
2683 }
2684
2685
XS(_wrap_file_lock_locked)2686 XS(_wrap_file_lock_locked) {
2687 {
2688 file_lock *arg1 = (file_lock *) 0 ;
2689 void *argp1 = 0 ;
2690 int res1 = 0 ;
2691 int argvi = 0;
2692 int result;
2693 dXSARGS;
2694
2695 if ((items < 1) || (items > 1)) {
2696 SWIG_croak("Usage: file_lock_locked(self);");
2697 }
2698 res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_file_lock, 0 | 0 );
2699 if (!SWIG_IsOK(res1)) {
2700 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "file_lock_locked" "', argument " "1"" of type '" "file_lock *""'");
2701 }
2702 arg1 = (file_lock *)(argp1);
2703 result = (int)file_lock_locked(arg1);
2704 {
2705 SV *for_stack;
2706 SP += argvi; PUTBACK;
2707 for_stack = sv_2mortal(amglue_newSVi64(result));
2708 SPAGAIN; SP -= argvi;
2709 ST(argvi) = for_stack;
2710 argvi++;
2711 }
2712
2713 XSRETURN(argvi);
2714 fail:
2715
2716 SWIG_croak_null();
2717 }
2718 }
2719
2720
XS(_wrap_file_lock_write)2721 XS(_wrap_file_lock_write) {
2722 {
2723 file_lock *arg1 = (file_lock *) 0 ;
2724 char *arg2 = (char *) 0 ;
2725 size_t arg3 ;
2726 void *argp1 = 0 ;
2727 int res1 = 0 ;
2728 int argvi = 0;
2729 int result;
2730 dXSARGS;
2731
2732 if ((items < 2) || (items > 2)) {
2733 SWIG_croak("Usage: file_lock_write(self,data,len);");
2734 }
2735 res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_file_lock, 0 | 0 );
2736 if (!SWIG_IsOK(res1)) {
2737 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "file_lock_write" "', argument " "1"" of type '" "file_lock *""'");
2738 }
2739 arg1 = (file_lock *)(argp1);
2740 {
2741 arg2 = SvPV(ST(1), arg3);
2742 }
2743 result = (int)file_lock_write(arg1,(char const *)arg2,arg3);
2744 {
2745 SV *for_stack;
2746 SP += argvi; PUTBACK;
2747 for_stack = sv_2mortal(amglue_newSVi64(result));
2748 SPAGAIN; SP -= argvi;
2749 ST(argvi) = for_stack;
2750 argvi++;
2751 }
2752
2753
2754 XSRETURN(argvi);
2755 fail:
2756
2757
2758 SWIG_croak_null();
2759 }
2760 }
2761
2762
XS(_wrap_file_lock_data)2763 XS(_wrap_file_lock_data) {
2764 {
2765 file_lock *arg1 = (file_lock *) 0 ;
2766 void *argp1 = 0 ;
2767 int res1 = 0 ;
2768 int argvi = 0;
2769 SV *result = 0 ;
2770 dXSARGS;
2771
2772 if ((items < 1) || (items > 1)) {
2773 SWIG_croak("Usage: file_lock_data(self);");
2774 }
2775 res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_file_lock, 0 | 0 );
2776 if (!SWIG_IsOK(res1)) {
2777 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "file_lock_data" "', argument " "1"" of type '" "file_lock *""'");
2778 }
2779 arg1 = (file_lock *)(argp1);
2780 result = (SV *)file_lock_data(arg1);
2781 {
2782 ST(argvi) = result; argvi++;
2783 }
2784
2785 XSRETURN(argvi);
2786 fail:
2787
2788 SWIG_croak_null();
2789 }
2790 }
2791
2792
XS(_wrap_weaken_ref)2793 XS(_wrap_weaken_ref) {
2794 {
2795 SV *arg1 = (SV *) 0 ;
2796 int argvi = 0;
2797 dXSARGS;
2798
2799 if ((items < 1) || (items > 1)) {
2800 SWIG_croak("Usage: weaken_ref(rv);");
2801 }
2802 arg1 = ST(0);
2803 weaken_ref(arg1);
2804 ST(argvi) = sv_newmortal();
2805
2806 XSRETURN(argvi);
2807 fail:
2808
2809 SWIG_croak_null();
2810 }
2811 }
2812
2813
XS(_wrap_gettimeofday)2814 XS(_wrap_gettimeofday) {
2815 {
2816 int argvi = 0;
2817 guint64 result;
2818 dXSARGS;
2819
2820 if ((items < 0) || (items > 0)) {
2821 SWIG_croak("Usage: gettimeofday();");
2822 }
2823 result = gettimeofday_for_perl();
2824 {
2825 SV *for_stack;
2826 SP += argvi; PUTBACK;
2827 for_stack = sv_2mortal(amglue_newSVu64(result));
2828 SPAGAIN; SP -= argvi;
2829 ST(argvi) = for_stack;
2830 argvi++;
2831 }
2832 XSRETURN(argvi);
2833 fail:
2834 SWIG_croak_null();
2835 }
2836 }
2837
2838
XS(_wrap_openbsd_fd_inform)2839 XS(_wrap_openbsd_fd_inform) {
2840 {
2841 int argvi = 0;
2842 dXSARGS;
2843
2844 if ((items < 0) || (items > 0)) {
2845 SWIG_croak("Usage: openbsd_fd_inform();");
2846 }
2847 openbsd_fd_inform();
2848 ST(argvi) = sv_newmortal();
2849 XSRETURN(argvi);
2850 fail:
2851 SWIG_croak_null();
2852 }
2853 }
2854
2855
XS(_wrap_stream_server)2856 XS(_wrap_stream_server) {
2857 {
2858 int arg1 ;
2859 in_port_t *arg2 = (in_port_t *) 0 ;
2860 size_t arg3 ;
2861 size_t arg4 ;
2862 gboolean arg5 ;
2863 in_port_t port2 ;
2864 int argvi = 0;
2865 socketfd result;
2866 dXSARGS;
2867
2868 {
2869 arg2 = &port2;
2870 }
2871 if ((items < 4) || (items > 4)) {
2872 SWIG_croak("Usage: stream_server(family,sendsize,recvsize,privileged);");
2873 }
2874 {
2875 if (sizeof(signed int) == 1) {
2876 arg1 = amglue_SvI8(ST(0));
2877 } else if (sizeof(signed int) == 2) {
2878 arg1 = amglue_SvI16(ST(0));
2879 } else if (sizeof(signed int) == 4) {
2880 arg1 = amglue_SvI32(ST(0));
2881 } else if (sizeof(signed int) == 8) {
2882 arg1 = amglue_SvI64(ST(0));
2883 } else {
2884 g_critical("Unexpected signed int >64 bits?"); /* should be optimized out unless sizeof(signed int) > 8 */
2885 }
2886 }
2887 {
2888 if (sizeof(size_t) == 1) {
2889 arg3 = amglue_SvU8(ST(1));
2890 } else if (sizeof(size_t) == 2) {
2891 arg3 = amglue_SvU16(ST(1));
2892 } else if (sizeof(size_t) == 4) {
2893 arg3 = amglue_SvU32(ST(1));
2894 } else if (sizeof(size_t) == 8) {
2895 arg3 = amglue_SvU64(ST(1));
2896 } else {
2897 croak("Unexpected size_t >64 bits?"); /* should be optimized out unless sizeof(size_t) > 8 */
2898 }
2899 }
2900 {
2901 if (sizeof(size_t) == 1) {
2902 arg4 = amglue_SvU8(ST(2));
2903 } else if (sizeof(size_t) == 2) {
2904 arg4 = amglue_SvU16(ST(2));
2905 } else if (sizeof(size_t) == 4) {
2906 arg4 = amglue_SvU32(ST(2));
2907 } else if (sizeof(size_t) == 8) {
2908 arg4 = amglue_SvU64(ST(2));
2909 } else {
2910 croak("Unexpected size_t >64 bits?"); /* should be optimized out unless sizeof(size_t) > 8 */
2911 }
2912 }
2913 {
2914 arg5 = SvTRUE(ST(3));
2915 }
2916 result = stream_server(arg1,arg2,arg3,arg4,arg5);
2917 {
2918 ST(argvi) = sv_2mortal(newSViv(result));
2919 argvi++;
2920 }
2921 {
2922 ST(argvi) = sv_2mortal(newSViv(*arg2));
2923 argvi++;
2924 }
2925
2926
2927
2928
2929
2930 XSRETURN(argvi);
2931 fail:
2932
2933
2934
2935
2936
2937 SWIG_croak_null();
2938 }
2939 }
2940
2941
XS(_wrap_stream_accept)2942 XS(_wrap_stream_accept) {
2943 {
2944 int arg1 ;
2945 int arg2 ;
2946 size_t arg3 ;
2947 size_t arg4 ;
2948 int argvi = 0;
2949 socketfd result;
2950 dXSARGS;
2951
2952 if ((items < 4) || (items > 4)) {
2953 SWIG_croak("Usage: stream_accept(fd,timeout,sendsize,recvsize);");
2954 }
2955 {
2956 IO *io = NULL;
2957 PerlIO *pio = NULL;
2958 int fd = -1;
2959
2960 if (SvIOK(ST(0))) {
2961 /* plain old integer */
2962 arg1 = SvIV(ST(0));
2963 } else {
2964 /* try extracting as filehandle */
2965
2966 /* note: sv_2io may call die() */
2967 io = sv_2io(ST(0));
2968 if (io) {
2969 pio = IoIFP(io);
2970 }
2971 if (pio) {
2972 fd = PerlIO_fileno(pio);
2973 }
2974 if (fd >= 0) {
2975 arg1 = fd;
2976 } else {
2977 SWIG_exception(SWIG_TypeError, "Expected integer file descriptor "
2978 "or file handle for argument 1");
2979 }
2980 }
2981 }
2982 {
2983 if (sizeof(signed int) == 1) {
2984 arg2 = amglue_SvI8(ST(1));
2985 } else if (sizeof(signed int) == 2) {
2986 arg2 = amglue_SvI16(ST(1));
2987 } else if (sizeof(signed int) == 4) {
2988 arg2 = amglue_SvI32(ST(1));
2989 } else if (sizeof(signed int) == 8) {
2990 arg2 = amglue_SvI64(ST(1));
2991 } else {
2992 g_critical("Unexpected signed int >64 bits?"); /* should be optimized out unless sizeof(signed int) > 8 */
2993 }
2994 }
2995 {
2996 if (sizeof(size_t) == 1) {
2997 arg3 = amglue_SvU8(ST(2));
2998 } else if (sizeof(size_t) == 2) {
2999 arg3 = amglue_SvU16(ST(2));
3000 } else if (sizeof(size_t) == 4) {
3001 arg3 = amglue_SvU32(ST(2));
3002 } else if (sizeof(size_t) == 8) {
3003 arg3 = amglue_SvU64(ST(2));
3004 } else {
3005 croak("Unexpected size_t >64 bits?"); /* should be optimized out unless sizeof(size_t) > 8 */
3006 }
3007 }
3008 {
3009 if (sizeof(size_t) == 1) {
3010 arg4 = amglue_SvU8(ST(3));
3011 } else if (sizeof(size_t) == 2) {
3012 arg4 = amglue_SvU16(ST(3));
3013 } else if (sizeof(size_t) == 4) {
3014 arg4 = amglue_SvU32(ST(3));
3015 } else if (sizeof(size_t) == 8) {
3016 arg4 = amglue_SvU64(ST(3));
3017 } else {
3018 croak("Unexpected size_t >64 bits?"); /* should be optimized out unless sizeof(size_t) > 8 */
3019 }
3020 }
3021 result = stream_accept(arg1,arg2,arg3,arg4);
3022 {
3023 ST(argvi) = sv_2mortal(newSViv(result));
3024 argvi++;
3025 }
3026
3027
3028
3029
3030 XSRETURN(argvi);
3031 fail:
3032
3033
3034
3035
3036 SWIG_croak_null();
3037 }
3038 }
3039
3040
XS(_wrap_check_security)3041 XS(_wrap_check_security) {
3042 {
3043 int arg1 ;
3044 char *arg2 = (char *) 0 ;
3045 char *arg3 = (char *) 0 ;
3046 int res2 ;
3047 char *buf2 = 0 ;
3048 int alloc2 = 0 ;
3049 int res3 ;
3050 char *buf3 = 0 ;
3051 int alloc3 = 0 ;
3052 int argvi = 0;
3053 char *result = 0 ;
3054 dXSARGS;
3055
3056 if ((items < 3) || (items > 3)) {
3057 SWIG_croak("Usage: check_security(fd,userstr,service);");
3058 }
3059 {
3060 IO *io = NULL;
3061 PerlIO *pio = NULL;
3062 int fd = -1;
3063
3064 if (SvIOK(ST(0))) {
3065 /* plain old integer */
3066 arg1 = SvIV(ST(0));
3067 } else {
3068 /* try extracting as filehandle */
3069
3070 /* note: sv_2io may call die() */
3071 io = sv_2io(ST(0));
3072 if (io) {
3073 pio = IoIFP(io);
3074 }
3075 if (pio) {
3076 fd = PerlIO_fileno(pio);
3077 }
3078 if (fd >= 0) {
3079 arg1 = fd;
3080 } else {
3081 SWIG_exception(SWIG_TypeError, "Expected integer file descriptor "
3082 "or file handle for argument 1");
3083 }
3084 }
3085 }
3086 res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
3087 if (!SWIG_IsOK(res2)) {
3088 SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "check_security" "', argument " "2"" of type '" "char *""'");
3089 }
3090 arg2 = (char *)(buf2);
3091 res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
3092 if (!SWIG_IsOK(res3)) {
3093 SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "check_security" "', argument " "3"" of type '" "char *""'");
3094 }
3095 arg3 = (char *)(buf3);
3096 result = (char *)check_security_fd(arg1,arg2,arg3);
3097 ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
3098
3099 if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
3100 if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
3101 free((char*)result);
3102 XSRETURN(argvi);
3103 fail:
3104
3105 if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
3106 if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
3107 SWIG_croak_null();
3108 }
3109 }
3110
3111
XS(_wrap_match_host)3112 XS(_wrap_match_host) {
3113 {
3114 char *arg1 = (char *) 0 ;
3115 char *arg2 = (char *) 0 ;
3116 int res1 ;
3117 char *buf1 = 0 ;
3118 int alloc1 = 0 ;
3119 int res2 ;
3120 char *buf2 = 0 ;
3121 int alloc2 = 0 ;
3122 int argvi = 0;
3123 gboolean result;
3124 dXSARGS;
3125
3126 if ((items < 2) || (items > 2)) {
3127 SWIG_croak("Usage: match_host(pat,value);");
3128 }
3129 res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
3130 if (!SWIG_IsOK(res1)) {
3131 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "match_host" "', argument " "1"" of type '" "char *""'");
3132 }
3133 arg1 = (char *)(buf1);
3134 res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
3135 if (!SWIG_IsOK(res2)) {
3136 SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "match_host" "', argument " "2"" of type '" "char *""'");
3137 }
3138 arg2 = (char *)(buf2);
3139 result = (gboolean)match_host(arg1,arg2);
3140 {
3141 if (result)
3142 ST(argvi) = &PL_sv_yes;
3143 else
3144 ST(argvi) = &PL_sv_no;
3145 argvi++;
3146 }
3147 if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
3148 if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
3149 XSRETURN(argvi);
3150 fail:
3151 if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
3152 if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
3153 SWIG_croak_null();
3154 }
3155 }
3156
3157
XS(_wrap_match_disk)3158 XS(_wrap_match_disk) {
3159 {
3160 char *arg1 = (char *) 0 ;
3161 char *arg2 = (char *) 0 ;
3162 int res1 ;
3163 char *buf1 = 0 ;
3164 int alloc1 = 0 ;
3165 int res2 ;
3166 char *buf2 = 0 ;
3167 int alloc2 = 0 ;
3168 int argvi = 0;
3169 gboolean result;
3170 dXSARGS;
3171
3172 if ((items < 2) || (items > 2)) {
3173 SWIG_croak("Usage: match_disk(pat,value);");
3174 }
3175 res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
3176 if (!SWIG_IsOK(res1)) {
3177 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "match_disk" "', argument " "1"" of type '" "char *""'");
3178 }
3179 arg1 = (char *)(buf1);
3180 res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
3181 if (!SWIG_IsOK(res2)) {
3182 SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "match_disk" "', argument " "2"" of type '" "char *""'");
3183 }
3184 arg2 = (char *)(buf2);
3185 result = (gboolean)match_disk(arg1,arg2);
3186 {
3187 if (result)
3188 ST(argvi) = &PL_sv_yes;
3189 else
3190 ST(argvi) = &PL_sv_no;
3191 argvi++;
3192 }
3193 if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
3194 if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
3195 XSRETURN(argvi);
3196 fail:
3197 if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
3198 if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
3199 SWIG_croak_null();
3200 }
3201 }
3202
3203
XS(_wrap_match_datestamp)3204 XS(_wrap_match_datestamp) {
3205 {
3206 char *arg1 = (char *) 0 ;
3207 char *arg2 = (char *) 0 ;
3208 int res1 ;
3209 char *buf1 = 0 ;
3210 int alloc1 = 0 ;
3211 int res2 ;
3212 char *buf2 = 0 ;
3213 int alloc2 = 0 ;
3214 int argvi = 0;
3215 gboolean result;
3216 dXSARGS;
3217
3218 if ((items < 2) || (items > 2)) {
3219 SWIG_croak("Usage: match_datestamp(pat,value);");
3220 }
3221 res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
3222 if (!SWIG_IsOK(res1)) {
3223 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "match_datestamp" "', argument " "1"" of type '" "char *""'");
3224 }
3225 arg1 = (char *)(buf1);
3226 res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
3227 if (!SWIG_IsOK(res2)) {
3228 SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "match_datestamp" "', argument " "2"" of type '" "char *""'");
3229 }
3230 arg2 = (char *)(buf2);
3231 result = (gboolean)match_datestamp(arg1,arg2);
3232 {
3233 if (result)
3234 ST(argvi) = &PL_sv_yes;
3235 else
3236 ST(argvi) = &PL_sv_no;
3237 argvi++;
3238 }
3239 if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
3240 if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
3241 XSRETURN(argvi);
3242 fail:
3243 if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
3244 if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
3245 SWIG_croak_null();
3246 }
3247 }
3248
3249
XS(_wrap_match_level)3250 XS(_wrap_match_level) {
3251 {
3252 char *arg1 = (char *) 0 ;
3253 char *arg2 = (char *) 0 ;
3254 int res1 ;
3255 char *buf1 = 0 ;
3256 int alloc1 = 0 ;
3257 int res2 ;
3258 char *buf2 = 0 ;
3259 int alloc2 = 0 ;
3260 int argvi = 0;
3261 gboolean result;
3262 dXSARGS;
3263
3264 if ((items < 2) || (items > 2)) {
3265 SWIG_croak("Usage: match_level(pat,value);");
3266 }
3267 res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
3268 if (!SWIG_IsOK(res1)) {
3269 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "match_level" "', argument " "1"" of type '" "char *""'");
3270 }
3271 arg1 = (char *)(buf1);
3272 res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
3273 if (!SWIG_IsOK(res2)) {
3274 SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "match_level" "', argument " "2"" of type '" "char *""'");
3275 }
3276 arg2 = (char *)(buf2);
3277 result = (gboolean)match_level(arg1,arg2);
3278 {
3279 if (result)
3280 ST(argvi) = &PL_sv_yes;
3281 else
3282 ST(argvi) = &PL_sv_no;
3283 argvi++;
3284 }
3285 if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
3286 if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
3287 XSRETURN(argvi);
3288 fail:
3289 if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
3290 if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
3291 SWIG_croak_null();
3292 }
3293 }
3294
3295
XS(_wrap_make_crc_table)3296 XS(_wrap_make_crc_table) {
3297 {
3298 int argvi = 0;
3299 dXSARGS;
3300
3301 if ((items < 0) || (items > 0)) {
3302 SWIG_croak("Usage: make_crc_table();");
3303 }
3304 make_crc_table();
3305 ST(argvi) = sv_newmortal();
3306 XSRETURN(argvi);
3307 fail:
3308 SWIG_croak_null();
3309 }
3310 }
3311
3312
XS(_wrap_crc32_init)3313 XS(_wrap_crc32_init) {
3314 {
3315 crc_t *arg1 = (crc_t *) 0 ;
3316 void *argp1 = 0 ;
3317 int res1 = 0 ;
3318 int argvi = 0;
3319 dXSARGS;
3320
3321 if ((items < 1) || (items > 1)) {
3322 SWIG_croak("Usage: crc32_init(crc);");
3323 }
3324 res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_crc_t, 0 | 0 );
3325 if (!SWIG_IsOK(res1)) {
3326 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "crc32_init" "', argument " "1"" of type '" "crc_t *""'");
3327 }
3328 arg1 = (crc_t *)(argp1);
3329 crc32_init(arg1);
3330 ST(argvi) = sv_newmortal();
3331
3332 XSRETURN(argvi);
3333 fail:
3334
3335 SWIG_croak_null();
3336 }
3337 }
3338
3339
XS(_wrap_crc32_add)3340 XS(_wrap_crc32_add) {
3341 {
3342 uint8_t *arg1 = (uint8_t *) 0 ;
3343 size_t arg2 ;
3344 crc_t *arg3 = (crc_t *) 0 ;
3345 void *argp1 = 0 ;
3346 int res1 = 0 ;
3347 void *argp3 = 0 ;
3348 int res3 = 0 ;
3349 int argvi = 0;
3350 dXSARGS;
3351
3352 if ((items < 3) || (items > 3)) {
3353 SWIG_croak("Usage: crc32_add(buf,len,crc);");
3354 }
3355 res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_uint8_t, 0 | 0 );
3356 if (!SWIG_IsOK(res1)) {
3357 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "crc32_add" "', argument " "1"" of type '" "uint8_t *""'");
3358 }
3359 arg1 = (uint8_t *)(argp1);
3360 {
3361 if (sizeof(size_t) == 1) {
3362 arg2 = amglue_SvU8(ST(1));
3363 } else if (sizeof(size_t) == 2) {
3364 arg2 = amglue_SvU16(ST(1));
3365 } else if (sizeof(size_t) == 4) {
3366 arg2 = amglue_SvU32(ST(1));
3367 } else if (sizeof(size_t) == 8) {
3368 arg2 = amglue_SvU64(ST(1));
3369 } else {
3370 croak("Unexpected size_t >64 bits?"); /* should be optimized out unless sizeof(size_t) > 8 */
3371 }
3372 }
3373 res3 = SWIG_ConvertPtr(ST(2), &argp3,SWIGTYPE_p_crc_t, 0 | 0 );
3374 if (!SWIG_IsOK(res3)) {
3375 SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "crc32_add" "', argument " "3"" of type '" "crc_t *""'");
3376 }
3377 arg3 = (crc_t *)(argp3);
3378 crc32_add(arg1,arg2,arg3);
3379 ST(argvi) = sv_newmortal();
3380
3381
3382
3383 XSRETURN(argvi);
3384 fail:
3385
3386
3387
3388 SWIG_croak_null();
3389 }
3390 }
3391
3392
XS(_wrap_crc32_finish)3393 XS(_wrap_crc32_finish) {
3394 {
3395 crc_t *arg1 = (crc_t *) 0 ;
3396 void *argp1 = 0 ;
3397 int res1 = 0 ;
3398 int argvi = 0;
3399 uint32_t result;
3400 dXSARGS;
3401
3402 if ((items < 1) || (items > 1)) {
3403 SWIG_croak("Usage: crc32_finish(crc);");
3404 }
3405 res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_crc_t, 0 | 0 );
3406 if (!SWIG_IsOK(res1)) {
3407 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "crc32_finish" "', argument " "1"" of type '" "crc_t *""'");
3408 }
3409 arg1 = (crc_t *)(argp1);
3410 result = crc32_finish(arg1);
3411 ST(argvi) = SWIG_NewPointerObj((uint32_t *)memcpy((uint32_t *)malloc(sizeof(uint32_t)),&result,sizeof(uint32_t)), SWIGTYPE_p_uint32_t, SWIG_POINTER_OWN | 0); argvi++ ;
3412
3413 XSRETURN(argvi);
3414 fail:
3415
3416 SWIG_croak_null();
3417 }
3418 }
3419
3420
XS(_wrap_set_pname)3421 XS(_wrap_set_pname) {
3422 {
3423 char *arg1 = (char *) 0 ;
3424 int res1 ;
3425 char *buf1 = 0 ;
3426 int alloc1 = 0 ;
3427 int argvi = 0;
3428 dXSARGS;
3429
3430 if ((items < 1) || (items > 1)) {
3431 SWIG_croak("Usage: set_pname(name);");
3432 }
3433 res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
3434 if (!SWIG_IsOK(res1)) {
3435 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "set_pname" "', argument " "1"" of type '" "char *""'");
3436 }
3437 arg1 = (char *)(buf1);
3438 set_pname(arg1);
3439 ST(argvi) = sv_newmortal();
3440 if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
3441 XSRETURN(argvi);
3442 fail:
3443 if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
3444 SWIG_croak_null();
3445 }
3446 }
3447
3448
XS(_wrap_get_pname)3449 XS(_wrap_get_pname) {
3450 {
3451 int argvi = 0;
3452 char *result = 0 ;
3453 dXSARGS;
3454
3455 if ((items < 0) || (items > 0)) {
3456 SWIG_croak("Usage: get_pname();");
3457 }
3458 result = (char *)get_pname();
3459 ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
3460 XSRETURN(argvi);
3461 fail:
3462 SWIG_croak_null();
3463 }
3464 }
3465
3466
XS(_wrap_set_ptype)3467 XS(_wrap_set_ptype) {
3468 {
3469 char *arg1 = (char *) 0 ;
3470 int res1 ;
3471 char *buf1 = 0 ;
3472 int alloc1 = 0 ;
3473 int argvi = 0;
3474 dXSARGS;
3475
3476 if ((items < 1) || (items > 1)) {
3477 SWIG_croak("Usage: set_ptype(type);");
3478 }
3479 res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
3480 if (!SWIG_IsOK(res1)) {
3481 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "set_ptype" "', argument " "1"" of type '" "char *""'");
3482 }
3483 arg1 = (char *)(buf1);
3484 set_ptype(arg1);
3485 ST(argvi) = sv_newmortal();
3486 if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
3487 XSRETURN(argvi);
3488 fail:
3489 if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
3490 SWIG_croak_null();
3491 }
3492 }
3493
3494
XS(_wrap_get_ptype)3495 XS(_wrap_get_ptype) {
3496 {
3497 int argvi = 0;
3498 char *result = 0 ;
3499 dXSARGS;
3500
3501 if ((items < 0) || (items > 0)) {
3502 SWIG_croak("Usage: get_ptype();");
3503 }
3504 result = (char *)get_ptype();
3505 ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
3506 XSRETURN(argvi);
3507 fail:
3508 SWIG_croak_null();
3509 }
3510 }
3511
3512
XS(_wrap_set_pcontext)3513 XS(_wrap_set_pcontext) {
3514 {
3515 pcontext_t arg1 ;
3516 int argvi = 0;
3517 dXSARGS;
3518
3519 if ((items < 1) || (items > 1)) {
3520 SWIG_croak("Usage: set_pcontext(context);");
3521 }
3522 {
3523 if (sizeof(signed int) == 1) {
3524 arg1 = amglue_SvI8(ST(0));
3525 } else if (sizeof(signed int) == 2) {
3526 arg1 = amglue_SvI16(ST(0));
3527 } else if (sizeof(signed int) == 4) {
3528 arg1 = amglue_SvI32(ST(0));
3529 } else if (sizeof(signed int) == 8) {
3530 arg1 = amglue_SvI64(ST(0));
3531 } else {
3532 g_critical("Unexpected signed int >64 bits?"); /* should be optimized out unless sizeof(signed int) > 8 */
3533 }
3534 }
3535 set_pcontext(arg1);
3536 ST(argvi) = sv_newmortal();
3537
3538 XSRETURN(argvi);
3539 fail:
3540
3541 SWIG_croak_null();
3542 }
3543 }
3544
3545
XS(_wrap_get_pcontext)3546 XS(_wrap_get_pcontext) {
3547 {
3548 int argvi = 0;
3549 pcontext_t result;
3550 dXSARGS;
3551
3552 if ((items < 0) || (items > 0)) {
3553 SWIG_croak("Usage: get_pcontext();");
3554 }
3555 result = (pcontext_t)get_pcontext();
3556 {
3557 SV *for_stack;
3558 SP += argvi; PUTBACK;
3559 for_stack = sv_2mortal(amglue_newSVi64(result));
3560 SPAGAIN; SP -= argvi;
3561 ST(argvi) = for_stack;
3562 argvi++;
3563 }
3564 XSRETURN(argvi);
3565 fail:
3566 SWIG_croak_null();
3567 }
3568 }
3569
3570
XS(_wrap_safe_cd)3571 XS(_wrap_safe_cd) {
3572 {
3573 int argvi = 0;
3574 dXSARGS;
3575
3576 if ((items < 0) || (items > 0)) {
3577 SWIG_croak("Usage: safe_cd();");
3578 }
3579 safe_cd();
3580 ST(argvi) = sv_newmortal();
3581 XSRETURN(argvi);
3582 fail:
3583 SWIG_croak_null();
3584 }
3585 }
3586
3587
XS(_wrap_check_running_as)3588 XS(_wrap_check_running_as) {
3589 {
3590 running_as_flags arg1 ;
3591 int argvi = 0;
3592 dXSARGS;
3593
3594 if ((items < 1) || (items > 1)) {
3595 SWIG_croak("Usage: check_running_as(who);");
3596 }
3597 {
3598 if (sizeof(signed int) == 1) {
3599 arg1 = amglue_SvI8(ST(0));
3600 } else if (sizeof(signed int) == 2) {
3601 arg1 = amglue_SvI16(ST(0));
3602 } else if (sizeof(signed int) == 4) {
3603 arg1 = amglue_SvI32(ST(0));
3604 } else if (sizeof(signed int) == 8) {
3605 arg1 = amglue_SvI64(ST(0));
3606 } else {
3607 g_critical("Unexpected signed int >64 bits?"); /* should be optimized out unless sizeof(signed int) > 8 */
3608 }
3609 }
3610 check_running_as(arg1);
3611 ST(argvi) = sv_newmortal();
3612
3613 XSRETURN(argvi);
3614 fail:
3615
3616 SWIG_croak_null();
3617 }
3618 }
3619
3620
3621
3622 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
3623
3624 static swig_type_info _swigt__p_GPtrArray = {"_p_GPtrArray", "GPtrArray *", 0, 0, (void*)0, 0};
3625 static swig_type_info _swigt__p_char = {"_p_char", "gchar *|char *", 0, 0, (void*)0, 0};
3626 static swig_type_info _swigt__p_crc_t = {"_p_crc_t", "crc_t *", 0, 0, (void*)0, 0};
3627 static swig_type_info _swigt__p_double = {"_p_double", "double *|gdouble *", 0, 0, (void*)0, 0};
3628 static swig_type_info _swigt__p_file_lock = {"_p_file_lock", "file_lock *", 0, 0, (void*)"Amanda::Util::file_lock", 0};
3629 static swig_type_info _swigt__p_float = {"_p_float", "float *|gfloat *", 0, 0, (void*)0, 0};
3630 static swig_type_info _swigt__p_fs_usage = {"_p_fs_usage", "struct fs_usage *", 0, 0, (void*)0, 0};
3631 static swig_type_info _swigt__p_in_port_t = {"_p_in_port_t", "in_port_t *", 0, 0, (void*)0, 0};
3632 static swig_type_info _swigt__p_int = {"_p_int", "int *|pcontext_t *|gboolean *|running_as_flags *", 0, 0, (void*)0, 0};
3633 static swig_type_info _swigt__p_uint32_t = {"_p_uint32_t", "uint32_t *", 0, 0, (void*)0, 0};
3634 static swig_type_info _swigt__p_uint8_t = {"_p_uint8_t", "uint8_t *", 0, 0, (void*)0, 0};
3635 static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "guchar *|unsigned char *", 0, 0, (void*)0, 0};
3636
3637 static swig_type_info *swig_type_initial[] = {
3638 &_swigt__p_GPtrArray,
3639 &_swigt__p_char,
3640 &_swigt__p_crc_t,
3641 &_swigt__p_double,
3642 &_swigt__p_file_lock,
3643 &_swigt__p_float,
3644 &_swigt__p_fs_usage,
3645 &_swigt__p_in_port_t,
3646 &_swigt__p_int,
3647 &_swigt__p_uint32_t,
3648 &_swigt__p_uint8_t,
3649 &_swigt__p_unsigned_char,
3650 };
3651
3652 static swig_cast_info _swigc__p_GPtrArray[] = { {&_swigt__p_GPtrArray, 0, 0, 0},{0, 0, 0, 0}};
3653 static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
3654 static swig_cast_info _swigc__p_crc_t[] = { {&_swigt__p_crc_t, 0, 0, 0},{0, 0, 0, 0}};
3655 static swig_cast_info _swigc__p_double[] = { {&_swigt__p_double, 0, 0, 0},{0, 0, 0, 0}};
3656 static swig_cast_info _swigc__p_file_lock[] = { {&_swigt__p_file_lock, 0, 0, 0},{0, 0, 0, 0}};
3657 static swig_cast_info _swigc__p_float[] = { {&_swigt__p_float, 0, 0, 0},{0, 0, 0, 0}};
3658 static swig_cast_info _swigc__p_fs_usage[] = { {&_swigt__p_fs_usage, 0, 0, 0},{0, 0, 0, 0}};
3659 static swig_cast_info _swigc__p_in_port_t[] = { {&_swigt__p_in_port_t, 0, 0, 0},{0, 0, 0, 0}};
3660 static swig_cast_info _swigc__p_int[] = { {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};
3661 static swig_cast_info _swigc__p_uint32_t[] = { {&_swigt__p_uint32_t, 0, 0, 0},{0, 0, 0, 0}};
3662 static swig_cast_info _swigc__p_uint8_t[] = { {&_swigt__p_uint8_t, 0, 0, 0},{0, 0, 0, 0}};
3663 static swig_cast_info _swigc__p_unsigned_char[] = { {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}};
3664
3665 static swig_cast_info *swig_cast_initial[] = {
3666 _swigc__p_GPtrArray,
3667 _swigc__p_char,
3668 _swigc__p_crc_t,
3669 _swigc__p_double,
3670 _swigc__p_file_lock,
3671 _swigc__p_float,
3672 _swigc__p_fs_usage,
3673 _swigc__p_in_port_t,
3674 _swigc__p_int,
3675 _swigc__p_uint32_t,
3676 _swigc__p_uint8_t,
3677 _swigc__p_unsigned_char,
3678 };
3679
3680
3681 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
3682
3683 static swig_constant_info swig_constants[] = {
3684 {0,0,0,0,0,0}
3685 };
3686 #ifdef __cplusplus
3687 }
3688 #endif
3689 static swig_variable_info swig_variables[] = {
3690 {0,0,0,0}
3691 };
3692 static swig_command_info swig_commands[] = {
3693 {"Amanda::Utilc::glib_init", _wrap_glib_init},
3694 {"Amanda::Utilc::get_original_cwd", _wrap_get_original_cwd},
3695 {"Amanda::Utilc::hexencode", _wrap_hexencode},
3696 {"Amanda::Utilc::hexdecode", _wrap_hexdecode},
3697 {"Amanda::Utilc::sanitise_filename", _wrap_sanitise_filename},
3698 {"Amanda::Utilc::quote_string", _wrap_quote_string},
3699 {"Amanda::Utilc::unquote_string", _wrap_unquote_string},
3700 {"Amanda::Utilc::expand_braced_alternates", _wrap_expand_braced_alternates},
3701 {"Amanda::Utilc::collapse_braced_alternates", _wrap_collapse_braced_alternates},
3702 {"Amanda::Utilc::split_quoted_strings", _wrap_split_quoted_strings},
3703 {"Amanda::Utilc::get_fs_usage", _wrap_get_fs_usage},
3704 {"Amanda::Utilc::fsync", _wrap_fsync},
3705 {"Amanda::Utilc::set_blocking", _wrap_set_blocking},
3706 {"Amanda::Utilc::new_file_lock", _wrap_new_file_lock},
3707 {"Amanda::Utilc::delete_file_lock", _wrap_delete_file_lock},
3708 {"Amanda::Utilc::file_lock_lock", _wrap_file_lock_lock},
3709 {"Amanda::Utilc::file_lock_lock_wr", _wrap_file_lock_lock_wr},
3710 {"Amanda::Utilc::file_lock_lock_rd", _wrap_file_lock_lock_rd},
3711 {"Amanda::Utilc::file_lock_unlock", _wrap_file_lock_unlock},
3712 {"Amanda::Utilc::file_lock_locked", _wrap_file_lock_locked},
3713 {"Amanda::Utilc::file_lock_write", _wrap_file_lock_write},
3714 {"Amanda::Utilc::file_lock_data", _wrap_file_lock_data},
3715 {"Amanda::Utilc::weaken_ref", _wrap_weaken_ref},
3716 {"Amanda::Utilc::gettimeofday", _wrap_gettimeofday},
3717 {"Amanda::Utilc::openbsd_fd_inform", _wrap_openbsd_fd_inform},
3718 {"Amanda::Utilc::stream_server", _wrap_stream_server},
3719 {"Amanda::Utilc::stream_accept", _wrap_stream_accept},
3720 {"Amanda::Utilc::check_security", _wrap_check_security},
3721 {"Amanda::Utilc::match_host", _wrap_match_host},
3722 {"Amanda::Utilc::match_disk", _wrap_match_disk},
3723 {"Amanda::Utilc::match_datestamp", _wrap_match_datestamp},
3724 {"Amanda::Utilc::match_level", _wrap_match_level},
3725 {"Amanda::Utilc::make_crc_table", _wrap_make_crc_table},
3726 {"Amanda::Utilc::crc32_init", _wrap_crc32_init},
3727 {"Amanda::Utilc::crc32_add", _wrap_crc32_add},
3728 {"Amanda::Utilc::crc32_finish", _wrap_crc32_finish},
3729 {"Amanda::Utilc::set_pname", _wrap_set_pname},
3730 {"Amanda::Utilc::get_pname", _wrap_get_pname},
3731 {"Amanda::Utilc::set_ptype", _wrap_set_ptype},
3732 {"Amanda::Utilc::get_ptype", _wrap_get_ptype},
3733 {"Amanda::Utilc::set_pcontext", _wrap_set_pcontext},
3734 {"Amanda::Utilc::get_pcontext", _wrap_get_pcontext},
3735 {"Amanda::Utilc::safe_cd", _wrap_safe_cd},
3736 {"Amanda::Utilc::check_running_as", _wrap_check_running_as},
3737 {0,0}
3738 };
3739 /* -----------------------------------------------------------------------------
3740 * Type initialization:
3741 * This problem is tough by the requirement that no dynamic
3742 * memory is used. Also, since swig_type_info structures store pointers to
3743 * swig_cast_info structures and swig_cast_info structures store pointers back
3744 * to swig_type_info structures, we need some lookup code at initialization.
3745 * The idea is that swig generates all the structures that are needed.
3746 * The runtime then collects these partially filled structures.
3747 * The SWIG_InitializeModule function takes these initial arrays out of
3748 * swig_module, and does all the lookup, filling in the swig_module.types
3749 * array with the correct data and linking the correct swig_cast_info
3750 * structures together.
3751 *
3752 * The generated swig_type_info structures are assigned statically to an initial
3753 * array. We just loop through that array, and handle each type individually.
3754 * First we lookup if this type has been already loaded, and if so, use the
3755 * loaded structure instead of the generated one. Then we have to fill in the
3756 * cast linked list. The cast data is initially stored in something like a
3757 * two-dimensional array. Each row corresponds to a type (there are the same
3758 * number of rows as there are in the swig_type_initial array). Each entry in
3759 * a column is one of the swig_cast_info structures for that type.
3760 * The cast_initial array is actually an array of arrays, because each row has
3761 * a variable number of columns. So to actually build the cast linked list,
3762 * we find the array of casts associated with the type, and loop through it
3763 * adding the casts to the list. The one last trick we need to do is making
3764 * sure the type pointer in the swig_cast_info struct is correct.
3765 *
3766 * First off, we lookup the cast->type name to see if it is already loaded.
3767 * There are three cases to handle:
3768 * 1) If the cast->type has already been loaded AND the type we are adding
3769 * casting info to has not been loaded (it is in this module), THEN we
3770 * replace the cast->type pointer with the type pointer that has already
3771 * been loaded.
3772 * 2) If BOTH types (the one we are adding casting info to, and the
3773 * cast->type) are loaded, THEN the cast info has already been loaded by
3774 * the previous module so we just ignore it.
3775 * 3) Finally, if cast->type has not already been loaded, then we add that
3776 * swig_cast_info to the linked list (because the cast->type) pointer will
3777 * be correct.
3778 * ----------------------------------------------------------------------------- */
3779
3780 #ifdef __cplusplus
3781 extern "C" {
3782 #if 0
3783 } /* c-mode */
3784 #endif
3785 #endif
3786
3787 #if 0
3788 #define SWIGRUNTIME_DEBUG
3789 #endif
3790
3791
3792 SWIGRUNTIME void
SWIG_InitializeModule(void * clientdata)3793 SWIG_InitializeModule(void *clientdata) {
3794 size_t i;
3795 swig_module_info *module_head, *iter;
3796 int init;
3797
3798 /* check to see if the circular list has been setup, if not, set it up */
3799 if (swig_module.next==0) {
3800 /* Initialize the swig_module */
3801 swig_module.type_initial = swig_type_initial;
3802 swig_module.cast_initial = swig_cast_initial;
3803 swig_module.next = &swig_module;
3804 init = 1;
3805 } else {
3806 init = 0;
3807 }
3808
3809 /* Try and load any already created modules */
3810 module_head = SWIG_GetModule(clientdata);
3811 if (!module_head) {
3812 /* This is the first module loaded for this interpreter */
3813 /* so set the swig module into the interpreter */
3814 SWIG_SetModule(clientdata, &swig_module);
3815 } else {
3816 /* the interpreter has loaded a SWIG module, but has it loaded this one? */
3817 iter=module_head;
3818 do {
3819 if (iter==&swig_module) {
3820 /* Our module is already in the list, so there's nothing more to do. */
3821 return;
3822 }
3823 iter=iter->next;
3824 } while (iter!= module_head);
3825
3826 /* otherwise we must add our module into the list */
3827 swig_module.next = module_head->next;
3828 module_head->next = &swig_module;
3829 }
3830
3831 /* When multiple interpreters are used, a module could have already been initialized in
3832 a different interpreter, but not yet have a pointer in this interpreter.
3833 In this case, we do not want to continue adding types... everything should be
3834 set up already */
3835 if (init == 0) return;
3836
3837 /* Now work on filling in swig_module.types */
3838 #ifdef SWIGRUNTIME_DEBUG
3839 printf("SWIG_InitializeModule: size %d\n", swig_module.size);
3840 #endif
3841 for (i = 0; i < swig_module.size; ++i) {
3842 swig_type_info *type = 0;
3843 swig_type_info *ret;
3844 swig_cast_info *cast;
3845
3846 #ifdef SWIGRUNTIME_DEBUG
3847 printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
3848 #endif
3849
3850 /* if there is another module already loaded */
3851 if (swig_module.next != &swig_module) {
3852 type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
3853 }
3854 if (type) {
3855 /* Overwrite clientdata field */
3856 #ifdef SWIGRUNTIME_DEBUG
3857 printf("SWIG_InitializeModule: found type %s\n", type->name);
3858 #endif
3859 if (swig_module.type_initial[i]->clientdata) {
3860 type->clientdata = swig_module.type_initial[i]->clientdata;
3861 #ifdef SWIGRUNTIME_DEBUG
3862 printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
3863 #endif
3864 }
3865 } else {
3866 type = swig_module.type_initial[i];
3867 }
3868
3869 /* Insert casting types */
3870 cast = swig_module.cast_initial[i];
3871 while (cast->type) {
3872 /* Don't need to add information already in the list */
3873 ret = 0;
3874 #ifdef SWIGRUNTIME_DEBUG
3875 printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
3876 #endif
3877 if (swig_module.next != &swig_module) {
3878 ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
3879 #ifdef SWIGRUNTIME_DEBUG
3880 if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
3881 #endif
3882 }
3883 if (ret) {
3884 if (type == swig_module.type_initial[i]) {
3885 #ifdef SWIGRUNTIME_DEBUG
3886 printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
3887 #endif
3888 cast->type = ret;
3889 ret = 0;
3890 } else {
3891 /* Check for casting already in the list */
3892 swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
3893 #ifdef SWIGRUNTIME_DEBUG
3894 if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
3895 #endif
3896 if (!ocast) ret = 0;
3897 }
3898 }
3899
3900 if (!ret) {
3901 #ifdef SWIGRUNTIME_DEBUG
3902 printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
3903 #endif
3904 if (type->cast) {
3905 type->cast->prev = cast;
3906 cast->next = type->cast;
3907 }
3908 type->cast = cast;
3909 }
3910 cast++;
3911 }
3912 /* Set entry in modules->types array equal to the type */
3913 swig_module.types[i] = type;
3914 }
3915 swig_module.types[i] = 0;
3916
3917 #ifdef SWIGRUNTIME_DEBUG
3918 printf("**** SWIG_InitializeModule: Cast List ******\n");
3919 for (i = 0; i < swig_module.size; ++i) {
3920 int j = 0;
3921 swig_cast_info *cast = swig_module.cast_initial[i];
3922 printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
3923 while (cast->type) {
3924 printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
3925 cast++;
3926 ++j;
3927 }
3928 printf("---- Total casts: %d\n",j);
3929 }
3930 printf("**** SWIG_InitializeModule: Cast List ******\n");
3931 #endif
3932 }
3933
3934 /* This function will propagate the clientdata field of type to
3935 * any new swig_type_info structures that have been added into the list
3936 * of equivalent types. It is like calling
3937 * SWIG_TypeClientData(type, clientdata) a second time.
3938 */
3939 SWIGRUNTIME void
SWIG_PropagateClientData(void)3940 SWIG_PropagateClientData(void) {
3941 size_t i;
3942 swig_cast_info *equiv;
3943 static int init_run = 0;
3944
3945 if (init_run) return;
3946 init_run = 1;
3947
3948 for (i = 0; i < swig_module.size; i++) {
3949 if (swig_module.types[i]->clientdata) {
3950 equiv = swig_module.types[i]->cast;
3951 while (equiv) {
3952 if (!equiv->converter) {
3953 if (equiv->type && !equiv->type->clientdata)
3954 SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
3955 }
3956 equiv = equiv->next;
3957 }
3958 }
3959 }
3960 }
3961
3962 #ifdef __cplusplus
3963 #if 0
3964 {
3965 /* c-mode */
3966 #endif
3967 }
3968 #endif
3969
3970
3971
3972 #if defined(__cplusplus) && ! defined(XSPROTO)
3973 extern "C"
3974 #endif
3975
XS(SWIG_init)3976 XS(SWIG_init) {
3977 dXSARGS;
3978 int i;
3979
3980 SWIG_InitializeModule(0);
3981
3982 /* Install commands */
3983 for (i = 0; swig_commands[i].name; i++) {
3984 /* Casts only needed for Perl < 5.10. */
3985 #ifdef __cplusplus
3986 newXS(const_cast<char*>(swig_commands[i].name), swig_commands[i].wrapper, const_cast<char*>(__FILE__));
3987 #else
3988 newXS((char*)swig_commands[i].name, swig_commands[i].wrapper, (char*)__FILE__);
3989 #endif
3990 }
3991
3992 /* Install variables */
3993 for (i = 0; swig_variables[i].name; i++) {
3994 SV *sv;
3995 sv = get_sv(swig_variables[i].name, TRUE | 0x2 | GV_ADDMULTI);
3996 if (swig_variables[i].type) {
3997 SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0);
3998 } else {
3999 sv_setiv(sv,(IV) 0);
4000 }
4001 swig_create_magic(sv, swig_variables[i].name, swig_variables[i].set, swig_variables[i].get);
4002 }
4003
4004 /* Install constant */
4005 for (i = 0; swig_constants[i].type; i++) {
4006 SV *sv;
4007 sv = get_sv(swig_constants[i].name, TRUE | 0x2 | GV_ADDMULTI);
4008 switch(swig_constants[i].type) {
4009 case SWIG_INT:
4010 sv_setiv(sv, (IV) swig_constants[i].lvalue);
4011 break;
4012 case SWIG_FLOAT:
4013 sv_setnv(sv, (double) swig_constants[i].dvalue);
4014 break;
4015 case SWIG_STRING:
4016 sv_setpv(sv, (const char *) swig_constants[i].pvalue);
4017 break;
4018 case SWIG_POINTER:
4019 SWIG_MakePtr(sv, swig_constants[i].pvalue, *(swig_constants[i].ptype),0);
4020 break;
4021 case SWIG_BINARY:
4022 SWIG_MakePackedObj(sv, swig_constants[i].pvalue, swig_constants[i].lvalue, *(swig_constants[i].ptype));
4023 break;
4024 default:
4025 break;
4026 }
4027 SvREADONLY_on(sv);
4028 }
4029
4030 /*@SWIG:/usr/share/swig/3.0.7/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4031 SV *sv = get_sv((char*) SWIG_prefix "RUNNING_AS_ANY", TRUE | 0x2 | GV_ADDMULTI);
4032 sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1((int)(RUNNING_AS_ANY)));
4033 SvREADONLY_on(sv);
4034 } while(0) /*@SWIG@*/;
4035 /*@SWIG:/usr/share/swig/3.0.7/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4036 SV *sv = get_sv((char*) SWIG_prefix "RUNNING_AS_ROOT", TRUE | 0x2 | GV_ADDMULTI);
4037 sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1((int)(RUNNING_AS_ROOT)));
4038 SvREADONLY_on(sv);
4039 } while(0) /*@SWIG@*/;
4040 /*@SWIG:/usr/share/swig/3.0.7/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4041 SV *sv = get_sv((char*) SWIG_prefix "RUNNING_AS_DUMPUSER", TRUE | 0x2 | GV_ADDMULTI);
4042 sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1((int)(RUNNING_AS_DUMPUSER)));
4043 SvREADONLY_on(sv);
4044 } while(0) /*@SWIG@*/;
4045 /*@SWIG:/usr/share/swig/3.0.7/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4046 SV *sv = get_sv((char*) SWIG_prefix "RUNNING_AS_DUMPUSER_PREFERRED", TRUE | 0x2 | GV_ADDMULTI);
4047 sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1((int)(RUNNING_AS_DUMPUSER_PREFERRED)));
4048 SvREADONLY_on(sv);
4049 } while(0) /*@SWIG@*/;
4050 /*@SWIG:/usr/share/swig/3.0.7/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4051 SV *sv = get_sv((char*) SWIG_prefix "RUNNING_AS_CLIENT_LOGIN", TRUE | 0x2 | GV_ADDMULTI);
4052 sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1((int)(RUNNING_AS_CLIENT_LOGIN)));
4053 SvREADONLY_on(sv);
4054 } while(0) /*@SWIG@*/;
4055 /*@SWIG:/usr/share/swig/3.0.7/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4056 SV *sv = get_sv((char*) SWIG_prefix "RUNNING_AS_UID_ONLY", TRUE | 0x2 | GV_ADDMULTI);
4057 sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1((int)(RUNNING_AS_UID_ONLY)));
4058 SvREADONLY_on(sv);
4059 } while(0) /*@SWIG@*/;
4060 /*@SWIG:/usr/share/swig/3.0.7/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4061 SV *sv = get_sv((char*) SWIG_prefix "CONTEXT_DEFAULT", TRUE | 0x2 | GV_ADDMULTI);
4062 sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1((int)(CONTEXT_DEFAULT)));
4063 SvREADONLY_on(sv);
4064 } while(0) /*@SWIG@*/;
4065 /*@SWIG:/usr/share/swig/3.0.7/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4066 SV *sv = get_sv((char*) SWIG_prefix "CONTEXT_CMDLINE", TRUE | 0x2 | GV_ADDMULTI);
4067 sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1((int)(CONTEXT_CMDLINE)));
4068 SvREADONLY_on(sv);
4069 } while(0) /*@SWIG@*/;
4070 /*@SWIG:/usr/share/swig/3.0.7/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4071 SV *sv = get_sv((char*) SWIG_prefix "CONTEXT_DAEMON", TRUE | 0x2 | GV_ADDMULTI);
4072 sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1((int)(CONTEXT_DAEMON)));
4073 SvREADONLY_on(sv);
4074 } while(0) /*@SWIG@*/;
4075 /*@SWIG:/usr/share/swig/3.0.7/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4076 SV *sv = get_sv((char*) SWIG_prefix "CONTEXT_SCRIPTUTIL", TRUE | 0x2 | GV_ADDMULTI);
4077 sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1((int)(CONTEXT_SCRIPTUTIL)));
4078 SvREADONLY_on(sv);
4079 } while(0) /*@SWIG@*/;
4080 SWIG_TypeClientData(SWIGTYPE_p_file_lock, (void*) "Amanda::Util::file_lock");
4081 /*@SWIG:/usr/share/swig/3.0.7/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4082 SV *sv = get_sv((char*) SWIG_prefix "AF_INET", TRUE | 0x2 | GV_ADDMULTI);
4083 sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1((int)(AF_INET)));
4084 SvREADONLY_on(sv);
4085 } while(0) /*@SWIG@*/;
4086 /*@SWIG:/usr/share/swig/3.0.7/perl5/perltypemaps.swg,65,%set_constant@*/ do {
4087 SV *sv = get_sv((char*) SWIG_prefix "STREAM_BUFSIZE", TRUE | 0x2 | GV_ADDMULTI);
4088 sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1((int)(STREAM_BUFSIZE)));
4089 SvREADONLY_on(sv);
4090 } while(0) /*@SWIG@*/;
4091 ST(0) = &PL_sv_yes;
4092 XSRETURN(1);
4093 }
4094
4095