/itexToMML

To download this project, use:
bzr branch http://golem.ph.utexas.edu/~distler/code/itexToMML/
82 by Jacques Distler
Perl bindings
1
/* ----------------------------------------------------------------------------
2
 * This file was automatically generated by SWIG (http://www.swig.org).
3
 * Version 3.0.12
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
12
#ifndef SWIGPERL
13
#define SWIGPERL
14
#endif
15
16
#define SWIG_CASTRANK_MODE
17
18
/* -----------------------------------------------------------------------------
19
 *  This section contains generic SWIG labels for method/variable
20
 *  declarations/attributes, and other compiler dependent labels.
21
 * ----------------------------------------------------------------------------- */
22
23
/* template workaround for compilers that cannot correctly implement the C++ standard */
24
#ifndef SWIGTEMPLATEDISAMBIGUATOR
25
# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
26
#  define SWIGTEMPLATEDISAMBIGUATOR template
27
# elif defined(__HP_aCC)
28
/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
29
/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
30
#  define SWIGTEMPLATEDISAMBIGUATOR template
31
# else
32
#  define SWIGTEMPLATEDISAMBIGUATOR
33
# endif
34
#endif
35
36
/* inline attribute */
37
#ifndef SWIGINLINE
38
# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
39
#   define SWIGINLINE inline
40
# else
41
#   define SWIGINLINE
42
# endif
43
#endif
44
45
/* attribute recognised by some compilers to avoid 'unused' warnings */
46
#ifndef SWIGUNUSED
47
# if defined(__GNUC__)
48
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
49
#     define SWIGUNUSED __attribute__ ((__unused__))
50
#   else
51
#     define SWIGUNUSED
52
#   endif
53
# elif defined(__ICC)
54
#   define SWIGUNUSED __attribute__ ((__unused__))
55
# else
56
#   define SWIGUNUSED
57
# endif
58
#endif
59
60
#ifndef SWIG_MSC_UNSUPPRESS_4505
61
# if defined(_MSC_VER)
62
#   pragma warning(disable : 4505) /* unreferenced local function has been removed */
63
# endif
64
#endif
65
66
#ifndef SWIGUNUSEDPARM
67
# ifdef __cplusplus
68
#   define SWIGUNUSEDPARM(p)
69
# else
70
#   define SWIGUNUSEDPARM(p) p SWIGUNUSED
71
# endif
72
#endif
73
74
/* internal SWIG method */
75
#ifndef SWIGINTERN
76
# define SWIGINTERN static SWIGUNUSED
77
#endif
78
79
/* internal inline SWIG method */
80
#ifndef SWIGINTERNINLINE
81
# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
82
#endif
83
84
/* exporting methods */
85
#if defined(__GNUC__)
86
#  if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
87
#    ifndef GCC_HASCLASSVISIBILITY
88
#      define GCC_HASCLASSVISIBILITY
89
#    endif
90
#  endif
91
#endif
92
93
#ifndef SWIGEXPORT
94
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
95
#   if defined(STATIC_LINKED)
96
#     define SWIGEXPORT
97
#   else
98
#     define SWIGEXPORT __declspec(dllexport)
99
#   endif
100
# else
101
#   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
102
#     define SWIGEXPORT __attribute__ ((visibility("default")))
103
#   else
104
#     define SWIGEXPORT
105
#   endif
106
# endif
107
#endif
108
109
/* calling conventions for Windows */
110
#ifndef SWIGSTDCALL
111
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
112
#   define SWIGSTDCALL __stdcall
113
# else
114
#   define SWIGSTDCALL
115
# endif
116
#endif
117
118
/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
119
#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
120
# define _CRT_SECURE_NO_DEPRECATE
121
#endif
122
123
/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
124
#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
125
# define _SCL_SECURE_NO_DEPRECATE
126
#endif
127
128
/* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */
129
#if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES)
130
# define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
131
#endif
132
133
/* Intel's compiler complains if a variable which was never initialised is
134
 * cast to void, which is a common idiom which we use to indicate that we
135
 * are aware a variable isn't used.  So we just silence that warning.
136
 * See: https://github.com/swig/swig/issues/192 for more discussion.
137
 */
138
#ifdef __INTEL_COMPILER
139
# pragma warning disable 592
140
#endif
141
142
/* -----------------------------------------------------------------------------
143
 * swigrun.swg
144
 *
145
 * This file contains generic C API SWIG runtime support for pointer
146
 * type checking.
147
 * ----------------------------------------------------------------------------- */
148
149
/* This should only be incremented when either the layout of swig_type_info changes,
150
   or for whatever reason, the runtime changes incompatibly */
151
#define SWIG_RUNTIME_VERSION "4"
152
153
/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
154
#ifdef SWIG_TYPE_TABLE
155
# define SWIG_QUOTE_STRING(x) #x
156
# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
157
# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
158
#else
159
# define SWIG_TYPE_TABLE_NAME
160
#endif
161
162
/*
163
  You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
164
  creating a static or dynamic library from the SWIG runtime code.
165
  In 99.9% of the cases, SWIG just needs to declare them as 'static'.
166
167
  But only do this if strictly necessary, ie, if you have problems
168
  with your compiler or suchlike.
169
*/
170
171
#ifndef SWIGRUNTIME
172
# define SWIGRUNTIME SWIGINTERN
173
#endif
174
175
#ifndef SWIGRUNTIMEINLINE
176
# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
177
#endif
178
179
/*  Generic buffer size */
180
#ifndef SWIG_BUFFER_SIZE
181
# define SWIG_BUFFER_SIZE 1024
182
#endif
183
184
/* Flags for pointer conversions */
185
#define SWIG_POINTER_DISOWN        0x1
186
#define SWIG_CAST_NEW_MEMORY       0x2
187
188
/* Flags for new pointer objects */
189
#define SWIG_POINTER_OWN           0x1
190
191
192
/*
193
   Flags/methods for returning states.
194
195
   The SWIG conversion methods, as ConvertPtr, return an integer
196
   that tells if the conversion was successful or not. And if not,
197
   an error code can be returned (see swigerrors.swg for the codes).
198
199
   Use the following macros/flags to set or process the returning
200
   states.
201
202
   In old versions of SWIG, code such as the following was usually written:
203
204
     if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
205
       // success code
206
     } else {
207
       //fail code
208
     }
209
210
   Now you can be more explicit:
211
212
    int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
213
    if (SWIG_IsOK(res)) {
214
      // success code
215
    } else {
216
      // fail code
217
    }
218
219
   which is the same really, but now you can also do
220
221
    Type *ptr;
222
    int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
223
    if (SWIG_IsOK(res)) {
224
      // success code
225
      if (SWIG_IsNewObj(res) {
226
        ...
227
	delete *ptr;
228
      } else {
229
        ...
230
      }
231
    } else {
232
      // fail code
233
    }
234
235
   I.e., now SWIG_ConvertPtr can return new objects and you can
236
   identify the case and take care of the deallocation. Of course that
237
   also requires SWIG_ConvertPtr to return new result values, such as
238
239
      int SWIG_ConvertPtr(obj, ptr,...) {
240
        if (<obj is ok>) {
241
          if (<need new object>) {
242
            *ptr = <ptr to new allocated object>;
243
            return SWIG_NEWOBJ;
244
          } else {
245
            *ptr = <ptr to old object>;
246
            return SWIG_OLDOBJ;
247
          }
248
        } else {
249
          return SWIG_BADOBJ;
250
        }
251
      }
252
253
   Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
254
   more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
255
   SWIG errors code.
256
257
   Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
258
   allows to return the 'cast rank', for example, if you have this
259
260
       int food(double)
261
       int fooi(int);
262
263
   and you call
264
265
      food(1)   // cast rank '1'  (1 -> 1.0)
266
      fooi(1)   // cast rank '0'
267
268
   just use the SWIG_AddCast()/SWIG_CheckState()
269
*/
270
271
#define SWIG_OK                    (0)
272
#define SWIG_ERROR                 (-1)
273
#define SWIG_IsOK(r)               (r >= 0)
274
#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)
275
276
/* The CastRankLimit says how many bits are used for the cast rank */
277
#define SWIG_CASTRANKLIMIT         (1 << 8)
278
/* The NewMask denotes the object was created (using new/malloc) */
279
#define SWIG_NEWOBJMASK            (SWIG_CASTRANKLIMIT  << 1)
280
/* The TmpMask is for in/out typemaps that use temporal objects */
281
#define SWIG_TMPOBJMASK            (SWIG_NEWOBJMASK << 1)
282
/* Simple returning values */
283
#define SWIG_BADOBJ                (SWIG_ERROR)
284
#define SWIG_OLDOBJ                (SWIG_OK)
285
#define SWIG_NEWOBJ                (SWIG_OK | SWIG_NEWOBJMASK)
286
#define SWIG_TMPOBJ                (SWIG_OK | SWIG_TMPOBJMASK)
287
/* Check, add and del mask methods */
288
#define SWIG_AddNewMask(r)         (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
289
#define SWIG_DelNewMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
290
#define SWIG_IsNewObj(r)           (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
291
#define SWIG_AddTmpMask(r)         (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
292
#define SWIG_DelTmpMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
293
#define SWIG_IsTmpObj(r)           (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
294
295
/* Cast-Rank Mode */
296
#if defined(SWIG_CASTRANK_MODE)
297
#  ifndef SWIG_TypeRank
298
#    define SWIG_TypeRank             unsigned long
299
#  endif
300
#  ifndef SWIG_MAXCASTRANK            /* Default cast allowed */
301
#    define SWIG_MAXCASTRANK          (2)
302
#  endif
303
#  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
304
#  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
305
SWIGINTERNINLINE int SWIG_AddCast(int r) {
306
  return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
307
}
308
SWIGINTERNINLINE int SWIG_CheckState(int r) {
309
  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
310
}
311
#else /* no cast-rank mode */
312
#  define SWIG_AddCast(r) (r)
313
#  define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
314
#endif
315
316
317
#include <string.h>
318
319
#ifdef __cplusplus
320
extern "C" {
321
#endif
322
323
typedef void *(*swig_converter_func)(void *, int *);
324
typedef struct swig_type_info *(*swig_dycast_func)(void **);
325
326
/* Structure to store information on one type */
327
typedef struct swig_type_info {
328
  const char             *name;			/* mangled name of this type */
329
  const char             *str;			/* human readable name of this type */
330
  swig_dycast_func        dcast;		/* dynamic cast function down a hierarchy */
331
  struct swig_cast_info  *cast;			/* linked list of types that can cast into this type */
332
  void                   *clientdata;		/* language specific type data */
333
  int                    owndata;		/* flag if the structure owns the clientdata */
334
} swig_type_info;
335
336
/* Structure to store a type and conversion function used for casting */
337
typedef struct swig_cast_info {
338
  swig_type_info         *type;			/* pointer to type that is equivalent to this type */
339
  swig_converter_func     converter;		/* function to cast the void pointers */
340
  struct swig_cast_info  *next;			/* pointer to next cast in linked list */
341
  struct swig_cast_info  *prev;			/* pointer to the previous cast */
342
} swig_cast_info;
343
344
/* Structure used to store module information
345
 * Each module generates one structure like this, and the runtime collects
346
 * all of these structures and stores them in a circularly linked list.*/
347
typedef struct swig_module_info {
348
  swig_type_info         **types;		/* Array of pointers to swig_type_info structures that are in this module */
349
  size_t                 size;		        /* Number of types in this module */
350
  struct swig_module_info *next;		/* Pointer to next element in circularly linked list */
351
  swig_type_info         **type_initial;	/* Array of initially generated type structures */
352
  swig_cast_info         **cast_initial;	/* Array of initially generated casting structures */
353
  void                    *clientdata;		/* Language specific module data */
354
} swig_module_info;
355
356
/*
357
  Compare two type names skipping the space characters, therefore
358
  "char*" == "char *" and "Class<int>" == "Class<int >", etc.
359
360
  Return 0 when the two name types are equivalent, as in
361
  strncmp, but skipping ' '.
362
*/
363
SWIGRUNTIME int
364
SWIG_TypeNameComp(const char *f1, const char *l1,
365
		  const char *f2, const char *l2) {
366
  for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
367
    while ((*f1 == ' ') && (f1 != l1)) ++f1;
368
    while ((*f2 == ' ') && (f2 != l2)) ++f2;
369
    if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
370
  }
371
  return (int)((l1 - f1) - (l2 - f2));
372
}
373
374
/*
375
  Check type equivalence in a name list like <name1>|<name2>|...
376
  Return 0 if equal, -1 if nb < tb, 1 if nb > tb
377
*/
378
SWIGRUNTIME int
379
SWIG_TypeCmp(const char *nb, const char *tb) {
380
  int equiv = 1;
381
  const char* te = tb + strlen(tb);
382
  const char* ne = nb;
383
  while (equiv != 0 && *ne) {
384
    for (nb = ne; *ne; ++ne) {
385
      if (*ne == '|') break;
386
    }
387
    equiv = SWIG_TypeNameComp(nb, ne, tb, te);
388
    if (*ne) ++ne;
389
  }
390
  return equiv;
391
}
392
393
/*
394
  Check type equivalence in a name list like <name1>|<name2>|...
395
  Return 0 if not equal, 1 if equal
396
*/
397
SWIGRUNTIME int
398
SWIG_TypeEquiv(const char *nb, const char *tb) {
399
  return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
400
}
401
402
/*
403
  Check the typename
404
*/
405
SWIGRUNTIME swig_cast_info *
406
SWIG_TypeCheck(const char *c, swig_type_info *ty) {
407
  if (ty) {
408
    swig_cast_info *iter = ty->cast;
409
    while (iter) {
410
      if (strcmp(iter->type->name, c) == 0) {
411
        if (iter == ty->cast)
412
          return iter;
413
        /* Move iter to the top of the linked list */
414
        iter->prev->next = iter->next;
415
        if (iter->next)
416
          iter->next->prev = iter->prev;
417
        iter->next = ty->cast;
418
        iter->prev = 0;
419
        if (ty->cast) ty->cast->prev = iter;
420
        ty->cast = iter;
421
        return iter;
422
      }
423
      iter = iter->next;
424
    }
425
  }
426
  return 0;
427
}
428
429
/*
430
  Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
431
*/
432
SWIGRUNTIME swig_cast_info *
433
SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
434
  if (ty) {
435
    swig_cast_info *iter = ty->cast;
436
    while (iter) {
437
      if (iter->type == from) {
438
        if (iter == ty->cast)
439
          return iter;
440
        /* Move iter to the top of the linked list */
441
        iter->prev->next = iter->next;
442
        if (iter->next)
443
          iter->next->prev = iter->prev;
444
        iter->next = ty->cast;
445
        iter->prev = 0;
446
        if (ty->cast) ty->cast->prev = iter;
447
        ty->cast = iter;
448
        return iter;
449
      }
450
      iter = iter->next;
451
    }
452
  }
453
  return 0;
454
}
455
456
/*
457
  Cast a pointer up an inheritance hierarchy
458
*/
459
SWIGRUNTIMEINLINE void *
460
SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
461
  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
462
}
463
464
/*
465
   Dynamic pointer casting. Down an inheritance hierarchy
466
*/
467
SWIGRUNTIME swig_type_info *
468
SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
469
  swig_type_info *lastty = ty;
470
  if (!ty || !ty->dcast) return ty;
471
  while (ty && (ty->dcast)) {
472
    ty = (*ty->dcast)(ptr);
473
    if (ty) lastty = ty;
474
  }
475
  return lastty;
476
}
477
478
/*
479
  Return the name associated with this type
480
*/
481
SWIGRUNTIMEINLINE const char *
482
SWIG_TypeName(const swig_type_info *ty) {
483
  return ty->name;
484
}
485
486
/*
487
  Return the pretty name associated with this type,
488
  that is an unmangled type name in a form presentable to the user.
489
*/
490
SWIGRUNTIME const char *
491
SWIG_TypePrettyName(const swig_type_info *type) {
492
  /* The "str" field contains the equivalent pretty names of the
493
     type, separated by vertical-bar characters.  We choose
494
     to print the last name, as it is often (?) the most
495
     specific. */
496
  if (!type) return NULL;
497
  if (type->str != NULL) {
498
    const char *last_name = type->str;
499
    const char *s;
500
    for (s = type->str; *s; s++)
501
      if (*s == '|') last_name = s+1;
502
    return last_name;
503
  }
504
  else
505
    return type->name;
506
}
507
508
/*
509
   Set the clientdata field for a type
510
*/
511
SWIGRUNTIME void
512
SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
513
  swig_cast_info *cast = ti->cast;
514
  /* if (ti->clientdata == clientdata) return; */
515
  ti->clientdata = clientdata;
516
517
  while (cast) {
518
    if (!cast->converter) {
519
      swig_type_info *tc = cast->type;
520
      if (!tc->clientdata) {
521
	SWIG_TypeClientData(tc, clientdata);
522
      }
523
    }
524
    cast = cast->next;
525
  }
526
}
527
SWIGRUNTIME void
528
SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
529
  SWIG_TypeClientData(ti, clientdata);
530
  ti->owndata = 1;
531
}
532
533
/*
534
  Search for a swig_type_info structure only by mangled name
535
  Search is a O(log #types)
536
537
  We start searching at module start, and finish searching when start == end.
538
  Note: if start == end at the beginning of the function, we go all the way around
539
  the circular list.
540
*/
541
SWIGRUNTIME swig_type_info *
542
SWIG_MangledTypeQueryModule(swig_module_info *start,
543
                            swig_module_info *end,
544
		            const char *name) {
545
  swig_module_info *iter = start;
546
  do {
547
    if (iter->size) {
548
      size_t l = 0;
549
      size_t r = iter->size - 1;
550
      do {
551
	/* since l+r >= 0, we can (>> 1) instead (/ 2) */
552
	size_t i = (l + r) >> 1;
553
	const char *iname = iter->types[i]->name;
554
	if (iname) {
555
	  int compare = strcmp(name, iname);
556
	  if (compare == 0) {
557
	    return iter->types[i];
558
	  } else if (compare < 0) {
559
	    if (i) {
560
	      r = i - 1;
561
	    } else {
562
	      break;
563
	    }
564
	  } else if (compare > 0) {
565
	    l = i + 1;
566
	  }
567
	} else {
568
	  break; /* should never happen */
569
	}
570
      } while (l <= r);
571
    }
572
    iter = iter->next;
573
  } while (iter != end);
574
  return 0;
575
}
576
577
/*
578
  Search for a swig_type_info structure for either a mangled name or a human readable name.
579
  It first searches the mangled names of the types, which is a O(log #types)
580
  If a type is not found it then searches the human readable names, which is O(#types).
581
582
  We start searching at module start, and finish searching when start == end.
583
  Note: if start == end at the beginning of the function, we go all the way around
584
  the circular list.
585
*/
586
SWIGRUNTIME swig_type_info *
587
SWIG_TypeQueryModule(swig_module_info *start,
588
                     swig_module_info *end,
589
		     const char *name) {
590
  /* STEP 1: Search the name field using binary search */
591
  swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
592
  if (ret) {
593
    return ret;
594
  } else {
595
    /* STEP 2: If the type hasn't been found, do a complete search
596
       of the str field (the human readable name) */
597
    swig_module_info *iter = start;
598
    do {
599
      size_t i = 0;
600
      for (; i < iter->size; ++i) {
601
	if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
602
	  return iter->types[i];
603
      }
604
      iter = iter->next;
605
    } while (iter != end);
606
  }
607
608
  /* neither found a match */
609
  return 0;
610
}
611
612
/*
613
   Pack binary data into a string
614
*/
615
SWIGRUNTIME char *
616
SWIG_PackData(char *c, void *ptr, size_t sz) {
617
  static const char hex[17] = "0123456789abcdef";
618
  const unsigned char *u = (unsigned char *) ptr;
619
  const unsigned char *eu =  u + sz;
620
  for (; u != eu; ++u) {
621
    unsigned char uu = *u;
622
    *(c++) = hex[(uu & 0xf0) >> 4];
623
    *(c++) = hex[uu & 0xf];
624
  }
625
  return c;
626
}
627
628
/*
629
   Unpack binary data from a string
630
*/
631
SWIGRUNTIME const char *
632
SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
633
  unsigned char *u = (unsigned char *) ptr;
634
  const unsigned char *eu = u + sz;
635
  for (; u != eu; ++u) {
636
    char d = *(c++);
637
    unsigned char uu;
638
    if ((d >= '0') && (d <= '9'))
639
      uu = (unsigned char)((d - '0') << 4);
640
    else if ((d >= 'a') && (d <= 'f'))
641
      uu = (unsigned char)((d - ('a'-10)) << 4);
642
    else
643
      return (char *) 0;
644
    d = *(c++);
645
    if ((d >= '0') && (d <= '9'))
646
      uu |= (unsigned char)(d - '0');
647
    else if ((d >= 'a') && (d <= 'f'))
648
      uu |= (unsigned char)(d - ('a'-10));
649
    else
650
      return (char *) 0;
651
    *u = uu;
652
  }
653
  return c;
654
}
655
656
/*
657
   Pack 'void *' into a string buffer.
658
*/
659
SWIGRUNTIME char *
660
SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
661
  char *r = buff;
662
  if ((2*sizeof(void *) + 2) > bsz) return 0;
663
  *(r++) = '_';
664
  r = SWIG_PackData(r,&ptr,sizeof(void *));
665
  if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
666
  strcpy(r,name);
667
  return buff;
668
}
669
670
SWIGRUNTIME const char *
671
SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
672
  if (*c != '_') {
673
    if (strcmp(c,"NULL") == 0) {
674
      *ptr = (void *) 0;
675
      return name;
676
    } else {
677
      return 0;
678
    }
679
  }
680
  return SWIG_UnpackData(++c,ptr,sizeof(void *));
681
}
682
683
SWIGRUNTIME char *
684
SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
685
  char *r = buff;
686
  size_t lname = (name ? strlen(name) : 0);
687
  if ((2*sz + 2 + lname) > bsz) return 0;
688
  *(r++) = '_';
689
  r = SWIG_PackData(r,ptr,sz);
690
  if (lname) {
691
    strncpy(r,name,lname+1);
692
  } else {
693
    *r = 0;
694
  }
695
  return buff;
696
}
697
698
SWIGRUNTIME const char *
699
SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
700
  if (*c != '_') {
701
    if (strcmp(c,"NULL") == 0) {
702
      memset(ptr,0,sz);
703
      return name;
704
    } else {
705
      return 0;
706
    }
707
  }
708
  return SWIG_UnpackData(++c,ptr,sz);
709
}
710
711
#ifdef __cplusplus
712
}
713
#endif
714
715
/*  Errors in SWIG */
716
#define  SWIG_UnknownError    	   -1
717
#define  SWIG_IOError        	   -2
718
#define  SWIG_RuntimeError   	   -3
719
#define  SWIG_IndexError     	   -4
720
#define  SWIG_TypeError      	   -5
721
#define  SWIG_DivisionByZero 	   -6
722
#define  SWIG_OverflowError  	   -7
723
#define  SWIG_SyntaxError    	   -8
724
#define  SWIG_ValueError     	   -9
725
#define  SWIG_SystemError    	   -10
726
#define  SWIG_AttributeError 	   -11
727
#define  SWIG_MemoryError    	   -12
728
#define  SWIG_NullReferenceError   -13
729
730
731
732
#ifdef __cplusplus
733
/* Needed on some windows machines---since MS plays funny games with the header files under C++ */
734
#include <math.h>
735
#include <stdlib.h>
736
extern "C" {
737
#endif
738
#include "EXTERN.h"
739
#include "perl.h"
740
#include "XSUB.h"
741
742
/* Add in functionality missing in older versions of Perl. Much of this is based on Devel-PPPort on cpan. */
743
744
/* Add PERL_REVISION, PERL_VERSION, PERL_SUBVERSION if missing */
745
#ifndef PERL_REVISION
746
#  if !defined(__PATCHLEVEL_H_INCLUDED__) && !(defined(PATCHLEVEL) && defined(SUBVERSION))
747
#    define PERL_PATCHLEVEL_H_IMPLICIT
748
#    include <patchlevel.h>
749
#  endif
750
#  if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL)))
751
#    include <could_not_find_Perl_patchlevel.h>
752
#  endif
753
#  ifndef PERL_REVISION
754
#    define PERL_REVISION       (5)
755
#    define PERL_VERSION        PATCHLEVEL
756
#    define PERL_SUBVERSION     SUBVERSION
757
#  endif
758
#endif
759
760
#if defined(WIN32) && defined(PERL_OBJECT) && !defined(PerlIO_exportFILE)
761
#define PerlIO_exportFILE(fh,fl) (FILE*)(fh)
762
#endif
763
764
#ifndef SvIOK_UV
765
# define SvIOK_UV(sv)       (SvIOK(sv) && (SvUVX(sv) == SvIVX(sv)))
766
#endif
767
768
#ifndef SvUOK
769
# define SvUOK(sv)           SvIOK_UV(sv)
770
#endif
771
772
#if ((PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 5)))
773
#  define PL_sv_undef               sv_undef
774
#  define PL_na	                    na
775
#  define PL_errgv                  errgv
776
#  define PL_sv_no                  sv_no
777
#  define PL_sv_yes                 sv_yes
778
#  define PL_markstack_ptr          markstack_ptr
779
#endif
780
781
#ifndef IVSIZE
782
#  ifdef LONGSIZE
783
#    define IVSIZE LONGSIZE
784
#  else
785
#    define IVSIZE 4 /* A bold guess, but the best we can make. */
786
#  endif
787
#endif
788
789
#ifndef INT2PTR
790
#  if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE)
791
#    define PTRV                  UV
792
#    define INT2PTR(any,d)        (any)(d)
793
#  else
794
#    if PTRSIZE == LONGSIZE
795
#      define PTRV                unsigned long
796
#    else
797
#      define PTRV                unsigned
798
#    endif
799
#    define INT2PTR(any,d)        (any)(PTRV)(d)
800
#  endif
801
802
#  define NUM2PTR(any,d)  (any)(PTRV)(d)
803
#  define PTR2IV(p)       INT2PTR(IV,p)
804
#  define PTR2UV(p)       INT2PTR(UV,p)
805
#  define PTR2NV(p)       NUM2PTR(NV,p)
806
807
#  if PTRSIZE == LONGSIZE
808
#    define PTR2ul(p)     (unsigned long)(p)
809
#  else
810
#    define PTR2ul(p)     INT2PTR(unsigned long,p)
811
#  endif
812
#endif /* !INT2PTR */
813
814
#ifndef SvPV_nolen
815
# define SvPV_nolen(x) SvPV(x,PL_na)
816
#endif
817
818
#ifndef get_sv
819
#  define get_sv perl_get_sv
820
#endif
821
822
#ifndef ERRSV
823
#  define ERRSV get_sv("@",FALSE)
824
#endif
825
826
#ifndef pTHX_
827
#define pTHX_
828
#endif   
829
830
#include <string.h>
831
#ifdef __cplusplus
832
}
833
#endif
834
835
/* -----------------------------------------------------------------------------
836
 * error manipulation
837
 * ----------------------------------------------------------------------------- */
838
839
SWIGINTERN const char*
840
SWIG_Perl_ErrorType(int code) {
841
  switch(code) {
842
  case SWIG_MemoryError:
843
    return "MemoryError";
844
  case SWIG_IOError:
845
    return "IOError";
846
  case SWIG_RuntimeError:
847
    return "RuntimeError";
848
  case SWIG_IndexError:
849
    return "IndexError";
850
  case SWIG_TypeError:
851
    return "TypeError";
852
  case SWIG_DivisionByZero:
853
    return "ZeroDivisionError";
854
  case SWIG_OverflowError:
855
    return "OverflowError";
856
  case SWIG_SyntaxError:
857
    return "SyntaxError";
858
  case SWIG_ValueError:
859
    return "ValueError";
860
  case SWIG_SystemError:
861
    return "SystemError";
862
  case SWIG_AttributeError:
863
    return "AttributeError";
864
  default:
865
    return "RuntimeError";
866
  }
867
}
868
869
870
/* -----------------------------------------------------------------------------
871
 * perlrun.swg
872
 *
873
 * This file contains the runtime support for Perl modules
874
 * and includes code for managing global variables and pointer
875
 * type checking.
876
 * ----------------------------------------------------------------------------- */
877
878
#ifdef PERL_OBJECT
879
#define SWIG_PERL_OBJECT_DECL CPerlObj *SWIGUNUSEDPARM(pPerl),
880
#define SWIG_PERL_OBJECT_CALL pPerl,
881
#else
882
#define SWIG_PERL_OBJECT_DECL
883
#define SWIG_PERL_OBJECT_CALL
884
#endif
885
886
/* Common SWIG API */
887
888
/* for raw pointers */
889
#define SWIG_ConvertPtr(obj, pp, type, flags)           SWIG_Perl_ConvertPtr(SWIG_PERL_OBJECT_CALL obj, pp, type, flags)
890
#define SWIG_ConvertPtrAndOwn(obj, pp, type, flags,own) SWIG_Perl_ConvertPtrAndOwn(SWIG_PERL_OBJECT_CALL obj, pp, type, flags, own)
891
#define SWIG_NewPointerObj(p, type, flags)              SWIG_Perl_NewPointerObj(SWIG_PERL_OBJECT_CALL p, type, flags)
892
#define swig_owntype                                    int
893
894
/* for raw packed data */
895
#define SWIG_ConvertPacked(obj, p, s, type)             SWIG_Perl_ConvertPacked(SWIG_PERL_OBJECT_CALL obj, p, s, type)
896
#define SWIG_NewPackedObj(p, s, type)	                SWIG_Perl_NewPackedObj(SWIG_PERL_OBJECT_CALL p, s, type)
897
898
/* for class or struct pointers */
899
#define SWIG_ConvertInstance(obj, pptr, type, flags)    SWIG_ConvertPtr(obj, pptr, type, flags)
900
#define SWIG_NewInstanceObj(ptr, type, flags)           SWIG_NewPointerObj(ptr, type, flags)
901
902
/* for C or C++ function pointers */
903
#define SWIG_ConvertFunctionPtr(obj, pptr, type)        SWIG_ConvertPtr(obj, pptr, type, 0)
904
#define SWIG_NewFunctionPtrObj(ptr, type)               SWIG_NewPointerObj(ptr, type, 0)
905
906
/* for C++ member pointers, ie, member methods */
907
#define SWIG_ConvertMember(obj, ptr, sz, ty)            SWIG_ConvertPacked(obj, ptr, sz, ty)
908
#define SWIG_NewMemberObj(ptr, sz, type)                SWIG_NewPackedObj(ptr, sz, type)
909
910
911
/* Runtime API */
912
913
#define SWIG_GetModule(clientdata)                      SWIG_Perl_GetModule(clientdata)
914
#define SWIG_SetModule(clientdata, pointer)             SWIG_Perl_SetModule(pointer)
915
916
917
/* Error manipulation */
918
919
#define SWIG_ErrorType(code)                            SWIG_Perl_ErrorType(code)               
920
#define SWIG_Error(code, msg)            		sv_setpvf(get_sv("@", GV_ADD), "%s %s", SWIG_ErrorType(code), msg)
921
#define SWIG_fail                        		goto fail						    
922
923
/* Perl-specific SWIG API */
924
925
#define SWIG_MakePtr(sv, ptr, type, flags)              SWIG_Perl_MakePtr(SWIG_PERL_OBJECT_CALL sv, ptr, type, flags)
926
#define SWIG_MakePackedObj(sv, p, s, type)	        SWIG_Perl_MakePackedObj(SWIG_PERL_OBJECT_CALL sv, p, s, type)
927
#define SWIG_SetError(str)                              SWIG_Error(SWIG_RuntimeError, str)
928
929
930
#define SWIG_PERL_DECL_ARGS_1(arg1)                     (SWIG_PERL_OBJECT_DECL arg1)
931
#define SWIG_PERL_CALL_ARGS_1(arg1)                     (SWIG_PERL_OBJECT_CALL arg1)
932
#define SWIG_PERL_DECL_ARGS_2(arg1, arg2)               (SWIG_PERL_OBJECT_DECL arg1, arg2)
933
#define SWIG_PERL_CALL_ARGS_2(arg1, arg2)               (SWIG_PERL_OBJECT_CALL arg1, arg2)
934
935
/* -----------------------------------------------------------------------------
936
 * pointers/data manipulation
937
 * ----------------------------------------------------------------------------- */
938
939
/* For backward compatibility only */
940
#define SWIG_POINTER_EXCEPTION  0
941
942
#ifdef __cplusplus
943
extern "C" {
944
#endif
945
946
#define SWIG_OWNER   SWIG_POINTER_OWN
947
#define SWIG_SHADOW  SWIG_OWNER << 1
948
949
#define SWIG_MAYBE_PERL_OBJECT SWIG_PERL_OBJECT_DECL
950
951
/* SWIG Perl macros */
952
953
/* Macro to declare an XS function */
954
#ifndef XSPROTO
955
#   define XSPROTO(name) void name(pTHX_ CV* cv)
956
#endif
957
958
/* Macro to call an XS function */
959
#ifdef PERL_OBJECT 
960
#  define SWIG_CALLXS(_name) _name(cv,pPerl) 
961
#else 
962
#  ifndef MULTIPLICITY 
963
#    define SWIG_CALLXS(_name) _name(cv) 
964
#  else 
965
#    define SWIG_CALLXS(_name) _name(PERL_GET_THX, cv) 
966
#  endif 
967
#endif 
968
969
#ifdef PERL_OBJECT
970
#define MAGIC_PPERL  CPerlObj *pPerl = (CPerlObj *) this;
971
972
#ifdef __cplusplus
973
extern "C" {
974
#endif
975
typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *);
976
#ifdef __cplusplus
977
}
978
#endif
979
980
#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
981
#define SWIGCLASS_STATIC
982
983
#else /* PERL_OBJECT */
984
985
#define MAGIC_PPERL
986
#define SWIGCLASS_STATIC static SWIGUNUSED
987
988
#ifndef MULTIPLICITY
989
#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
990
991
#ifdef __cplusplus
992
extern "C" {
993
#endif
994
typedef int (*SwigMagicFunc)(SV *, MAGIC *);
995
#ifdef __cplusplus
996
}
997
#endif
998
999
#else /* MULTIPLICITY */
1000
1001
#define SWIG_MAGIC(a,b) (struct interpreter *interp, SV *a, MAGIC *b)
1002
1003
#ifdef __cplusplus
1004
extern "C" {
1005
#endif
1006
typedef int (*SwigMagicFunc)(struct interpreter *, SV *, MAGIC *);
1007
#ifdef __cplusplus
1008
}
1009
#endif
1010
1011
#endif /* MULTIPLICITY */
1012
#endif /* PERL_OBJECT */
1013
1014
#  ifdef PERL_OBJECT
1015
#    define SWIG_croak_null() SWIG_Perl_croak_null(pPerl)
1016
static void SWIGUNUSED SWIG_Perl_croak_null(CPerlObj *pPerl)
1017
#  else
1018
static void SWIGUNUSED SWIG_croak_null()
1019
#  endif
1020
{
1021
  SV *err = get_sv("@", GV_ADD);
1022
#  if (PERL_VERSION < 6)
1023
  croak("%_", err);
1024
#  else
1025
  if (sv_isobject(err))
1026
    croak(0);
1027
  else
1028
    croak("%s", SvPV_nolen(err));
1029
#  endif
1030
}
1031
1032
1033
/* 
1034
   Define how strict is the cast between strings and integers/doubles
1035
   when overloading between these types occurs.
1036
   
1037
   The default is making it as strict as possible by using SWIG_AddCast
1038
   when needed.
1039
   
1040
   You can use -DSWIG_PERL_NO_STRICT_STR2NUM at compilation time to
1041
   disable the SWIG_AddCast, making the casting between string and
1042
   numbers less strict.
1043
1044
   In the end, we try to solve the overloading between strings and
1045
   numerical types in the more natural way, but if you can avoid it,
1046
   well, avoid it using %rename, for example.
1047
*/
1048
#ifndef SWIG_PERL_NO_STRICT_STR2NUM
1049
# ifndef SWIG_PERL_STRICT_STR2NUM
1050
#  define SWIG_PERL_STRICT_STR2NUM
1051
# endif
1052
#endif
1053
#ifdef SWIG_PERL_STRICT_STR2NUM
1054
/* string takes precedence */
1055
#define SWIG_Str2NumCast(x) SWIG_AddCast(x)  
1056
#else
1057
/* number takes precedence */
1058
#define SWIG_Str2NumCast(x) x
1059
#endif
1060
1061
1062
1063
#include <stdlib.h>
1064
1065
SWIGRUNTIME const char *
1066
SWIG_Perl_TypeProxyName(const swig_type_info *type) {
1067
  if (!type) return NULL;
1068
  if (type->clientdata != NULL) {
1069
    return (const char*) type->clientdata;
1070
  } 
1071
  else {
1072
    return type->name;
1073
  }
1074
}
1075
1076
/* Identical to SWIG_TypeCheck, except for strcmp comparison */
1077
SWIGRUNTIME swig_cast_info *
1078
SWIG_TypeProxyCheck(const char *c, swig_type_info *ty) {
1079
  if (ty) {
1080
    swig_cast_info *iter = ty->cast;
1081
    while (iter) {
1082
      if (strcmp(SWIG_Perl_TypeProxyName(iter->type), c) == 0) {
1083
        if (iter == ty->cast)
1084
          return iter;
1085
        /* Move iter to the top of the linked list */
1086
        iter->prev->next = iter->next;
1087
        if (iter->next)
1088
          iter->next->prev = iter->prev;
1089
        iter->next = ty->cast;
1090
        iter->prev = 0;
1091
        if (ty->cast) ty->cast->prev = iter;
1092
        ty->cast = iter;
1093
        return iter;
1094
      }
1095
      iter = iter->next;
1096
    }
1097
  }
1098
  return 0;
1099
}
1100
1101
/* Function for getting a pointer value */
1102
1103
SWIGRUNTIME int
1104
SWIG_Perl_ConvertPtrAndOwn(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *_t, int flags, int *own) {
1105
  swig_cast_info *tc;
1106
  void *voidptr = (void *)0;
1107
  SV *tsv = 0;
1108
1109
  if (own)
1110
    *own = 0;
1111
1112
  /* If magical, apply more magic */
1113
  if (SvGMAGICAL(sv))
1114
    mg_get(sv);
1115
1116
  /* Check to see if this is an object */
1117
  if (sv_isobject(sv)) {
1118
    IV tmp = 0;
1119
    tsv = (SV*) SvRV(sv);
1120
    if ((SvTYPE(tsv) == SVt_PVHV)) {
1121
      MAGIC *mg;
1122
      if (SvMAGICAL(tsv)) {
1123
        mg = mg_find(tsv,'P');
1124
        if (mg) {
1125
          sv = mg->mg_obj;
1126
          if (sv_isobject(sv)) {
1127
	    tsv = (SV*)SvRV(sv);
1128
            tmp = SvIV(tsv);
1129
          }
1130
        }
1131
      } else {
1132
        return SWIG_ERROR;
1133
      }
1134
    } else {
1135
      tmp = SvIV(tsv);
1136
    }
1137
    voidptr = INT2PTR(void *,tmp);
1138
  } else if (! SvOK(sv)) {            /* Check for undef */
1139
    *(ptr) = (void *) 0;
1140
    return SWIG_OK;
1141
  } else if (SvTYPE(sv) == SVt_RV) {  /* Check for NULL pointer */
1142
    if (!SvROK(sv)) {
1143
      /* In Perl 5.12 and later, SVt_RV == SVt_IV, so sv could be a valid integer value.  */
1144
      if (SvIOK(sv)) {
1145
        return SWIG_ERROR;
1146
      } else {
1147
        /* NULL pointer (reference to undef). */
1148
        *(ptr) = (void *) 0;
1149
        return SWIG_OK;
1150
      }
1151
    } else {
1152
      return SWIG_ERROR;
1153
    }
1154
  } else {                            /* Don't know what it is */
1155
    return SWIG_ERROR;
1156
  }
1157
  if (_t) {
1158
    /* Now see if the types match */
1159
    char *_c = HvNAME(SvSTASH(SvRV(sv)));
1160
    tc = SWIG_TypeProxyCheck(_c,_t);
1161
#ifdef SWIG_DIRECTORS
1162
    if (!tc && !sv_derived_from(sv,SWIG_Perl_TypeProxyName(_t))) {
1163
#else
1164
    if (!tc) {
1165
#endif
1166
      return SWIG_ERROR;
1167
    }
1168
    {
1169
      int newmemory = 0;
1170
      *ptr = SWIG_TypeCast(tc,voidptr,&newmemory);
1171
      if (newmemory == SWIG_CAST_NEW_MEMORY) {
1172
        assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */
1173
        if (own)
1174
          *own = *own | SWIG_CAST_NEW_MEMORY;
1175
      }
1176
    }
1177
  } else {
1178
    *ptr = voidptr;
1179
  }
1180
1181
  /* 
1182
   *  DISOWN implementation: we need a perl guru to check this one.
1183
   */
1184
  if (tsv && (flags & SWIG_POINTER_DISOWN)) {
1185
    /* 
1186
     *  almost copy paste code from below SWIG_POINTER_OWN setting
1187
     */
1188
    SV *obj = sv;
1189
    HV *stash = SvSTASH(SvRV(obj));
1190
    GV *gv = *(GV**)hv_fetch(stash, "OWNER", 5, TRUE);
1191
    if (isGV(gv)) {
1192
      HV *hv = GvHVn(gv);
1193
      /*
1194
       * To set ownership (see below), a newSViv(1) entry is added. 
1195
       * Hence, to remove ownership, we delete the entry.
1196
       */
1197
      if (hv_exists_ent(hv, obj, 0)) {
1198
	hv_delete_ent(hv, obj, 0, 0);
1199
      }
1200
    }
1201
  }
1202
  return SWIG_OK;
1203
}
1204
1205
SWIGRUNTIME int
1206
SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *_t, int flags) {
1207
  return SWIG_Perl_ConvertPtrAndOwn(sv, ptr, _t, flags, 0);
1208
}
1209
1210
SWIGRUNTIME void
1211
SWIG_Perl_MakePtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, swig_type_info *t, int flags) {
1212
  if (ptr && (flags & (SWIG_SHADOW | SWIG_POINTER_OWN))) {
1213
    SV *self;
1214
    SV *obj=newSV(0);
1215
    HV *hash=newHV();
1216
    HV *stash;
1217
    sv_setref_pv(obj, SWIG_Perl_TypeProxyName(t), ptr);
1218
    stash=SvSTASH(SvRV(obj));
1219
    if (flags & SWIG_POINTER_OWN) {
1220
      HV *hv;
1221
      GV *gv = *(GV**)hv_fetch(stash, "OWNER", 5, TRUE);
1222
      if (!isGV(gv))
1223
        gv_init(gv, stash, "OWNER", 5, FALSE);
1224
      hv=GvHVn(gv);
1225
      hv_store_ent(hv, obj, newSViv(1), 0);
1226
    }
1227
    sv_magic((SV *)hash, (SV *)obj, 'P', Nullch, 0);
1228
    SvREFCNT_dec(obj);
1229
    self=newRV_noinc((SV *)hash);
1230
    sv_setsv(sv, self);
1231
    SvREFCNT_dec((SV *)self);
1232
    sv_bless(sv, stash);
1233
  }
1234
  else {
1235
    sv_setref_pv(sv, SWIG_Perl_TypeProxyName(t), ptr);
1236
  }
1237
}
1238
1239
SWIGRUNTIMEINLINE SV *
1240
SWIG_Perl_NewPointerObj(SWIG_MAYBE_PERL_OBJECT void *ptr, swig_type_info *t, int flags) {
1241
  SV *result = sv_newmortal();
1242
  SWIG_MakePtr(result, ptr, t, flags);
1243
  return result;
1244
}
1245
1246
SWIGRUNTIME void
1247
SWIG_Perl_MakePackedObj(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, int sz, swig_type_info *type) {
1248
  char result[1024];
1249
  char *r = result;
1250
  if ((2*sz + 1 + strlen(SWIG_Perl_TypeProxyName(type))) > 1000) return;
1251
  *(r++) = '_';
1252
  r = SWIG_PackData(r,ptr,sz);
1253
  strcpy(r,SWIG_Perl_TypeProxyName(type));
1254
  sv_setpv(sv, result);
1255
}
1256
1257
SWIGRUNTIME SV *
1258
SWIG_Perl_NewPackedObj(SWIG_MAYBE_PERL_OBJECT void *ptr, int sz, swig_type_info *type) {
1259
  SV *result = sv_newmortal();
1260
  SWIG_Perl_MakePackedObj(result, ptr, sz, type);
1261
  return result;
1262
}
1263
1264
/* Convert a packed value value */
1265
SWIGRUNTIME int
1266
SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV *obj, void *ptr, int sz, swig_type_info *ty) {
1267
  swig_cast_info *tc;
1268
  const char  *c = 0;
1269
1270
  if ((!obj) || (!SvOK(obj))) return SWIG_ERROR;
1271
  c = SvPV_nolen(obj);
1272
  /* Pointer values must start with leading underscore */
1273
  if (*c != '_') return SWIG_ERROR;
1274
  c++;
1275
  c = SWIG_UnpackData(c,ptr,sz);
1276
  if (ty) {
1277
    tc = SWIG_TypeCheck(c,ty);
1278
    if (!tc) return SWIG_ERROR;
1279
  }
1280
  return SWIG_OK;
1281
}
1282
1283
1284
/* Macros for low-level exception handling */
1285
#define SWIG_croak(x)    { SWIG_Error(SWIG_RuntimeError, x); SWIG_fail; }
1286
1287
1288
typedef XSPROTO(SwigPerlWrapper);
1289
typedef SwigPerlWrapper *SwigPerlWrapperPtr;
1290
1291
/* Structure for command table */
1292
typedef struct {
1293
  const char         *name;
1294
  SwigPerlWrapperPtr  wrapper;
1295
} swig_command_info;
1296
1297
/* Information for constant table */
1298
1299
#define SWIG_INT     1
1300
#define SWIG_FLOAT   2
1301
#define SWIG_STRING  3
1302
#define SWIG_POINTER 4
1303
#define SWIG_BINARY  5
1304
1305
/* Constant information structure */
1306
typedef struct swig_constant_info {
1307
    int              type;
1308
    const char      *name;
1309
    long             lvalue;
1310
    double           dvalue;
1311
    void            *pvalue;
1312
    swig_type_info **ptype;
1313
} swig_constant_info;
1314
1315
1316
/* Structure for variable table */
1317
typedef struct {
1318
  const char   *name;
1319
  SwigMagicFunc   set;
1320
  SwigMagicFunc   get;
1321
  swig_type_info  **type;
1322
} swig_variable_info;
1323
1324
/* Magic variable code */
1325
#ifndef PERL_OBJECT
1326
# ifdef __cplusplus
1327
#  define swig_create_magic(s,a,b,c) _swig_create_magic(s,const_cast<char*>(a),b,c)
1328
# else
1329
#  define swig_create_magic(s,a,b,c) _swig_create_magic(s,(char*)(a),b,c)
1330
# endif
1331
# ifndef MULTIPLICITY
1332
SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(SV *, MAGIC *), int (*get)(SV *,MAGIC *)) 
1333
# else
1334
SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(struct interpreter*, SV *, MAGIC *), int (*get)(struct interpreter*, SV *,MAGIC *)) 
1335
# endif
1336
#else
1337
#  define swig_create_magic(s,a,b,c) _swig_create_magic(pPerl,s,a,b,c)
1338
SWIGRUNTIME void _swig_create_magic(CPerlObj *pPerl, SV *sv, const char *name, int (CPerlObj::*set)(SV *, MAGIC *), int (CPerlObj::*get)(SV *, MAGIC *)) 
1339
#endif
1340
{
1341
  MAGIC *mg;
1342
  sv_magic(sv,sv,'U',name,strlen(name));
1343
  mg = mg_find(sv,'U');
1344
  mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL));
1345
  mg->mg_virtual->svt_get = (SwigMagicFunc) get;
1346
  mg->mg_virtual->svt_set = (SwigMagicFunc) set;
1347
  mg->mg_virtual->svt_len = 0;
1348
  mg->mg_virtual->svt_clear = 0;
1349
  mg->mg_virtual->svt_free = 0;
1350
}
1351
1352
1353
SWIGRUNTIME swig_module_info *
1354
SWIG_Perl_GetModule(void *SWIGUNUSEDPARM(clientdata)) {
1355
  static void *type_pointer = (void *)0;
1356
  SV *pointer;
1357
1358
  /* first check if pointer already created */
1359
  if (!type_pointer) {
1360
    pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE | GV_ADDMULTI);
1361
    if (pointer && SvOK(pointer)) {
1362
      type_pointer = INT2PTR(swig_type_info **, SvIV(pointer));
1363
    }
1364
  }
1365
1366
  return (swig_module_info *) type_pointer;
1367
}
1368
1369
SWIGRUNTIME void
1370
SWIG_Perl_SetModule(swig_module_info *module) {
1371
  SV *pointer;
1372
1373
  /* create a new pointer */
1374
  pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE | GV_ADDMULTI);
1375
  sv_setiv(pointer, PTR2IV(module));
1376
}
1377
1378
#ifdef __cplusplus
1379
}
1380
#endif
1381
1382
/* Workaround perl5 global namespace pollution. Note that undefining library
1383
 * functions like fopen will not solve the problem on all platforms as fopen
1384
 * might be a macro on Windows but not necessarily on other operating systems. */
1385
#ifdef do_open
1386
  #undef do_open
1387
#endif
1388
#ifdef do_close
1389
  #undef do_close
1390
#endif
1391
#ifdef do_exec
1392
  #undef do_exec
1393
#endif
1394
#ifdef scalar
1395
  #undef scalar
1396
#endif
1397
#ifdef list
1398
  #undef list
1399
#endif
1400
#ifdef apply
1401
  #undef apply
1402
#endif
1403
#ifdef convert
1404
  #undef convert
1405
#endif
1406
#ifdef Error
1407
  #undef Error
1408
#endif
1409
#ifdef form
1410
  #undef form
1411
#endif
1412
#ifdef vform
1413
  #undef vform
1414
#endif
1415
#ifdef LABEL
1416
  #undef LABEL
1417
#endif
1418
#ifdef METHOD
1419
  #undef METHOD
1420
#endif
1421
#ifdef Move
1422
  #undef Move
1423
#endif
1424
#ifdef yylex
1425
  #undef yylex
1426
#endif
1427
#ifdef yyparse
1428
  #undef yyparse
1429
#endif
1430
#ifdef yyerror
1431
  #undef yyerror
1432
#endif
1433
#ifdef invert
1434
  #undef invert
1435
#endif
1436
#ifdef ref
1437
  #undef ref
1438
#endif
1439
#ifdef read
1440
  #undef read
1441
#endif
1442
#ifdef write
1443
  #undef write
1444
#endif
1445
#ifdef eof
1446
  #undef eof
1447
#endif
1448
#ifdef close
1449
  #undef close
1450
#endif
1451
#ifdef rewind
1452
  #undef rewind
1453
#endif
1454
#ifdef free
1455
  #undef free
1456
#endif
1457
#ifdef malloc
1458
  #undef malloc
1459
#endif
1460
#ifdef calloc
1461
  #undef calloc
1462
#endif
1463
#ifdef Stat
1464
  #undef Stat
1465
#endif
1466
#ifdef check
1467
  #undef check
1468
#endif
1469
#ifdef seekdir
1470
  #undef seekdir
1471
#endif
1472
#ifdef open
1473
  #undef open
1474
#endif
1475
#ifdef readdir
1476
  #undef readdir
1477
#endif
1478
#ifdef bind
1479
  #undef bind
1480
#endif
1481
#ifdef access
1482
  #undef access
1483
#endif
1484
#ifdef stat
1485
  #undef stat
1486
#endif
1487
#ifdef seed
1488
  #undef seed
1489
#endif
1490
1491
#ifdef bool
1492
  /* Leave if macro is from C99 stdbool.h */
1493
  #ifndef __bool_true_false_are_defined
1494
    #undef bool
1495
  #endif
1496
#endif
1497
1498
1499
1500
1501
#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
1502
1503
#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else 
1504
1505
1506
1507
/* -------- TYPES TABLE (BEGIN) -------- */
1508
1509
#define SWIGTYPE_p_char swig_types[0]
1510
static swig_type_info *swig_types[2];
1511
static swig_module_info swig_module = {swig_types, 1, 0, 0, 0, 0};
1512
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
1513
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
1514
1515
/* -------- TYPES TABLE (END) -------- */
1516
1517
#define SWIG_init    boot_MathML__itex2MML
1518
1519
#define SWIG_name   "MathML::itex2MMLc::boot_MathML__itex2MML"
1520
#define SWIG_prefix "MathML::itex2MMLc::"
1521
1522
#define SWIGVERSION 0x030012 
1523
#define SWIG_VERSION SWIGVERSION
1524
1525
1526
#define SWIG_as_voidptr(a) (void *)((const void *)(a)) 
1527
#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a)) 
1528
1529
1530
#ifdef __cplusplus
1531
extern "C"
1532
#endif
1533
#ifndef PERL_OBJECT
1534
#ifndef MULTIPLICITY
1535
SWIGEXPORT void SWIG_init (CV* cv);
1536
#else
1537
SWIGEXPORT void SWIG_init (pTHXo_ CV* cv);
1538
#endif
1539
#else
1540
SWIGEXPORT void SWIG_init (CV *cv, CPerlObj *);
1541
#endif
1542
1543
1544
#include "itex2MML.h"
1545
extern const char * itex2MML_output ();
1546
1547
1548
SWIGINTERN swig_type_info*
1549
SWIG_pchar_descriptor(void)
1550
{
1551
  static int init = 0;
1552
  static swig_type_info* info = 0;
1553
  if (!init) {
1554
    info = SWIG_TypeQuery("_p_char");
1555
    init = 1;
1556
  }
1557
  return info;
1558
}
1559
1560
1561
SWIGINTERN int
1562
SWIG_AsCharPtrAndSize(SV *obj, char** cptr, size_t* psize, int *alloc)
1563
{
1564
  if (SvMAGICAL(obj)) {
1565
     SV *tmp = sv_newmortal();
1566
     SvSetSV(tmp, obj);
1567
     obj = tmp;
1568
  }
1569
  if (SvPOK(obj)) {
1570
    STRLEN len = 0;
1571
    char *cstr = SvPV(obj, len); 
1572
    size_t size = len + 1;
1573
    if (cptr)  {
1574
      if (alloc) {
1575
	if (*alloc == SWIG_NEWOBJ) {
1576
	  *cptr = (char *)memcpy(malloc((size)*sizeof(char)), cstr, sizeof(char)*(size));
1577
	} else {
1578
	  *cptr = cstr;
1579
	  *alloc = SWIG_OLDOBJ;
1580
	}
1581
      }
1582
    }
1583
    if (psize) *psize = size;
1584
    return SWIG_OK;
1585
  } else {
1586
    swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
1587
    if (pchar_descriptor) {
1588
      char* vptr = 0; 
1589
      if (SWIG_ConvertPtr(obj, (void**)&vptr, pchar_descriptor, 0) == SWIG_OK) {
1590
	if (cptr) *cptr = vptr;
1591
	if (psize) *psize = vptr ? (strlen(vptr) + 1) : 0;
1592
	if (alloc) *alloc = SWIG_OLDOBJ;
1593
	return SWIG_OK;
1594
      }
1595
    }
1596
  }
1597
  return SWIG_TypeError;
1598
}
1599
1600
1601
1602
1603
1604
#include <limits.h>
1605
#if !defined(SWIG_NO_LLONG_MAX)
1606
# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
1607
#   define LLONG_MAX __LONG_LONG_MAX__
1608
#   define LLONG_MIN (-LLONG_MAX - 1LL)
1609
#   define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
1610
# endif
1611
#endif
1612
1613
1614
#include <stdlib.h>
1615
#ifdef _MSC_VER
1616
# ifndef strtoull
1617
#  define strtoull _strtoui64
1618
# endif
1619
# ifndef strtoll
1620
#  define strtoll _strtoi64
1621
# endif
1622
#endif
1623
1624
1625
SWIGINTERN int
1626
SWIG_AsVal_double SWIG_PERL_DECL_ARGS_2(SV *obj, double *val)
1627
{
1628
  if (SvNIOK(obj)) {
1629
    if (val) *val = SvNV(obj);
1630
    return SWIG_OK;
1631
  } else if (SvIOK(obj)) {
1632
    if (val) *val = (double) SvIV(obj);
1633
    return SWIG_AddCast(SWIG_OK);
1634
  } else {
1635
    const char *nptr = SvPV_nolen(obj);
1636
    if (nptr) {
1637
      char *endptr;
1638
      double v;
1639
      errno = 0;
1640
      v = strtod(nptr, &endptr);
1641
      if (errno == ERANGE) {
1642
	errno = 0;
1643
	return SWIG_OverflowError;
1644
      } else {
1645
	if (*endptr == '\0') {
1646
	  if (val) *val = v;
1647
	  return SWIG_Str2NumCast(SWIG_OK);
1648
	}
1649
      }
1650
    }
1651
  }
1652
  return SWIG_TypeError;
1653
}
1654
1655
1656
#include <float.h>
1657
1658
1659
#include <math.h>
1660
1661
1662
SWIGINTERNINLINE int
1663
SWIG_CanCastAsInteger(double *d, double min, double max) {
1664
  double x = *d;
1665
  if ((min <= x && x <= max)) {
1666
   double fx = floor(x);
1667
   double cx = ceil(x);
1668
   double rd =  ((x - fx) < 0.5) ? fx : cx; /* simple rint */
1669
   if ((errno == EDOM) || (errno == ERANGE)) {
1670
     errno = 0;
1671
   } else {
1672
     double summ, reps, diff;
1673
     if (rd < x) {
1674
       diff = x - rd;
1675
     } else if (rd > x) {
1676
       diff = rd - x;
1677
     } else {
1678
       return 1;
1679
     }
1680
     summ = rd + x;
1681
     reps = diff/summ;
1682
     if (reps < 8*DBL_EPSILON) {
1683
       *d = rd;
1684
       return 1;
1685
     }
1686
   }
1687
  }
1688
  return 0;
1689
}
1690
1691
1692
SWIGINTERN int
1693
SWIG_AsVal_unsigned_SS_long SWIG_PERL_DECL_ARGS_2(SV *obj, unsigned long *val) 
1694
{
1695
  if (SvUOK(obj)) {
1696
    UV v = SvUV(obj);
1697
    if (UVSIZE <= sizeof(*val) || v <= ULONG_MAX) {
1698
      if (val) *val = v;
1699
      return SWIG_OK;
1700
    }
1701
    return SWIG_OverflowError;
1702
  } else if (SvIOK(obj)) {
1703
    IV v = SvIV(obj);
1704
    if (v >= 0 && (IVSIZE <= sizeof(*val) || v <= ULONG_MAX)) {
1705
      if (val) *val = v;
1706
      return SWIG_OK;
1707
    }
1708
    return SWIG_OverflowError;
1709
  } else {
1710
    int dispatch = 0;
1711
    const char *nptr = SvPV_nolen(obj);
1712
    if (nptr) {
1713
      char *endptr;
1714
      unsigned long v;
1715
      errno = 0;
1716
      v = strtoul(nptr, &endptr,0);
1717
      if (errno == ERANGE) {
1718
	errno = 0;
1719
	return SWIG_OverflowError;
1720
      } else {
1721
	if (*endptr == '\0') {
1722
	  if (val) *val = v;
1723
	  return SWIG_Str2NumCast(SWIG_OK);
1724
	}
1725
      }
1726
    }
1727
    if (!dispatch) {
1728
      double d;
1729
      int res = SWIG_AddCast(SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(obj,&d));
1730
      if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULONG_MAX)) {
1731
	if (val) *val = (unsigned long)(d);
1732
	return res;
1733
      }
1734
    }
1735
  }
1736
  return SWIG_TypeError;
1737
}
1738
1739
1740
#if defined(LLONG_MAX) && !defined(SWIG_LONG_LONG_AVAILABLE)
1741
#  define SWIG_LONG_LONG_AVAILABLE
1742
#endif
1743
1744
1745
#ifdef SWIG_LONG_LONG_AVAILABLE
1746
SWIGINTERN int
1747
SWIG_AsVal_unsigned_SS_long_SS_long SWIG_PERL_DECL_ARGS_2(SV *obj, unsigned long long *val)
1748
{
1749
  if (SvUOK(obj)) {
1750
    /* pretty sure this should be conditional on
1751
     * (UVSIZE <= sizeof(*val) || v <= ULLONG_MAX) */
1752
    if (val) *val = SvUV(obj);
1753
    return SWIG_OK;
1754
  } else  if (SvIOK(obj)) {
1755
    IV v = SvIV(obj);
1756
    if (v >= 0 && (IVSIZE <= sizeof(*val) || v <= ULLONG_MAX)) {
1757
      if (val) *val = v;
1758
      return SWIG_OK;
1759
    } else {
1760
      return SWIG_OverflowError;
1761
    }
1762
  } else {
1763
    int dispatch = 0;
1764
    const char *nptr = SvPV_nolen(obj);
1765
    if (nptr) {
1766
      char *endptr;
1767
      unsigned long long v;
1768
      errno = 0;
1769
      v = strtoull(nptr, &endptr,0);
1770
      if (errno == ERANGE) {
1771
	errno = 0;
1772
	return SWIG_OverflowError;
1773
      } else {
1774
	if (*endptr == '\0') {
1775
	  if (val) *val = v;
1776
	  return SWIG_Str2NumCast(SWIG_OK);
1777
	}
1778
      }
1779
    }
1780
    if (!dispatch) {
1781
      const double mant_max = 1LL << DBL_MANT_DIG;
1782
      double d;
1783
      int res = SWIG_AddCast(SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(obj,&d));
1784
      if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, mant_max)) {
1785
	if (val) *val = (unsigned long long)(d);
1786
	return res;
1787
      }
1788
    }
1789
  }
1790
  return SWIG_TypeError;
1791
}
1792
#endif
1793
1794
1795
SWIGINTERNINLINE int
1796
SWIG_AsVal_size_t SWIG_PERL_DECL_ARGS_2(SV * obj, size_t *val)
1797
{
1798
  int res = SWIG_TypeError;
1799
#ifdef SWIG_LONG_LONG_AVAILABLE
1800
  if (sizeof(size_t) <= sizeof(unsigned long)) {
1801
#endif
1802
    unsigned long v;
1803
    res = SWIG_AsVal_unsigned_SS_long SWIG_PERL_CALL_ARGS_2(obj, val ? &v : 0);
1804
    if (SWIG_IsOK(res) && val) *val = (size_t)(v);
1805
#ifdef SWIG_LONG_LONG_AVAILABLE
1806
  } else if (sizeof(size_t) <= sizeof(unsigned long long)) {
1807
    unsigned long long v;
1808
    res = SWIG_AsVal_unsigned_SS_long_SS_long SWIG_PERL_CALL_ARGS_2(obj, val ? &v : 0);
1809
    if (SWIG_IsOK(res) && val) *val = (size_t)(v);
1810
  }
1811
#endif
1812
  return res;
1813
}
1814
1815
1816
SWIGINTERNINLINE SV *
1817
SWIG_From_long  SWIG_PERL_DECL_ARGS_1(long value)
1818
{
1819
  SV *sv;
1820
  if (IVSIZE >= sizeof(value) || (value >= IV_MIN && value <= IV_MAX))
1821
    sv = newSViv(value);
1822
  else
1823
    sv = newSVpvf("%ld", value);
1824
  return sv_2mortal(sv);
1825
}
1826
1827
1828
SWIGINTERNINLINE SV *
1829
SWIG_From_int  SWIG_PERL_DECL_ARGS_1(int value)
1830
{    
1831
  return SWIG_From_long  SWIG_PERL_CALL_ARGS_1(value);
1832
}
1833
1834
1835
SWIGINTERNINLINE SV *
1836
SWIG_FromCharPtrAndSize(const char* carray, size_t size)
1837
{
1838
  SV *obj = sv_newmortal();
1839
  if (carray) {
1840
    sv_setpvn(obj, carray, size);
1841
  } else {
1842
    sv_setsv(obj, &PL_sv_undef);
1843
  }
1844
  return obj;
1845
}
1846
1847
1848
SWIGINTERNINLINE SV * 
1849
SWIG_FromCharPtr(const char *cptr)
1850
{ 
1851
  return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
1852
}
1853
1854
#ifdef __cplusplus
1855
extern "C" {
1856
#endif
1857
1858
#ifdef PERL_OBJECT
1859
#define MAGIC_CLASS _wrap_MathML__itex2MML_var::
1860
class _wrap_MathML__itex2MML_var : public CPerlObj {
1861
public:
1862
#else
1863
#define MAGIC_CLASS
1864
#endif
1865
SWIGCLASS_STATIC int swig_magic_readonly(pTHX_ SV *SWIGUNUSEDPARM(sv), MAGIC *SWIGUNUSEDPARM(mg)) {
1866
    MAGIC_PPERL
1867
    croak("Value is read-only.");
1868
    return 0;
1869
}
1870
1871
1872
#ifdef PERL_OBJECT
1873
};
1874
#endif
1875
1876
#ifdef __cplusplus
1877
}
1878
#endif
1879
1880
#ifdef __cplusplus
1881
extern "C" {
1882
#endif
1883
XS(_wrap_itex2MML_filter) {
1884
  {
1885
    char *arg1 = (char *) 0 ;
1886
    size_t arg2 ;
1887
    int res1 ;
1888
    char *buf1 = 0 ;
1889
    int alloc1 = 0 ;
1890
    size_t val2 ;
1891
    int ecode2 = 0 ;
1892
    int argvi = 0;
1893
    int result;
1894
    dXSARGS;
1895
    
1896
    if ((items < 2) || (items > 2)) {
1897
      SWIG_croak("Usage: itex2MML_filter(buffer,length);");
1898
    }
1899
    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
1900
    if (!SWIG_IsOK(res1)) {
1901
      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "itex2MML_filter" "', argument " "1"" of type '" "char const *""'");
1902
    }
1903
    arg1 = (char *)(buf1);
1904
    ecode2 = SWIG_AsVal_size_t SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
1905
    if (!SWIG_IsOK(ecode2)) {
1906
      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "itex2MML_filter" "', argument " "2"" of type '" "size_t""'");
1907
    } 
1908
    arg2 = (size_t)(val2);
1909
    result = (int)itex2MML_filter((char const *)arg1,arg2);
1910
    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(result)); argvi++ ;
1911
    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
1912
    
1913
    XSRETURN(argvi);
1914
  fail:
1915
    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
1916
    
1917
    SWIG_croak_null();
1918
  }
1919
}
1920
1921
1922
XS(_wrap_itex2MML_html_filter) {
1923
  {
1924
    char *arg1 = (char *) 0 ;
1925
    size_t arg2 ;
1926
    int res1 ;
1927
    char *buf1 = 0 ;
1928
    int alloc1 = 0 ;
1929
    size_t val2 ;
1930
    int ecode2 = 0 ;
1931
    int argvi = 0;
1932
    int result;
1933
    dXSARGS;
1934
    
1935
    if ((items < 2) || (items > 2)) {
1936
      SWIG_croak("Usage: itex2MML_html_filter(buffer,length);");
1937
    }
1938
    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
1939
    if (!SWIG_IsOK(res1)) {
1940
      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "itex2MML_html_filter" "', argument " "1"" of type '" "char const *""'");
1941
    }
1942
    arg1 = (char *)(buf1);
1943
    ecode2 = SWIG_AsVal_size_t SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
1944
    if (!SWIG_IsOK(ecode2)) {
1945
      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "itex2MML_html_filter" "', argument " "2"" of type '" "size_t""'");
1946
    } 
1947
    arg2 = (size_t)(val2);
1948
    result = (int)itex2MML_html_filter((char const *)arg1,arg2);
1949
    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(result)); argvi++ ;
1950
    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
1951
    
1952
    XSRETURN(argvi);
1953
  fail:
1954
    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
1955
    
1956
    SWIG_croak_null();
1957
  }
1958
}
1959
1960
1961
XS(_wrap_itex2MML_output) {
1962
  {
1963
    int argvi = 0;
1964
    char *result = 0 ;
1965
    dXSARGS;
1966
    
1967
    if ((items < 0) || (items > 0)) {
1968
      SWIG_croak("Usage: itex2MML_output();");
1969
    }
1970
    result = (char *)itex2MML_output();
1971
    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
1972
    XSRETURN(argvi);
1973
  fail:
1974
    SWIG_croak_null();
1975
  }
1976
}
1977
1978
1979
1980
/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
1981
1982
static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
1983
1984
static swig_type_info *swig_type_initial[] = {
1985
  &_swigt__p_char,
1986
};
1987
1988
static swig_cast_info _swigc__p_char[] = {  {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
1989
1990
static swig_cast_info *swig_cast_initial[] = {
1991
  _swigc__p_char,
1992
};
1993
1994
1995
/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
1996
1997
static swig_constant_info swig_constants[] = {
1998
{0,0,0,0,0,0}
1999
};
2000
#ifdef __cplusplus
2001
}
2002
#endif
2003
static swig_variable_info swig_variables[] = {
2004
{0,0,0,0}
2005
};
2006
static swig_command_info swig_commands[] = {
2007
{"MathML::itex2MMLc::itex2MML_filter", _wrap_itex2MML_filter},
2008
{"MathML::itex2MMLc::itex2MML_html_filter", _wrap_itex2MML_html_filter},
2009
{"MathML::itex2MMLc::itex2MML_output", _wrap_itex2MML_output},
2010
{0,0}
2011
};
2012
/* -----------------------------------------------------------------------------
2013
 * Type initialization:
2014
 * This problem is tough by the requirement that no dynamic
2015
 * memory is used. Also, since swig_type_info structures store pointers to
2016
 * swig_cast_info structures and swig_cast_info structures store pointers back
2017
 * to swig_type_info structures, we need some lookup code at initialization.
2018
 * The idea is that swig generates all the structures that are needed.
2019
 * The runtime then collects these partially filled structures.
2020
 * The SWIG_InitializeModule function takes these initial arrays out of
2021
 * swig_module, and does all the lookup, filling in the swig_module.types
2022
 * array with the correct data and linking the correct swig_cast_info
2023
 * structures together.
2024
 *
2025
 * The generated swig_type_info structures are assigned statically to an initial
2026
 * array. We just loop through that array, and handle each type individually.
2027
 * First we lookup if this type has been already loaded, and if so, use the
2028
 * loaded structure instead of the generated one. Then we have to fill in the
2029
 * cast linked list. The cast data is initially stored in something like a
2030
 * two-dimensional array. Each row corresponds to a type (there are the same
2031
 * number of rows as there are in the swig_type_initial array). Each entry in
2032
 * a column is one of the swig_cast_info structures for that type.
2033
 * The cast_initial array is actually an array of arrays, because each row has
2034
 * a variable number of columns. So to actually build the cast linked list,
2035
 * we find the array of casts associated with the type, and loop through it
2036
 * adding the casts to the list. The one last trick we need to do is making
2037
 * sure the type pointer in the swig_cast_info struct is correct.
2038
 *
2039
 * First off, we lookup the cast->type name to see if it is already loaded.
2040
 * There are three cases to handle:
2041
 *  1) If the cast->type has already been loaded AND the type we are adding
2042
 *     casting info to has not been loaded (it is in this module), THEN we
2043
 *     replace the cast->type pointer with the type pointer that has already
2044
 *     been loaded.
2045
 *  2) If BOTH types (the one we are adding casting info to, and the
2046
 *     cast->type) are loaded, THEN the cast info has already been loaded by
2047
 *     the previous module so we just ignore it.
2048
 *  3) Finally, if cast->type has not already been loaded, then we add that
2049
 *     swig_cast_info to the linked list (because the cast->type) pointer will
2050
 *     be correct.
2051
 * ----------------------------------------------------------------------------- */
2052
2053
#ifdef __cplusplus
2054
extern "C" {
2055
#if 0
2056
} /* c-mode */
2057
#endif
2058
#endif
2059
2060
#if 0
2061
#define SWIGRUNTIME_DEBUG
2062
#endif
2063
2064
2065
SWIGRUNTIME void
2066
SWIG_InitializeModule(void *clientdata) {
2067
  size_t i;
2068
  swig_module_info *module_head, *iter;
2069
  int init;
2070
  
2071
  /* check to see if the circular list has been setup, if not, set it up */
2072
  if (swig_module.next==0) {
2073
    /* Initialize the swig_module */
2074
    swig_module.type_initial = swig_type_initial;
2075
    swig_module.cast_initial = swig_cast_initial;
2076
    swig_module.next = &swig_module;
2077
    init = 1;
2078
  } else {
2079
    init = 0;
2080
  }
2081
  
2082
  /* Try and load any already created modules */
2083
  module_head = SWIG_GetModule(clientdata);
2084
  if (!module_head) {
2085
    /* This is the first module loaded for this interpreter */
2086
    /* so set the swig module into the interpreter */
2087
    SWIG_SetModule(clientdata, &swig_module);
2088
  } else {
2089
    /* the interpreter has loaded a SWIG module, but has it loaded this one? */
2090
    iter=module_head;
2091
    do {
2092
      if (iter==&swig_module) {
2093
        /* Our module is already in the list, so there's nothing more to do. */
2094
        return;
2095
      }
2096
      iter=iter->next;
2097
    } while (iter!= module_head);
2098
    
2099
    /* otherwise we must add our module into the list */
2100
    swig_module.next = module_head->next;
2101
    module_head->next = &swig_module;
2102
  }
2103
  
2104
  /* When multiple interpreters are used, a module could have already been initialized in
2105
       a different interpreter, but not yet have a pointer in this interpreter.
2106
       In this case, we do not want to continue adding types... everything should be
2107
       set up already */
2108
  if (init == 0) return;
2109
  
2110
  /* Now work on filling in swig_module.types */
2111
#ifdef SWIGRUNTIME_DEBUG
2112
  printf("SWIG_InitializeModule: size %d\n", swig_module.size);
2113
#endif
2114
  for (i = 0; i < swig_module.size; ++i) {
2115
    swig_type_info *type = 0;
2116
    swig_type_info *ret;
2117
    swig_cast_info *cast;
2118
    
2119
#ifdef SWIGRUNTIME_DEBUG
2120
    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
2121
#endif
2122
    
2123
    /* if there is another module already loaded */
2124
    if (swig_module.next != &swig_module) {
2125
      type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
2126
    }
2127
    if (type) {
2128
      /* Overwrite clientdata field */
2129
#ifdef SWIGRUNTIME_DEBUG
2130
      printf("SWIG_InitializeModule: found type %s\n", type->name);
2131
#endif
2132
      if (swig_module.type_initial[i]->clientdata) {
2133
        type->clientdata = swig_module.type_initial[i]->clientdata;
2134
#ifdef SWIGRUNTIME_DEBUG
2135
        printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
2136
#endif
2137
      }
2138
    } else {
2139
      type = swig_module.type_initial[i];
2140
    }
2141
    
2142
    /* Insert casting types */
2143
    cast = swig_module.cast_initial[i];
2144
    while (cast->type) {
2145
      /* Don't need to add information already in the list */
2146
      ret = 0;
2147
#ifdef SWIGRUNTIME_DEBUG
2148
      printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
2149
#endif
2150
      if (swig_module.next != &swig_module) {
2151
        ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
2152
#ifdef SWIGRUNTIME_DEBUG
2153
        if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
2154
#endif
2155
      }
2156
      if (ret) {
2157
        if (type == swig_module.type_initial[i]) {
2158
#ifdef SWIGRUNTIME_DEBUG
2159
          printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
2160
#endif
2161
          cast->type = ret;
2162
          ret = 0;
2163
        } else {
2164
          /* Check for casting already in the list */
2165
          swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
2166
#ifdef SWIGRUNTIME_DEBUG
2167
          if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
2168
#endif
2169
          if (!ocast) ret = 0;
2170
        }
2171
      }
2172
      
2173
      if (!ret) {
2174
#ifdef SWIGRUNTIME_DEBUG
2175
        printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
2176
#endif
2177
        if (type->cast) {
2178
          type->cast->prev = cast;
2179
          cast->next = type->cast;
2180
        }
2181
        type->cast = cast;
2182
      }
2183
      cast++;
2184
    }
2185
    /* Set entry in modules->types array equal to the type */
2186
    swig_module.types[i] = type;
2187
  }
2188
  swig_module.types[i] = 0;
2189
  
2190
#ifdef SWIGRUNTIME_DEBUG
2191
  printf("**** SWIG_InitializeModule: Cast List ******\n");
2192
  for (i = 0; i < swig_module.size; ++i) {
2193
    int j = 0;
2194
    swig_cast_info *cast = swig_module.cast_initial[i];
2195
    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
2196
    while (cast->type) {
2197
      printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
2198
      cast++;
2199
      ++j;
2200
    }
2201
    printf("---- Total casts: %d\n",j);
2202
  }
2203
  printf("**** SWIG_InitializeModule: Cast List ******\n");
2204
#endif
2205
}
2206
2207
/* This function will propagate the clientdata field of type to
2208
* any new swig_type_info structures that have been added into the list
2209
* of equivalent types.  It is like calling
2210
* SWIG_TypeClientData(type, clientdata) a second time.
2211
*/
2212
SWIGRUNTIME void
2213
SWIG_PropagateClientData(void) {
2214
  size_t i;
2215
  swig_cast_info *equiv;
2216
  static int init_run = 0;
2217
  
2218
  if (init_run) return;
2219
  init_run = 1;
2220
  
2221
  for (i = 0; i < swig_module.size; i++) {
2222
    if (swig_module.types[i]->clientdata) {
2223
      equiv = swig_module.types[i]->cast;
2224
      while (equiv) {
2225
        if (!equiv->converter) {
2226
          if (equiv->type && !equiv->type->clientdata)
2227
          SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
2228
        }
2229
        equiv = equiv->next;
2230
      }
2231
    }
2232
  }
2233
}
2234
2235
#ifdef __cplusplus
2236
#if 0
2237
{
2238
  /* c-mode */
2239
#endif
2240
}
2241
#endif
2242
2243
2244
2245
#if defined(__cplusplus) && ! defined(XSPROTO)
2246
extern "C"
2247
#endif
2248
2249
XS(SWIG_init) {
2250
  dXSARGS;
2251
  int i;
2252
  (void)items;
2253
  
2254
  SWIG_InitializeModule(0);
2255
  
2256
  /* Install commands */
2257
  for (i = 0; swig_commands[i].name; i++) {
2258
    /* Casts only needed for Perl < 5.10. */
2259
#ifdef __cplusplus
2260
    newXS(const_cast<char*>(swig_commands[i].name), swig_commands[i].wrapper, const_cast<char*>(__FILE__));
2261
#else
2262
    newXS((char*)swig_commands[i].name, swig_commands[i].wrapper, (char*)__FILE__);
2263
#endif
2264
  }
2265
  
2266
  /* Install variables */
2267
  for (i = 0; swig_variables[i].name; i++) {
2268
    SV *sv;
2269
    sv = get_sv(swig_variables[i].name, TRUE | 0x2 | GV_ADDMULTI);
2270
    if (swig_variables[i].type) {
2271
      SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0);
2272
    } else {
2273
      sv_setiv(sv,(IV) 0);
2274
    }
2275
    swig_create_magic(sv, swig_variables[i].name, swig_variables[i].set, swig_variables[i].get); 
2276
  }
2277
  
2278
  /* Install constant */
2279
  for (i = 0; swig_constants[i].type; i++) {
2280
    SV *sv;
2281
    sv = get_sv(swig_constants[i].name, TRUE | 0x2 | GV_ADDMULTI);
2282
    switch(swig_constants[i].type) {
2283
    case SWIG_INT:
2284
      sv_setiv(sv, (IV) swig_constants[i].lvalue);
2285
      break;
2286
    case SWIG_FLOAT:
2287
      sv_setnv(sv, (double) swig_constants[i].dvalue);
2288
      break;
2289
    case SWIG_STRING:
2290
      sv_setpv(sv, (const char *) swig_constants[i].pvalue);
2291
      break;
2292
    case SWIG_POINTER:
2293
      SWIG_MakePtr(sv, swig_constants[i].pvalue, *(swig_constants[i].ptype),0);
2294
      break;
2295
    case SWIG_BINARY:
2296
      SWIG_MakePackedObj(sv, swig_constants[i].pvalue, swig_constants[i].lvalue, *(swig_constants[i].ptype));
2297
      break;
2298
    default:
2299
      break;
2300
    }
2301
    SvREADONLY_on(sv);
2302
  }
2303
  
2304
  ST(0) = &PL_sv_yes;
2305
  XSRETURN(1);
2306
}
2307