cdilib_wrap.c 561 KB
Newer Older
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1
2
/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
Ralf Mueller's avatar
Ralf Mueller committed
3
4
5
 * Version 4.0.0
 *
 * This file is not intended to be easily readable and contains a number of
Uwe Schulzweida's avatar
Uwe Schulzweida committed
6
 * coding conventions designed to improve portability and efficiency. Do not make
Ralf Mueller's avatar
Ralf Mueller committed
7
8
 * changes to this file unless you know what you are doing--modify the SWIG
 * interface file instead.
Uwe Schulzweida's avatar
Uwe Schulzweida committed
9
10
 * ----------------------------------------------------------------------------- */

Ralf Mueller's avatar
Ralf Mueller committed
11
12

#ifndef SWIGRUBY
Uwe Schulzweida's avatar
Uwe Schulzweida committed
13
#define SWIGRUBY
Ralf Mueller's avatar
Ralf Mueller committed
14
15
16
#endif


Uwe Schulzweida's avatar
Uwe Schulzweida committed
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/* -----------------------------------------------------------------------------
 *  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
# 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
# else
#  define SWIGTEMPLATEDISAMBIGUATOR
# endif
#endif

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

/* attribute recognised by some compilers to avoid 'unused' warnings */
#ifndef SWIGUNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
Ralf Mueller's avatar
Ralf Mueller committed
48
#     define SWIGUNUSED __attribute__ ((__unused__))
Uwe Schulzweida's avatar
Uwe Schulzweida committed
49
50
51
52
#   else
#     define SWIGUNUSED
#   endif
# elif defined(__ICC)
Ralf Mueller's avatar
Ralf Mueller committed
53
#   define SWIGUNUSED __attribute__ ((__unused__))
Uwe Schulzweida's avatar
Uwe Schulzweida committed
54
# else
Ralf Mueller's avatar
Ralf Mueller committed
55
#   define SWIGUNUSED
Uwe Schulzweida's avatar
Uwe Schulzweida committed
56
57
58
59
60
61
# endif
#endif

#ifndef SWIG_MSC_UNSUPPRESS_4505
# if defined(_MSC_VER)
#   pragma warning(disable : 4505) /* unreferenced local function has been removed */
Ralf Mueller's avatar
Ralf Mueller committed
62
# endif
Uwe Schulzweida's avatar
Uwe Schulzweida committed
63
64
65
66
67
68
#endif

#ifndef SWIGUNUSEDPARM
# ifdef __cplusplus
#   define SWIGUNUSEDPARM(p)
# else
Ralf Mueller's avatar
Ralf Mueller committed
69
#   define SWIGUNUSEDPARM(p) p SWIGUNUSED
Uwe Schulzweida's avatar
Uwe Schulzweida committed
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# endif
#endif

/* internal SWIG method */
#ifndef SWIGINTERN
# define SWIGINTERN static SWIGUNUSED
#endif

/* internal inline SWIG method */
#ifndef SWIGINTERNINLINE
# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
#endif

/* exporting methods */
Ralf Mueller's avatar
Ralf Mueller committed
84
85
86
87
88
#if defined(__GNUC__)
#  if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
#    ifndef GCC_HASCLASSVISIBILITY
#      define GCC_HASCLASSVISIBILITY
#    endif
Uwe Schulzweida's avatar
Uwe Schulzweida committed
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#  endif
#endif

#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
Ralf Mueller's avatar
Ralf Mueller committed
114
# endif
Uwe Schulzweida's avatar
Uwe Schulzweida committed
115
116
117
118
119
120
121
122
123
124
125
126
#endif

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

/* 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

Ralf Mueller's avatar
Ralf Mueller committed
127
128
129
130
131
132
133
134
135
136
137
138
139
/* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */
#if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES)
# define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
#endif

/* Intel's compiler complains if a variable which was never initialised is
 * cast to void, which is a common idiom which we use to indicate that we
 * are aware a variable isn't used.  So we just silence that warning.
 * See: https://github.com/swig/swig/issues/192 for more discussion.
 */
#ifdef __INTEL_COMPILER
# pragma warning disable 592
#endif
Uwe Schulzweida's avatar
Uwe Schulzweida committed
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171

/* -----------------------------------------------------------------------------
 *  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
# 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
# else
#  define SWIGTEMPLATEDISAMBIGUATOR
# endif
#endif

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

/* attribute recognised by some compilers to avoid 'unused' warnings */
#ifndef SWIGUNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
Ralf Mueller's avatar
Ralf Mueller committed
172
#     define SWIGUNUSED __attribute__ ((__unused__))
Uwe Schulzweida's avatar
Uwe Schulzweida committed
173
174
175
176
#   else
#     define SWIGUNUSED
#   endif
# elif defined(__ICC)
Ralf Mueller's avatar
Ralf Mueller committed
177
#   define SWIGUNUSED __attribute__ ((__unused__))
Uwe Schulzweida's avatar
Uwe Schulzweida committed
178
# else
Ralf Mueller's avatar
Ralf Mueller committed
179
#   define SWIGUNUSED
Uwe Schulzweida's avatar
Uwe Schulzweida committed
180
181
182
183
184
185
# endif
#endif

#ifndef SWIG_MSC_UNSUPPRESS_4505
# if defined(_MSC_VER)
#   pragma warning(disable : 4505) /* unreferenced local function has been removed */
Ralf Mueller's avatar
Ralf Mueller committed
186
# endif
Uwe Schulzweida's avatar
Uwe Schulzweida committed
187
188
189
190
191
192
#endif

#ifndef SWIGUNUSEDPARM
# ifdef __cplusplus
#   define SWIGUNUSEDPARM(p)
# else
Ralf Mueller's avatar
Ralf Mueller committed
193
#   define SWIGUNUSEDPARM(p) p SWIGUNUSED
Uwe Schulzweida's avatar
Uwe Schulzweida committed
194
195
196
197
198
199
200
201
202
203
204
205
206
207
# endif
#endif

/* internal SWIG method */
#ifndef SWIGINTERN
# define SWIGINTERN static SWIGUNUSED
#endif

/* internal inline SWIG method */
#ifndef SWIGINTERNINLINE
# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
#endif

/* exporting methods */
Ralf Mueller's avatar
Ralf Mueller committed
208
209
210
211
212
#if defined(__GNUC__)
#  if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
#    ifndef GCC_HASCLASSVISIBILITY
#      define GCC_HASCLASSVISIBILITY
#    endif
Uwe Schulzweida's avatar
Uwe Schulzweida committed
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
#  endif
#endif

#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
Ralf Mueller's avatar
Ralf Mueller committed
238
# endif
Uwe Schulzweida's avatar
Uwe Schulzweida committed
239
240
241
242
243
244
245
246
247
248
249
250
#endif

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

/* 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

Ralf Mueller's avatar
Ralf Mueller committed
251
252
253
254
255
256
257
258
259
260
261
262
263
/* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */
#if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES)
# define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
#endif

/* Intel's compiler complains if a variable which was never initialised is
 * cast to void, which is a common idiom which we use to indicate that we
 * are aware a variable isn't used.  So we just silence that warning.
 * See: https://github.com/swig/swig/issues/192 for more discussion.
 */
#ifdef __INTEL_COMPILER
# pragma warning disable 592
#endif
Uwe Schulzweida's avatar
Uwe Schulzweida committed
264
265
266
267

/* -----------------------------------------------------------------------------
 * swigrun.swg
 *
Ralf Mueller's avatar
Ralf Mueller committed
268
 * This file contains generic C API SWIG runtime support for pointer
Uwe Schulzweida's avatar
Uwe Schulzweida committed
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
 * type checking.
 * ----------------------------------------------------------------------------- */

/* This should only be incremented when either the layout of swig_type_info changes,
   or for whatever reason, the runtime changes incompatibly */
#define SWIG_RUNTIME_VERSION "4"

/* 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)
#else
# define SWIG_TYPE_TABLE_NAME
#endif

/*
  You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
Ralf Mueller's avatar
Ralf Mueller committed
287
288
289
290
291
  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'.

  But only do this if strictly necessary, ie, if you have problems
  with your compiler or suchlike.
Uwe Schulzweida's avatar
Uwe Schulzweida committed
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
*/

#ifndef SWIGRUNTIME
# define SWIGRUNTIME SWIGINTERN
#endif

#ifndef SWIGRUNTIMEINLINE
# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
#endif

/*  Generic buffer size */
#ifndef SWIG_BUFFER_SIZE
# define SWIG_BUFFER_SIZE 1024
#endif

/* Flags for pointer conversions */
#define SWIG_POINTER_DISOWN        0x1
#define SWIG_CAST_NEW_MEMORY       0x2
Ralf Mueller's avatar
Ralf Mueller committed
310
#define SWIG_POINTER_NO_NULL       0x4
Uwe Schulzweida's avatar
Uwe Schulzweida committed
311
312
313
314
315

/* Flags for new pointer objects */
#define SWIG_POINTER_OWN           0x1


Ralf Mueller's avatar
Ralf Mueller committed
316
/*
Uwe Schulzweida's avatar
Uwe Schulzweida committed
317
   Flags/methods for returning states.
Ralf Mueller's avatar
Ralf Mueller committed
318
319

   The SWIG conversion methods, as ConvertPtr, return an integer
Uwe Schulzweida's avatar
Uwe Schulzweida committed
320
321
   that tells if the conversion was successful or not. And if not,
   an error code can be returned (see swigerrors.swg for the codes).
Ralf Mueller's avatar
Ralf Mueller committed
322

Uwe Schulzweida's avatar
Uwe Schulzweida committed
323
324
   Use the following macros/flags to set or process the returning
   states.
Ralf Mueller's avatar
Ralf Mueller committed
325
326

   In old versions of SWIG, code such as the following was usually written:
Uwe Schulzweida's avatar
Uwe Schulzweida committed
327
328
329
330
331
332
333

     if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
       // success code
     } else {
       //fail code
     }

Ralf Mueller's avatar
Ralf Mueller committed
334
   Now you can be more explicit:
Uwe Schulzweida's avatar
Uwe Schulzweida committed
335
336
337
338
339
340
341
342

    int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
    if (SWIG_IsOK(res)) {
      // success code
    } else {
      // fail code
    }

Ralf Mueller's avatar
Ralf Mueller committed
343
   which is the same really, but now you can also do
Uwe Schulzweida's avatar
Uwe Schulzweida committed
344
345
346
347
348
349
350
351
352
353
354
355
356
357

    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
    }
Ralf Mueller's avatar
Ralf Mueller committed
358

Uwe Schulzweida's avatar
Uwe Schulzweida committed
359
360
   I.e., now SWIG_ConvertPtr can return new objects and you can
   identify the case and take care of the deallocation. Of course that
Ralf Mueller's avatar
Ralf Mueller committed
361
362
363
364
365
366
367
368
369
370
371
372
373
374
   also requires SWIG_ConvertPtr to return new result values, such as

      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;
        }
Uwe Schulzweida's avatar
Uwe Schulzweida committed
375
376
377
378
      }

   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
Ralf Mueller's avatar
Ralf Mueller committed
379
   SWIG errors code.
Uwe Schulzweida's avatar
Uwe Schulzweida committed
380
381
382
383
384
385
386
387

   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
Ralf Mueller's avatar
Ralf Mueller committed
388

Uwe Schulzweida's avatar
Uwe Schulzweida committed
389
390
391
392
      food(1)   // cast rank '1'  (1 -> 1.0)
      fooi(1)   // cast rank '0'

   just use the SWIG_AddCast()/SWIG_CheckState()
Ralf Mueller's avatar
Ralf Mueller committed
393
*/
Uwe Schulzweida's avatar
Uwe Schulzweida committed
394

Ralf Mueller's avatar
Ralf Mueller committed
395
#define SWIG_OK                    (0)
Uwe Schulzweida's avatar
Uwe Schulzweida committed
396
397
#define SWIG_ERROR                 (-1)
#define SWIG_IsOK(r)               (r >= 0)
Ralf Mueller's avatar
Ralf Mueller committed
398
#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)
Uwe Schulzweida's avatar
Uwe Schulzweida committed
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428

/* 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)
Ralf Mueller's avatar
Ralf Mueller committed
429
SWIGINTERNINLINE int SWIG_AddCast(int r) {
Uwe Schulzweida's avatar
Uwe Schulzweida committed
430
431
  return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
}
Ralf Mueller's avatar
Ralf Mueller committed
432
433
SWIGINTERNINLINE int SWIG_CheckState(int r) {
  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
434
435
}
#else /* no cast-rank mode */
Ralf Mueller's avatar
Ralf Mueller committed
436
#  define SWIG_AddCast(r) (r)
Uwe Schulzweida's avatar
Uwe Schulzweida committed
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
#  define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
#endif


#include <string.h>

#ifdef __cplusplus
extern "C" {
#endif

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

/* Structure to store information on one type */
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;

Ralf Mueller's avatar
Ralf Mueller committed
480
/*
Uwe Schulzweida's avatar
Uwe Schulzweida committed
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
  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;
  }
  return (int)((l1 - f1) - (l2 - f2));
}

/*
  Check type equivalence in a name list like <name1>|<name2>|...
Ralf Mueller's avatar
Ralf Mueller committed
500
  Return 0 if equal, -1 if nb < tb, 1 if nb > tb
Uwe Schulzweida's avatar
Uwe Schulzweida committed
501
502
*/
SWIGRUNTIME int
Ralf Mueller's avatar
Ralf Mueller committed
503
504
SWIG_TypeCmp(const char *nb, const char *tb) {
  int equiv = 1;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
505
506
  const char* te = tb + strlen(tb);
  const char* ne = nb;
Ralf Mueller's avatar
Ralf Mueller committed
507
  while (equiv != 0 && *ne) {
Uwe Schulzweida's avatar
Uwe Schulzweida committed
508
509
510
    for (nb = ne; *ne; ++ne) {
      if (*ne == '|') break;
    }
Ralf Mueller's avatar
Ralf Mueller committed
511
    equiv = SWIG_TypeNameComp(nb, ne, tb, te);
Uwe Schulzweida's avatar
Uwe Schulzweida committed
512
513
514
515
516
517
518
    if (*ne) ++ne;
  }
  return equiv;
}

/*
  Check type equivalence in a name list like <name1>|<name2>|...
Ralf Mueller's avatar
Ralf Mueller committed
519
  Return 0 if not equal, 1 if equal
Uwe Schulzweida's avatar
Uwe Schulzweida committed
520
521
*/
SWIGRUNTIME int
Ralf Mueller's avatar
Ralf Mueller committed
522
523
SWIG_TypeEquiv(const char *nb, const char *tb) {
  return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
524
525
526
527
528
529
530
}

/*
  Check the typename
*/
SWIGRUNTIME swig_cast_info *
SWIG_TypeCheck(const char *c, swig_type_info *ty) {
Ralf Mueller's avatar
Ralf Mueller committed
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
  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;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
551
552
}

Ralf Mueller's avatar
Ralf Mueller committed
553
554
555
/*
  Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
*/
Uwe Schulzweida's avatar
Uwe Schulzweida committed
556
SWIGRUNTIME swig_cast_info *
Ralf Mueller's avatar
Ralf Mueller committed
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
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;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
578
579
580
581
582
583
584
585
586
587
}

/*
  Cast a pointer up an inheritance hierarchy
*/
SWIGRUNTIMEINLINE void *
SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
}

Ralf Mueller's avatar
Ralf Mueller committed
588
/*
Uwe Schulzweida's avatar
Uwe Schulzweida committed
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
   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;
}

/*
  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;
  }
  else
    return type->name;
}

Ralf Mueller's avatar
Ralf Mueller committed
632
/*
Uwe Schulzweida's avatar
Uwe Schulzweida committed
633
634
635
636
637
638
639
   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;
Ralf Mueller's avatar
Ralf Mueller committed
640

Uwe Schulzweida's avatar
Uwe Schulzweida committed
641
642
643
644
645
646
  while (cast) {
    if (!cast->converter) {
      swig_type_info *tc = cast->type;
      if (!tc->clientdata) {
	SWIG_TypeClientData(tc, clientdata);
      }
Ralf Mueller's avatar
Ralf Mueller committed
647
    }
Uwe Schulzweida's avatar
Uwe Schulzweida committed
648
649
650
651
652
653
654
655
    cast = cast->next;
  }
}
SWIGRUNTIME void
SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
  SWIG_TypeClientData(ti, clientdata);
  ti->owndata = 1;
}
Ralf Mueller's avatar
Ralf Mueller committed
656

Uwe Schulzweida's avatar
Uwe Schulzweida committed
657
658
659
/*
  Search for a swig_type_info structure only by mangled name
  Search is a O(log #types)
Ralf Mueller's avatar
Ralf Mueller committed
660
661

  We start searching at module start, and finish searching when start == end.
Uwe Schulzweida's avatar
Uwe Schulzweida committed
662
663
664
665
  Note: if start == end at the beginning of the function, we go all the way around
  the circular list.
*/
SWIGRUNTIME swig_type_info *
Ralf Mueller's avatar
Ralf Mueller committed
666
667
SWIG_MangledTypeQueryModule(swig_module_info *start,
                            swig_module_info *end,
Uwe Schulzweida's avatar
Uwe Schulzweida committed
668
669
670
671
		            const char *name) {
  swig_module_info *iter = start;
  do {
    if (iter->size) {
Ralf Mueller's avatar
Ralf Mueller committed
672
673
      size_t l = 0;
      size_t r = iter->size - 1;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
674
675
      do {
	/* since l+r >= 0, we can (>> 1) instead (/ 2) */
Ralf Mueller's avatar
Ralf Mueller committed
676
	size_t i = (l + r) >> 1;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
677
678
	const char *iname = iter->types[i]->name;
	if (iname) {
Ralf Mueller's avatar
Ralf Mueller committed
679
680
	  int compare = strcmp(name, iname);
	  if (compare == 0) {
Uwe Schulzweida's avatar
Uwe Schulzweida committed
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
	    return iter->types[i];
	  } else if (compare < 0) {
	    if (i) {
	      r = i - 1;
	    } else {
	      break;
	    }
	  } else if (compare > 0) {
	    l = i + 1;
	  }
	} else {
	  break; /* should never happen */
	}
      } while (l <= r);
    }
    iter = iter->next;
  } while (iter != end);
  return 0;
}

/*
  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).
Ralf Mueller's avatar
Ralf Mueller committed
705
706

  We start searching at module start, and finish searching when start == end.
Uwe Schulzweida's avatar
Uwe Schulzweida committed
707
708
709
710
  Note: if start == end at the beginning of the function, we go all the way around
  the circular list.
*/
SWIGRUNTIME swig_type_info *
Ralf Mueller's avatar
Ralf Mueller committed
711
712
SWIG_TypeQueryModule(swig_module_info *start,
                     swig_module_info *end,
Uwe Schulzweida's avatar
Uwe Schulzweida committed
713
714
715
716
717
718
719
720
721
722
		     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 {
Ralf Mueller's avatar
Ralf Mueller committed
723
      size_t i = 0;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
724
725
726
727
728
729
730
      for (; i < iter->size; ++i) {
	if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
	  return iter->types[i];
      }
      iter = iter->next;
    } while (iter != end);
  }
Ralf Mueller's avatar
Ralf Mueller committed
731

Uwe Schulzweida's avatar
Uwe Schulzweida committed
732
733
734
735
  /* neither found a match */
  return 0;
}

Ralf Mueller's avatar
Ralf Mueller committed
736
/*
Uwe Schulzweida's avatar
Uwe Schulzweida committed
737
738
739
740
741
   Pack binary data into a string
*/
SWIGRUNTIME char *
SWIG_PackData(char *c, void *ptr, size_t sz) {
  static const char hex[17] = "0123456789abcdef";
Ralf Mueller's avatar
Ralf Mueller committed
742
743
  const unsigned char *u = (unsigned char *) ptr;
  const unsigned char *eu =  u + sz;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
744
  for (; u != eu; ++u) {
Ralf Mueller's avatar
Ralf Mueller committed
745
    unsigned char uu = *u;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
746
747
748
749
750
751
    *(c++) = hex[(uu & 0xf0) >> 4];
    *(c++) = hex[uu & 0xf];
  }
  return c;
}

Ralf Mueller's avatar
Ralf Mueller committed
752
/*
Uwe Schulzweida's avatar
Uwe Schulzweida committed
753
754
755
756
   Unpack binary data from a string
*/
SWIGRUNTIME const char *
SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
Ralf Mueller's avatar
Ralf Mueller committed
757
758
  unsigned char *u = (unsigned char *) ptr;
  const unsigned char *eu = u + sz;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
759
  for (; u != eu; ++u) {
Ralf Mueller's avatar
Ralf Mueller committed
760
761
    char d = *(c++);
    unsigned char uu;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
762
    if ((d >= '0') && (d <= '9'))
Ralf Mueller's avatar
Ralf Mueller committed
763
      uu = (unsigned char)((d - '0') << 4);
Uwe Schulzweida's avatar
Uwe Schulzweida committed
764
    else if ((d >= 'a') && (d <= 'f'))
Ralf Mueller's avatar
Ralf Mueller committed
765
766
      uu = (unsigned char)((d - ('a'-10)) << 4);
    else
Uwe Schulzweida's avatar
Uwe Schulzweida committed
767
768
769
      return (char *) 0;
    d = *(c++);
    if ((d >= '0') && (d <= '9'))
Ralf Mueller's avatar
Ralf Mueller committed
770
      uu |= (unsigned char)(d - '0');
Uwe Schulzweida's avatar
Uwe Schulzweida committed
771
    else if ((d >= 'a') && (d <= 'f'))
Ralf Mueller's avatar
Ralf Mueller committed
772
773
      uu |= (unsigned char)(d - ('a'-10));
    else
Uwe Schulzweida's avatar
Uwe Schulzweida committed
774
775
776
777
778
779
      return (char *) 0;
    *u = uu;
  }
  return c;
}

Ralf Mueller's avatar
Ralf Mueller committed
780
/*
Uwe Schulzweida's avatar
Uwe Schulzweida committed
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
   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;
    }
  }
  return SWIG_UnpackData(++c,ptr,sizeof(void *));
}

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;
}

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);
}

#ifdef __cplusplus
}
#endif

/*  Errors in SWIG */
Ralf Mueller's avatar
Ralf Mueller committed
840
841
842
843
844
845
846
847
848
#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
Uwe Schulzweida's avatar
Uwe Schulzweida committed
849
850
#define  SWIG_SystemError    	   -10
#define  SWIG_AttributeError 	   -11
Ralf Mueller's avatar
Ralf Mueller committed
851
#define  SWIG_MemoryError    	   -12
Uwe Schulzweida's avatar
Uwe Schulzweida committed
852
853
854
855
856
857
#define  SWIG_NullReferenceError   -13



#include <ruby.h>

Ralf Mueller's avatar
Ralf Mueller committed
858
859
860
861
862
863
864
865
866
/* Ruby 1.9.1 has a "memoisation optimisation" when compiling with GCC which
 * breaks using rb_intern as an lvalue, as SWIG does.  We work around this
 * issue for now by disabling this.
 * https://sourceforge.net/tracker/?func=detail&aid=2859614&group_id=1645&atid=101645
 */
#ifdef rb_intern
# undef rb_intern
#endif

Uwe Schulzweida's avatar
Uwe Schulzweida committed
867
868
869
870
871
872
873
/* Remove global macros defined in Ruby's win32.h */
#ifdef write
# undef write
#endif
#ifdef read
# undef read
#endif
Ralf Mueller's avatar
Ralf Mueller committed
874
875
876
877
878
879
880
881
882
#ifdef bind
# undef bind
#endif
#ifdef close
# undef close
#endif
#ifdef connect
# undef connect
#endif
Uwe Schulzweida's avatar
Uwe Schulzweida committed
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
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
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948


/* Ruby 1.7 defines NUM2LL(), LL2NUM() and ULL2NUM() macros */
#ifndef NUM2LL
#define NUM2LL(x) NUM2LONG((x))
#endif
#ifndef LL2NUM
#define LL2NUM(x) INT2NUM((long) (x))
#endif
#ifndef ULL2NUM
#define ULL2NUM(x) UINT2NUM((unsigned long) (x))
#endif

/* Ruby 1.7 doesn't (yet) define NUM2ULL() */
#ifndef NUM2ULL
#ifdef HAVE_LONG_LONG
#define NUM2ULL(x) rb_num2ull((x))
#else
#define NUM2ULL(x) NUM2ULONG(x)
#endif
#endif

/* RSTRING_LEN, etc are new in Ruby 1.9, but ->ptr and ->len no longer work */
/* Define these for older versions so we can just write code the new way */
#ifndef RSTRING_LEN
# define RSTRING_LEN(x) RSTRING(x)->len
#endif
#ifndef RSTRING_PTR
# define RSTRING_PTR(x) RSTRING(x)->ptr
#endif
#ifndef RSTRING_END
# define RSTRING_END(x) (RSTRING_PTR(x) + RSTRING_LEN(x))
#endif
#ifndef RARRAY_LEN
# define RARRAY_LEN(x) RARRAY(x)->len
#endif
#ifndef RARRAY_PTR
# define RARRAY_PTR(x) RARRAY(x)->ptr
#endif
#ifndef RFLOAT_VALUE
# define RFLOAT_VALUE(x) RFLOAT(x)->value
#endif
#ifndef DOUBLE2NUM
# define DOUBLE2NUM(x) rb_float_new(x)
#endif
#ifndef RHASH_TBL
# define RHASH_TBL(x) (RHASH(x)->tbl)
#endif
#ifndef RHASH_ITER_LEV
# define RHASH_ITER_LEV(x) (RHASH(x)->iter_lev)
#endif
#ifndef RHASH_IFNONE
# define RHASH_IFNONE(x) (RHASH(x)->ifnone)
#endif
#ifndef RHASH_SIZE
# define RHASH_SIZE(x) (RHASH(x)->tbl->num_entries)
#endif
#ifndef RHASH_EMPTY_P
# define RHASH_EMPTY_P(x) (RHASH_SIZE(x) == 0)
#endif
#ifndef RSTRUCT_LEN
# define RSTRUCT_LEN(x) RSTRUCT(x)->len
#endif
#ifndef RSTRUCT_PTR
# define RSTRUCT_PTR(x) RSTRUCT(x)->ptr
#endif
Ralf Mueller's avatar
Ralf Mueller committed
949
950
951
#ifndef RTYPEDDATA_P
# define RTYPEDDATA_P(x) (TYPE(x) != T_DATA)
#endif
Uwe Schulzweida's avatar
Uwe Schulzweida committed
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027



/*
 * Need to be very careful about how these macros are defined, especially
 * when compiling C++ code or C code with an ANSI C compiler.
 *
 * VALUEFUNC(f) is a macro used to typecast a C function that implements
 * a Ruby method so that it can be passed as an argument to API functions
 * like rb_define_method() and rb_define_singleton_method().
 *
 * VOIDFUNC(f) is a macro used to typecast a C function that implements
 * either the "mark" or "free" stuff for a Ruby Data object, so that it
 * can be passed as an argument to API functions like Data_Wrap_Struct()
 * and Data_Make_Struct().
 */
 
#ifdef __cplusplus
#  ifndef RUBY_METHOD_FUNC /* These definitions should work for Ruby 1.4.6 */
#    define PROTECTFUNC(f) ((VALUE (*)()) f)
#    define VALUEFUNC(f) ((VALUE (*)()) f)
#    define VOIDFUNC(f)  ((void (*)()) f)
#  else
#    ifndef ANYARGS /* These definitions should work for Ruby 1.6 */
#      define PROTECTFUNC(f) ((VALUE (*)()) f)
#      define VALUEFUNC(f) ((VALUE (*)()) f)
#      define VOIDFUNC(f)  ((RUBY_DATA_FUNC) f)
#    else /* These definitions should work for Ruby 1.7+ */
#      define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f)
#      define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f)
#      define VOIDFUNC(f)  ((RUBY_DATA_FUNC) f)
#    endif
#  endif
#else
#  define VALUEFUNC(f) (f)
#  define VOIDFUNC(f) (f)
#endif

/* Don't use for expressions have side effect */
#ifndef RB_STRING_VALUE
#define RB_STRING_VALUE(s) (TYPE(s) == T_STRING ? (s) : (*(volatile VALUE *)&(s) = rb_str_to_str(s)))
#endif
#ifndef StringValue
#define StringValue(s) RB_STRING_VALUE(s)
#endif
#ifndef StringValuePtr
#define StringValuePtr(s) RSTRING_PTR(RB_STRING_VALUE(s))
#endif
#ifndef StringValueLen
#define StringValueLen(s) RSTRING_LEN(RB_STRING_VALUE(s))
#endif
#ifndef SafeStringValue
#define SafeStringValue(v) do {\
    StringValue(v);\
    rb_check_safe_str(v);\
} while (0)
#endif

#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
#define rb_define_alloc_func(klass, func) rb_define_singleton_method((klass), "new", VALUEFUNC((func)), -1)
#define rb_undef_alloc_func(klass) rb_undef_method(CLASS_OF((klass)), "new")
#endif

static VALUE _mSWIG = Qnil;

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


/* Define some additional error types */
#define SWIG_ObjectPreviouslyDeletedError  -100


/* Define custom exceptions for errors that do not map to existing Ruby
   exceptions.  Note this only works for C++ since a global cannot be
Ralf Mueller's avatar
Ralf Mueller committed
1028
   initialized by a function in C.  For C, fallback to rb_eRuntimeError.*/
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
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
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174

SWIGINTERN VALUE 
getNullReferenceError(void) {
  static int init = 0;
  static VALUE rb_eNullReferenceError ;
  if (!init) {
    init = 1;
    rb_eNullReferenceError = rb_define_class("NullReferenceError", rb_eRuntimeError);
  }
  return rb_eNullReferenceError;
} 

SWIGINTERN VALUE 
getObjectPreviouslyDeletedError(void) {
  static int init = 0;
  static VALUE rb_eObjectPreviouslyDeleted ;
  if (!init) {
    init = 1;
    rb_eObjectPreviouslyDeleted = rb_define_class("ObjectPreviouslyDeleted", rb_eRuntimeError);
  }
  return rb_eObjectPreviouslyDeleted;
} 


SWIGINTERN VALUE
SWIG_Ruby_ErrorType(int SWIG_code) {
  VALUE type;
  switch (SWIG_code) {
  case SWIG_MemoryError:
    type = rb_eNoMemError;
    break;
  case SWIG_IOError:
    type = rb_eIOError;
    break;
  case SWIG_RuntimeError:
    type = rb_eRuntimeError;
    break;
  case SWIG_IndexError:
    type = rb_eIndexError;
    break;
  case SWIG_TypeError:
    type = rb_eTypeError;
    break;
  case SWIG_DivisionByZero:
    type = rb_eZeroDivError;
    break;
  case SWIG_OverflowError:
    type = rb_eRangeError;
    break;
  case SWIG_SyntaxError:
    type = rb_eSyntaxError;
    break;
  case SWIG_ValueError:
    type = rb_eArgError;
    break;
  case SWIG_SystemError:
    type = rb_eFatal;
    break;
  case SWIG_AttributeError:
    type = rb_eRuntimeError;
    break;
  case SWIG_NullReferenceError:
    type = getNullReferenceError();
    break;
  case SWIG_ObjectPreviouslyDeletedError:
    type = getObjectPreviouslyDeletedError();
    break;
  case SWIG_UnknownError:
    type = rb_eRuntimeError;
    break;
  default:
    type = rb_eRuntimeError;
  }
  return type;
}


/* This function is called when a user inputs a wrong argument to
   a method.
 */
SWIGINTERN 
const char* Ruby_Format_TypeError( const char* msg,
				   const char* type, 
				   const char* name, 
				   const int argn,
				   VALUE input )
{
  char buf[128];
  VALUE str;
  VALUE asStr;
  if ( msg && *msg )
    {
      str = rb_str_new2(msg);
    }
  else
    {
      str = rb_str_new(NULL, 0);
    }

  str = rb_str_cat2( str, "Expected argument " );
  sprintf( buf, "%d of type ", argn-1 );
  str = rb_str_cat2( str, buf );
  str = rb_str_cat2( str, type );
  str = rb_str_cat2( str, ", but got " );
  str = rb_str_cat2( str, rb_obj_classname(input) );
  str = rb_str_cat2( str, " " );
  asStr = rb_inspect(input);
  if ( RSTRING_LEN(asStr) > 30 )
    {
      str = rb_str_cat( str, StringValuePtr(asStr), 30 );
      str = rb_str_cat2( str, "..." );
    }
  else
    {
      str = rb_str_append( str, asStr );
    }

  if ( name )
    {
      str = rb_str_cat2( str, "\n\tin SWIG method '" );
      str = rb_str_cat2( str, name );
      str = rb_str_cat2( str, "'" );
    }

  return StringValuePtr( str );
}

/* This function is called when an overloaded method fails */
SWIGINTERN 
void Ruby_Format_OverloadedError(
				 const int argc,
				 const int maxargs,
				 const char* method, 
				 const char* prototypes 
				 )
{
  const char* msg = "Wrong # of arguments";
  if ( argc <= maxargs ) msg = "Wrong arguments";
  rb_raise(rb_eArgError,"%s for overloaded method '%s'.\n"  
	   "Possible C/C++ prototypes are:\n%s",
	   msg, method, prototypes);
}

/* -----------------------------------------------------------------------------
 * rubytracking.swg
 *
Ralf Mueller's avatar
Ralf Mueller committed
1175
 * This file contains support for tracking mappings from
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1176
1177
1178
1179
1180
1181
1182
1183
1184
 * Ruby objects to C++ objects.  This functionality is needed
 * to implement mark functions for Ruby's mark and sweep
 * garbage collector.
 * ----------------------------------------------------------------------------- */

#ifdef __cplusplus
extern "C" {
#endif

Ralf Mueller's avatar
Ralf Mueller committed
1185
1186
1187
1188
1189
#if !defined(ST_DATA_T_DEFINED)
/* Needs to be explicitly included for Ruby 1.8 and earlier */
#include <st.h>
#endif

Uwe Schulzweida's avatar
Uwe Schulzweida committed
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
/* Ruby 1.8 actually assumes the first case. */
#if SIZEOF_VOIDP == SIZEOF_LONG
#  define SWIG2NUM(v) LONG2NUM((unsigned long)v)
#  define NUM2SWIG(x) (unsigned long)NUM2LONG(x)
#elif SIZEOF_VOIDP == SIZEOF_LONG_LONG
#  define SWIG2NUM(v) LL2NUM((unsigned long long)v)
#  define NUM2SWIG(x) (unsigned long long)NUM2LL(x)
#else
#  error sizeof(void*) is not the same as long or long long
#endif

Ralf Mueller's avatar
Ralf Mueller committed
1201
1202
/* Global hash table to store Trackings from C/C++
   structs to Ruby Objects.
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1203
*/
Ralf Mueller's avatar
Ralf Mueller committed
1204
1205
1206
1207
1208
static st_table* swig_ruby_trackings = NULL;

static VALUE swig_ruby_trackings_count(ANYARGS) {
  return SWIG2NUM(swig_ruby_trackings->num_entries);
}
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1209
1210


Ralf Mueller's avatar
Ralf Mueller committed
1211
/* Setup a hash table to store Trackings */
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1212
SWIGRUNTIME void SWIG_RubyInitializeTrackings(void) {
Ralf Mueller's avatar
Ralf Mueller committed
1213
  /* Create a hash table to store Trackings from C++
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1214
1215
     objects to Ruby objects. */

Ralf Mueller's avatar
Ralf Mueller committed
1216
  /* Try to see if some other .so has already created a
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1217
1218
1219
1220
1221
     tracking hash table, which we keep hidden in an instance var
     in the SWIG module.
     This is done to allow multiple DSOs to share the same
     tracking table.
  */
Ralf Mueller's avatar
Ralf Mueller committed
1222
1223
1224
1225
  VALUE trackings_value = Qnil;
  /* change the variable name so that we can mix modules
     compiled with older SWIG's - this used to be called "@__trackings__" */
  ID trackings_id = rb_intern( "@__safetrackings__" );
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1226
1227
  VALUE verbose = rb_gv_get("VERBOSE");
  rb_gv_set("VERBOSE", Qfalse);
Ralf Mueller's avatar
Ralf Mueller committed
1228
  trackings_value = rb_ivar_get( _mSWIG, trackings_id );
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1229
1230
  rb_gv_set("VERBOSE", verbose);

Ralf Mueller's avatar
Ralf Mueller committed
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
  /* The trick here is that we have to store the hash table
  pointer in a Ruby variable. We do not want Ruby's GC to
  treat this pointer as a Ruby object, so we convert it to
  a Ruby numeric value. */
  if (trackings_value == Qnil) {
    /* No, it hasn't.  Create one ourselves */
    swig_ruby_trackings = st_init_numtable();
    rb_ivar_set( _mSWIG, trackings_id, SWIG2NUM(swig_ruby_trackings) );
  } else {
    swig_ruby_trackings = (st_table*)NUM2SWIG(trackings_value);
  }
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1242

Ralf Mueller's avatar
Ralf Mueller committed
1243
  rb_define_virtual_variable("SWIG_TRACKINGS_COUNT", swig_ruby_trackings_count, NULL);
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1244
1245
1246
1247
1248
}

/* Add a Tracking from a C/C++ struct to a Ruby object */
SWIGRUNTIME void SWIG_RubyAddTracking(void* ptr, VALUE object) {
  /* Store the mapping to the global hash table. */
Ralf Mueller's avatar
Ralf Mueller committed
1249
  st_insert(swig_ruby_trackings, (st_data_t)ptr, object);
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1250
1251
1252
1253
1254
}

/* Get the Ruby object that owns the specified C/C++ struct */
SWIGRUNTIME VALUE SWIG_RubyInstanceFor(void* ptr) {
  /* Now lookup the value stored in the global hash table */
Ralf Mueller's avatar
Ralf Mueller committed
1255
1256
1257
1258
1259
  VALUE value;

  if (st_lookup(swig_ruby_trackings, (st_data_t)ptr, &value)) {
    return value;
  } else {
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1260
1261
1262
1263
1264
1265
1266
1267
1268
    return Qnil;
  }
}

/* Remove a Tracking from a C/C++ struct to a Ruby object.  It
   is very important to remove objects once they are destroyed
   since the same memory address may be reused later to create
   a new object. */
SWIGRUNTIME void SWIG_RubyRemoveTracking(void* ptr) {
Ralf Mueller's avatar
Ralf Mueller committed
1269
1270
  /* Delete the object from the hash table */
  st_delete(swig_ruby_trackings, (st_data_t *)&ptr, NULL);
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1271
1272
1273
1274
}

/* This is a helper method that unlinks a Ruby object from its
   underlying C++ object.  This is needed if the lifetime of the
Ralf Mueller's avatar
Ralf Mueller committed
1275
   Ruby object is longer than the C++ object. */
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1276
1277
1278
1279
SWIGRUNTIME void SWIG_RubyUnlinkObjects(void* ptr) {
  VALUE object = SWIG_RubyInstanceFor(ptr);

  if (object != Qnil) {
Ralf Mueller's avatar
Ralf Mueller committed
1280
1281
1282
    // object might have the T_ZOMBIE type, but that's just
    // because the GC has flagged it as such for a deferred
    // destruction. Until then, it's still a T_DATA object.
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1283
1284
1285
1286
    DATA_PTR(object) = 0;
  }
}

Ralf Mueller's avatar
Ralf Mueller committed
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
/* This is a helper method that iterates over all the trackings
   passing the C++ object pointer and its related Ruby object
   to the passed callback function. */

/* Proxy method to abstract the internal trackings datatype */
static int swig_ruby_internal_iterate_callback(void* ptr, VALUE obj, void(*meth)(void* ptr, VALUE obj)) {
  (*meth)(ptr, obj);
  return ST_CONTINUE;
}

SWIGRUNTIME void SWIG_RubyIterateTrackings( void(*meth)(void* ptr, VALUE obj) ) {
  st_foreach(swig_ruby_trackings, (int (*)(ANYARGS))&swig_ruby_internal_iterate_callback, (st_data_t)meth);
}
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357

#ifdef __cplusplus
}
#endif

/* -----------------------------------------------------------------------------
 * Ruby API portion that goes into the runtime
 * ----------------------------------------------------------------------------- */

#ifdef __cplusplus
extern "C" {
#endif

SWIGINTERN VALUE
SWIG_Ruby_AppendOutput(VALUE target, VALUE o) {
  if (NIL_P(target)) {
    target = o;
  } else {
    if (TYPE(target) != T_ARRAY) {
      VALUE o2 = target;
      target = rb_ary_new();
      rb_ary_push(target, o2);
    }
    rb_ary_push(target, o);
  }
  return target;
}

/* For ruby1.8.4 and earlier. */
#ifndef RUBY_INIT_STACK
   RUBY_EXTERN void Init_stack(VALUE* addr);
#  define RUBY_INIT_STACK \
   VALUE variable_in_this_stack_frame; \
   Init_stack(&variable_in_this_stack_frame);
#endif


#ifdef __cplusplus
}
#endif


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

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

/* for raw pointers */
#define SWIG_ConvertPtr(obj, pptr, type, flags)         SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own)  SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, own)
#define SWIG_NewPointerObj(ptr, type, flags)            SWIG_Ruby_NewPointerObj(ptr, type, flags)
#define SWIG_AcquirePtr(ptr, own)                       SWIG_Ruby_AcquirePtr(ptr, own)
Ralf Mueller's avatar
Ralf Mueller committed
1358
#define swig_owntype                                    swig_ruby_owntype
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378

/* for raw packed data */
#define SWIG_ConvertPacked(obj, ptr, sz, ty)            SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty, flags)
#define SWIG_NewPackedObj(ptr, sz, type)                SWIG_Ruby_NewPackedObj(ptr, sz, 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_Ruby_ConvertPacked(obj, ptr, sz, ty)
#define SWIG_NewMemberObj(ptr, sz, type)                SWIG_Ruby_NewPackedObj(ptr, sz, type)


/* Runtime API */

Ralf Mueller's avatar
Ralf Mueller committed
1379
#define SWIG_GetModule(clientdata)                      SWIG_Ruby_GetModule(clientdata)
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1380
1381
1382
1383
1384
1385
#define SWIG_SetModule(clientdata, pointer) 		SWIG_Ruby_SetModule(pointer)


/* Error manipulation */

#define SWIG_ErrorType(code)                            SWIG_Ruby_ErrorType(code)               
Ralf Mueller's avatar
Ralf Mueller committed
1386
#define SWIG_Error(code, msg)            		rb_raise(SWIG_Ruby_ErrorType(code), "%s", msg)
Uwe Schulzweida's avatar
Uwe Schulzweida committed
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
#define SWIG_fail                        		goto fail				 


/* Ruby-specific SWIG API */

#define SWIG_InitRuntime()                              SWIG_Ruby_InitRuntime()              
#define SWIG_define_class(ty)                        	SWIG_Ruby_define_class(ty)
#define SWIG_NewClassInstance(value, ty)             	SWIG_Ruby_NewClassInstance(value, ty)
#define SWIG_MangleStr(value)                        	SWIG_Ruby_MangleStr(value)		  
#define SWIG_CheckConvert(value, ty)                 	SWIG_Ruby_CheckConvert(value, ty)	  

#include "assert.h"

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

#ifdef __cplusplus
extern "C" {
#endif

typedef struct {
  VALUE klass;
  VALUE mImpl;
  void  (*mark)(void *);
  void  (*destroy)(void *);
  int trackObjects;
} swig_class;


/* Global pointer used to keep some internal SWIG stuff */
static VALUE _cSWIG_Pointer = Qnil;
static VALUE swig_runtime_data_type_pointer = Qnil;

/* Global IDs used to keep some internal SWIG stuff */
static ID swig_arity_id = 0;
static ID swig_call_id  = 0;

/*
  If your swig extension is to be run within an embedded ruby and has
  director callbacks, you should set -DRUBY_EMBEDDED during compilation.  
  This will reset ruby's stack frame on each entry point from the main 
  program the first time a virtual director function is invoked (in a 
  non-recursive way).
  If this is not done, you run the risk of Ruby trashing the stack.
*/

#ifdef RUBY_EMBEDDED

#  define SWIG_INIT_STACK                            \
      if ( !swig_virtual_calls ) { RUBY_INIT_STACK } \
      ++swig_virtual_calls;
#  define SWIG_RELEASE_STACK --swig_virtual_calls;
#  define Ruby_DirectorTypeMismatchException(x) \
Ralf Mueller's avatar
Ralf Mueller committed
1441
          rb_raise( rb_eTypeError, "%s", x ); return c_result;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500

      static unsigned int swig_virtual_calls = 0;

#else  /* normal non-embedded extension */

#  define SWIG_INIT_STACK
#  define SWIG_RELEASE_STACK
#  define Ruby_DirectorTypeMismatchException(x) \
          throw Swig::DirectorTypeMismatchException( x );

#endif  /* RUBY_EMBEDDED */


SWIGRUNTIME VALUE 
getExceptionClass(void) {
  static int init = 0;
  static VALUE rubyExceptionClass ;
  if (!init) {
    init = 1;
    rubyExceptionClass = rb_const_get(_mSWIG, rb_intern("Exception"));
  }
  return rubyExceptionClass;
} 

/* This code checks to see if the Ruby object being raised as part
   of an exception inherits from the Ruby class Exception.  If so,
   the object is simply returned.  If not, then a new Ruby exception
   object is created and that will be returned to Ruby.*/
SWIGRUNTIME VALUE
SWIG_Ruby_ExceptionType(swig_type_info *desc, VALUE obj) {
  VALUE exceptionClass = getExceptionClass();
  if (rb_obj_is_kind_of(obj, exceptionClass)) {
    return obj;
  }  else {
    return rb_exc_new3(rb_eRuntimeError, rb_obj_as_string(obj));
  }
}

/* Initialize Ruby runtime support */
SWIGRUNTIME void
SWIG_Ruby_InitRuntime(void)
{
  if (_mSWIG == Qnil) {
    _mSWIG = rb_define_module("SWIG");
    swig_call_id  = rb_intern("call");
    swig_arity_id = rb_intern("arity");
  }
}

/* Define Ruby class for C type */
SWIGRUNTIME void
SWIG_Ruby_define_class(swig_type_info *type)
{
  char *klass_name = (char *) malloc(4 + strlen(type->name) + 1);
  sprintf(klass_name, "TYPE%s", type->name);
  if (NIL_P(_cSWIG_Pointer)) {
    _cSWIG_Pointer = rb_define_class_under(_mSWIG, "Pointer", rb_cObject);
    rb_undef_method(CLASS_OF(_cSWIG_Pointer), "new");
  }
Ralf Mueller's avatar
Ralf Mueller committed
1501
  rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer);
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
  free((void *) klass_name);
}

/* Create a new pointer object */
SWIGRUNTIME VALUE
SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags)
{
  int own =  flags & SWIG_POINTER_OWN; 
  int track;
  char *klass_name;
  swig_class *sklass;
  VALUE klass;
  VALUE obj;
Ralf Mueller's avatar
Ralf Mueller committed
1515

Uwe Schulzweida's avatar
Uwe Schulzweida committed
1516
1517
  if (!ptr)
    return Qnil;
Ralf Mueller's avatar
Ralf Mueller committed
1518
1519

  assert(type);
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1520
1521
1522
1523
1524
1525
1526
  if (type->clientdata) {
    sklass = (swig_class *) type->clientdata;
		
    /* Are we tracking this class and have we already returned this Ruby object? */
    track = sklass->trackObjects;
    if (track) {
      obj = SWIG_RubyInstanceFor(ptr);
Ralf Mueller's avatar
Ralf Mueller committed
1527

Uwe Schulzweida's avatar
Uwe Schulzweida committed
1528
1529
1530
1531
1532
      /* Check the object's type and make sure it has the correct type.
        It might not in cases where methods do things like 
        downcast methods. */
      if (obj != Qnil) {
        VALUE value = rb_iv_get(obj, "@__swigtype__");
Ralf Mueller's avatar
Ralf Mueller committed
1533
        const char* type_name = RSTRING_PTR(value);
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
				
        if (strcmp(type->name, type_name) == 0) {
          return obj;
        }
      }
    }

    /* Create a new Ruby object */
    obj = Data_Wrap_Struct(sklass->klass, VOIDFUNC(sklass->mark), 
			   ( own ? VOIDFUNC(sklass->destroy) : 
			     (track ? VOIDFUNC(SWIG_RubyRemoveTracking) : 0 )
			     ), ptr);

    /* If tracking is on for this class then track this object. */
    if (track) {
      SWIG_RubyAddTracking(ptr, obj);
    }
  } else {
    klass_name = (char *) malloc(4 + strlen(type->name) + 1);
    sprintf(klass_name, "TYPE%s", type->name);
    klass = rb_const_get(_mSWIG, rb_intern(klass_name));
    free((void *) klass_name);
    obj = Data_Wrap_Struct(klass, 0, 0, ptr);
  }
  rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name));
Ralf Mueller's avatar
Ralf Mueller committed
1559

Uwe Schulzweida's avatar
Uwe Schulzweida committed
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
  return obj;
}

/* Create a new class instance (always owned) */
SWIGRUNTIME VALUE
SWIG_Ruby_NewClassInstance(VALUE klass, swig_type_info *type)
{
  VALUE obj;
  swig_class *sklass = (swig_class *) type->clientdata;
  obj = Data_Wrap_Struct(klass, VOIDFUNC(sklass->mark), VOIDFUNC(sklass->destroy), 0);
  rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name));
  return obj;
}

/* Get type mangle from class name */
SWIGRUNTIMEINLINE char *
SWIG_Ruby_MangleStr(VALUE obj)
{
  VALUE stype = rb_iv_get(obj, "@__swigtype__");
  return StringValuePtr(stype);
}

/* Acquire a pointer value */
Ralf Mueller's avatar
Ralf Mueller committed
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
typedef struct {
  void (*datafree)(void *);
  int own;
} swig_ruby_owntype;

SWIGRUNTIME swig_ruby_owntype
SWIG_Ruby_AcquirePtr(VALUE obj, swig_ruby_owntype own) {
  swig_ruby_owntype oldown = {0, 0};
  if (TYPE(obj) == T_DATA && !RTYPEDDATA_P(obj)) {
    oldown.datafree = RDATA(obj)->dfree;
    RDATA(obj)->dfree = own.datafree;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1594
  }
Ralf Mueller's avatar
Ralf Mueller committed
1595
  return oldown;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1596
1597
1598
1599
}

/* Convert a pointer value */
SWIGRUNTIME int
Ralf Mueller's avatar
Ralf Mueller committed
1600
SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags, swig_ruby_owntype *own)
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1601
1602
1603
1604
1605
1606
1607
{
  char *c;
  swig_cast_info *tc;
  void *vptr = 0;

  /* Grab the pointer */
  if (NIL_P(obj)) {
Ralf Mueller's avatar
Ralf Mueller committed
1608
1609
1610
    if (ptr)
      *ptr = 0;
    return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1611
  } else {
Ralf Mueller's avatar
Ralf Mueller committed
1612
    if (TYPE(obj) != T_DATA || (TYPE(obj) == T_DATA && RTYPEDDATA_P(obj))) {
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1613
1614
1615
1616
1617
      return SWIG_ERROR;
    }
    Data_Get_Struct(obj, void, vptr);
  }
  
Ralf Mueller's avatar
Ralf Mueller committed
1618
1619
1620
1621
  if (own) {
    own->datafree = RDATA(obj)->dfree;
    own->own = 0;
  }
Uwe Schulzweida's avatar
Uwe Schulzweida committed
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
    
  /* Check to see if the input object is giving up ownership
     of the underlying C struct or C++ object.  If so then we
     need to reset the destructor since the Ruby object no 
     longer owns the underlying C++ object.*/ 
  if (flags & SWIG_POINTER_DISOWN) {
    /* Is tracking on for this class? */
    int track = 0;
    if (ty && ty->clientdata) {
      swig_class *sklass = (swig_class *) ty->clientdata;
      track = sklass->trackObjects;
    }
		
    if (track) {
      /* We are tracking objects for this class.  Thus we change the destructor
       * to SWIG_RubyRemoveTracking.  This allows us to
       * remove the mapping from the C++ to Ruby object
       * when the Ruby object is garbage collected.  If we don't
       * do this, then it is possible we will return a reference 
       * to a Ruby object that no longer exists thereby crashing Ruby. */
      RDATA(obj)->dfree = SWIG_RubyRemoveTracking;
    } else {    
      RDATA(obj)->dfree = 0;
    }
  }

  /* Do type-checking if type info was provided */
  if (ty) {
    if (ty->clientdata) {
      if (rb_obj_is_kind_of(obj, ((swig_class *) (ty->clientdata))->klass)) {
        if (vptr == 0) {
          /* The object has already been deleted */
          return SWIG_ObjectPreviouslyDeletedError;
        }
      }
    }
    if ((c = SWIG_MangleStr(obj)) == NULL) {
      return SWIG_ERROR;
    }
    tc = SWIG_TypeCheck(c, ty);
    if (!tc) {
      return SWIG_ERROR;
    } else {
Ralf Mueller's avatar
Ralf Mueller committed
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
      if (ptr) {
        if (tc->type == ty) {
          *ptr = vptr;
        } else {
          int newmemory = 0;
          *ptr = SWIG_TypeCast(tc, vptr, &newmemory);
          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 = own->own | SWIG_CAST_NEW_MEMORY;
          }
        }
      }
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1678
1679
    }
  } else {
Ralf Mueller's avatar
Ralf Mueller committed
1680
1681
    if (ptr)
      *ptr = vptr;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
  }
  
  return SWIG_OK;
}

/* Check convert */
SWIGRUNTIMEINLINE int
SWIG_Ruby_CheckConvert(VALUE obj, swig_type_info *ty)
{
  char *c = SWIG_MangleStr(obj);
  if (!c) return 0;
  return SWIG_TypeCheck(c,ty) != 0;
}

SWIGRUNTIME VALUE
SWIG_Ruby_NewPackedObj(void *ptr, int sz, swig_type_info *type) {
  char result[1024];
  char *r = result;
  if ((2*sz + 1 + strlen(type->name)) > 1000) return 0;
  *(r++) = '_';
  r = SWIG_PackData(r, ptr, sz);
  strcpy(r, type->name);
  return rb_str_new2(result);
}

Ralf Mueller's avatar
Ralf Mueller committed
1707
/* Convert a packed pointer value */
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
SWIGRUNTIME int
SWIG_Ruby_ConvertPacked(VALUE obj, void *ptr, int sz, swig_type_info *ty) {
  swig_cast_info *tc;
  const char  *c;

  if (TYPE(obj) != T_STRING) goto type_error;
  c = StringValuePtr(obj);
  /* Pointer values must start with leading underscore */
  if (*c != '_') goto type_error;
  c++;
  c = SWIG_UnpackData(c, ptr, sz);
  if (ty) {
    tc = SWIG_TypeCheck(c, ty);
    if (!tc) goto type_error;
  }
  return SWIG_OK;

 type_error:
  return SWIG_ERROR;
}

SWIGRUNTIME swig_module_info *
Ralf Mueller's avatar
Ralf Mueller committed
1730
SWIG_Ruby_GetModule(void *SWIGUNUSEDPARM(clientdata))
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
{
  VALUE pointer;
  swig_module_info *ret = 0;
  VALUE verbose = rb_gv_get("VERBOSE");

 /* temporarily disable warnings, since the pointer check causes warnings with 'ruby -w' */
  rb_gv_set("VERBOSE", Qfalse);
  
  /* first check if pointer already created */
  pointer = rb_gv_get("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
  if (pointer != Qnil) {
    Data_Get_Struct(pointer, swig_module_info, ret);
  }

  /* reinstate warnings */
  rb_gv_set("VERBOSE", verbose);
  return ret;
}

SWIGRUNTIME void 
SWIG_Ruby_SetModule(swig_module_info *pointer)
{
  /* register a new class */
  VALUE cl = rb_define_class("swig_runtime_data", rb_cObject);
  /* create and store the structure pointer to a global variable */
  swig_runtime_data_type_pointer = Data_Wrap_Struct(cl, 0, 0, pointer);
  rb_define_readonly_variable("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, &swig_runtime_data_type_pointer);
}

/* This function can be used to check whether a proc or method or similarly
   callable function has been passed.  Usually used in a %typecheck, like:

   %typecheck(c_callback_t, precedence=SWIG_TYPECHECK_POINTER) {
        $result = SWIG_Ruby_isCallable( $input );
   }
 */
SWIGINTERN
int SWIG_Ruby_isCallable( VALUE proc )
{
Ralf Mueller's avatar
Ralf Mueller committed
1770
  if ( rb_respond_to( proc, swig_call_id ) )
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
    return 1;
  return 0;
}

/* This function can be used to check the arity (number of arguments)
   a proc or method can take.  Usually used in a %typecheck.
   Valid arities will be that equal to minimal or those < 0
   which indicate a variable number of parameters at the end.
 */
SWIGINTERN
int SWIG_Ruby_arity( VALUE proc, int minimal )
{
Ralf Mueller's avatar
Ralf Mueller committed
1783
  if ( rb_respond_to( proc, swig_arity_id ) )
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
    {
      VALUE num = rb_funcall( proc, swig_arity_id, 0 );
      int arity = NUM2INT(num);
      if ( arity < 0 && (arity+1) < -minimal ) return 1;
      if ( arity == minimal ) return 1;
      return 1;
    }
  return 0;
}


#ifdef __cplusplus
}
#endif



#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) -------- */

Ralf Mueller's avatar
Ralf Mueller committed
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
#define SWIGTYPE_p_CdiGribIterator swig_types[0]
#define SWIGTYPE_p_CdiIterator swig_types[1]
#define SWIGTYPE_p_CdiParam swig_types[2]
#define SWIGTYPE_p_FILE swig_types[3]
#define SWIGTYPE_p_a_10__int swig_types[4]
#define SWIGTYPE_p_a_2__int swig_types[5]
#define SWIGTYPE_p_char swig_types[6]
#define SWIGTYPE_p_double swig_types[7]
#define SWIGTYPE_p_float swig_types[8]
#define SWIGTYPE_p_int swig_types[9]
#define SWIGTYPE_p_int64_t swig_types[10]
#define SWIGTYPE_p_long swig_types[11]
#define SWIGTYPE_p_off_t swig_types[12]
#define SWIGTYPE_p_p_char swig_types[13]
#define SWIGTYPE_p_p_p_char swig_types[14]
#define SWIGTYPE_p_size_t swig_types[15]
#define SWIGTYPE_p_subtype_query_t swig_types[16]
#define SWIGTYPE_p_unsigned_char swig_types[17]
static swig_type_info *swig_types[19];
static swig_module_info swig_module = {swig_types, 18, 0, 0, 0, 0};
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
#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    Init_CdiLib
#define SWIG_name    "CdiLib"

static VALUE mCdiLib;

#define SWIG_RUBY_THREAD_BEGIN_BLOCK
#define SWIG_RUBY_THREAD_END_BLOCK


Ralf Mueller's avatar
Ralf Mueller committed
1843
#define SWIGVERSION 0x040000 
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
#define SWIG_VERSION SWIGVERSION


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


#include "cdi.h"


#include <limits.h>
#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
#endif


  #define SWIG_From_long   LONG2NUM 


SWIGINTERNINLINE VALUE
SWIG_From_int  (int value)
{    
  return SWIG_From_long  (value);
}


SWIGINTERN VALUE
SWIG_ruby_failed(void)
{
  return Qnil;
} 


Ralf Mueller's avatar
Ralf Mueller committed
1881
/*@SWIG:/usr/share/swig/4.0.0/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE *args)
{
  VALUE obj = args[0];
  VALUE type = TYPE(obj);
  long *res = (long *)(args[1]);
  *res = type == T_FIXNUM ? NUM2LONG(obj) : rb_big2long(obj);
  return obj;
}
/*@SWIG@*/

SWIGINTERN int
SWIG_AsVal_long (VALUE obj, long* val)
{
  VALUE type = TYPE(obj);
  if ((type == T_FIXNUM) || (type == T_BIGNUM)) {
    long v;
    VALUE a[2];
    a[0] = obj;
    a[1] = (VALUE)(&v);
    if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2LONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
      if (val) *val = v;
      return SWIG_OK;
    }
  }
  return SWIG_TypeError;
}


SWIGINTERN int
SWIG_AsVal_int (VALUE obj, int *val)
{
  long v;
  int res = SWIG_AsVal_long (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*
SWIG_pchar_descriptor(void)
{
  static int init = 0;
  static swig_type_info* info = 0;
  if (!init) {
    info = SWIG_TypeQuery("_p_char");
    init = 1;
  }
  return info;
}


SWIGINTERNINLINE VALUE 
SWIG_FromCharPtrAndSize(const char* carray, size_t size)
{
  if (carray) {
    if (size > LONG_MAX) {
      swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
      return pchar_descriptor ? 
	SWIG_NewPointerObj((char *)(carray), pchar_descriptor, 0) : Qnil;
    } else {
      return rb_str_new(carray, (long)(size));
    }
  } else {
    return Qnil;
  }
}


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


Ralf Mueller's avatar
Ralf Mueller committed
1963
/*@SWIG:/usr/share/swig/4.0.0/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1964
1965
1966
1967
1968
SWIGINTERN VALUE SWIG_AUX_NUM2DBL(VALUE *args)
{
  VALUE obj = args[0];
  VALUE type = TYPE(obj);
  double *res = (double *)(args[1]);
Ralf Mueller's avatar
Ralf Mueller committed
1969
  *res = NUM2DBL(obj); (void)type;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
  return obj;
}
/*@SWIG@*/

SWIGINTERN int
SWIG_AsVal_double (VALUE obj, double *val)
{
  VALUE type = TYPE(obj);
  if ((type == T_FLOAT) || (type == T_FIXNUM) || (type == T_BIGNUM)) {
    double v;
    VALUE a[2];
    a[0] = obj;
    a[1] = (VALUE)(&v);
    if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2DBL), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
      if (val) *val = v;
      return SWIG_OK;
    }
  }
  return SWIG_TypeError;
}


  #define SWIG_From_double   rb_float_new 


SWIGINTERN int
SWIG_AsCharPtrAndSize(VALUE obj, char** cptr, size_t* psize, int *alloc)
{
  if (TYPE(obj) == T_STRING) {
    char *cstr = StringValuePtr(obj); 
    size_t size = RSTRING_LEN(obj) + 1;
    if (cptr)  {
      if (alloc) {
	if (*alloc == SWIG_NEWOBJ) {
Ralf Mueller's avatar
Ralf Mueller committed
2004
	  *cptr = (char *)memcpy(malloc((size)*sizeof(char)), cstr, sizeof(char)*(size));
Uwe Schulzweida's avatar
Uwe Schulzweida committed
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
	} 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) {
      void* vptr = 0;
      if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
	if (cptr) *cptr = (char *)vptr;
	if (psize) *psize = vptr ? (strlen((char*)vptr) + 1) : 0;
	if (alloc) *alloc = SWIG_OLDOBJ;
	return SWIG_OK;
      }
    }
  }  
  return SWIG_TypeError;
}




Ralf Mueller's avatar
Ralf Mueller committed
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063

SWIGINTERNINLINE VALUE
SWIG_From_unsigned_SS_long  (unsigned long value)
{
  return ULONG2NUM(value); 
}


#if defined(LLONG_MAX) && !defined(SWIG_LONG_LONG_AVAILABLE)
#  define SWIG_LONG_LONG_AVAILABLE
#endif


#ifdef SWIG_LONG_LONG_AVAILABLE
SWIGINTERNINLINE VALUE 
SWIG_From_unsigned_SS_long_SS_long  (unsigned long long value)
{
  return ULL2NUM(value);
}
#endif


SWIGINTERNINLINE VALUE
SWIG_From_size_t  (size_t value)
{    
#ifdef SWIG_LONG_LONG_AVAILABLE
  if (sizeof(size_t) <= sizeof(unsigned long)) {
#endif
    return SWIG_From_unsigned_SS_long  ((unsigned long)(value));
#ifdef SWIG_LONG_LONG_AVAILABLE
  } else {
    /* assume sizeof(size_t) <= sizeof(unsigned long long) */
    return SWIG_From_unsigned_SS_long_SS_long  ((unsigned long long)(value));
Uwe Schulzweida's avatar
Uwe Schulzweida committed
2064
  }
Ralf Mueller's avatar
Ralf Mueller committed
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
#endif
}


/*@SWIG:/usr/share/swig/4.0.0/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
SWIGINTERN VALUE SWIG_AUX_NUM2ULONG(VALUE *args)
{
  VALUE obj = args[0];
  VALUE type = TYPE(obj);
  unsigned long *res = (unsigned long *)(args[1]);
  *res = type == T_FIXNUM ? NUM2ULONG(obj) : rb_big2ulong(obj);
  return obj;
}
/*@SWIG@*/

SWIGINTERN int
SWIG_AsVal_unsigned_SS_long (VALUE obj, unsigned long *val) 
{
  VALUE type = TYPE(obj);
  if ((type == T_FIXNUM) || (type == T_BIGNUM)) {
    unsigned long v;
    VALUE a[2];
    a[0] = obj;
    a[1] = (VALUE)(&v);
    if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2ULONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
      if (val) *val = v;
      return SWIG_OK;
    }
  }
  return SWIG_TypeError;
}


#ifdef SWIG_LONG_LONG_AVAILABLE
/*@SWIG:/usr/share/swig/4.0.0/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
SWIGINTERN VALUE SWIG_AUX_NUM2ULL(VALUE *args)
{
  VALUE obj = args[0];
  VALUE type = TYPE(obj);
  long long *res = (long long *)(args[1]);
  *res = type == T_FIXNUM ? NUM2ULL(obj) : rb_big2ull(obj);
  return obj;
}
/*@SWIG@*/

SWIGINTERN int
SWIG_AsVal_unsigned_SS_long_SS_long (VALUE obj, unsigned long long *val)
{ 
  VALUE type = TYPE(obj);
  if ((type == T_FIXNUM) || (type == T_BIGNUM)) {
    unsigned long long v;
    VALUE a[2];
    a[0] = obj;
    a[1] = (VALUE)(&v);
    if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2ULL), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
      if (val) *val = v;
      return SWIG_OK;
    }
  }
  return SWIG_TypeError;
}
#endif


SWIGINTERNINLINE int
SWIG_AsVal_size_t (VALUE obj, size_t *val)
{
  int res = SWIG_TypeError;
#ifdef SWIG_LONG_LONG_AVAILABLE
  if (sizeof(size_t) <= sizeof(unsigned long)) {
#endif
    unsigned long v;
    res = SWIG_AsVal_unsigned_SS_long (obj, val ? &v : 0);
    if (SWIG_IsOK(res) && val) *val = (size_t)(v);
#ifdef SWIG_LONG_LONG_AVAILABLE
  } else if (sizeof(size_t) <= sizeof(unsigned long long)) {
    unsigned long long v;
    res = SWIG_AsVal_unsigned_SS_long_SS_long (obj, val ? &v : 0);
    if (SWIG_IsOK(res) && val) *val = (size_t)(v);
  }
#endif
  return res;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
2147
2148
}

Ralf Mueller's avatar
Ralf Mueller committed
2149
static swig_class SwigClassSubtype_query_t;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
2150
2151

SWIGINTERN VALUE
Ralf Mueller's avatar
Ralf Mueller committed
2152
2153
2154
2155
2156
2157
2158
_wrap_subtype_query_t_nAND_set(int argc, VALUE *argv, VALUE self) {
  subtype_query_t *arg1 = (subtype_query_t *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
2159
2160
2161
2162
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
Ralf Mueller's avatar
Ralf Mueller committed
2163
2164
2165
2166
2167
2168
2169
2170
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_subtype_query_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "subtype_query_t *","nAND", 1, self )); 
  }
  arg1 = (subtype_query_t *)(argp1);
  ecode2 = SWIG_AsVal_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","nAND", 2, argv[0] ));
Uwe Schulzweida's avatar
Uwe Schulzweida committed
2171
  } 
Ralf Mueller's avatar
Ralf Mueller committed
2172
2173
  arg2 = (int)(val2);
  if (arg1) (arg1)->nAND = arg2;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
2174
2175
2176
2177
2178
2179
2180
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
Ralf Mueller's avatar
Ralf Mueller committed
2181
2182
2183
2184
2185
_wrap_subtype_query_t_nAND_get(int argc, VALUE *argv, VALUE self) {
  subtype_query_t *arg1 = (subtype_query_t *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int result;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
2186
2187
2188
2189
2190
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
Ralf Mueller's avatar
Ralf Mueller committed
2191
2192
2193
2194
2195
2196
2197
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_subtype_query_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "subtype_query_t *","nAND", 1, self )); 
  }
  arg1 = (subtype_query_t *)(argp1);
  result = (int) ((arg1)->nAND);
  vresult = SWIG_From_int((int)(result));
Uwe Schulzweida's avatar
Uwe Schulzweida committed
2198
2199
2200
2201
2202
2203
2204
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
Ralf Mueller's avatar
Ralf Mueller committed
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
_wrap_subtype_query_t_key_value_pairs_set(int argc, VALUE *argv, VALUE self) {
  subtype_query_t *arg1 = (subtype_query_t *) 0 ;
  int (*arg2)[10] ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_subtype_query_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "subtype_query_t *","key_value_pairs", 1, self )); 
  }
  arg1 = (subtype_query_t *)(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_a_10__int, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "int [2][10]","key_value_pairs", 2, argv[0] )); 
  } 
  arg2 = (int (*)[10])(argp2);
  {
    if (arg2) {
      size_t ii = 0;
      for (; ii < (size_t)2; ++ii) {
        if (arg2[ii]) {
          size_t jj = 0;
          for (; jj < (size_t)10; ++jj) arg1->key_value_pairs[ii][jj] = arg2[ii][jj];
        } else {
          SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in variable '""key_value_pairs""' of type '""int [2][10]""'");
        }
      }
    } else {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in variable '""key_value_pairs""' of type '""int [2][10]""'");
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_subtype_query_t_key_value_pairs_get(int argc, VALUE *argv, VALUE self) {
  subtype_query_t *arg1 = (subtype_query_t *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int (*result)[10] = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
Uwe Schulzweida's avatar
Uwe Schulzweida committed
2256
2257
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
Ralf Mueller's avatar
Ralf Mueller committed
2258
2259
2260
2261
2262
2263
2264
2265
2266
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_subtype_query_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "subtype_query_t *","key_value_pairs", 1, self )); 
  }
  arg1 = (subtype_query_t *)(argp1);
  result = (int (*)[10])(int (*)[10]) ((arg1)->key_value_pairs);
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_a_10__int, 0 |  0 );
  return vresult;
fail:
Uwe Schulzweida's avatar
Uwe Schulzweida committed
2267
  return Qnil;
Ralf Mueller's avatar
Ralf Mueller committed
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
}


SWIGINTERN VALUE
#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
_wrap_subtype_query_t_allocate(VALUE self)
#else
_wrap_subtype_query_t_allocate(int argc, VALUE *argv, VALUE self)
#endif
{
  VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_subtype_query_t);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
  rb_obj_call_init(vresult, argc, argv);
#endif
  return vresult;
}


SWIGINTERN VALUE
_wrap_new_subtype_query_t(int argc, VALUE *argv, VALUE self) {
  subtype_query_t *result = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  result = (subtype_query_t *)calloc(1, sizeof(subtype_query_t));
  DATA_PTR(self) = result;
  return self;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
2296
2297
2298
2299
2300
fail:
  return Qnil;
}


Ralf Mueller's avatar
Ralf Mueller committed
2301
2302
2303
2304
2305
2306
2307
2308
SWIGINTERN void
free_subtype_query_t(void *self) {
    subtype_query_t *arg1 = (subtype_query_t *)self;
    free((char *) arg1);
}

static swig_class SwigClassCdiParam;

Uwe Schulzweida's avatar
Uwe Schulzweida committed
2309
SWIGINTERN VALUE
Ralf Mueller's avatar
Ralf Mueller committed
2310
2311
2312
2313
2314
2315
2316
_wrap_CdiParam_discipline_set(int argc, VALUE *argv, VALUE self) {
  struct CdiParam *arg1 = (struct CdiParam *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
2317
2318
2319
2320
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
Ralf Mueller's avatar
Ralf Mueller committed
2321
2322
2323
2324
2325
2326
2327
2328
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiParam, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct CdiParam *","discipline", 1, self )); 
  }
  arg1 = (struct CdiParam *)(argp1);
  ecode2 = SWIG_AsVal_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","discipline", 2, argv[0] ));
Uwe Schulzweida's avatar
Uwe Schulzweida committed
2329
  } 
Ralf Mueller's avatar
Ralf Mueller committed
2330
2331
  arg2 = (int)(val2);
  if (arg1) (arg1)->discipline = arg2;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
2332
2333
2334
2335
2336
2337
2338
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
Ralf Mueller's avatar
Ralf Mueller committed
2339
2340
2341
2342
2343
_wrap_CdiParam_discipline_get(int argc, VALUE *argv, VALUE self) {
  struct CdiParam *arg1 = (struct CdiParam *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int result;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
2344
2345
2346
2347
2348
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
Ralf Mueller's avatar
Ralf Mueller committed
2349
2350
2351
2352
2353
2354
2355
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiParam, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct CdiParam *","discipline", 1, self )); 
  }
  arg1 = (struct CdiParam *)(argp1);
  result = (int) ((arg1)->discipline);
  vresult = SWIG_From_int((int)(result));
Uwe Schulzweida's avatar
Uwe Schulzweida committed
2356
2357
2358
2359
2360
2361
2362
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
Ralf Mueller's avatar
Ralf Mueller committed
2363
2364
_wrap_CdiParam_category_set(int argc, VALUE *argv, VALUE self) {
  struct CdiParam *arg1 = (struct CdiParam *) 0 ;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
2365
  int arg2 ;
Ralf Mueller's avatar
Ralf Mueller committed
2366
2367
  void *argp1 = 0 ;
  int res1 = 0 ;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
2368
2369
2370
  int val2 ;
  int ecode2 = 0 ;
  
Ralf Mueller's avatar
Ralf Mueller committed
2371
2372
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
2373
  }
Ralf Mueller's avatar
Ralf Mueller committed
2374
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CdiParam, 0 |  0 );
Uwe Schulzweida's avatar
Uwe Schulzweida committed
2375