event_wrap.c 245 KB
Newer Older
1 2
/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
3 4 5
 * Version 2.0.12
 *
 * 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 8
 * changes to this file unless you know what you are doing--modify the SWIG
 * interface file instead.
9
 * ----------------------------------------------------------------------------- */
10 11

#define SWIGPERL
12
#define SWIG_CASTRANK_MODE
13

14 15 16 17 18 19 20
/* -----------------------------------------------------------------------------
 *  This section contains generic SWIG labels for method/variable
 *  declarations/attributes, and other compiler dependent labels.
 * ----------------------------------------------------------------------------- */

/* template workaround for compilers that cannot correctly implement the C++ standard */
#ifndef SWIGTEMPLATEDISAMBIGUATOR
21 22 23 24 25 26
# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
#  define SWIGTEMPLATEDISAMBIGUATOR template
# elif defined(__HP_aCC)
/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
#  define SWIGTEMPLATEDISAMBIGUATOR template
27
# else
28
#  define SWIGTEMPLATEDISAMBIGUATOR
29
# endif
30
#endif
31 32 33 34 35 36 37 38

/* inline attribute */
#ifndef SWIGINLINE
# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
#   define SWIGINLINE inline
# else
#   define SWIGINLINE
# endif
39 40
#endif

41 42 43 44
/* attribute recognised by some compilers to avoid 'unused' warnings */
#ifndef SWIGUNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
45
#     define SWIGUNUSED __attribute__ ((__unused__))
46
#   else
47
#     define SWIGUNUSED
48
#   endif
49
# elif defined(__ICC)
50
#   define SWIGUNUSED __attribute__ ((__unused__))
51
# else
52
#   define SWIGUNUSED
53
# endif
54 55
#endif

56 57 58
#ifndef SWIG_MSC_UNSUPPRESS_4505
# if defined(_MSC_VER)
#   pragma warning(disable : 4505) /* unreferenced local function has been removed */
59
# endif
60 61
#endif

62 63 64 65
#ifndef SWIGUNUSEDPARM
# ifdef __cplusplus
#   define SWIGUNUSEDPARM(p)
# else
66
#   define SWIGUNUSEDPARM(p) p SWIGUNUSED
67
# endif
68 69
#endif

70 71 72 73
/* internal SWIG method */
#ifndef SWIGINTERN
# define SWIGINTERN static SWIGUNUSED
#endif
74

75 76 77 78
/* internal inline SWIG method */
#ifndef SWIGINTERNINLINE
# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
#endif
79

80 81 82 83 84 85
/* exporting methods */
#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
#  ifndef GCC_HASCLASSVISIBILITY
#    define GCC_HASCLASSVISIBILITY
#  endif
#endif
86

87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
#ifndef SWIGEXPORT
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
#   if defined(STATIC_LINKED)
#     define SWIGEXPORT
#   else
#     define SWIGEXPORT __declspec(dllexport)
#   endif
# else
#   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
#     define SWIGEXPORT __attribute__ ((visibility("default")))
#   else
#     define SWIGEXPORT
#   endif
# endif
#endif

/* calling conventions for Windows */
#ifndef SWIGSTDCALL
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
#   define SWIGSTDCALL __stdcall
# else
#   define SWIGSTDCALL
109
# endif
110 111 112
#endif

/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
113
#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
114 115 116
# define _CRT_SECURE_NO_DEPRECATE
#endif

117 118 119 120 121 122
/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
# define _SCL_SECURE_NO_DEPRECATE
#endif


123 124 125
/* -----------------------------------------------------------------------------
 * swigrun.swg
 *
126
 * This file contains generic C API SWIG runtime support for pointer
127 128 129 130 131
 * type checking.
 * ----------------------------------------------------------------------------- */

/* This should only be incremented when either the layout of swig_type_info changes,
   or for whatever reason, the runtime changes incompatibly */
132
#define SWIG_RUNTIME_VERSION "4"
133 134 135 136 137 138

/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
#ifdef SWIG_TYPE_TABLE
# define SWIG_QUOTE_STRING(x) #x
# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
139
#else
140 141 142 143 144
# define SWIG_TYPE_TABLE_NAME
#endif

/*
  You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
145 146
  creating a static or dynamic library from the SWIG runtime code.
  In 99.9% of the cases, SWIG just needs to declare them as 'static'.
147

148 149
  But only do this if strictly necessary, ie, if you have problems
  with your compiler or suchlike.
150 151 152 153
*/

#ifndef SWIGRUNTIME
# define SWIGRUNTIME SWIGINTERN
154
#endif
155 156 157

#ifndef SWIGRUNTIMEINLINE
# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
158 159
#endif

160 161 162
/*  Generic buffer size */
#ifndef SWIG_BUFFER_SIZE
# define SWIG_BUFFER_SIZE 1024
163 164
#endif

165 166
/* Flags for pointer conversions */
#define SWIG_POINTER_DISOWN        0x1
167
#define SWIG_CAST_NEW_MEMORY       0x2
168

169 170
/* Flags for new pointer objects */
#define SWIG_POINTER_OWN           0x1
171 172


173
/*
174
   Flags/methods for returning states.
175 176

   The SWIG conversion methods, as ConvertPtr, return an integer
177 178
   that tells if the conversion was successful or not. And if not,
   an error code can be returned (see swigerrors.swg for the codes).
179

180 181
   Use the following macros/flags to set or process the returning
   states.
182

183
   In old versions of SWIG, code such as the following was usually written:
184

185 186 187 188 189
     if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
       // success code
     } else {
       //fail code
     }
190

191
   Now you can be more explicit:
192

193 194 195 196 197 198
    int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
    if (SWIG_IsOK(res)) {
      // success code
    } else {
      // fail code
    }
199

200
   which is the same really, but now you can also do
201

202 203 204 205 206 207 208 209 210 211 212 213 214
    Type *ptr;
    int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
    if (SWIG_IsOK(res)) {
      // success code
      if (SWIG_IsNewObj(res) {
        ...
	delete *ptr;
      } else {
        ...
      }
    } else {
      // fail code
    }
215

216 217
   I.e., now SWIG_ConvertPtr can return new objects and you can
   identify the case and take care of the deallocation. Of course that
218
   also requires SWIG_ConvertPtr to return new result values, such as
219

220 221 222 223 224 225 226 227 228 229 230 231
      int SWIG_ConvertPtr(obj, ptr,...) {
        if (<obj is ok>) {
          if (<need new object>) {
            *ptr = <ptr to new allocated object>;
            return SWIG_NEWOBJ;
          } else {
            *ptr = <ptr to old object>;
            return SWIG_OLDOBJ;
          }
        } else {
          return SWIG_BADOBJ;
        }
232
      }
233

234 235
   Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
   more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
236
   SWIG errors code.
237

238 239 240 241 242 243 244
   Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
   allows to return the 'cast rank', for example, if you have this

       int food(double)
       int fooi(int);

   and you call
245

246 247 248 249
      food(1)   // cast rank '1'  (1 -> 1.0)
      fooi(1)   // cast rank '0'

   just use the SWIG_AddCast()/SWIG_CheckState()
250
*/
251

252
#define SWIG_OK                    (0)
253 254
#define SWIG_ERROR                 (-1)
#define SWIG_IsOK(r)               (r >= 0)
255
#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285

/* The CastRankLimit says how many bits are used for the cast rank */
#define SWIG_CASTRANKLIMIT         (1 << 8)
/* The NewMask denotes the object was created (using new/malloc) */
#define SWIG_NEWOBJMASK            (SWIG_CASTRANKLIMIT  << 1)
/* The TmpMask is for in/out typemaps that use temporal objects */
#define SWIG_TMPOBJMASK            (SWIG_NEWOBJMASK << 1)
/* Simple returning values */
#define SWIG_BADOBJ                (SWIG_ERROR)
#define SWIG_OLDOBJ                (SWIG_OK)
#define SWIG_NEWOBJ                (SWIG_OK | SWIG_NEWOBJMASK)
#define SWIG_TMPOBJ                (SWIG_OK | SWIG_TMPOBJMASK)
/* Check, add and del mask methods */
#define SWIG_AddNewMask(r)         (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
#define SWIG_DelNewMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
#define SWIG_IsNewObj(r)           (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
#define SWIG_AddTmpMask(r)         (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
#define SWIG_DelTmpMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
#define SWIG_IsTmpObj(r)           (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))

/* Cast-Rank Mode */
#if defined(SWIG_CASTRANK_MODE)
#  ifndef SWIG_TypeRank
#    define SWIG_TypeRank             unsigned long
#  endif
#  ifndef SWIG_MAXCASTRANK            /* Default cast allowed */
#    define SWIG_MAXCASTRANK          (2)
#  endif
#  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
#  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
286
SWIGINTERNINLINE int SWIG_AddCast(int r) {
287 288
  return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
}
289 290
SWIGINTERNINLINE int SWIG_CheckState(int r) {
  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
291 292
}
#else /* no cast-rank mode */
293
#  define SWIG_AddCast(r) (r)
294
#  define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
295 296 297
#endif


298 299 300
#include <string.h>

#ifdef __cplusplus
301
#include <string>
302 303 304
extern "C" {
#endif

305
typedef void *(*swig_converter_func)(void *, int *);
306 307
typedef struct swig_type_info *(*swig_dycast_func)(void **);

308
/* Structure to store information on one type */
309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337
typedef struct swig_type_info {
  const char             *name;			/* mangled name of this type */
  const char             *str;			/* human readable name of this type */
  swig_dycast_func        dcast;		/* dynamic cast function down a hierarchy */
  struct swig_cast_info  *cast;			/* linked list of types that can cast into this type */
  void                   *clientdata;		/* language specific type data */
  int                    owndata;		/* flag if the structure owns the clientdata */
} swig_type_info;

/* Structure to store a type and conversion function used for casting */
typedef struct swig_cast_info {
  swig_type_info         *type;			/* pointer to type that is equivalent to this type */
  swig_converter_func     converter;		/* function to cast the void pointers */
  struct swig_cast_info  *next;			/* pointer to next cast in linked list */
  struct swig_cast_info  *prev;			/* pointer to the previous cast */
} swig_cast_info;

/* Structure used to store module information
 * Each module generates one structure like this, and the runtime collects
 * all of these structures and stores them in a circularly linked list.*/
typedef struct swig_module_info {
  swig_type_info         **types;		/* Array of pointers to swig_type_info structures that are in this module */
  size_t                 size;		        /* Number of types in this module */
  struct swig_module_info *next;		/* Pointer to next element in circularly linked list */
  swig_type_info         **type_initial;	/* Array of initially generated type structures */
  swig_cast_info         **cast_initial;	/* Array of initially generated casting structures */
  void                    *clientdata;		/* Language specific module data */
} swig_module_info;

338
/*
339 340 341 342 343 344 345 346 347 348 349 350 351
  Compare two type names skipping the space characters, therefore
  "char*" == "char *" and "Class<int>" == "Class<int >", etc.

  Return 0 when the two name types are equivalent, as in
  strncmp, but skipping ' '.
*/
SWIGRUNTIME int
SWIG_TypeNameComp(const char *f1, const char *l1,
		  const char *f2, const char *l2) {
  for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
    while ((*f1 == ' ') && (f1 != l1)) ++f1;
    while ((*f2 == ' ') && (f2 != l2)) ++f2;
    if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
352
  }
353
  return (int)((l1 - f1) - (l2 - f2));
354 355 356 357
}

/*
  Check type equivalence in a name list like <name1>|<name2>|...
358
  Return 0 if equal, -1 if nb < tb, 1 if nb > tb
359 360
*/
SWIGRUNTIME int
361 362
SWIG_TypeCmp(const char *nb, const char *tb) {
  int equiv = 1;
363 364
  const char* te = tb + strlen(tb);
  const char* ne = nb;
365
  while (equiv != 0 && *ne) {
366 367 368
    for (nb = ne; *ne; ++ne) {
      if (*ne == '|') break;
    }
369
    equiv = SWIG_TypeNameComp(nb, ne, tb, te);
370
    if (*ne) ++ne;
371
  }
372 373 374 375 376
  return equiv;
}

/*
  Check type equivalence in a name list like <name1>|<name2>|...
377
  Return 0 if not equal, 1 if equal
378 379
*/
SWIGRUNTIME int
380 381
SWIG_TypeEquiv(const char *nb, const char *tb) {
  return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
382 383
}

384 385 386 387 388
/*
  Check the typename
*/
SWIGRUNTIME swig_cast_info *
SWIG_TypeCheck(const char *c, swig_type_info *ty) {
389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408
  if (ty) {
    swig_cast_info *iter = ty->cast;
    while (iter) {
      if (strcmp(iter->type->name, c) == 0) {
        if (iter == ty->cast)
          return iter;
        /* Move iter to the top of the linked list */
        iter->prev->next = iter->next;
        if (iter->next)
          iter->next->prev = iter->prev;
        iter->next = ty->cast;
        iter->prev = 0;
        if (ty->cast) ty->cast->prev = iter;
        ty->cast = iter;
        return iter;
      }
      iter = iter->next;
    }
  }
  return 0;
409
}
410

411
/*
412 413
  Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
*/
414
SWIGRUNTIME swig_cast_info *
415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435
SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
  if (ty) {
    swig_cast_info *iter = ty->cast;
    while (iter) {
      if (iter->type == from) {
        if (iter == ty->cast)
          return iter;
        /* Move iter to the top of the linked list */
        iter->prev->next = iter->next;
        if (iter->next)
          iter->next->prev = iter->prev;
        iter->next = ty->cast;
        iter->prev = 0;
        if (ty->cast) ty->cast->prev = iter;
        ty->cast = iter;
        return iter;
      }
      iter = iter->next;
    }
  }
  return 0;
436
}
437

438 439 440 441
/*
  Cast a pointer up an inheritance hierarchy
*/
SWIGRUNTIMEINLINE void *
442 443
SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
444
}
445

446
/*
447 448 449 450 451 452 453 454 455 456 457 458
   Dynamic pointer casting. Down an inheritance hierarchy
*/
SWIGRUNTIME swig_type_info *
SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
  swig_type_info *lastty = ty;
  if (!ty || !ty->dcast) return ty;
  while (ty && (ty->dcast)) {
    ty = (*ty->dcast)(ptr);
    if (ty) lastty = ty;
  }
  return lastty;
}
459

460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484
/*
  Return the name associated with this type
*/
SWIGRUNTIMEINLINE const char *
SWIG_TypeName(const swig_type_info *ty) {
  return ty->name;
}

/*
  Return the pretty name associated with this type,
  that is an unmangled type name in a form presentable to the user.
*/
SWIGRUNTIME const char *
SWIG_TypePrettyName(const swig_type_info *type) {
  /* The "str" field contains the equivalent pretty names of the
     type, separated by vertical-bar characters.  We choose
     to print the last name, as it is often (?) the most
     specific. */
  if (!type) return NULL;
  if (type->str != NULL) {
    const char *last_name = type->str;
    const char *s;
    for (s = type->str; *s; s++)
      if (*s == '|') last_name = s+1;
    return last_name;
485
  }
486 487 488 489
  else
    return type->name;
}

490
/*
491 492 493 494 495 496 497
   Set the clientdata field for a type
*/
SWIGRUNTIME void
SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
  swig_cast_info *cast = ti->cast;
  /* if (ti->clientdata == clientdata) return; */
  ti->clientdata = clientdata;
498

499 500 501 502 503
  while (cast) {
    if (!cast->converter) {
      swig_type_info *tc = cast->type;
      if (!tc->clientdata) {
	SWIG_TypeClientData(tc, clientdata);
504
      }
505
    }
506 507 508 509 510 511 512 513
    cast = cast->next;
  }
}
SWIGRUNTIME void
SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
  SWIG_TypeClientData(ti, clientdata);
  ti->owndata = 1;
}
514

515 516 517
/*
  Search for a swig_type_info structure only by mangled name
  Search is a O(log #types)
518 519

  We start searching at module start, and finish searching when start == end.
520 521 522 523
  Note: if start == end at the beginning of the function, we go all the way around
  the circular list.
*/
SWIGRUNTIME swig_type_info *
524 525
SWIG_MangledTypeQueryModule(swig_module_info *start,
                            swig_module_info *end,
526 527 528 529 530 531 532 533
		            const char *name) {
  swig_module_info *iter = start;
  do {
    if (iter->size) {
      register size_t l = 0;
      register size_t r = iter->size - 1;
      do {
	/* since l+r >= 0, we can (>> 1) instead (/ 2) */
534
	register size_t i = (l + r) >> 1;
535 536 537
	const char *iname = iter->types[i]->name;
	if (iname) {
	  register int compare = strcmp(name, iname);
538
	  if (compare == 0) {
539 540 541 542 543 544
	    return iter->types[i];
	  } else if (compare < 0) {
	    if (i) {
	      r = i - 1;
	    } else {
	      break;
545
	    }
546 547
	  } else if (compare > 0) {
	    l = i + 1;
548
	  }
549 550
	} else {
	  break; /* should never happen */
551
	}
552 553 554 555 556 557
      } while (l <= r);
    }
    iter = iter->next;
  } while (iter != end);
  return 0;
}
558

559 560 561 562
/*
  Search for a swig_type_info structure for either a mangled name or a human readable name.
  It first searches the mangled names of the types, which is a O(log #types)
  If a type is not found it then searches the human readable names, which is O(#types).
563 564

  We start searching at module start, and finish searching when start == end.
565 566 567 568
  Note: if start == end at the beginning of the function, we go all the way around
  the circular list.
*/
SWIGRUNTIME swig_type_info *
569 570
SWIG_TypeQueryModule(swig_module_info *start,
                     swig_module_info *end,
571 572 573 574 575 576 577 578 579 580 581 582 583 584
		     const char *name) {
  /* STEP 1: Search the name field using binary search */
  swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
  if (ret) {
    return ret;
  } else {
    /* STEP 2: If the type hasn't been found, do a complete search
       of the str field (the human readable name) */
    swig_module_info *iter = start;
    do {
      register size_t i = 0;
      for (; i < iter->size; ++i) {
	if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
	  return iter->types[i];
585
      }
586 587 588
      iter = iter->next;
    } while (iter != end);
  }
589

590 591 592 593
  /* neither found a match */
  return 0;
}

594
/*
595 596 597 598 599 600 601 602 603 604 605 606 607 608 609
   Pack binary data into a string
*/
SWIGRUNTIME char *
SWIG_PackData(char *c, void *ptr, size_t sz) {
  static const char hex[17] = "0123456789abcdef";
  register const unsigned char *u = (unsigned char *) ptr;
  register const unsigned char *eu =  u + sz;
  for (; u != eu; ++u) {
    register unsigned char uu = *u;
    *(c++) = hex[(uu & 0xf0) >> 4];
    *(c++) = hex[uu & 0xf];
  }
  return c;
}

610
/*
611 612 613 614 615 616 617 618 619 620 621 622 623
   Unpack binary data from a string
*/
SWIGRUNTIME const char *
SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
  register unsigned char *u = (unsigned char *) ptr;
  register const unsigned char *eu = u + sz;
  for (; u != eu; ++u) {
    register char d = *(c++);
    register unsigned char uu;
    if ((d >= '0') && (d <= '9'))
      uu = ((d - '0') << 4);
    else if ((d >= 'a') && (d <= 'f'))
      uu = ((d - ('a'-10)) << 4);
624
    else
625
      return (char *) 0;
626 627 628 629 630
    d = *(c++);
    if ((d >= '0') && (d <= '9'))
      uu |= (d - '0');
    else if ((d >= 'a') && (d <= 'f'))
      uu |= (d - ('a'-10));
631
    else
632 633 634 635 636 637
      return (char *) 0;
    *u = uu;
  }
  return c;
}

638
/*
639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659
   Pack 'void *' into a string buffer.
*/
SWIGRUNTIME char *
SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
  char *r = buff;
  if ((2*sizeof(void *) + 2) > bsz) return 0;
  *(r++) = '_';
  r = SWIG_PackData(r,&ptr,sizeof(void *));
  if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
  strcpy(r,name);
  return buff;
}

SWIGRUNTIME const char *
SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
  if (*c != '_') {
    if (strcmp(c,"NULL") == 0) {
      *ptr = (void *) 0;
      return name;
    } else {
      return 0;
660
    }
661 662
  }
  return SWIG_UnpackData(++c,ptr,sizeof(void *));
663 664
}

665 666 667 668 669 670 671 672 673 674 675 676 677 678
SWIGRUNTIME char *
SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
  char *r = buff;
  size_t lname = (name ? strlen(name) : 0);
  if ((2*sz + 2 + lname) > bsz) return 0;
  *(r++) = '_';
  r = SWIG_PackData(r,ptr,sz);
  if (lname) {
    strncpy(r,name,lname+1);
  } else {
    *r = 0;
  }
  return buff;
}
679

680 681 682 683 684 685 686 687 688 689 690
SWIGRUNTIME const char *
SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
  if (*c != '_') {
    if (strcmp(c,"NULL") == 0) {
      memset(ptr,0,sz);
      return name;
    } else {
      return 0;
    }
  }
  return SWIG_UnpackData(++c,ptr,sz);
691 692
}

693 694 695 696 697
#ifdef __cplusplus
}
#endif

/*  Errors in SWIG */
698 699 700 701 702 703 704 705 706
#define  SWIG_UnknownError    	   -1
#define  SWIG_IOError        	   -2
#define  SWIG_RuntimeError   	   -3
#define  SWIG_IndexError     	   -4
#define  SWIG_TypeError      	   -5
#define  SWIG_DivisionByZero 	   -6
#define  SWIG_OverflowError  	   -7
#define  SWIG_SyntaxError    	   -8
#define  SWIG_ValueError     	   -9
707 708
#define  SWIG_SystemError    	   -10
#define  SWIG_AttributeError 	   -11
709
#define  SWIG_MemoryError    	   -12
710 711 712
#define  SWIG_NullReferenceError   -13


713 714

#ifdef __cplusplus
715 716 717 718
/* Needed on some windows machines---since MS plays funny games with the header files under C++ */
#include <math.h>
#include <stdlib.h>
extern "C" {
719
#endif
720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"

/* Add in functionality missing in older versions of Perl. Much of this is based on Devel-PPPort on cpan. */

/* Add PERL_REVISION, PERL_VERSION, PERL_SUBVERSION if missing */
#ifndef PERL_REVISION
#  if !defined(__PATCHLEVEL_H_INCLUDED__) && !(defined(PATCHLEVEL) && defined(SUBVERSION))
#    define PERL_PATCHLEVEL_H_IMPLICIT
#    include <patchlevel.h>
#  endif
#  if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL)))
#    include <could_not_find_Perl_patchlevel.h>
#  endif
#  ifndef PERL_REVISION
#    define PERL_REVISION       (5)
#    define PERL_VERSION        PATCHLEVEL
#    define PERL_SUBVERSION     SUBVERSION
739
#  endif
740 741
#endif

742 743
#if defined(WIN32) && defined(PERL_OBJECT) && !defined(PerlIO_exportFILE)
#define PerlIO_exportFILE(fh,fl) (FILE*)(fh)
744 745
#endif

746 747
#ifndef SvIOK_UV
# define SvIOK_UV(sv)       (SvIOK(sv) && (SvUVX(sv) == SvIVX(sv)))
748 749
#endif

750 751 752
#ifndef SvUOK
# define SvUOK(sv)           SvIOK_UV(sv)
#endif
753

754 755 756 757 758 759 760 761
#if ((PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 5)))
#  define PL_sv_undef               sv_undef
#  define PL_na	                    na
#  define PL_errgv                  errgv
#  define PL_sv_no                  sv_no
#  define PL_sv_yes                 sv_yes
#  define PL_markstack_ptr          markstack_ptr
#endif
762

763 764 765 766 767 768 769
#ifndef IVSIZE
#  ifdef LONGSIZE
#    define IVSIZE LONGSIZE
#  else
#    define IVSIZE 4 /* A bold guess, but the best we can make. */
#  endif
#endif
770

771 772 773 774 775 776 777 778 779 780 781 782
#ifndef INT2PTR
#  if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE)
#    define PTRV                  UV
#    define INT2PTR(any,d)        (any)(d)
#  else
#    if PTRSIZE == LONGSIZE
#      define PTRV                unsigned long
#    else
#      define PTRV                unsigned
#    endif
#    define INT2PTR(any,d)        (any)(PTRV)(d)
#  endif
783

784 785 786 787
#  define NUM2PTR(any,d)  (any)(PTRV)(d)
#  define PTR2IV(p)       INT2PTR(IV,p)
#  define PTR2UV(p)       INT2PTR(UV,p)
#  define PTR2NV(p)       NUM2PTR(NV,p)
788

789 790 791 792 793 794
#  if PTRSIZE == LONGSIZE
#    define PTR2ul(p)     (unsigned long)(p)
#  else
#    define PTR2ul(p)     INT2PTR(unsigned long,p)
#  endif
#endif /* !INT2PTR */
795

796 797 798 799
#ifndef SvPV_nolen
# define SvPV_nolen(x) SvPV(x,PL_na)
#endif

800 801 802
#ifndef get_sv
#  define get_sv perl_get_sv
#endif
803

804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824
#ifndef ERRSV
#  define ERRSV get_sv("@",FALSE)
#endif

#ifndef pTHX_
#define pTHX_
#endif   

#include <string.h>
#ifdef __cplusplus
}
#endif

/* -----------------------------------------------------------------------------
 * error manipulation
 * ----------------------------------------------------------------------------- */

SWIGINTERN const char*
SWIG_Perl_ErrorType(int code) {
  switch(code) {
  case SWIG_MemoryError:
825
    return "MemoryError";
826
  case SWIG_IOError:
827
    return "IOError";
828
  case SWIG_RuntimeError:
829
    return "RuntimeError";
830
  case SWIG_IndexError:
831
    return "IndexError";
832
  case SWIG_TypeError:
833
    return "TypeError";
834
  case SWIG_DivisionByZero:
835
    return "ZeroDivisionError";
836
  case SWIG_OverflowError:
837
    return "OverflowError";
838
  case SWIG_SyntaxError:
839
    return "SyntaxError";
840
  case SWIG_ValueError:
841
    return "ValueError";
842
  case SWIG_SystemError:
843
    return "SystemError";
844
  case SWIG_AttributeError:
845
    return "AttributeError";
846
  default:
847
    return "RuntimeError";
848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871
  }
}


/* -----------------------------------------------------------------------------
 * perlrun.swg
 *
 * This file contains the runtime support for Perl modules
 * and includes code for managing global variables and pointer
 * type checking.
 * ----------------------------------------------------------------------------- */

#ifdef PERL_OBJECT
#define SWIG_PERL_OBJECT_DECL CPerlObj *SWIGUNUSEDPARM(pPerl),
#define SWIG_PERL_OBJECT_CALL pPerl,
#else
#define SWIG_PERL_OBJECT_DECL
#define SWIG_PERL_OBJECT_CALL
#endif

/* Common SWIG API */

/* for raw pointers */
#define SWIG_ConvertPtr(obj, pp, type, flags)           SWIG_Perl_ConvertPtr(SWIG_PERL_OBJECT_CALL obj, pp, type, flags)
872
#define SWIG_ConvertPtrAndOwn(obj, pp, type, flags,own) SWIG_Perl_ConvertPtrAndOwn(SWIG_PERL_OBJECT_CALL obj, pp, type, flags, own)
873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893
#define SWIG_NewPointerObj(p, type, flags)              SWIG_Perl_NewPointerObj(SWIG_PERL_OBJECT_CALL p, type, flags)

/* for raw packed data */
#define SWIG_ConvertPacked(obj, p, s, type)             SWIG_Perl_ConvertPacked(SWIG_PERL_OBJECT_CALL obj, p, s, type)
#define SWIG_NewPackedObj(p, s, type)	                SWIG_Perl_NewPackedObj(SWIG_PERL_OBJECT_CALL p, s, type)

/* for class or struct pointers */
#define SWIG_ConvertInstance(obj, pptr, type, flags)    SWIG_ConvertPtr(obj, pptr, type, flags)
#define SWIG_NewInstanceObj(ptr, type, flags)           SWIG_NewPointerObj(ptr, type, flags)

/* for C or C++ function pointers */
#define SWIG_ConvertFunctionPtr(obj, pptr, type)        SWIG_ConvertPtr(obj, pptr, type, 0)
#define SWIG_NewFunctionPtrObj(ptr, type)               SWIG_NewPointerObj(ptr, type, 0)

/* for C++ member pointers, ie, member methods */
#define SWIG_ConvertMember(obj, ptr, sz, ty)            SWIG_ConvertPacked(obj, ptr, sz, ty)
#define SWIG_NewMemberObj(ptr, sz, type)                SWIG_NewPackedObj(ptr, sz, type)


/* Runtime API */

894
#define SWIG_GetModule(clientdata)                      SWIG_Perl_GetModule(clientdata)
895 896 897 898 899 900
#define SWIG_SetModule(clientdata, pointer)             SWIG_Perl_SetModule(pointer)


/* Error manipulation */

#define SWIG_ErrorType(code)                            SWIG_Perl_ErrorType(code)               
901
#define SWIG_Error(code, msg)            		sv_setpvf(get_sv("@", GV_ADD), "%s %s", SWIG_ErrorType(code), msg)
902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933
#define SWIG_fail                        		goto fail						    

/* Perl-specific SWIG API */

#define SWIG_MakePtr(sv, ptr, type, flags)              SWIG_Perl_MakePtr(SWIG_PERL_OBJECT_CALL sv, ptr, type, flags)
#define SWIG_MakePackedObj(sv, p, s, type)	        SWIG_Perl_MakePackedObj(SWIG_PERL_OBJECT_CALL sv, p, s, type)
#define SWIG_SetError(str)                              SWIG_Error(SWIG_RuntimeError, str)


#define SWIG_PERL_DECL_ARGS_1(arg1)                     (SWIG_PERL_OBJECT_DECL arg1)
#define SWIG_PERL_CALL_ARGS_1(arg1)                     (SWIG_PERL_OBJECT_CALL arg1)
#define SWIG_PERL_DECL_ARGS_2(arg1, arg2)               (SWIG_PERL_OBJECT_DECL arg1, arg2)
#define SWIG_PERL_CALL_ARGS_2(arg1, arg2)               (SWIG_PERL_OBJECT_CALL arg1, arg2)

/* -----------------------------------------------------------------------------
 * pointers/data manipulation
 * ----------------------------------------------------------------------------- */

/* For backward compatibility only */
#define SWIG_POINTER_EXCEPTION  0

#ifdef __cplusplus
extern "C" {
#endif

#define SWIG_OWNER   SWIG_POINTER_OWN
#define SWIG_SHADOW  SWIG_OWNER << 1

#define SWIG_MAYBE_PERL_OBJECT SWIG_PERL_OBJECT_DECL

/* SWIG Perl macros */

934 935 936 937 938
/* Macro to declare an XS function */
#ifndef XSPROTO
#   define XSPROTO(name) void name(pTHX_ CV* cv)
#endif

939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955
/* Macro to call an XS function */
#ifdef PERL_OBJECT 
#  define SWIG_CALLXS(_name) _name(cv,pPerl) 
#else 
#  ifndef MULTIPLICITY 
#    define SWIG_CALLXS(_name) _name(cv) 
#  else 
#    define SWIG_CALLXS(_name) _name(PERL_GET_THX, cv) 
#  endif 
#endif 

#ifdef PERL_OBJECT
#define MAGIC_PPERL  CPerlObj *pPerl = (CPerlObj *) this;

#ifdef __cplusplus
extern "C" {
#endif
956
typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *);
957 958 959 960 961 962
#ifdef __cplusplus
}
#endif

#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
#define SWIGCLASS_STATIC
963 964 965

#else /* PERL_OBJECT */

966 967
#define MAGIC_PPERL
#define SWIGCLASS_STATIC static SWIGUNUSED
968

969 970 971 972 973 974
#ifndef MULTIPLICITY
#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)

#ifdef __cplusplus
extern "C" {
#endif
975
typedef int (*SwigMagicFunc)(SV *, MAGIC *);
976 977 978 979
#ifdef __cplusplus
}
#endif

980
#else /* MULTIPLICITY */
981 982

#define SWIG_MAGIC(a,b) (struct interpreter *interp, SV *a, MAGIC *b)
983

984 985 986
#ifdef __cplusplus
extern "C" {
#endif
987
typedef int (*SwigMagicFunc)(struct interpreter *, SV *, MAGIC *);
988 989 990 991
#ifdef __cplusplus
}
#endif

992 993
#endif /* MULTIPLICITY */
#endif /* PERL_OBJECT */
994 995 996 997 998 999 1000 1001

#  ifdef PERL_OBJECT
#    define SWIG_croak_null() SWIG_Perl_croak_null(pPerl)
static void SWIG_Perl_croak_null(CPerlObj *pPerl)
#  else
static void SWIG_croak_null()
#  endif
{
1002
  SV *err = get_sv("@", GV_ADD);
1003 1004 1005
#  if (PERL_VERSION < 6)
  croak("%_", err);
#  else
1006 1007 1008 1009
  if (sv_isobject(err))
    croak(0);
  else
    croak("%s", SvPV_nolen(err));
1010 1011 1012 1013
#  endif
}


1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042
/* 
   Define how strict is the cast between strings and integers/doubles
   when overloading between these types occurs.
   
   The default is making it as strict as possible by using SWIG_AddCast
   when needed.
   
   You can use -DSWIG_PERL_NO_STRICT_STR2NUM at compilation time to
   disable the SWIG_AddCast, making the casting between string and
   numbers less strict.

   In the end, we try to solve the overloading between strings and
   numerical types in the more natural way, but if you can avoid it,
   well, avoid it using %rename, for example.
*/
#ifndef SWIG_PERL_NO_STRICT_STR2NUM
# ifndef SWIG_PERL_STRICT_STR2NUM
#  define SWIG_PERL_STRICT_STR2NUM
# endif
#endif
#ifdef SWIG_PERL_STRICT_STR2NUM
/* string takes precedence */
#define SWIG_Str2NumCast(x) SWIG_AddCast(x)  
#else
/* number takes precedence */
#define SWIG_Str2NumCast(x) x
#endif


1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056

#include <stdlib.h>

SWIGRUNTIME const char *
SWIG_Perl_TypeProxyName(const swig_type_info *type) {
  if (!type) return NULL;
  if (type->clientdata != NULL) {
    return (const char*) type->clientdata;
  } 
  else {
    return type->name;
  }
}

1057
/* Identical to SWIG_TypeCheck, except for strcmp comparison */
1058 1059
SWIGRUNTIME swig_cast_info *
SWIG_TypeProxyCheck(const char *c, swig_type_info *ty) {
1060 1061 1062
  if (ty) {
    swig_cast_info *iter = ty->cast;
    while (iter) {
1063
      if (strcmp(SWIG_Perl_TypeProxyName(iter->type), c) == 0) {
1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079
        if (iter == ty->cast)
          return iter;
        /* Move iter to the top of the linked list */
        iter->prev->next = iter->next;
        if (iter->next)
          iter->next->prev = iter->prev;
        iter->next = ty->cast;
        iter->prev = 0;
        if (ty->cast) ty->cast->prev = iter;
        ty->cast = iter;
        return iter;
      }
      iter = iter->next;
    }
  }
  return 0;
1080 1081 1082 1083 1084
}

/* Function for getting a pointer value */

SWIGRUNTIME int
1085
SWIG_Perl_ConvertPtrAndOwn(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *_t, int flags, int *own) {
1086 1087 1088
  swig_cast_info *tc;
  void *voidptr = (void *)0;
  SV *tsv = 0;
1089 1090 1091 1092

  if (own)
    *own = 0;

1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123
  /* If magical, apply more magic */
  if (SvGMAGICAL(sv))
    mg_get(sv);

  /* Check to see if this is an object */
  if (sv_isobject(sv)) {
    IV tmp = 0;
    tsv = (SV*) SvRV(sv);
    if ((SvTYPE(tsv) == SVt_PVHV)) {
      MAGIC *mg;
      if (SvMAGICAL(tsv)) {
        mg = mg_find(tsv,'P');
        if (mg) {
          sv = mg->mg_obj;
          if (sv_isobject(sv)) {
	    tsv = (SV*)SvRV(sv);
            tmp = SvIV(tsv);
          }
        }
      } else {
        return SWIG_ERROR;
      }
    } else {
      tmp = SvIV(tsv);
    }
    voidptr = INT2PTR(void *,tmp);
  } else if (! SvOK(sv)) {            /* Check for undef */
    *(ptr) = (void *) 0;
    return SWIG_OK;
  } else if (SvTYPE(sv) == SVt_RV) {  /* Check for NULL pointer */
    if (!SvROK(sv)) {
1124 1125 1126 1127 1128 1129 1130 1131
      /* In Perl 5.12 and later, SVt_RV == SVt_IV, so sv could be a valid integer value.  */
      if (SvIOK(sv)) {
        return SWIG_ERROR;
      } else {
        /* NULL pointer (reference to undef). */
        *(ptr) = (void *) 0;
        return SWIG_OK;
      }
1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144
    } else {
      return SWIG_ERROR;
    }
  } else {                            /* Don't know what it is */
    return SWIG_ERROR;
  }
  if (_t) {
    /* Now see if the types match */
    char *_c = HvNAME(SvSTASH(SvRV(sv)));
    tc = SWIG_TypeProxyCheck(_c,_t);
    if (!tc) {
      return SWIG_ERROR;
    }
1145 1146 1147
    {
      int newmemory = 0;
      *ptr = SWIG_TypeCast(tc,voidptr,&newmemory);
1148 1149 1150 1151 1152
      if (newmemory == SWIG_CAST_NEW_MEMORY) {
        assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */
        if (own)
          *own = *own | SWIG_CAST_NEW_MEMORY;
      }
1153
    }
1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166
  } else {
    *ptr = voidptr;
  }

  /* 
   *  DISOWN implementation: we need a perl guru to check this one.
   */
  if (tsv && (flags & SWIG_POINTER_DISOWN)) {
    /* 
     *  almost copy paste code from below SWIG_POINTER_OWN setting
     */
    SV *obj = sv;
    HV *stash = SvSTASH(SvRV(obj));
1167
    GV *gv = *(GV**)hv_fetch(stash, "OWNER", 5, TRUE);
1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181
    if (isGV(gv)) {
      HV *hv = GvHVn(gv);
      /*
       * To set ownership (see below), a newSViv(1) entry is added. 
       * Hence, to remove ownership, we delete the entry.
       */
      if (hv_exists_ent(hv, obj, 0)) {
	hv_delete_ent(hv, obj, 0, 0);
      }
    }
  }
  return SWIG_OK;
}

1182 1183 1184 1185 1186
SWIGRUNTIME int
SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *_t, int flags) {
  return SWIG_Perl_ConvertPtrAndOwn(sv, ptr, _t, flags, 0);
}

1187 1188
SWIGRUNTIME void
SWIG_Perl_MakePtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, swig_type_info *t, int flags) {
1189
  if (ptr && (flags & (SWIG_SHADOW | SWIG_POINTER_OWN))) {
1190 1191 1192 1193
    SV *self;
    SV *obj=newSV(0);
    HV *hash=newHV();
    HV *stash;
1194
    sv_setref_pv(obj, SWIG_Perl_TypeProxyName(t), ptr);
1195 1196 1197
    stash=SvSTASH(SvRV(obj));
    if (flags & SWIG_POINTER_OWN) {
      HV *hv;
1198
      GV *gv = *(GV**)hv_fetch(stash, "OWNER", 5, TRUE);
1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211
      if (!isGV(gv))
        gv_init(gv, stash, "OWNER", 5, FALSE);
      hv=GvHVn(gv);
      hv_store_ent(hv, obj, newSViv(1), 0);
    }
    sv_magic((SV *)hash, (SV *)obj, 'P', Nullch, 0);
    SvREFCNT_dec(obj);
    self=newRV_noinc((SV *)hash);
    sv_setsv(sv, self);
    SvREFCNT_dec((SV *)self);
    sv_bless(sv, stash);
  }
  else {
1212
    sv_setref_pv(sv, SWIG_Perl_TypeProxyName(t), ptr);
1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247
  }
}

SWIGRUNTIMEINLINE SV *
SWIG_Perl_NewPointerObj(SWIG_MAYBE_PERL_OBJECT void *ptr, swig_type_info *t, int flags) {
  SV *result = sv_newmortal();
  SWIG_MakePtr(result, ptr, t, flags);
  return result;
}

SWIGRUNTIME void
SWIG_Perl_MakePackedObj(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, int sz, swig_type_info *type) {
  char result[1024];
  char *r = result;
  if ((2*sz + 1 + strlen(SWIG_Perl_TypeProxyName(type))) > 1000) return;
  *(r++) = '_';
  r = SWIG_PackData(r,ptr,sz);
  strcpy(r,SWIG_Perl_TypeProxyName(type));
  sv_setpv(sv, result);
}

SWIGRUNTIME SV *
SWIG_Perl_NewPackedObj(SWIG_MAYBE_PERL_OBJECT void *ptr, int sz, swig_type_info *type) {
  SV *result = sv_newmortal();
  SWIG_Perl_MakePackedObj(result, ptr, sz, type);
  return result;
}

/* Convert a packed value value */
SWIGRUNTIME int
SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV *obj, void *ptr, int sz, swig_type_info *ty) {
  swig_cast_info *tc;
  const char  *c = 0;

  if ((!obj) || (!SvOK(obj))) return SWIG_ERROR;
1248
  c = SvPV_nolen(obj);
1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264
  /* Pointer values must start with leading underscore */
  if (*c != '_') return SWIG_ERROR;
  c++;
  c = SWIG_UnpackData(c,ptr,sz);
  if (ty) {
    tc = SWIG_TypeCheck(c,ty);
    if (!tc) return SWIG_ERROR;
  }
  return SWIG_OK;
}


/* Macros for low-level exception handling */
#define SWIG_croak(x)    { SWIG_Error(SWIG_RuntimeError, x); SWIG_fail; }


1265
typedef XSPROTO(SwigPerlWrapper);
1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302
typedef SwigPerlWrapper *SwigPerlWrapperPtr;

/* Structure for command table */
typedef struct {
  const char         *name;
  SwigPerlWrapperPtr  wrapper;
} swig_command_info;

/* Information for constant table */

#define SWIG_INT     1
#define SWIG_FLOAT   2
#define SWIG_STRING  3
#define SWIG_POINTER 4
#define SWIG_BINARY  5

/* Constant information structure */
typedef struct swig_constant_info {
    int              type;
    const char      *name;
    long             lvalue;
    double           dvalue;
    void            *pvalue;
    swig_type_info **ptype;
} swig_constant_info;


/* Structure for variable table */
typedef struct {
  const char   *name;
  SwigMagicFunc   set;
  SwigMagicFunc   get;
  swig_type_info  **type;
} swig_variable_info;

/* Magic variable code */
#ifndef PERL_OBJECT
1303 1304 1305 1306 1307 1308 1309 1310 1311 1312
# ifdef __cplusplus
#  define swig_create_magic(s,a,b,c) _swig_create_magic(s,const_cast<char*>(a),b,c)
# else
#  define swig_create_magic(s,a,b,c) _swig_create_magic(s,(char*)(a),b,c)
# endif
# ifndef MULTIPLICITY
SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(SV *, MAGIC *), int (*get)(SV *,MAGIC *)) 
# else
SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(struct interpreter*, SV *, MAGIC *), int (*get)(struct interpreter*, SV *,MAGIC *)) 
# endif
1313 1314 1315 1316 1317 1318
#else
#  define swig_create_magic(s,a,b,c) _swig_create_magic(pPerl,s,a,b,c)
SWIGRUNTIME void _swig_create_magic(CPerlObj *pPerl, SV *sv, const char *name, int (CPerlObj::*set)(SV *, MAGIC *), int (CPerlObj::*get)(SV *, MAGIC *)) 
#endif
{
  MAGIC *mg;
1319
  sv_magic(sv,sv,'U',name,strlen(name));
1320 1321
  mg = mg_find(sv,'U');
  mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL));
1322 1323
  mg->mg_virtual->svt_get = (SwigMagicFunc) get;
  mg->mg_virtual->svt_set = (SwigMagicFunc) set;
1324 1325 1326 1327 1328 1329 1330
  mg->mg_virtual->svt_len = 0;
  mg->mg_virtual->svt_clear = 0;
  mg->mg_virtual->svt_free = 0;
}


SWIGRUNTIME swig_module_info *
1331
SWIG_Perl_GetModule(void *SWIGUNUSEDPARM(clientdata)) {
1332 1333 1334 1335 1336
  static void *type_pointer = (void *)0;
  SV *pointer;

  /* first check if pointer already created */
  if (!type_pointer) {
1337
    pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE | GV_ADDMULTI);
1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350
    if (pointer && SvOK(pointer)) {
      type_pointer = INT2PTR(swig_type_info **, SvIV(pointer));
    }
  }

  return (swig_module_info *) type_pointer;
}

SWIGRUNTIME void
SWIG_Perl_SetModule(swig_module_info *module) {
  SV *pointer;

  /* create a new pointer */
1351
  pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE | GV_ADDMULTI);
1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367
  sv_setiv(pointer, PTR2IV(module));
}

#ifdef __cplusplus
}
#endif

/* Workaround perl5 global namespace pollution. Note that undefining library
 * functions like fopen will not solve the problem on all platforms as fopen
 * might be a macro on Windows but not necessarily on other operating systems. */
#ifdef do_open
  #undef do_open
#endif
#ifdef do_close
  #undef do_close
#endif
1368 1369 1370
#ifdef do_exec
  #undef do_exec
#endif
1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445
#ifdef scalar
  #undef scalar
#endif
#ifdef list
  #undef list
#endif
#ifdef apply
  #undef apply
#endif
#ifdef convert
  #undef convert
#endif
#ifdef Error
  #undef Error
#endif
#ifdef form
  #undef form
#endif
#ifdef vform
  #undef vform
#endif
#ifdef LABEL
  #undef LABEL
#endif
#ifdef METHOD
  #undef METHOD
#endif
#ifdef Move
  #undef Move
#endif
#ifdef yylex
  #undef yylex
#endif
#ifdef yyparse
  #undef yyparse
#endif
#ifdef yyerror
  #undef yyerror
#endif
#ifdef invert
  #undef invert
#endif
#ifdef ref
  #undef ref
#endif
#ifdef read
  #undef read
#endif
#ifdef write
  #undef write
#endif
#ifdef eof
  #undef eof
#endif
#ifdef close
  #undef close
#endif
#ifdef rewind
  #undef rewind
#endif
#ifdef free
  #undef free
#endif
#ifdef malloc
  #undef malloc
#endif
#ifdef calloc
  #undef calloc
#endif
#ifdef Stat
  #undef Stat
#endif
#ifdef check
  #undef check
#endif
1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457
#ifdef seekdir
  #undef seekdir
#endif
#ifdef open
  #undef open
#endif
#ifdef readdir
  #undef readdir
#endif
#ifdef bind
  #undef bind
#endif
1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471
#ifdef access
  #undef access
#endif
#ifdef stat
  #undef stat
#endif

#ifdef bool
  /* Leave if macro is from C99 stdbool.h */
  #ifndef __bool_true_false_are_defined
    #undef bool
  #endif
#endif

1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487



#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 

#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else 



/* -------- TYPES TABLE (BEGIN) -------- */

#define SWIGTYPE_p__address_tuple swig_types[0]
#define SWIGTYPE_p_callback_data swig_types[1]
#define SWIGTYPE_p_char swig_types[2]
#define SWIGTYPE_p_double swig_types[3]
#define SWIGTYPE_p_ea_tag_t swig_types[4]
1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512
#define SWIGTYPE_p_event_handle swig_types[5]
#define SWIGTYPE_p_event_notification swig_types[6]
#define SWIGTYPE_p_event_type_t swig_types[7]
#define SWIGTYPE_p_f_p_char_int_p_p_pubsub_handle_t__int swig_types[8]
#define SWIGTYPE_p_f_p_pubsub_handle_t__int swig_types[9]
#define SWIGTYPE_p_f_p_pubsub_handle_t_p_char_pubsub_notify_callback_t_p_void_p_pubsub_error_t__p_pubsub_subscription_t swig_types[10]
#define SWIGTYPE_p_f_p_pubsub_handle_t_p_int_p_pubsub_error_t__int swig_types[11]
#define SWIGTYPE_p_f_p_pubsub_handle_t_p_pubsub_notification_t_p_pubsub_error_t__int swig_types[12]
#define SWIGTYPE_p_f_p_pubsub_handle_t_p_pubsub_subscription_t_p_pubsub_error_t__int swig_types[13]
#define SWIGTYPE_p_f_p_struct_event_handle_int_p_pubsub_subscription_t_p_void__void swig_types[14]
#define SWIGTYPE_p_f_p_struct_event_handle_p_struct_event_notification_p_void__void swig_types[15]
#define SWIGTYPE_p_int32_t swig_types[16]
#define SWIGTYPE_p_int64_t swig_types[17]
#define SWIGTYPE_p_p_char swig_types[18]
#define SWIGTYPE_p_p_timeval swig_types[19]
#define SWIGTYPE_p_pubsub_error_t swig_types[20]
#define SWIGTYPE_p_pubsub_handle_t swig_types[21]
#define SWIGTYPE_p_pubsub_notification_t swig_types[22]
#define SWIGTYPE_p_pubsub_subscription_t swig_types[23]
#define SWIGTYPE_p_timeval swig_types[24]
#define SWIGTYPE_p_unsigned_char swig_types[25]
#define SWIGTYPE_p_va_list swig_types[26]
#define SWIGTYPE_p_void swig_types[27]
static swig_type_info *swig_types[29];
static swig_module_info swig_module = {swig_types, 28, 0, 0, 0, 0};
1513 1514 1515 1516 1517 1518 1519 1520 1521 1522
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)

/* -------- TYPES TABLE (END) -------- */

#define SWIG_init    boot_event

#define SWIG_name   "eventc::boot_event"
#define SWIG_prefix "eventc::"

1523
#define SWIGVERSION 0x020012 
1524
#define SWIG_VERSION SWIGVERSION
1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548


#define SWIG_as_voidptr(a) (void *)((const void *)(a)) 
#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a)) 


#ifdef __cplusplus
extern "C"
#endif
#ifndef PERL_OBJECT
#ifndef MULTIPLICITY
SWIGEXPORT void SWIG_init (CV* cv);
#else
SWIGEXPORT void SWIG_init (pTHXo_ CV* cv);
#endif
#else
SWIGEXPORT void SWIG_init (CV *cv, CPerlObj *);
#endif


#define NO_EVENT_MACROS
#include "event.h"


1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568
SWIGINTERNINLINE SV *
SWIG_FromCharPtrAndSize(const char* carray, size_t size)
{
  SV *obj = sv_newmortal();
  if (carray) {
    sv_setpvn(obj, carray, size);
  } else {
    sv_setsv(obj, &PL_sv_undef);
  }
  return obj;
}


SWIGINTERNINLINE SV * 
SWIG_FromCharPtr(const char *cptr)
{ 
  return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
}


1569 1570
SWIGINTERNINLINE SV *
SWIG_From_long  SWIG_PERL_DECL_ARGS_1(long value)
1571 1572 1573 1574 1575 1576 1577
{
  SV *sv;
  if (value >= IV_MIN && value <= IV_MAX)
    sv = newSViv(value);
  else
    sv = newSVpvf("%ld", value);
  return sv_2mortal(sv);
1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588
}


SWIGINTERNINLINE SV *
SWIG_From_int  SWIG_PERL_DECL_ARGS_1(int value)
{    
  return SWIG_From_long  SWIG_PERL_CALL_ARGS_1(value);
}


#include <limits.h>
1589 1590 1591 1592 1593 1594
#if !defined(SWIG_NO_LLONG_MAX)
# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
#   define LLONG_MAX __LONG_LONG_MAX__
#   define LLONG_MIN (-LLONG_MAX - 1LL)
#   define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
# endif
1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607
#endif


SWIGINTERN int
SWIG_AsVal_double SWIG_PERL_DECL_ARGS_2(SV *obj, double *val)
{
  if (SvNIOK(obj)) {
    if (val) *val = SvNV(obj);
    return SWIG_OK;
  } else if (SvIOK(obj)) {
    if (val) *val = (double) SvIV(obj);
    return SWIG_AddCast(SWIG_OK);
  } else {
1608
    const char *nptr = SvPV_nolen(obj);
1609 1610
    if (nptr) {
      char *endptr;
1611 1612 1613
      double v;
      errno = 0;
      v = strtod(nptr, &endptr);
1614 1615 1616 1617 1618 1619
      if (errno == ERANGE) {
	errno = 0;
	return SWIG_OverflowError;
      } else {
	if (*endptr == '\0') {
	  if (val) *val = v;
1620
	  return SWIG_Str2NumCast(SWIG_OK);
1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667
	}
      }
    }
  }
  return SWIG_TypeError;
}


#include <float.h>


#include <math.h>


SWIGINTERNINLINE int
SWIG_CanCastAsInteger(double *d, double min, double max) {
  double x = *d;
  if ((min <= x && x <= max)) {
   double fx = floor(x);
   double cx = ceil(x);
   double rd =  ((x - fx) < 0.5) ? fx : cx; /* simple rint */
   if ((errno == EDOM) || (errno == ERANGE)) {
     errno = 0;
   } else {
     double summ, reps, diff;
     if (rd < x) {
       diff = x - rd;
     } else if (rd > x) {
       diff = rd - x;
     } else {
       return 1;
     }
     summ = rd + x;
     reps = diff/summ;
     if (reps < 8*DBL_EPSILON) {
       *d = rd;
       return 1;
     }
   }
  }
  return 0;
}


SWIGINTERN int
SWIG_AsVal_long SWIG_PERL_DECL_ARGS_2(SV *obj, long* val)
{
1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681
  if (SvUOK(obj)) {
    UV v = SvUV(obj);
    if (v <= LONG_MAX) {
      if (val) *val = v;
      return SWIG_OK;
    }
    return SWIG_OverflowError;
  } else if (SvIOK(obj)) {
    IV v = SvIV(obj);
    if (v >= LONG_MIN && v <= LONG_MAX) {
      if(val) *val = v;
      return SWIG_OK;
    }
    return SWIG_OverflowError;
1682 1683
  } else {
    int dispatch = 0;
1684
    const char *nptr = SvPV_nolen(obj);
1685 1686
    if (nptr) {
      char *endptr;
1687 1688 1689
      long v;
      errno = 0;
      v = strtol(nptr, &endptr,0);
1690 1691 1692 1693 1694 1695
      if (errno == ERANGE) {
	errno = 0;
	return SWIG_OverflowError;
      } else {
	if (*endptr == '\0') {
	  if (val) *val = v;
1696
	  return SWIG_Str2NumCast(SWIG_OK);
1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729
	}
      }
    }
    if (!dispatch) {
      double d;
      int res = SWIG_AddCast(SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(obj,&d));
      if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) {
	if (val) *val = (long)(d);
	return res;
      }
    }
  }
  return SWIG_TypeError;
}


SWIGINTERN int
SWIG_AsVal_int SWIG_PERL_DECL_ARGS_2(SV * obj, int *val)
{
  long v;
  int res = SWIG_AsVal_long SWIG_PERL_CALL_ARGS_2(obj, &v);
  if (SWIG_IsOK(res)) {
    if ((v < INT_MIN || v > INT_MAX)) {
      return SWIG_OverflowError;
    } else {
      if (val) *val = (int)(v);
    }
  }  
  return res;
}


SWIGINTERN swig_type_info*
1730
SWIG_pchar_descriptor(void)
1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744
{
  static int init = 0;
  static swig_type_info* info = 0;
  if (!init) {
    info = SWIG_TypeQuery("_p_char");
    init = 1;
  }
  return info;
}


SWIGINTERN int
SWIG_AsCharPtrAndSize(SV *obj, char** cptr, size_t* psize, int *alloc)
{
1745 1746 1747 1748 1749
  if (SvMAGICAL(obj)) {
     SV *tmp = sv_newmortal();
     SvSetSV(tmp, obj);
     obj = tmp;
  }
1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788
  if (SvPOK(obj)) {
    STRLEN len = 0;
    char *cstr = SvPV(obj, len); 
    size_t size = len + 1;
    if (cptr)  {
      if (alloc) {
	if (*alloc == SWIG_NEWOBJ) {
	  *cptr = (char *)memcpy((char *)malloc((size)*sizeof(char)), cstr, sizeof(char)*(size));
	} else {
	  *cptr = cstr;
	  *alloc = SWIG_OLDOBJ;
	}
      }
    }
    if (psize) *psize = size;
    return SWIG_OK;
  } else {
    swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
    if (pchar_descriptor) {
      char* vptr = 0; 
      if (SWIG_ConvertPtr(obj, (void**)&vptr, pchar_descriptor, 0) == SWIG_OK) {
	if (cptr) *cptr = vptr;
	if (psize) *psize = vptr ? (strlen(vptr) + 1) : 0;
	if (alloc) *alloc = SWIG_OLDOBJ;
	return SWIG_OK;
      }
    }
  }
  return SWIG_TypeError;
}





SWIGINTERN int
SWIG_AsVal_unsigned_SS_long SWIG_PERL_DECL_ARGS_2(SV *obj, unsigned long *val) 
{
  if (SvUOK(obj)) {
1789 1790 1791 1792 1793 1794 1795 1796 1797
    UV v = SvUV(obj);
    if (v <= ULONG_MAX) {
      if (val) *val = v;
      return SWIG_OK;
    }
    return SWIG_OverflowError;
  } else if (SvIOK(obj)) {
    IV v = SvIV(obj);
    if (v >= 0 && v <= ULONG_MAX) {
1798 1799 1800
      if (val) *val = v;
      return SWIG_OK;
    }
1801
    return SWIG_OverflowError;
1802 1803
  } else {
    int dispatch = 0;
1804
    const char *nptr = SvPV_nolen(obj);
1805 1806
    if (nptr) {
      char *endptr;
1807 1808 1809
      unsigned long v;
      errno = 0;
      v = strtoul(nptr, &endptr,0);
1810 1811 1812 1813 1814 1815
      if (errno == ERANGE) {
	errno = 0;
	return SWIG_OverflowError;
      } else {
	if (*endptr == '\0') {
	  if (val) *val = v;
1816
	  return SWIG_Str2NumCast(SWIG_OK);
1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865
	}
      }
    }
    if (!dispatch) {
      double d;
      int res = SWIG_AddCast(SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(obj,&d));
      if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULONG_MAX)) {
	if (val) *val = (unsigned long)(d);
	return res;
      }
    }
  }
  return SWIG_TypeError;
}


SWIGINTERN int
SWIG_AsVal_unsigned_SS_int SWIG_PERL_DECL_ARGS_2(SV * obj, unsigned int *val)
{
  unsigned long v;
  int res = SWIG_AsVal_unsigned_SS_long SWIG_PERL_CALL_ARGS_2(obj, &v);
  if (SWIG_IsOK(res)) {
    if ((v > UINT_MAX)) {
      return SWIG_OverflowError;
    } else {
      if (val) *val = (unsigned int)(v);
    }
  }  
  return res;
}



	/*
	 * Queue of notifications that have been received
	 */
	struct callback_data {
		event_notification_t callback_notification;
		struct callback_data *next;
	};
	typedef struct callback_data *callback_data_t;

	callback_data_t callback_data_list;

	/*
	 * Simple wrappers, since we don't want to (maybe can't) call
	 * malloc/free from perl
	 */
	callback_data_t allocate_callback_data() {
1866
		return (callback_data_t)malloc(sizeof(struct callback_data));
1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884
	}

	void free_callback_data(callback_data_t data) {
		free(data);
	}

	callback_data_t dequeue_callback_data() {
		callback_data_t data = callback_data_list;
		if (callback_data_list) {
			callback_data_list = callback_data_list->next;
		}
		return data;
	}

	void enqueue_callback_data(callback_data_t data) {
		callback_data_t *pos = &callback_data_list;
		while (*pos) {
			pos = &((*pos)->next);
1885 1886 1887
		}
		*pos = data;
	}
1888

1889 1890 1891 1892 1893 1894 1895 1896 1897
	/*
	 * Stub callback that simply pushes a new entry onto the list
	 * of data for the perl callback function
	 */
	void perl_stub_callback(event_handle_t handle,
		event_notification_t notification, void *data) {
		callback_data_t new_data;

		new_data = allocate_callback_data();