sunxi_gpio 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,2339 @@
1
+ /* ----------------------------------------------------------------------------
2
+ * This file was automatically generated by SWIG (http://www.swig.org).
3
+ * Version 2.0.11
4
+ *
5
+ * This file is not intended to be easily readable and contains a number of
6
+ * coding conventions designed to improve portability and efficiency. Do not make
7
+ * changes to this file unless you know what you are doing--modify the SWIG
8
+ * interface file instead.
9
+ * ----------------------------------------------------------------------------- */
10
+
11
+ #define SWIGRUBY
12
+
13
+ /* -----------------------------------------------------------------------------
14
+ * This section contains generic SWIG labels for method/variable
15
+ * declarations/attributes, and other compiler dependent labels.
16
+ * ----------------------------------------------------------------------------- */
17
+
18
+ /* template workaround for compilers that cannot correctly implement the C++ standard */
19
+ #ifndef SWIGTEMPLATEDISAMBIGUATOR
20
+ # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
21
+ # define SWIGTEMPLATEDISAMBIGUATOR template
22
+ # elif defined(__HP_aCC)
23
+ /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
24
+ /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
25
+ # define SWIGTEMPLATEDISAMBIGUATOR template
26
+ # else
27
+ # define SWIGTEMPLATEDISAMBIGUATOR
28
+ # endif
29
+ #endif
30
+
31
+ /* inline attribute */
32
+ #ifndef SWIGINLINE
33
+ # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
34
+ # define SWIGINLINE inline
35
+ # else
36
+ # define SWIGINLINE
37
+ # endif
38
+ #endif
39
+
40
+ /* attribute recognised by some compilers to avoid 'unused' warnings */
41
+ #ifndef SWIGUNUSED
42
+ # if defined(__GNUC__)
43
+ # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
44
+ # define SWIGUNUSED __attribute__ ((__unused__))
45
+ # else
46
+ # define SWIGUNUSED
47
+ # endif
48
+ # elif defined(__ICC)
49
+ # define SWIGUNUSED __attribute__ ((__unused__))
50
+ # else
51
+ # define SWIGUNUSED
52
+ # endif
53
+ #endif
54
+
55
+ #ifndef SWIG_MSC_UNSUPPRESS_4505
56
+ # if defined(_MSC_VER)
57
+ # pragma warning(disable : 4505) /* unreferenced local function has been removed */
58
+ # endif
59
+ #endif
60
+
61
+ #ifndef SWIGUNUSEDPARM
62
+ # ifdef __cplusplus
63
+ # define SWIGUNUSEDPARM(p)
64
+ # else
65
+ # define SWIGUNUSEDPARM(p) p SWIGUNUSED
66
+ # endif
67
+ #endif
68
+
69
+ /* internal SWIG method */
70
+ #ifndef SWIGINTERN
71
+ # define SWIGINTERN static SWIGUNUSED
72
+ #endif
73
+
74
+ /* internal inline SWIG method */
75
+ #ifndef SWIGINTERNINLINE
76
+ # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
77
+ #endif
78
+
79
+ /* exporting methods */
80
+ #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
81
+ # ifndef GCC_HASCLASSVISIBILITY
82
+ # define GCC_HASCLASSVISIBILITY
83
+ # endif
84
+ #endif
85
+
86
+ #ifndef SWIGEXPORT
87
+ # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
88
+ # if defined(STATIC_LINKED)
89
+ # define SWIGEXPORT
90
+ # else
91
+ # define SWIGEXPORT __declspec(dllexport)
92
+ # endif
93
+ # else
94
+ # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
95
+ # define SWIGEXPORT __attribute__ ((visibility("default")))
96
+ # else
97
+ # define SWIGEXPORT
98
+ # endif
99
+ # endif
100
+ #endif
101
+
102
+ /* calling conventions for Windows */
103
+ #ifndef SWIGSTDCALL
104
+ # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
105
+ # define SWIGSTDCALL __stdcall
106
+ # else
107
+ # define SWIGSTDCALL
108
+ # endif
109
+ #endif
110
+
111
+ /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
112
+ #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
113
+ # define _CRT_SECURE_NO_DEPRECATE
114
+ #endif
115
+
116
+ /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
117
+ #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
118
+ # define _SCL_SECURE_NO_DEPRECATE
119
+ #endif
120
+
121
+
122
+ /* -----------------------------------------------------------------------------
123
+ * This section contains generic SWIG labels for method/variable
124
+ * declarations/attributes, and other compiler dependent labels.
125
+ * ----------------------------------------------------------------------------- */
126
+
127
+ /* template workaround for compilers that cannot correctly implement the C++ standard */
128
+ #ifndef SWIGTEMPLATEDISAMBIGUATOR
129
+ # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
130
+ # define SWIGTEMPLATEDISAMBIGUATOR template
131
+ # elif defined(__HP_aCC)
132
+ /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
133
+ /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
134
+ # define SWIGTEMPLATEDISAMBIGUATOR template
135
+ # else
136
+ # define SWIGTEMPLATEDISAMBIGUATOR
137
+ # endif
138
+ #endif
139
+
140
+ /* inline attribute */
141
+ #ifndef SWIGINLINE
142
+ # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
143
+ # define SWIGINLINE inline
144
+ # else
145
+ # define SWIGINLINE
146
+ # endif
147
+ #endif
148
+
149
+ /* attribute recognised by some compilers to avoid 'unused' warnings */
150
+ #ifndef SWIGUNUSED
151
+ # if defined(__GNUC__)
152
+ # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
153
+ # define SWIGUNUSED __attribute__ ((__unused__))
154
+ # else
155
+ # define SWIGUNUSED
156
+ # endif
157
+ # elif defined(__ICC)
158
+ # define SWIGUNUSED __attribute__ ((__unused__))
159
+ # else
160
+ # define SWIGUNUSED
161
+ # endif
162
+ #endif
163
+
164
+ #ifndef SWIG_MSC_UNSUPPRESS_4505
165
+ # if defined(_MSC_VER)
166
+ # pragma warning(disable : 4505) /* unreferenced local function has been removed */
167
+ # endif
168
+ #endif
169
+
170
+ #ifndef SWIGUNUSEDPARM
171
+ # ifdef __cplusplus
172
+ # define SWIGUNUSEDPARM(p)
173
+ # else
174
+ # define SWIGUNUSEDPARM(p) p SWIGUNUSED
175
+ # endif
176
+ #endif
177
+
178
+ /* internal SWIG method */
179
+ #ifndef SWIGINTERN
180
+ # define SWIGINTERN static SWIGUNUSED
181
+ #endif
182
+
183
+ /* internal inline SWIG method */
184
+ #ifndef SWIGINTERNINLINE
185
+ # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
186
+ #endif
187
+
188
+ /* exporting methods */
189
+ #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
190
+ # ifndef GCC_HASCLASSVISIBILITY
191
+ # define GCC_HASCLASSVISIBILITY
192
+ # endif
193
+ #endif
194
+
195
+ #ifndef SWIGEXPORT
196
+ # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
197
+ # if defined(STATIC_LINKED)
198
+ # define SWIGEXPORT
199
+ # else
200
+ # define SWIGEXPORT __declspec(dllexport)
201
+ # endif
202
+ # else
203
+ # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
204
+ # define SWIGEXPORT __attribute__ ((visibility("default")))
205
+ # else
206
+ # define SWIGEXPORT
207
+ # endif
208
+ # endif
209
+ #endif
210
+
211
+ /* calling conventions for Windows */
212
+ #ifndef SWIGSTDCALL
213
+ # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
214
+ # define SWIGSTDCALL __stdcall
215
+ # else
216
+ # define SWIGSTDCALL
217
+ # endif
218
+ #endif
219
+
220
+ /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
221
+ #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
222
+ # define _CRT_SECURE_NO_DEPRECATE
223
+ #endif
224
+
225
+ /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
226
+ #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
227
+ # define _SCL_SECURE_NO_DEPRECATE
228
+ #endif
229
+
230
+
231
+ /* -----------------------------------------------------------------------------
232
+ * swigrun.swg
233
+ *
234
+ * This file contains generic C API SWIG runtime support for pointer
235
+ * type checking.
236
+ * ----------------------------------------------------------------------------- */
237
+
238
+ /* This should only be incremented when either the layout of swig_type_info changes,
239
+ or for whatever reason, the runtime changes incompatibly */
240
+ #define SWIG_RUNTIME_VERSION "4"
241
+
242
+ /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
243
+ #ifdef SWIG_TYPE_TABLE
244
+ # define SWIG_QUOTE_STRING(x) #x
245
+ # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
246
+ # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
247
+ #else
248
+ # define SWIG_TYPE_TABLE_NAME
249
+ #endif
250
+
251
+ /*
252
+ You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
253
+ creating a static or dynamic library from the SWIG runtime code.
254
+ In 99.9% of the cases, SWIG just needs to declare them as 'static'.
255
+
256
+ But only do this if strictly necessary, ie, if you have problems
257
+ with your compiler or suchlike.
258
+ */
259
+
260
+ #ifndef SWIGRUNTIME
261
+ # define SWIGRUNTIME SWIGINTERN
262
+ #endif
263
+
264
+ #ifndef SWIGRUNTIMEINLINE
265
+ # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
266
+ #endif
267
+
268
+ /* Generic buffer size */
269
+ #ifndef SWIG_BUFFER_SIZE
270
+ # define SWIG_BUFFER_SIZE 1024
271
+ #endif
272
+
273
+ /* Flags for pointer conversions */
274
+ #define SWIG_POINTER_DISOWN 0x1
275
+ #define SWIG_CAST_NEW_MEMORY 0x2
276
+
277
+ /* Flags for new pointer objects */
278
+ #define SWIG_POINTER_OWN 0x1
279
+
280
+
281
+ /*
282
+ Flags/methods for returning states.
283
+
284
+ The SWIG conversion methods, as ConvertPtr, return an integer
285
+ that tells if the conversion was successful or not. And if not,
286
+ an error code can be returned (see swigerrors.swg for the codes).
287
+
288
+ Use the following macros/flags to set or process the returning
289
+ states.
290
+
291
+ In old versions of SWIG, code such as the following was usually written:
292
+
293
+ if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
294
+ // success code
295
+ } else {
296
+ //fail code
297
+ }
298
+
299
+ Now you can be more explicit:
300
+
301
+ int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
302
+ if (SWIG_IsOK(res)) {
303
+ // success code
304
+ } else {
305
+ // fail code
306
+ }
307
+
308
+ which is the same really, but now you can also do
309
+
310
+ Type *ptr;
311
+ int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
312
+ if (SWIG_IsOK(res)) {
313
+ // success code
314
+ if (SWIG_IsNewObj(res) {
315
+ ...
316
+ delete *ptr;
317
+ } else {
318
+ ...
319
+ }
320
+ } else {
321
+ // fail code
322
+ }
323
+
324
+ I.e., now SWIG_ConvertPtr can return new objects and you can
325
+ identify the case and take care of the deallocation. Of course that
326
+ also requires SWIG_ConvertPtr to return new result values, such as
327
+
328
+ int SWIG_ConvertPtr(obj, ptr,...) {
329
+ if (<obj is ok>) {
330
+ if (<need new object>) {
331
+ *ptr = <ptr to new allocated object>;
332
+ return SWIG_NEWOBJ;
333
+ } else {
334
+ *ptr = <ptr to old object>;
335
+ return SWIG_OLDOBJ;
336
+ }
337
+ } else {
338
+ return SWIG_BADOBJ;
339
+ }
340
+ }
341
+
342
+ Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
343
+ more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
344
+ SWIG errors code.
345
+
346
+ Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
347
+ allows to return the 'cast rank', for example, if you have this
348
+
349
+ int food(double)
350
+ int fooi(int);
351
+
352
+ and you call
353
+
354
+ food(1) // cast rank '1' (1 -> 1.0)
355
+ fooi(1) // cast rank '0'
356
+
357
+ just use the SWIG_AddCast()/SWIG_CheckState()
358
+ */
359
+
360
+ #define SWIG_OK (0)
361
+ #define SWIG_ERROR (-1)
362
+ #define SWIG_IsOK(r) (r >= 0)
363
+ #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
364
+
365
+ /* The CastRankLimit says how many bits are used for the cast rank */
366
+ #define SWIG_CASTRANKLIMIT (1 << 8)
367
+ /* The NewMask denotes the object was created (using new/malloc) */
368
+ #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1)
369
+ /* The TmpMask is for in/out typemaps that use temporal objects */
370
+ #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1)
371
+ /* Simple returning values */
372
+ #define SWIG_BADOBJ (SWIG_ERROR)
373
+ #define SWIG_OLDOBJ (SWIG_OK)
374
+ #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK)
375
+ #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK)
376
+ /* Check, add and del mask methods */
377
+ #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
378
+ #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
379
+ #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
380
+ #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
381
+ #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
382
+ #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
383
+
384
+ /* Cast-Rank Mode */
385
+ #if defined(SWIG_CASTRANK_MODE)
386
+ # ifndef SWIG_TypeRank
387
+ # define SWIG_TypeRank unsigned long
388
+ # endif
389
+ # ifndef SWIG_MAXCASTRANK /* Default cast allowed */
390
+ # define SWIG_MAXCASTRANK (2)
391
+ # endif
392
+ # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
393
+ # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
394
+ SWIGINTERNINLINE int SWIG_AddCast(int r) {
395
+ return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
396
+ }
397
+ SWIGINTERNINLINE int SWIG_CheckState(int r) {
398
+ return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
399
+ }
400
+ #else /* no cast-rank mode */
401
+ # define SWIG_AddCast(r) (r)
402
+ # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
403
+ #endif
404
+
405
+
406
+ #include <string.h>
407
+
408
+ #ifdef __cplusplus
409
+ extern "C" {
410
+ #endif
411
+
412
+ typedef void *(*swig_converter_func)(void *, int *);
413
+ typedef struct swig_type_info *(*swig_dycast_func)(void **);
414
+
415
+ /* Structure to store information on one type */
416
+ typedef struct swig_type_info {
417
+ const char *name; /* mangled name of this type */
418
+ const char *str; /* human readable name of this type */
419
+ swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
420
+ struct swig_cast_info *cast; /* linked list of types that can cast into this type */
421
+ void *clientdata; /* language specific type data */
422
+ int owndata; /* flag if the structure owns the clientdata */
423
+ } swig_type_info;
424
+
425
+ /* Structure to store a type and conversion function used for casting */
426
+ typedef struct swig_cast_info {
427
+ swig_type_info *type; /* pointer to type that is equivalent to this type */
428
+ swig_converter_func converter; /* function to cast the void pointers */
429
+ struct swig_cast_info *next; /* pointer to next cast in linked list */
430
+ struct swig_cast_info *prev; /* pointer to the previous cast */
431
+ } swig_cast_info;
432
+
433
+ /* Structure used to store module information
434
+ * Each module generates one structure like this, and the runtime collects
435
+ * all of these structures and stores them in a circularly linked list.*/
436
+ typedef struct swig_module_info {
437
+ swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
438
+ size_t size; /* Number of types in this module */
439
+ struct swig_module_info *next; /* Pointer to next element in circularly linked list */
440
+ swig_type_info **type_initial; /* Array of initially generated type structures */
441
+ swig_cast_info **cast_initial; /* Array of initially generated casting structures */
442
+ void *clientdata; /* Language specific module data */
443
+ } swig_module_info;
444
+
445
+ /*
446
+ Compare two type names skipping the space characters, therefore
447
+ "char*" == "char *" and "Class<int>" == "Class<int >", etc.
448
+
449
+ Return 0 when the two name types are equivalent, as in
450
+ strncmp, but skipping ' '.
451
+ */
452
+ SWIGRUNTIME int
453
+ SWIG_TypeNameComp(const char *f1, const char *l1,
454
+ const char *f2, const char *l2) {
455
+ for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
456
+ while ((*f1 == ' ') && (f1 != l1)) ++f1;
457
+ while ((*f2 == ' ') && (f2 != l2)) ++f2;
458
+ if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
459
+ }
460
+ return (int)((l1 - f1) - (l2 - f2));
461
+ }
462
+
463
+ /*
464
+ Check type equivalence in a name list like <name1>|<name2>|...
465
+ Return 0 if equal, -1 if nb < tb, 1 if nb > tb
466
+ */
467
+ SWIGRUNTIME int
468
+ SWIG_TypeCmp(const char *nb, const char *tb) {
469
+ int equiv = 1;
470
+ const char* te = tb + strlen(tb);
471
+ const char* ne = nb;
472
+ while (equiv != 0 && *ne) {
473
+ for (nb = ne; *ne; ++ne) {
474
+ if (*ne == '|') break;
475
+ }
476
+ equiv = SWIG_TypeNameComp(nb, ne, tb, te);
477
+ if (*ne) ++ne;
478
+ }
479
+ return equiv;
480
+ }
481
+
482
+ /*
483
+ Check type equivalence in a name list like <name1>|<name2>|...
484
+ Return 0 if not equal, 1 if equal
485
+ */
486
+ SWIGRUNTIME int
487
+ SWIG_TypeEquiv(const char *nb, const char *tb) {
488
+ return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
489
+ }
490
+
491
+ /*
492
+ Check the typename
493
+ */
494
+ SWIGRUNTIME swig_cast_info *
495
+ SWIG_TypeCheck(const char *c, swig_type_info *ty) {
496
+ if (ty) {
497
+ swig_cast_info *iter = ty->cast;
498
+ while (iter) {
499
+ if (strcmp(iter->type->name, c) == 0) {
500
+ if (iter == ty->cast)
501
+ return iter;
502
+ /* Move iter to the top of the linked list */
503
+ iter->prev->next = iter->next;
504
+ if (iter->next)
505
+ iter->next->prev = iter->prev;
506
+ iter->next = ty->cast;
507
+ iter->prev = 0;
508
+ if (ty->cast) ty->cast->prev = iter;
509
+ ty->cast = iter;
510
+ return iter;
511
+ }
512
+ iter = iter->next;
513
+ }
514
+ }
515
+ return 0;
516
+ }
517
+
518
+ /*
519
+ Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
520
+ */
521
+ SWIGRUNTIME swig_cast_info *
522
+ SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
523
+ if (ty) {
524
+ swig_cast_info *iter = ty->cast;
525
+ while (iter) {
526
+ if (iter->type == from) {
527
+ if (iter == ty->cast)
528
+ return iter;
529
+ /* Move iter to the top of the linked list */
530
+ iter->prev->next = iter->next;
531
+ if (iter->next)
532
+ iter->next->prev = iter->prev;
533
+ iter->next = ty->cast;
534
+ iter->prev = 0;
535
+ if (ty->cast) ty->cast->prev = iter;
536
+ ty->cast = iter;
537
+ return iter;
538
+ }
539
+ iter = iter->next;
540
+ }
541
+ }
542
+ return 0;
543
+ }
544
+
545
+ /*
546
+ Cast a pointer up an inheritance hierarchy
547
+ */
548
+ SWIGRUNTIMEINLINE void *
549
+ SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
550
+ return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
551
+ }
552
+
553
+ /*
554
+ Dynamic pointer casting. Down an inheritance hierarchy
555
+ */
556
+ SWIGRUNTIME swig_type_info *
557
+ SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
558
+ swig_type_info *lastty = ty;
559
+ if (!ty || !ty->dcast) return ty;
560
+ while (ty && (ty->dcast)) {
561
+ ty = (*ty->dcast)(ptr);
562
+ if (ty) lastty = ty;
563
+ }
564
+ return lastty;
565
+ }
566
+
567
+ /*
568
+ Return the name associated with this type
569
+ */
570
+ SWIGRUNTIMEINLINE const char *
571
+ SWIG_TypeName(const swig_type_info *ty) {
572
+ return ty->name;
573
+ }
574
+
575
+ /*
576
+ Return the pretty name associated with this type,
577
+ that is an unmangled type name in a form presentable to the user.
578
+ */
579
+ SWIGRUNTIME const char *
580
+ SWIG_TypePrettyName(const swig_type_info *type) {
581
+ /* The "str" field contains the equivalent pretty names of the
582
+ type, separated by vertical-bar characters. We choose
583
+ to print the last name, as it is often (?) the most
584
+ specific. */
585
+ if (!type) return NULL;
586
+ if (type->str != NULL) {
587
+ const char *last_name = type->str;
588
+ const char *s;
589
+ for (s = type->str; *s; s++)
590
+ if (*s == '|') last_name = s+1;
591
+ return last_name;
592
+ }
593
+ else
594
+ return type->name;
595
+ }
596
+
597
+ /*
598
+ Set the clientdata field for a type
599
+ */
600
+ SWIGRUNTIME void
601
+ SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
602
+ swig_cast_info *cast = ti->cast;
603
+ /* if (ti->clientdata == clientdata) return; */
604
+ ti->clientdata = clientdata;
605
+
606
+ while (cast) {
607
+ if (!cast->converter) {
608
+ swig_type_info *tc = cast->type;
609
+ if (!tc->clientdata) {
610
+ SWIG_TypeClientData(tc, clientdata);
611
+ }
612
+ }
613
+ cast = cast->next;
614
+ }
615
+ }
616
+ SWIGRUNTIME void
617
+ SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
618
+ SWIG_TypeClientData(ti, clientdata);
619
+ ti->owndata = 1;
620
+ }
621
+
622
+ /*
623
+ Search for a swig_type_info structure only by mangled name
624
+ Search is a O(log #types)
625
+
626
+ We start searching at module start, and finish searching when start == end.
627
+ Note: if start == end at the beginning of the function, we go all the way around
628
+ the circular list.
629
+ */
630
+ SWIGRUNTIME swig_type_info *
631
+ SWIG_MangledTypeQueryModule(swig_module_info *start,
632
+ swig_module_info *end,
633
+ const char *name) {
634
+ swig_module_info *iter = start;
635
+ do {
636
+ if (iter->size) {
637
+ register size_t l = 0;
638
+ register size_t r = iter->size - 1;
639
+ do {
640
+ /* since l+r >= 0, we can (>> 1) instead (/ 2) */
641
+ register size_t i = (l + r) >> 1;
642
+ const char *iname = iter->types[i]->name;
643
+ if (iname) {
644
+ register int compare = strcmp(name, iname);
645
+ if (compare == 0) {
646
+ return iter->types[i];
647
+ } else if (compare < 0) {
648
+ if (i) {
649
+ r = i - 1;
650
+ } else {
651
+ break;
652
+ }
653
+ } else if (compare > 0) {
654
+ l = i + 1;
655
+ }
656
+ } else {
657
+ break; /* should never happen */
658
+ }
659
+ } while (l <= r);
660
+ }
661
+ iter = iter->next;
662
+ } while (iter != end);
663
+ return 0;
664
+ }
665
+
666
+ /*
667
+ Search for a swig_type_info structure for either a mangled name or a human readable name.
668
+ It first searches the mangled names of the types, which is a O(log #types)
669
+ If a type is not found it then searches the human readable names, which is O(#types).
670
+
671
+ We start searching at module start, and finish searching when start == end.
672
+ Note: if start == end at the beginning of the function, we go all the way around
673
+ the circular list.
674
+ */
675
+ SWIGRUNTIME swig_type_info *
676
+ SWIG_TypeQueryModule(swig_module_info *start,
677
+ swig_module_info *end,
678
+ const char *name) {
679
+ /* STEP 1: Search the name field using binary search */
680
+ swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
681
+ if (ret) {
682
+ return ret;
683
+ } else {
684
+ /* STEP 2: If the type hasn't been found, do a complete search
685
+ of the str field (the human readable name) */
686
+ swig_module_info *iter = start;
687
+ do {
688
+ register size_t i = 0;
689
+ for (; i < iter->size; ++i) {
690
+ if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
691
+ return iter->types[i];
692
+ }
693
+ iter = iter->next;
694
+ } while (iter != end);
695
+ }
696
+
697
+ /* neither found a match */
698
+ return 0;
699
+ }
700
+
701
+ /*
702
+ Pack binary data into a string
703
+ */
704
+ SWIGRUNTIME char *
705
+ SWIG_PackData(char *c, void *ptr, size_t sz) {
706
+ static const char hex[17] = "0123456789abcdef";
707
+ register const unsigned char *u = (unsigned char *) ptr;
708
+ register const unsigned char *eu = u + sz;
709
+ for (; u != eu; ++u) {
710
+ register unsigned char uu = *u;
711
+ *(c++) = hex[(uu & 0xf0) >> 4];
712
+ *(c++) = hex[uu & 0xf];
713
+ }
714
+ return c;
715
+ }
716
+
717
+ /*
718
+ Unpack binary data from a string
719
+ */
720
+ SWIGRUNTIME const char *
721
+ SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
722
+ register unsigned char *u = (unsigned char *) ptr;
723
+ register const unsigned char *eu = u + sz;
724
+ for (; u != eu; ++u) {
725
+ register char d = *(c++);
726
+ register unsigned char uu;
727
+ if ((d >= '0') && (d <= '9'))
728
+ uu = ((d - '0') << 4);
729
+ else if ((d >= 'a') && (d <= 'f'))
730
+ uu = ((d - ('a'-10)) << 4);
731
+ else
732
+ return (char *) 0;
733
+ d = *(c++);
734
+ if ((d >= '0') && (d <= '9'))
735
+ uu |= (d - '0');
736
+ else if ((d >= 'a') && (d <= 'f'))
737
+ uu |= (d - ('a'-10));
738
+ else
739
+ return (char *) 0;
740
+ *u = uu;
741
+ }
742
+ return c;
743
+ }
744
+
745
+ /*
746
+ Pack 'void *' into a string buffer.
747
+ */
748
+ SWIGRUNTIME char *
749
+ SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
750
+ char *r = buff;
751
+ if ((2*sizeof(void *) + 2) > bsz) return 0;
752
+ *(r++) = '_';
753
+ r = SWIG_PackData(r,&ptr,sizeof(void *));
754
+ if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
755
+ strcpy(r,name);
756
+ return buff;
757
+ }
758
+
759
+ SWIGRUNTIME const char *
760
+ SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
761
+ if (*c != '_') {
762
+ if (strcmp(c,"NULL") == 0) {
763
+ *ptr = (void *) 0;
764
+ return name;
765
+ } else {
766
+ return 0;
767
+ }
768
+ }
769
+ return SWIG_UnpackData(++c,ptr,sizeof(void *));
770
+ }
771
+
772
+ SWIGRUNTIME char *
773
+ SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
774
+ char *r = buff;
775
+ size_t lname = (name ? strlen(name) : 0);
776
+ if ((2*sz + 2 + lname) > bsz) return 0;
777
+ *(r++) = '_';
778
+ r = SWIG_PackData(r,ptr,sz);
779
+ if (lname) {
780
+ strncpy(r,name,lname+1);
781
+ } else {
782
+ *r = 0;
783
+ }
784
+ return buff;
785
+ }
786
+
787
+ SWIGRUNTIME const char *
788
+ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
789
+ if (*c != '_') {
790
+ if (strcmp(c,"NULL") == 0) {
791
+ memset(ptr,0,sz);
792
+ return name;
793
+ } else {
794
+ return 0;
795
+ }
796
+ }
797
+ return SWIG_UnpackData(++c,ptr,sz);
798
+ }
799
+
800
+ #ifdef __cplusplus
801
+ }
802
+ #endif
803
+
804
+ /* Errors in SWIG */
805
+ #define SWIG_UnknownError -1
806
+ #define SWIG_IOError -2
807
+ #define SWIG_RuntimeError -3
808
+ #define SWIG_IndexError -4
809
+ #define SWIG_TypeError -5
810
+ #define SWIG_DivisionByZero -6
811
+ #define SWIG_OverflowError -7
812
+ #define SWIG_SyntaxError -8
813
+ #define SWIG_ValueError -9
814
+ #define SWIG_SystemError -10
815
+ #define SWIG_AttributeError -11
816
+ #define SWIG_MemoryError -12
817
+ #define SWIG_NullReferenceError -13
818
+
819
+
820
+
821
+ #include <ruby.h>
822
+
823
+ /* Ruby 1.9.1 has a "memoisation optimisation" when compiling with GCC which
824
+ * breaks using rb_intern as an lvalue, as SWIG does. We work around this
825
+ * issue for now by disabling this.
826
+ * https://sourceforge.net/tracker/?func=detail&aid=2859614&group_id=1645&atid=101645
827
+ */
828
+ #ifdef rb_intern
829
+ # undef rb_intern
830
+ #endif
831
+
832
+ /* Remove global macros defined in Ruby's win32.h */
833
+ #ifdef write
834
+ # undef write
835
+ #endif
836
+ #ifdef read
837
+ # undef read
838
+ #endif
839
+ #ifdef bind
840
+ # undef bind
841
+ #endif
842
+ #ifdef close
843
+ # undef close
844
+ #endif
845
+ #ifdef connect
846
+ # undef connect
847
+ #endif
848
+
849
+
850
+ /* Ruby 1.7 defines NUM2LL(), LL2NUM() and ULL2NUM() macros */
851
+ #ifndef NUM2LL
852
+ #define NUM2LL(x) NUM2LONG((x))
853
+ #endif
854
+ #ifndef LL2NUM
855
+ #define LL2NUM(x) INT2NUM((long) (x))
856
+ #endif
857
+ #ifndef ULL2NUM
858
+ #define ULL2NUM(x) UINT2NUM((unsigned long) (x))
859
+ #endif
860
+
861
+ /* Ruby 1.7 doesn't (yet) define NUM2ULL() */
862
+ #ifndef NUM2ULL
863
+ #ifdef HAVE_LONG_LONG
864
+ #define NUM2ULL(x) rb_num2ull((x))
865
+ #else
866
+ #define NUM2ULL(x) NUM2ULONG(x)
867
+ #endif
868
+ #endif
869
+
870
+ /* RSTRING_LEN, etc are new in Ruby 1.9, but ->ptr and ->len no longer work */
871
+ /* Define these for older versions so we can just write code the new way */
872
+ #ifndef RSTRING_LEN
873
+ # define RSTRING_LEN(x) RSTRING(x)->len
874
+ #endif
875
+ #ifndef RSTRING_PTR
876
+ # define RSTRING_PTR(x) RSTRING(x)->ptr
877
+ #endif
878
+ #ifndef RSTRING_END
879
+ # define RSTRING_END(x) (RSTRING_PTR(x) + RSTRING_LEN(x))
880
+ #endif
881
+ #ifndef RARRAY_LEN
882
+ # define RARRAY_LEN(x) RARRAY(x)->len
883
+ #endif
884
+ #ifndef RARRAY_PTR
885
+ # define RARRAY_PTR(x) RARRAY(x)->ptr
886
+ #endif
887
+ #ifndef RFLOAT_VALUE
888
+ # define RFLOAT_VALUE(x) RFLOAT(x)->value
889
+ #endif
890
+ #ifndef DOUBLE2NUM
891
+ # define DOUBLE2NUM(x) rb_float_new(x)
892
+ #endif
893
+ #ifndef RHASH_TBL
894
+ # define RHASH_TBL(x) (RHASH(x)->tbl)
895
+ #endif
896
+ #ifndef RHASH_ITER_LEV
897
+ # define RHASH_ITER_LEV(x) (RHASH(x)->iter_lev)
898
+ #endif
899
+ #ifndef RHASH_IFNONE
900
+ # define RHASH_IFNONE(x) (RHASH(x)->ifnone)
901
+ #endif
902
+ #ifndef RHASH_SIZE
903
+ # define RHASH_SIZE(x) (RHASH(x)->tbl->num_entries)
904
+ #endif
905
+ #ifndef RHASH_EMPTY_P
906
+ # define RHASH_EMPTY_P(x) (RHASH_SIZE(x) == 0)
907
+ #endif
908
+ #ifndef RSTRUCT_LEN
909
+ # define RSTRUCT_LEN(x) RSTRUCT(x)->len
910
+ #endif
911
+ #ifndef RSTRUCT_PTR
912
+ # define RSTRUCT_PTR(x) RSTRUCT(x)->ptr
913
+ #endif
914
+
915
+
916
+
917
+ /*
918
+ * Need to be very careful about how these macros are defined, especially
919
+ * when compiling C++ code or C code with an ANSI C compiler.
920
+ *
921
+ * VALUEFUNC(f) is a macro used to typecast a C function that implements
922
+ * a Ruby method so that it can be passed as an argument to API functions
923
+ * like rb_define_method() and rb_define_singleton_method().
924
+ *
925
+ * VOIDFUNC(f) is a macro used to typecast a C function that implements
926
+ * either the "mark" or "free" stuff for a Ruby Data object, so that it
927
+ * can be passed as an argument to API functions like Data_Wrap_Struct()
928
+ * and Data_Make_Struct().
929
+ */
930
+
931
+ #ifdef __cplusplus
932
+ # ifndef RUBY_METHOD_FUNC /* These definitions should work for Ruby 1.4.6 */
933
+ # define PROTECTFUNC(f) ((VALUE (*)()) f)
934
+ # define VALUEFUNC(f) ((VALUE (*)()) f)
935
+ # define VOIDFUNC(f) ((void (*)()) f)
936
+ # else
937
+ # ifndef ANYARGS /* These definitions should work for Ruby 1.6 */
938
+ # define PROTECTFUNC(f) ((VALUE (*)()) f)
939
+ # define VALUEFUNC(f) ((VALUE (*)()) f)
940
+ # define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
941
+ # else /* These definitions should work for Ruby 1.7+ */
942
+ # define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f)
943
+ # define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f)
944
+ # define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
945
+ # endif
946
+ # endif
947
+ #else
948
+ # define VALUEFUNC(f) (f)
949
+ # define VOIDFUNC(f) (f)
950
+ #endif
951
+
952
+ /* Don't use for expressions have side effect */
953
+ #ifndef RB_STRING_VALUE
954
+ #define RB_STRING_VALUE(s) (TYPE(s) == T_STRING ? (s) : (*(volatile VALUE *)&(s) = rb_str_to_str(s)))
955
+ #endif
956
+ #ifndef StringValue
957
+ #define StringValue(s) RB_STRING_VALUE(s)
958
+ #endif
959
+ #ifndef StringValuePtr
960
+ #define StringValuePtr(s) RSTRING_PTR(RB_STRING_VALUE(s))
961
+ #endif
962
+ #ifndef StringValueLen
963
+ #define StringValueLen(s) RSTRING_LEN(RB_STRING_VALUE(s))
964
+ #endif
965
+ #ifndef SafeStringValue
966
+ #define SafeStringValue(v) do {\
967
+ StringValue(v);\
968
+ rb_check_safe_str(v);\
969
+ } while (0)
970
+ #endif
971
+
972
+ #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
973
+ #define rb_define_alloc_func(klass, func) rb_define_singleton_method((klass), "new", VALUEFUNC((func)), -1)
974
+ #define rb_undef_alloc_func(klass) rb_undef_method(CLASS_OF((klass)), "new")
975
+ #endif
976
+
977
+ static VALUE _mSWIG = Qnil;
978
+
979
+ /* -----------------------------------------------------------------------------
980
+ * error manipulation
981
+ * ----------------------------------------------------------------------------- */
982
+
983
+
984
+ /* Define some additional error types */
985
+ #define SWIG_ObjectPreviouslyDeletedError -100
986
+
987
+
988
+ /* Define custom exceptions for errors that do not map to existing Ruby
989
+ exceptions. Note this only works for C++ since a global cannot be
990
+ initialized by a function in C. For C, fallback to rb_eRuntimeError.*/
991
+
992
+ SWIGINTERN VALUE
993
+ getNullReferenceError(void) {
994
+ static int init = 0;
995
+ static VALUE rb_eNullReferenceError ;
996
+ if (!init) {
997
+ init = 1;
998
+ rb_eNullReferenceError = rb_define_class("NullReferenceError", rb_eRuntimeError);
999
+ }
1000
+ return rb_eNullReferenceError;
1001
+ }
1002
+
1003
+ SWIGINTERN VALUE
1004
+ getObjectPreviouslyDeletedError(void) {
1005
+ static int init = 0;
1006
+ static VALUE rb_eObjectPreviouslyDeleted ;
1007
+ if (!init) {
1008
+ init = 1;
1009
+ rb_eObjectPreviouslyDeleted = rb_define_class("ObjectPreviouslyDeleted", rb_eRuntimeError);
1010
+ }
1011
+ return rb_eObjectPreviouslyDeleted;
1012
+ }
1013
+
1014
+
1015
+ SWIGINTERN VALUE
1016
+ SWIG_Ruby_ErrorType(int SWIG_code) {
1017
+ VALUE type;
1018
+ switch (SWIG_code) {
1019
+ case SWIG_MemoryError:
1020
+ type = rb_eNoMemError;
1021
+ break;
1022
+ case SWIG_IOError:
1023
+ type = rb_eIOError;
1024
+ break;
1025
+ case SWIG_RuntimeError:
1026
+ type = rb_eRuntimeError;
1027
+ break;
1028
+ case SWIG_IndexError:
1029
+ type = rb_eIndexError;
1030
+ break;
1031
+ case SWIG_TypeError:
1032
+ type = rb_eTypeError;
1033
+ break;
1034
+ case SWIG_DivisionByZero:
1035
+ type = rb_eZeroDivError;
1036
+ break;
1037
+ case SWIG_OverflowError:
1038
+ type = rb_eRangeError;
1039
+ break;
1040
+ case SWIG_SyntaxError:
1041
+ type = rb_eSyntaxError;
1042
+ break;
1043
+ case SWIG_ValueError:
1044
+ type = rb_eArgError;
1045
+ break;
1046
+ case SWIG_SystemError:
1047
+ type = rb_eFatal;
1048
+ break;
1049
+ case SWIG_AttributeError:
1050
+ type = rb_eRuntimeError;
1051
+ break;
1052
+ case SWIG_NullReferenceError:
1053
+ type = getNullReferenceError();
1054
+ break;
1055
+ case SWIG_ObjectPreviouslyDeletedError:
1056
+ type = getObjectPreviouslyDeletedError();
1057
+ break;
1058
+ case SWIG_UnknownError:
1059
+ type = rb_eRuntimeError;
1060
+ break;
1061
+ default:
1062
+ type = rb_eRuntimeError;
1063
+ }
1064
+ return type;
1065
+ }
1066
+
1067
+
1068
+ /* This function is called when a user inputs a wrong argument to
1069
+ a method.
1070
+ */
1071
+ SWIGINTERN
1072
+ const char* Ruby_Format_TypeError( const char* msg,
1073
+ const char* type,
1074
+ const char* name,
1075
+ const int argn,
1076
+ VALUE input )
1077
+ {
1078
+ char buf[128];
1079
+ VALUE str;
1080
+ VALUE asStr;
1081
+ if ( msg && *msg )
1082
+ {
1083
+ str = rb_str_new2(msg);
1084
+ }
1085
+ else
1086
+ {
1087
+ str = rb_str_new(NULL, 0);
1088
+ }
1089
+
1090
+ str = rb_str_cat2( str, "Expected argument " );
1091
+ sprintf( buf, "%d of type ", argn-1 );
1092
+ str = rb_str_cat2( str, buf );
1093
+ str = rb_str_cat2( str, type );
1094
+ str = rb_str_cat2( str, ", but got " );
1095
+ str = rb_str_cat2( str, rb_obj_classname(input) );
1096
+ str = rb_str_cat2( str, " " );
1097
+ asStr = rb_inspect(input);
1098
+ if ( RSTRING_LEN(asStr) > 30 )
1099
+ {
1100
+ str = rb_str_cat( str, StringValuePtr(asStr), 30 );
1101
+ str = rb_str_cat2( str, "..." );
1102
+ }
1103
+ else
1104
+ {
1105
+ str = rb_str_append( str, asStr );
1106
+ }
1107
+
1108
+ if ( name )
1109
+ {
1110
+ str = rb_str_cat2( str, "\n\tin SWIG method '" );
1111
+ str = rb_str_cat2( str, name );
1112
+ str = rb_str_cat2( str, "'" );
1113
+ }
1114
+
1115
+ return StringValuePtr( str );
1116
+ }
1117
+
1118
+ /* This function is called when an overloaded method fails */
1119
+ SWIGINTERN
1120
+ void Ruby_Format_OverloadedError(
1121
+ const int argc,
1122
+ const int maxargs,
1123
+ const char* method,
1124
+ const char* prototypes
1125
+ )
1126
+ {
1127
+ const char* msg = "Wrong # of arguments";
1128
+ if ( argc <= maxargs ) msg = "Wrong arguments";
1129
+ rb_raise(rb_eArgError,"%s for overloaded method '%s'.\n"
1130
+ "Possible C/C++ prototypes are:\n%s",
1131
+ msg, method, prototypes);
1132
+ }
1133
+
1134
+ /* -----------------------------------------------------------------------------
1135
+ * rubytracking.swg
1136
+ *
1137
+ * This file contains support for tracking mappings from
1138
+ * Ruby objects to C++ objects. This functionality is needed
1139
+ * to implement mark functions for Ruby's mark and sweep
1140
+ * garbage collector.
1141
+ * ----------------------------------------------------------------------------- */
1142
+
1143
+ #ifdef __cplusplus
1144
+ extern "C" {
1145
+ #endif
1146
+
1147
+ /* Ruby 1.8 actually assumes the first case. */
1148
+ #if SIZEOF_VOIDP == SIZEOF_LONG
1149
+ # define SWIG2NUM(v) LONG2NUM((unsigned long)v)
1150
+ # define NUM2SWIG(x) (unsigned long)NUM2LONG(x)
1151
+ #elif SIZEOF_VOIDP == SIZEOF_LONG_LONG
1152
+ # define SWIG2NUM(v) LL2NUM((unsigned long long)v)
1153
+ # define NUM2SWIG(x) (unsigned long long)NUM2LL(x)
1154
+ #else
1155
+ # error sizeof(void*) is not the same as long or long long
1156
+ #endif
1157
+
1158
+
1159
+ /* Global Ruby hash table to store Trackings from C/C++
1160
+ structs to Ruby Objects.
1161
+ */
1162
+ static VALUE swig_ruby_trackings = Qnil;
1163
+
1164
+ /* Global variable that stores a reference to the ruby
1165
+ hash table delete function. */
1166
+ static ID swig_ruby_hash_delete;
1167
+
1168
+ /* Setup a Ruby hash table to store Trackings */
1169
+ SWIGRUNTIME void SWIG_RubyInitializeTrackings(void) {
1170
+ /* Create a ruby hash table to store Trackings from C++
1171
+ objects to Ruby objects. */
1172
+
1173
+ /* Try to see if some other .so has already created a
1174
+ tracking hash table, which we keep hidden in an instance var
1175
+ in the SWIG module.
1176
+ This is done to allow multiple DSOs to share the same
1177
+ tracking table.
1178
+ */
1179
+ ID trackings_id = rb_intern( "@__trackings__" );
1180
+ VALUE verbose = rb_gv_get("VERBOSE");
1181
+ rb_gv_set("VERBOSE", Qfalse);
1182
+ swig_ruby_trackings = rb_ivar_get( _mSWIG, trackings_id );
1183
+ rb_gv_set("VERBOSE", verbose);
1184
+
1185
+ /* No, it hasn't. Create one ourselves */
1186
+ if ( swig_ruby_trackings == Qnil )
1187
+ {
1188
+ swig_ruby_trackings = rb_hash_new();
1189
+ rb_ivar_set( _mSWIG, trackings_id, swig_ruby_trackings );
1190
+ }
1191
+
1192
+ /* Now store a reference to the hash table delete function
1193
+ so that we only have to look it up once.*/
1194
+ swig_ruby_hash_delete = rb_intern("delete");
1195
+ }
1196
+
1197
+ /* Get a Ruby number to reference a pointer */
1198
+ SWIGRUNTIME VALUE SWIG_RubyPtrToReference(void* ptr) {
1199
+ /* We cast the pointer to an unsigned long
1200
+ and then store a reference to it using
1201
+ a Ruby number object. */
1202
+
1203
+ /* Convert the pointer to a Ruby number */
1204
+ return SWIG2NUM(ptr);
1205
+ }
1206
+
1207
+ /* Get a Ruby number to reference an object */
1208
+ SWIGRUNTIME VALUE SWIG_RubyObjectToReference(VALUE object) {
1209
+ /* We cast the object to an unsigned long
1210
+ and then store a reference to it using
1211
+ a Ruby number object. */
1212
+
1213
+ /* Convert the Object to a Ruby number */
1214
+ return SWIG2NUM(object);
1215
+ }
1216
+
1217
+ /* Get a Ruby object from a previously stored reference */
1218
+ SWIGRUNTIME VALUE SWIG_RubyReferenceToObject(VALUE reference) {
1219
+ /* The provided Ruby number object is a reference
1220
+ to the Ruby object we want.*/
1221
+
1222
+ /* Convert the Ruby number to a Ruby object */
1223
+ return NUM2SWIG(reference);
1224
+ }
1225
+
1226
+ /* Add a Tracking from a C/C++ struct to a Ruby object */
1227
+ SWIGRUNTIME void SWIG_RubyAddTracking(void* ptr, VALUE object) {
1228
+ /* In a Ruby hash table we store the pointer and
1229
+ the associated Ruby object. The trick here is
1230
+ that we cannot store the Ruby object directly - if
1231
+ we do then it cannot be garbage collected. So
1232
+ instead we typecast it as a unsigned long and
1233
+ convert it to a Ruby number object.*/
1234
+
1235
+ /* Get a reference to the pointer as a Ruby number */
1236
+ VALUE key = SWIG_RubyPtrToReference(ptr);
1237
+
1238
+ /* Get a reference to the Ruby object as a Ruby number */
1239
+ VALUE value = SWIG_RubyObjectToReference(object);
1240
+
1241
+ /* Store the mapping to the global hash table. */
1242
+ rb_hash_aset(swig_ruby_trackings, key, value);
1243
+ }
1244
+
1245
+ /* Get the Ruby object that owns the specified C/C++ struct */
1246
+ SWIGRUNTIME VALUE SWIG_RubyInstanceFor(void* ptr) {
1247
+ /* Get a reference to the pointer as a Ruby number */
1248
+ VALUE key = SWIG_RubyPtrToReference(ptr);
1249
+
1250
+ /* Now lookup the value stored in the global hash table */
1251
+ VALUE value = rb_hash_aref(swig_ruby_trackings, key);
1252
+
1253
+ if (value == Qnil) {
1254
+ /* No object exists - return nil. */
1255
+ return Qnil;
1256
+ }
1257
+ else {
1258
+ /* Convert this value to Ruby object */
1259
+ return SWIG_RubyReferenceToObject(value);
1260
+ }
1261
+ }
1262
+
1263
+ /* Remove a Tracking from a C/C++ struct to a Ruby object. It
1264
+ is very important to remove objects once they are destroyed
1265
+ since the same memory address may be reused later to create
1266
+ a new object. */
1267
+ SWIGRUNTIME void SWIG_RubyRemoveTracking(void* ptr) {
1268
+ /* Get a reference to the pointer as a Ruby number */
1269
+ VALUE key = SWIG_RubyPtrToReference(ptr);
1270
+
1271
+ /* Delete the object from the hash table by calling Ruby's
1272
+ do this we need to call the Hash.delete method.*/
1273
+ rb_funcall(swig_ruby_trackings, swig_ruby_hash_delete, 1, key);
1274
+ }
1275
+
1276
+ /* This is a helper method that unlinks a Ruby object from its
1277
+ underlying C++ object. This is needed if the lifetime of the
1278
+ Ruby object is longer than the C++ object */
1279
+ SWIGRUNTIME void SWIG_RubyUnlinkObjects(void* ptr) {
1280
+ VALUE object = SWIG_RubyInstanceFor(ptr);
1281
+
1282
+ if (object != Qnil) {
1283
+ DATA_PTR(object) = 0;
1284
+ }
1285
+ }
1286
+
1287
+
1288
+ #ifdef __cplusplus
1289
+ }
1290
+ #endif
1291
+
1292
+ /* -----------------------------------------------------------------------------
1293
+ * Ruby API portion that goes into the runtime
1294
+ * ----------------------------------------------------------------------------- */
1295
+
1296
+ #ifdef __cplusplus
1297
+ extern "C" {
1298
+ #endif
1299
+
1300
+ SWIGINTERN VALUE
1301
+ SWIG_Ruby_AppendOutput(VALUE target, VALUE o) {
1302
+ if (NIL_P(target)) {
1303
+ target = o;
1304
+ } else {
1305
+ if (TYPE(target) != T_ARRAY) {
1306
+ VALUE o2 = target;
1307
+ target = rb_ary_new();
1308
+ rb_ary_push(target, o2);
1309
+ }
1310
+ rb_ary_push(target, o);
1311
+ }
1312
+ return target;
1313
+ }
1314
+
1315
+ /* For ruby1.8.4 and earlier. */
1316
+ #ifndef RUBY_INIT_STACK
1317
+ RUBY_EXTERN void Init_stack(VALUE* addr);
1318
+ # define RUBY_INIT_STACK \
1319
+ VALUE variable_in_this_stack_frame; \
1320
+ Init_stack(&variable_in_this_stack_frame);
1321
+ #endif
1322
+
1323
+
1324
+ #ifdef __cplusplus
1325
+ }
1326
+ #endif
1327
+
1328
+
1329
+ /* -----------------------------------------------------------------------------
1330
+ * rubyrun.swg
1331
+ *
1332
+ * This file contains the runtime support for Ruby modules
1333
+ * and includes code for managing global variables and pointer
1334
+ * type checking.
1335
+ * ----------------------------------------------------------------------------- */
1336
+
1337
+ /* For backward compatibility only */
1338
+ #define SWIG_POINTER_EXCEPTION 0
1339
+
1340
+ /* for raw pointers */
1341
+ #define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
1342
+ #define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, own)
1343
+ #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Ruby_NewPointerObj(ptr, type, flags)
1344
+ #define SWIG_AcquirePtr(ptr, own) SWIG_Ruby_AcquirePtr(ptr, own)
1345
+ #define swig_owntype ruby_owntype
1346
+
1347
+ /* for raw packed data */
1348
+ #define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty, flags)
1349
+ #define SWIG_NewPackedObj(ptr, sz, type) SWIG_Ruby_NewPackedObj(ptr, sz, type)
1350
+
1351
+ /* for class or struct pointers */
1352
+ #define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags)
1353
+ #define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags)
1354
+
1355
+ /* for C or C++ function pointers */
1356
+ #define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_ConvertPtr(obj, pptr, type, 0)
1357
+ #define SWIG_NewFunctionPtrObj(ptr, type) SWIG_NewPointerObj(ptr, type, 0)
1358
+
1359
+ /* for C++ member pointers, ie, member methods */
1360
+ #define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty)
1361
+ #define SWIG_NewMemberObj(ptr, sz, type) SWIG_Ruby_NewPackedObj(ptr, sz, type)
1362
+
1363
+
1364
+ /* Runtime API */
1365
+
1366
+ #define SWIG_GetModule(clientdata) SWIG_Ruby_GetModule(clientdata)
1367
+ #define SWIG_SetModule(clientdata, pointer) SWIG_Ruby_SetModule(pointer)
1368
+
1369
+
1370
+ /* Error manipulation */
1371
+
1372
+ #define SWIG_ErrorType(code) SWIG_Ruby_ErrorType(code)
1373
+ #define SWIG_Error(code, msg) rb_raise(SWIG_Ruby_ErrorType(code), "%s", msg)
1374
+ #define SWIG_fail goto fail
1375
+
1376
+
1377
+ /* Ruby-specific SWIG API */
1378
+
1379
+ #define SWIG_InitRuntime() SWIG_Ruby_InitRuntime()
1380
+ #define SWIG_define_class(ty) SWIG_Ruby_define_class(ty)
1381
+ #define SWIG_NewClassInstance(value, ty) SWIG_Ruby_NewClassInstance(value, ty)
1382
+ #define SWIG_MangleStr(value) SWIG_Ruby_MangleStr(value)
1383
+ #define SWIG_CheckConvert(value, ty) SWIG_Ruby_CheckConvert(value, ty)
1384
+
1385
+ #include "assert.h"
1386
+
1387
+ /* -----------------------------------------------------------------------------
1388
+ * pointers/data manipulation
1389
+ * ----------------------------------------------------------------------------- */
1390
+
1391
+ #ifdef __cplusplus
1392
+ extern "C" {
1393
+ #endif
1394
+
1395
+ typedef struct {
1396
+ VALUE klass;
1397
+ VALUE mImpl;
1398
+ void (*mark)(void *);
1399
+ void (*destroy)(void *);
1400
+ int trackObjects;
1401
+ } swig_class;
1402
+
1403
+
1404
+ /* Global pointer used to keep some internal SWIG stuff */
1405
+ static VALUE _cSWIG_Pointer = Qnil;
1406
+ static VALUE swig_runtime_data_type_pointer = Qnil;
1407
+
1408
+ /* Global IDs used to keep some internal SWIG stuff */
1409
+ static ID swig_arity_id = 0;
1410
+ static ID swig_call_id = 0;
1411
+
1412
+ /*
1413
+ If your swig extension is to be run within an embedded ruby and has
1414
+ director callbacks, you should set -DRUBY_EMBEDDED during compilation.
1415
+ This will reset ruby's stack frame on each entry point from the main
1416
+ program the first time a virtual director function is invoked (in a
1417
+ non-recursive way).
1418
+ If this is not done, you run the risk of Ruby trashing the stack.
1419
+ */
1420
+
1421
+ #ifdef RUBY_EMBEDDED
1422
+
1423
+ # define SWIG_INIT_STACK \
1424
+ if ( !swig_virtual_calls ) { RUBY_INIT_STACK } \
1425
+ ++swig_virtual_calls;
1426
+ # define SWIG_RELEASE_STACK --swig_virtual_calls;
1427
+ # define Ruby_DirectorTypeMismatchException(x) \
1428
+ rb_raise( rb_eTypeError, "%s", x ); return c_result;
1429
+
1430
+ static unsigned int swig_virtual_calls = 0;
1431
+
1432
+ #else /* normal non-embedded extension */
1433
+
1434
+ # define SWIG_INIT_STACK
1435
+ # define SWIG_RELEASE_STACK
1436
+ # define Ruby_DirectorTypeMismatchException(x) \
1437
+ throw Swig::DirectorTypeMismatchException( x );
1438
+
1439
+ #endif /* RUBY_EMBEDDED */
1440
+
1441
+
1442
+ SWIGRUNTIME VALUE
1443
+ getExceptionClass(void) {
1444
+ static int init = 0;
1445
+ static VALUE rubyExceptionClass ;
1446
+ if (!init) {
1447
+ init = 1;
1448
+ rubyExceptionClass = rb_const_get(_mSWIG, rb_intern("Exception"));
1449
+ }
1450
+ return rubyExceptionClass;
1451
+ }
1452
+
1453
+ /* This code checks to see if the Ruby object being raised as part
1454
+ of an exception inherits from the Ruby class Exception. If so,
1455
+ the object is simply returned. If not, then a new Ruby exception
1456
+ object is created and that will be returned to Ruby.*/
1457
+ SWIGRUNTIME VALUE
1458
+ SWIG_Ruby_ExceptionType(swig_type_info *desc, VALUE obj) {
1459
+ VALUE exceptionClass = getExceptionClass();
1460
+ if (rb_obj_is_kind_of(obj, exceptionClass)) {
1461
+ return obj;
1462
+ } else {
1463
+ return rb_exc_new3(rb_eRuntimeError, rb_obj_as_string(obj));
1464
+ }
1465
+ }
1466
+
1467
+ /* Initialize Ruby runtime support */
1468
+ SWIGRUNTIME void
1469
+ SWIG_Ruby_InitRuntime(void)
1470
+ {
1471
+ if (_mSWIG == Qnil) {
1472
+ _mSWIG = rb_define_module("SWIG");
1473
+ swig_call_id = rb_intern("call");
1474
+ swig_arity_id = rb_intern("arity");
1475
+ }
1476
+ }
1477
+
1478
+ /* Define Ruby class for C type */
1479
+ SWIGRUNTIME void
1480
+ SWIG_Ruby_define_class(swig_type_info *type)
1481
+ {
1482
+ VALUE klass;
1483
+ char *klass_name = (char *) malloc(4 + strlen(type->name) + 1);
1484
+ sprintf(klass_name, "TYPE%s", type->name);
1485
+ if (NIL_P(_cSWIG_Pointer)) {
1486
+ _cSWIG_Pointer = rb_define_class_under(_mSWIG, "Pointer", rb_cObject);
1487
+ rb_undef_method(CLASS_OF(_cSWIG_Pointer), "new");
1488
+ }
1489
+ klass = rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer);
1490
+ free((void *) klass_name);
1491
+ }
1492
+
1493
+ /* Create a new pointer object */
1494
+ SWIGRUNTIME VALUE
1495
+ SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags)
1496
+ {
1497
+ int own = flags & SWIG_POINTER_OWN;
1498
+ int track;
1499
+ char *klass_name;
1500
+ swig_class *sklass;
1501
+ VALUE klass;
1502
+ VALUE obj;
1503
+
1504
+ if (!ptr)
1505
+ return Qnil;
1506
+
1507
+ if (type->clientdata) {
1508
+ sklass = (swig_class *) type->clientdata;
1509
+
1510
+ /* Are we tracking this class and have we already returned this Ruby object? */
1511
+ track = sklass->trackObjects;
1512
+ if (track) {
1513
+ obj = SWIG_RubyInstanceFor(ptr);
1514
+
1515
+ /* Check the object's type and make sure it has the correct type.
1516
+ It might not in cases where methods do things like
1517
+ downcast methods. */
1518
+ if (obj != Qnil) {
1519
+ VALUE value = rb_iv_get(obj, "@__swigtype__");
1520
+ const char* type_name = RSTRING_PTR(value);
1521
+
1522
+ if (strcmp(type->name, type_name) == 0) {
1523
+ return obj;
1524
+ }
1525
+ }
1526
+ }
1527
+
1528
+ /* Create a new Ruby object */
1529
+ obj = Data_Wrap_Struct(sklass->klass, VOIDFUNC(sklass->mark),
1530
+ ( own ? VOIDFUNC(sklass->destroy) :
1531
+ (track ? VOIDFUNC(SWIG_RubyRemoveTracking) : 0 )
1532
+ ), ptr);
1533
+
1534
+ /* If tracking is on for this class then track this object. */
1535
+ if (track) {
1536
+ SWIG_RubyAddTracking(ptr, obj);
1537
+ }
1538
+ } else {
1539
+ klass_name = (char *) malloc(4 + strlen(type->name) + 1);
1540
+ sprintf(klass_name, "TYPE%s", type->name);
1541
+ klass = rb_const_get(_mSWIG, rb_intern(klass_name));
1542
+ free((void *) klass_name);
1543
+ obj = Data_Wrap_Struct(klass, 0, 0, ptr);
1544
+ }
1545
+ rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name));
1546
+
1547
+ return obj;
1548
+ }
1549
+
1550
+ /* Create a new class instance (always owned) */
1551
+ SWIGRUNTIME VALUE
1552
+ SWIG_Ruby_NewClassInstance(VALUE klass, swig_type_info *type)
1553
+ {
1554
+ VALUE obj;
1555
+ swig_class *sklass = (swig_class *) type->clientdata;
1556
+ obj = Data_Wrap_Struct(klass, VOIDFUNC(sklass->mark), VOIDFUNC(sklass->destroy), 0);
1557
+ rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name));
1558
+ return obj;
1559
+ }
1560
+
1561
+ /* Get type mangle from class name */
1562
+ SWIGRUNTIMEINLINE char *
1563
+ SWIG_Ruby_MangleStr(VALUE obj)
1564
+ {
1565
+ VALUE stype = rb_iv_get(obj, "@__swigtype__");
1566
+ return StringValuePtr(stype);
1567
+ }
1568
+
1569
+ /* Acquire a pointer value */
1570
+ typedef void (*ruby_owntype)(void*);
1571
+
1572
+ SWIGRUNTIME ruby_owntype
1573
+ SWIG_Ruby_AcquirePtr(VALUE obj, ruby_owntype own) {
1574
+ if (obj) {
1575
+ ruby_owntype oldown = RDATA(obj)->dfree;
1576
+ RDATA(obj)->dfree = own;
1577
+ return oldown;
1578
+ } else {
1579
+ return 0;
1580
+ }
1581
+ }
1582
+
1583
+ /* Convert a pointer value */
1584
+ SWIGRUNTIME int
1585
+ SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags, ruby_owntype *own)
1586
+ {
1587
+ char *c;
1588
+ swig_cast_info *tc;
1589
+ void *vptr = 0;
1590
+
1591
+ /* Grab the pointer */
1592
+ if (NIL_P(obj)) {
1593
+ *ptr = 0;
1594
+ return SWIG_OK;
1595
+ } else {
1596
+ if (TYPE(obj) != T_DATA) {
1597
+ return SWIG_ERROR;
1598
+ }
1599
+ Data_Get_Struct(obj, void, vptr);
1600
+ }
1601
+
1602
+ if (own) *own = RDATA(obj)->dfree;
1603
+
1604
+ /* Check to see if the input object is giving up ownership
1605
+ of the underlying C struct or C++ object. If so then we
1606
+ need to reset the destructor since the Ruby object no
1607
+ longer owns the underlying C++ object.*/
1608
+ if (flags & SWIG_POINTER_DISOWN) {
1609
+ /* Is tracking on for this class? */
1610
+ int track = 0;
1611
+ if (ty && ty->clientdata) {
1612
+ swig_class *sklass = (swig_class *) ty->clientdata;
1613
+ track = sklass->trackObjects;
1614
+ }
1615
+
1616
+ if (track) {
1617
+ /* We are tracking objects for this class. Thus we change the destructor
1618
+ * to SWIG_RubyRemoveTracking. This allows us to
1619
+ * remove the mapping from the C++ to Ruby object
1620
+ * when the Ruby object is garbage collected. If we don't
1621
+ * do this, then it is possible we will return a reference
1622
+ * to a Ruby object that no longer exists thereby crashing Ruby. */
1623
+ RDATA(obj)->dfree = SWIG_RubyRemoveTracking;
1624
+ } else {
1625
+ RDATA(obj)->dfree = 0;
1626
+ }
1627
+ }
1628
+
1629
+ /* Do type-checking if type info was provided */
1630
+ if (ty) {
1631
+ if (ty->clientdata) {
1632
+ if (rb_obj_is_kind_of(obj, ((swig_class *) (ty->clientdata))->klass)) {
1633
+ if (vptr == 0) {
1634
+ /* The object has already been deleted */
1635
+ return SWIG_ObjectPreviouslyDeletedError;
1636
+ }
1637
+ *ptr = vptr;
1638
+ return SWIG_OK;
1639
+ }
1640
+ }
1641
+ if ((c = SWIG_MangleStr(obj)) == NULL) {
1642
+ return SWIG_ERROR;
1643
+ }
1644
+ tc = SWIG_TypeCheck(c, ty);
1645
+ if (!tc) {
1646
+ return SWIG_ERROR;
1647
+ } else {
1648
+ int newmemory = 0;
1649
+ *ptr = SWIG_TypeCast(tc, vptr, &newmemory);
1650
+ assert(!newmemory); /* newmemory handling not yet implemented */
1651
+ }
1652
+ } else {
1653
+ *ptr = vptr;
1654
+ }
1655
+
1656
+ return SWIG_OK;
1657
+ }
1658
+
1659
+ /* Check convert */
1660
+ SWIGRUNTIMEINLINE int
1661
+ SWIG_Ruby_CheckConvert(VALUE obj, swig_type_info *ty)
1662
+ {
1663
+ char *c = SWIG_MangleStr(obj);
1664
+ if (!c) return 0;
1665
+ return SWIG_TypeCheck(c,ty) != 0;
1666
+ }
1667
+
1668
+ SWIGRUNTIME VALUE
1669
+ SWIG_Ruby_NewPackedObj(void *ptr, int sz, swig_type_info *type) {
1670
+ char result[1024];
1671
+ char *r = result;
1672
+ if ((2*sz + 1 + strlen(type->name)) > 1000) return 0;
1673
+ *(r++) = '_';
1674
+ r = SWIG_PackData(r, ptr, sz);
1675
+ strcpy(r, type->name);
1676
+ return rb_str_new2(result);
1677
+ }
1678
+
1679
+ /* Convert a packed value value */
1680
+ SWIGRUNTIME int
1681
+ SWIG_Ruby_ConvertPacked(VALUE obj, void *ptr, int sz, swig_type_info *ty) {
1682
+ swig_cast_info *tc;
1683
+ const char *c;
1684
+
1685
+ if (TYPE(obj) != T_STRING) goto type_error;
1686
+ c = StringValuePtr(obj);
1687
+ /* Pointer values must start with leading underscore */
1688
+ if (*c != '_') goto type_error;
1689
+ c++;
1690
+ c = SWIG_UnpackData(c, ptr, sz);
1691
+ if (ty) {
1692
+ tc = SWIG_TypeCheck(c, ty);
1693
+ if (!tc) goto type_error;
1694
+ }
1695
+ return SWIG_OK;
1696
+
1697
+ type_error:
1698
+ return SWIG_ERROR;
1699
+ }
1700
+
1701
+ SWIGRUNTIME swig_module_info *
1702
+ SWIG_Ruby_GetModule(void *SWIGUNUSEDPARM(clientdata))
1703
+ {
1704
+ VALUE pointer;
1705
+ swig_module_info *ret = 0;
1706
+ VALUE verbose = rb_gv_get("VERBOSE");
1707
+
1708
+ /* temporarily disable warnings, since the pointer check causes warnings with 'ruby -w' */
1709
+ rb_gv_set("VERBOSE", Qfalse);
1710
+
1711
+ /* first check if pointer already created */
1712
+ pointer = rb_gv_get("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
1713
+ if (pointer != Qnil) {
1714
+ Data_Get_Struct(pointer, swig_module_info, ret);
1715
+ }
1716
+
1717
+ /* reinstate warnings */
1718
+ rb_gv_set("VERBOSE", verbose);
1719
+ return ret;
1720
+ }
1721
+
1722
+ SWIGRUNTIME void
1723
+ SWIG_Ruby_SetModule(swig_module_info *pointer)
1724
+ {
1725
+ /* register a new class */
1726
+ VALUE cl = rb_define_class("swig_runtime_data", rb_cObject);
1727
+ /* create and store the structure pointer to a global variable */
1728
+ swig_runtime_data_type_pointer = Data_Wrap_Struct(cl, 0, 0, pointer);
1729
+ rb_define_readonly_variable("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, &swig_runtime_data_type_pointer);
1730
+ }
1731
+
1732
+ /* This function can be used to check whether a proc or method or similarly
1733
+ callable function has been passed. Usually used in a %typecheck, like:
1734
+
1735
+ %typecheck(c_callback_t, precedence=SWIG_TYPECHECK_POINTER) {
1736
+ $result = SWIG_Ruby_isCallable( $input );
1737
+ }
1738
+ */
1739
+ SWIGINTERN
1740
+ int SWIG_Ruby_isCallable( VALUE proc )
1741
+ {
1742
+ if ( rb_respond_to( proc, swig_call_id ) )
1743
+ return 1;
1744
+ return 0;
1745
+ }
1746
+
1747
+ /* This function can be used to check the arity (number of arguments)
1748
+ a proc or method can take. Usually used in a %typecheck.
1749
+ Valid arities will be that equal to minimal or those < 0
1750
+ which indicate a variable number of parameters at the end.
1751
+ */
1752
+ SWIGINTERN
1753
+ int SWIG_Ruby_arity( VALUE proc, int minimal )
1754
+ {
1755
+ if ( rb_respond_to( proc, swig_arity_id ) )
1756
+ {
1757
+ VALUE num = rb_funcall( proc, swig_arity_id, 0 );
1758
+ int arity = NUM2INT(num);
1759
+ if ( arity < 0 && (arity+1) < -minimal ) return 1;
1760
+ if ( arity == minimal ) return 1;
1761
+ return 1;
1762
+ }
1763
+ return 0;
1764
+ }
1765
+
1766
+
1767
+ #ifdef __cplusplus
1768
+ }
1769
+ #endif
1770
+
1771
+
1772
+
1773
+ #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0)
1774
+
1775
+ #define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else
1776
+
1777
+
1778
+
1779
+ /* -------- TYPES TABLE (BEGIN) -------- */
1780
+
1781
+ #define SWIGTYPE_p_char swig_types[0]
1782
+ static swig_type_info *swig_types[2];
1783
+ static swig_module_info swig_module = {swig_types, 1, 0, 0, 0, 0};
1784
+ #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
1785
+ #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
1786
+
1787
+ /* -------- TYPES TABLE (END) -------- */
1788
+
1789
+ #define SWIG_init Init_gpio_lib
1790
+ #define SWIG_name "Gpio_lib"
1791
+
1792
+ static VALUE mGpio_lib;
1793
+
1794
+ #define SWIG_RUBY_THREAD_BEGIN_BLOCK
1795
+ #define SWIG_RUBY_THREAD_END_BLOCK
1796
+
1797
+
1798
+ #define SWIGVERSION 0x020011
1799
+ #define SWIG_VERSION SWIGVERSION
1800
+
1801
+
1802
+ #define SWIG_as_voidptr(a) (void *)((const void *)(a))
1803
+ #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a))
1804
+
1805
+
1806
+ #include "gpio_lib.h"
1807
+
1808
+
1809
+ #include <limits.h>
1810
+ #if !defined(SWIG_NO_LLONG_MAX)
1811
+ # if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
1812
+ # define LLONG_MAX __LONG_LONG_MAX__
1813
+ # define LLONG_MIN (-LLONG_MAX - 1LL)
1814
+ # define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
1815
+ # endif
1816
+ #endif
1817
+
1818
+
1819
+ #define SWIG_From_long LONG2NUM
1820
+
1821
+
1822
+ SWIGINTERNINLINE VALUE
1823
+ SWIG_From_unsigned_SS_long (unsigned long value)
1824
+ {
1825
+ return ULONG2NUM(value);
1826
+ }
1827
+
1828
+
1829
+ SWIGINTERNINLINE VALUE
1830
+ SWIG_From_unsigned_SS_int (unsigned int value)
1831
+ {
1832
+ return SWIG_From_unsigned_SS_long (value);
1833
+ }
1834
+
1835
+
1836
+ SWIGINTERN VALUE
1837
+ SWIG_ruby_failed(void)
1838
+ {
1839
+ return Qnil;
1840
+ }
1841
+
1842
+
1843
+ /*@SWIG:/usr/share/swig2.0/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
1844
+ SWIGINTERN VALUE SWIG_AUX_NUM2ULONG(VALUE *args)
1845
+ {
1846
+ VALUE obj = args[0];
1847
+ VALUE type = TYPE(obj);
1848
+ unsigned long *res = (unsigned long *)(args[1]);
1849
+ *res = type == T_FIXNUM ? NUM2ULONG(obj) : rb_big2ulong(obj);
1850
+ return obj;
1851
+ }
1852
+ /*@SWIG@*/
1853
+
1854
+ SWIGINTERN int
1855
+ SWIG_AsVal_unsigned_SS_long (VALUE obj, unsigned long *val)
1856
+ {
1857
+ VALUE type = TYPE(obj);
1858
+ if ((type == T_FIXNUM) || (type == T_BIGNUM)) {
1859
+ unsigned long v;
1860
+ VALUE a[2];
1861
+ a[0] = obj;
1862
+ a[1] = (VALUE)(&v);
1863
+ if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2ULONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
1864
+ if (val) *val = v;
1865
+ return SWIG_OK;
1866
+ }
1867
+ }
1868
+ return SWIG_TypeError;
1869
+ }
1870
+
1871
+
1872
+ SWIGINTERN int
1873
+ SWIG_AsVal_unsigned_SS_int (VALUE obj, unsigned int *val)
1874
+ {
1875
+ unsigned long v;
1876
+ int res = SWIG_AsVal_unsigned_SS_long (obj, &v);
1877
+ if (SWIG_IsOK(res)) {
1878
+ if ((v > UINT_MAX)) {
1879
+ return SWIG_OverflowError;
1880
+ } else {
1881
+ if (val) *val = (unsigned int)(v);
1882
+ }
1883
+ }
1884
+ return res;
1885
+ }
1886
+
1887
+
1888
+ SWIGINTERNINLINE VALUE
1889
+ SWIG_From_int (int value)
1890
+ {
1891
+ return SWIG_From_long (value);
1892
+ }
1893
+
1894
+ SWIGINTERN VALUE
1895
+ _wrap_SUNXI_PIO_BASE_get(VALUE self) {
1896
+ VALUE _val;
1897
+
1898
+ _val = SWIG_From_unsigned_SS_int((unsigned int)(SUNXI_PIO_BASE));
1899
+ return _val;
1900
+ }
1901
+
1902
+
1903
+ SWIGINTERN VALUE
1904
+ _wrap_SUNXI_PIO_BASE_set(VALUE self, VALUE _val) {
1905
+ {
1906
+ unsigned int val;
1907
+ int res = SWIG_AsVal_unsigned_SS_int(_val, &val);
1908
+ if (!SWIG_IsOK(res)) {
1909
+ SWIG_exception_fail(SWIG_ArgError(res), "in variable '""SUNXI_PIO_BASE""' of type '""unsigned int""'");
1910
+ }
1911
+ SUNXI_PIO_BASE = (unsigned int)(val);
1912
+ }
1913
+ return _val;
1914
+ fail:
1915
+ return Qnil;
1916
+ }
1917
+
1918
+
1919
+ SWIGINTERN VALUE
1920
+ _wrap_sunxi_gpio_input(int argc, VALUE *argv, VALUE self) {
1921
+ unsigned int arg1 ;
1922
+ unsigned int val1 ;
1923
+ int ecode1 = 0 ;
1924
+ int result;
1925
+ VALUE vresult = Qnil;
1926
+
1927
+ if ((argc < 1) || (argc > 1)) {
1928
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
1929
+ }
1930
+ ecode1 = SWIG_AsVal_unsigned_SS_int(argv[0], &val1);
1931
+ if (!SWIG_IsOK(ecode1)) {
1932
+ SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "unsigned int","sunxi_gpio_input", 1, argv[0] ));
1933
+ }
1934
+ arg1 = (unsigned int)(val1);
1935
+ result = (int)sunxi_gpio_input(arg1);
1936
+ vresult = SWIG_From_int((int)(result));
1937
+ return vresult;
1938
+ fail:
1939
+ return Qnil;
1940
+ }
1941
+
1942
+
1943
+ SWIGINTERN VALUE
1944
+ _wrap_sunxi_gpio_init(int argc, VALUE *argv, VALUE self) {
1945
+ int result;
1946
+ VALUE vresult = Qnil;
1947
+
1948
+ if ((argc < 0) || (argc > 0)) {
1949
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
1950
+ }
1951
+ result = (int)sunxi_gpio_init();
1952
+ vresult = SWIG_From_int((int)(result));
1953
+ return vresult;
1954
+ fail:
1955
+ return Qnil;
1956
+ }
1957
+
1958
+
1959
+ SWIGINTERN VALUE
1960
+ _wrap_sunxi_gpio_set_cfgpin(int argc, VALUE *argv, VALUE self) {
1961
+ unsigned int arg1 ;
1962
+ unsigned int arg2 ;
1963
+ unsigned int val1 ;
1964
+ int ecode1 = 0 ;
1965
+ unsigned int val2 ;
1966
+ int ecode2 = 0 ;
1967
+ int result;
1968
+ VALUE vresult = Qnil;
1969
+
1970
+ if ((argc < 2) || (argc > 2)) {
1971
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
1972
+ }
1973
+ ecode1 = SWIG_AsVal_unsigned_SS_int(argv[0], &val1);
1974
+ if (!SWIG_IsOK(ecode1)) {
1975
+ SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "unsigned int","sunxi_gpio_set_cfgpin", 1, argv[0] ));
1976
+ }
1977
+ arg1 = (unsigned int)(val1);
1978
+ ecode2 = SWIG_AsVal_unsigned_SS_int(argv[1], &val2);
1979
+ if (!SWIG_IsOK(ecode2)) {
1980
+ SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "unsigned int","sunxi_gpio_set_cfgpin", 2, argv[1] ));
1981
+ }
1982
+ arg2 = (unsigned int)(val2);
1983
+ result = (int)sunxi_gpio_set_cfgpin(arg1,arg2);
1984
+ vresult = SWIG_From_int((int)(result));
1985
+ return vresult;
1986
+ fail:
1987
+ return Qnil;
1988
+ }
1989
+
1990
+
1991
+ SWIGINTERN VALUE
1992
+ _wrap_sunxi_gpio_get_cfgpin(int argc, VALUE *argv, VALUE self) {
1993
+ unsigned int arg1 ;
1994
+ unsigned int val1 ;
1995
+ int ecode1 = 0 ;
1996
+ int result;
1997
+ VALUE vresult = Qnil;
1998
+
1999
+ if ((argc < 1) || (argc > 1)) {
2000
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2001
+ }
2002
+ ecode1 = SWIG_AsVal_unsigned_SS_int(argv[0], &val1);
2003
+ if (!SWIG_IsOK(ecode1)) {
2004
+ SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "unsigned int","sunxi_gpio_get_cfgpin", 1, argv[0] ));
2005
+ }
2006
+ arg1 = (unsigned int)(val1);
2007
+ result = (int)sunxi_gpio_get_cfgpin(arg1);
2008
+ vresult = SWIG_From_int((int)(result));
2009
+ return vresult;
2010
+ fail:
2011
+ return Qnil;
2012
+ }
2013
+
2014
+
2015
+ SWIGINTERN VALUE
2016
+ _wrap_sunxi_gpio_output(int argc, VALUE *argv, VALUE self) {
2017
+ unsigned int arg1 ;
2018
+ unsigned int arg2 ;
2019
+ unsigned int val1 ;
2020
+ int ecode1 = 0 ;
2021
+ unsigned int val2 ;
2022
+ int ecode2 = 0 ;
2023
+ int result;
2024
+ VALUE vresult = Qnil;
2025
+
2026
+ if ((argc < 2) || (argc > 2)) {
2027
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
2028
+ }
2029
+ ecode1 = SWIG_AsVal_unsigned_SS_int(argv[0], &val1);
2030
+ if (!SWIG_IsOK(ecode1)) {
2031
+ SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "unsigned int","sunxi_gpio_output", 1, argv[0] ));
2032
+ }
2033
+ arg1 = (unsigned int)(val1);
2034
+ ecode2 = SWIG_AsVal_unsigned_SS_int(argv[1], &val2);
2035
+ if (!SWIG_IsOK(ecode2)) {
2036
+ SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "unsigned int","sunxi_gpio_output", 2, argv[1] ));
2037
+ }
2038
+ arg2 = (unsigned int)(val2);
2039
+ result = (int)sunxi_gpio_output(arg1,arg2);
2040
+ vresult = SWIG_From_int((int)(result));
2041
+ return vresult;
2042
+ fail:
2043
+ return Qnil;
2044
+ }
2045
+
2046
+
2047
+ SWIGINTERN VALUE
2048
+ _wrap_sunxi_gpio_cleanup(int argc, VALUE *argv, VALUE self) {
2049
+ if ((argc < 0) || (argc > 0)) {
2050
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2051
+ }
2052
+ sunxi_gpio_cleanup();
2053
+ return Qnil;
2054
+ fail:
2055
+ return Qnil;
2056
+ }
2057
+
2058
+
2059
+
2060
+ /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
2061
+
2062
+ static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
2063
+
2064
+ static swig_type_info *swig_type_initial[] = {
2065
+ &_swigt__p_char,
2066
+ };
2067
+
2068
+ static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
2069
+
2070
+ static swig_cast_info *swig_cast_initial[] = {
2071
+ _swigc__p_char,
2072
+ };
2073
+
2074
+
2075
+ /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
2076
+
2077
+ /* -----------------------------------------------------------------------------
2078
+ * Type initialization:
2079
+ * This problem is tough by the requirement that no dynamic
2080
+ * memory is used. Also, since swig_type_info structures store pointers to
2081
+ * swig_cast_info structures and swig_cast_info structures store pointers back
2082
+ * to swig_type_info structures, we need some lookup code at initialization.
2083
+ * The idea is that swig generates all the structures that are needed.
2084
+ * The runtime then collects these partially filled structures.
2085
+ * The SWIG_InitializeModule function takes these initial arrays out of
2086
+ * swig_module, and does all the lookup, filling in the swig_module.types
2087
+ * array with the correct data and linking the correct swig_cast_info
2088
+ * structures together.
2089
+ *
2090
+ * The generated swig_type_info structures are assigned staticly to an initial
2091
+ * array. We just loop through that array, and handle each type individually.
2092
+ * First we lookup if this type has been already loaded, and if so, use the
2093
+ * loaded structure instead of the generated one. Then we have to fill in the
2094
+ * cast linked list. The cast data is initially stored in something like a
2095
+ * two-dimensional array. Each row corresponds to a type (there are the same
2096
+ * number of rows as there are in the swig_type_initial array). Each entry in
2097
+ * a column is one of the swig_cast_info structures for that type.
2098
+ * The cast_initial array is actually an array of arrays, because each row has
2099
+ * a variable number of columns. So to actually build the cast linked list,
2100
+ * we find the array of casts associated with the type, and loop through it
2101
+ * adding the casts to the list. The one last trick we need to do is making
2102
+ * sure the type pointer in the swig_cast_info struct is correct.
2103
+ *
2104
+ * First off, we lookup the cast->type name to see if it is already loaded.
2105
+ * There are three cases to handle:
2106
+ * 1) If the cast->type has already been loaded AND the type we are adding
2107
+ * casting info to has not been loaded (it is in this module), THEN we
2108
+ * replace the cast->type pointer with the type pointer that has already
2109
+ * been loaded.
2110
+ * 2) If BOTH types (the one we are adding casting info to, and the
2111
+ * cast->type) are loaded, THEN the cast info has already been loaded by
2112
+ * the previous module so we just ignore it.
2113
+ * 3) Finally, if cast->type has not already been loaded, then we add that
2114
+ * swig_cast_info to the linked list (because the cast->type) pointer will
2115
+ * be correct.
2116
+ * ----------------------------------------------------------------------------- */
2117
+
2118
+ #ifdef __cplusplus
2119
+ extern "C" {
2120
+ #if 0
2121
+ } /* c-mode */
2122
+ #endif
2123
+ #endif
2124
+
2125
+ #if 0
2126
+ #define SWIGRUNTIME_DEBUG
2127
+ #endif
2128
+
2129
+
2130
+ SWIGRUNTIME void
2131
+ SWIG_InitializeModule(void *clientdata) {
2132
+ size_t i;
2133
+ swig_module_info *module_head, *iter;
2134
+ int found, init;
2135
+
2136
+ /* check to see if the circular list has been setup, if not, set it up */
2137
+ if (swig_module.next==0) {
2138
+ /* Initialize the swig_module */
2139
+ swig_module.type_initial = swig_type_initial;
2140
+ swig_module.cast_initial = swig_cast_initial;
2141
+ swig_module.next = &swig_module;
2142
+ init = 1;
2143
+ } else {
2144
+ init = 0;
2145
+ }
2146
+
2147
+ /* Try and load any already created modules */
2148
+ module_head = SWIG_GetModule(clientdata);
2149
+ if (!module_head) {
2150
+ /* This is the first module loaded for this interpreter */
2151
+ /* so set the swig module into the interpreter */
2152
+ SWIG_SetModule(clientdata, &swig_module);
2153
+ module_head = &swig_module;
2154
+ } else {
2155
+ /* the interpreter has loaded a SWIG module, but has it loaded this one? */
2156
+ found=0;
2157
+ iter=module_head;
2158
+ do {
2159
+ if (iter==&swig_module) {
2160
+ found=1;
2161
+ break;
2162
+ }
2163
+ iter=iter->next;
2164
+ } while (iter!= module_head);
2165
+
2166
+ /* if the is found in the list, then all is done and we may leave */
2167
+ if (found) return;
2168
+ /* otherwise we must add out module into the list */
2169
+ swig_module.next = module_head->next;
2170
+ module_head->next = &swig_module;
2171
+ }
2172
+
2173
+ /* When multiple interpreters are used, a module could have already been initialized in
2174
+ a different interpreter, but not yet have a pointer in this interpreter.
2175
+ In this case, we do not want to continue adding types... everything should be
2176
+ set up already */
2177
+ if (init == 0) return;
2178
+
2179
+ /* Now work on filling in swig_module.types */
2180
+ #ifdef SWIGRUNTIME_DEBUG
2181
+ printf("SWIG_InitializeModule: size %d\n", swig_module.size);
2182
+ #endif
2183
+ for (i = 0; i < swig_module.size; ++i) {
2184
+ swig_type_info *type = 0;
2185
+ swig_type_info *ret;
2186
+ swig_cast_info *cast;
2187
+
2188
+ #ifdef SWIGRUNTIME_DEBUG
2189
+ printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
2190
+ #endif
2191
+
2192
+ /* if there is another module already loaded */
2193
+ if (swig_module.next != &swig_module) {
2194
+ type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
2195
+ }
2196
+ if (type) {
2197
+ /* Overwrite clientdata field */
2198
+ #ifdef SWIGRUNTIME_DEBUG
2199
+ printf("SWIG_InitializeModule: found type %s\n", type->name);
2200
+ #endif
2201
+ if (swig_module.type_initial[i]->clientdata) {
2202
+ type->clientdata = swig_module.type_initial[i]->clientdata;
2203
+ #ifdef SWIGRUNTIME_DEBUG
2204
+ printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
2205
+ #endif
2206
+ }
2207
+ } else {
2208
+ type = swig_module.type_initial[i];
2209
+ }
2210
+
2211
+ /* Insert casting types */
2212
+ cast = swig_module.cast_initial[i];
2213
+ while (cast->type) {
2214
+
2215
+ /* Don't need to add information already in the list */
2216
+ ret = 0;
2217
+ #ifdef SWIGRUNTIME_DEBUG
2218
+ printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
2219
+ #endif
2220
+ if (swig_module.next != &swig_module) {
2221
+ ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
2222
+ #ifdef SWIGRUNTIME_DEBUG
2223
+ if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
2224
+ #endif
2225
+ }
2226
+ if (ret) {
2227
+ if (type == swig_module.type_initial[i]) {
2228
+ #ifdef SWIGRUNTIME_DEBUG
2229
+ printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
2230
+ #endif
2231
+ cast->type = ret;
2232
+ ret = 0;
2233
+ } else {
2234
+ /* Check for casting already in the list */
2235
+ swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
2236
+ #ifdef SWIGRUNTIME_DEBUG
2237
+ if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
2238
+ #endif
2239
+ if (!ocast) ret = 0;
2240
+ }
2241
+ }
2242
+
2243
+ if (!ret) {
2244
+ #ifdef SWIGRUNTIME_DEBUG
2245
+ printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
2246
+ #endif
2247
+ if (type->cast) {
2248
+ type->cast->prev = cast;
2249
+ cast->next = type->cast;
2250
+ }
2251
+ type->cast = cast;
2252
+ }
2253
+ cast++;
2254
+ }
2255
+ /* Set entry in modules->types array equal to the type */
2256
+ swig_module.types[i] = type;
2257
+ }
2258
+ swig_module.types[i] = 0;
2259
+
2260
+ #ifdef SWIGRUNTIME_DEBUG
2261
+ printf("**** SWIG_InitializeModule: Cast List ******\n");
2262
+ for (i = 0; i < swig_module.size; ++i) {
2263
+ int j = 0;
2264
+ swig_cast_info *cast = swig_module.cast_initial[i];
2265
+ printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
2266
+ while (cast->type) {
2267
+ printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
2268
+ cast++;
2269
+ ++j;
2270
+ }
2271
+ printf("---- Total casts: %d\n",j);
2272
+ }
2273
+ printf("**** SWIG_InitializeModule: Cast List ******\n");
2274
+ #endif
2275
+ }
2276
+
2277
+ /* This function will propagate the clientdata field of type to
2278
+ * any new swig_type_info structures that have been added into the list
2279
+ * of equivalent types. It is like calling
2280
+ * SWIG_TypeClientData(type, clientdata) a second time.
2281
+ */
2282
+ SWIGRUNTIME void
2283
+ SWIG_PropagateClientData(void) {
2284
+ size_t i;
2285
+ swig_cast_info *equiv;
2286
+ static int init_run = 0;
2287
+
2288
+ if (init_run) return;
2289
+ init_run = 1;
2290
+
2291
+ for (i = 0; i < swig_module.size; i++) {
2292
+ if (swig_module.types[i]->clientdata) {
2293
+ equiv = swig_module.types[i]->cast;
2294
+ while (equiv) {
2295
+ if (!equiv->converter) {
2296
+ if (equiv->type && !equiv->type->clientdata)
2297
+ SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
2298
+ }
2299
+ equiv = equiv->next;
2300
+ }
2301
+ }
2302
+ }
2303
+ }
2304
+
2305
+ #ifdef __cplusplus
2306
+ #if 0
2307
+ { /* c-mode */
2308
+ #endif
2309
+ }
2310
+ #endif
2311
+
2312
+ /*
2313
+
2314
+ */
2315
+ #ifdef __cplusplus
2316
+ extern "C"
2317
+ #endif
2318
+ SWIGEXPORT void Init_gpio_lib(void) {
2319
+ size_t i;
2320
+
2321
+ SWIG_InitRuntime();
2322
+ mGpio_lib = rb_define_module("Gpio_lib");
2323
+
2324
+ SWIG_InitializeModule(0);
2325
+ for (i = 0; i < swig_module.size; i++) {
2326
+ SWIG_define_class(swig_module.types[i]);
2327
+ }
2328
+
2329
+ SWIG_RubyInitializeTrackings();
2330
+ rb_define_singleton_method(mGpio_lib, "SUNXI_PIO_BASE", _wrap_SUNXI_PIO_BASE_get, 0);
2331
+ rb_define_singleton_method(mGpio_lib, "SUNXI_PIO_BASE=", _wrap_SUNXI_PIO_BASE_set, 1);
2332
+ rb_define_module_function(mGpio_lib, "sunxi_gpio_input", _wrap_sunxi_gpio_input, -1);
2333
+ rb_define_module_function(mGpio_lib, "sunxi_gpio_init", _wrap_sunxi_gpio_init, -1);
2334
+ rb_define_module_function(mGpio_lib, "sunxi_gpio_set_cfgpin", _wrap_sunxi_gpio_set_cfgpin, -1);
2335
+ rb_define_module_function(mGpio_lib, "sunxi_gpio_get_cfgpin", _wrap_sunxi_gpio_get_cfgpin, -1);
2336
+ rb_define_module_function(mGpio_lib, "sunxi_gpio_output", _wrap_sunxi_gpio_output, -1);
2337
+ rb_define_module_function(mGpio_lib, "sunxi_gpio_cleanup", _wrap_sunxi_gpio_cleanup, -1);
2338
+ }
2339
+