ws2812 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,3189 @@
1
+ /* ----------------------------------------------------------------------------
2
+ * This file was automatically generated by SWIG (http://www.swig.org).
3
+ * Version 2.0.7
4
+ *
5
+ * This file is not intended to be easily readable and contains a number of
6
+ * coding conventions designed to improve portability and efficiency. Do not make
7
+ * changes to this file unless you know what you are doing--modify the SWIG
8
+ * interface file instead.
9
+ * ----------------------------------------------------------------------------- */
10
+
11
+ #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
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 not equal, 1 if equal
466
+ */
467
+ SWIGRUNTIME int
468
+ SWIG_TypeEquiv(const char *nb, const char *tb) {
469
+ int equiv = 0;
470
+ const char* te = tb + strlen(tb);
471
+ const char* ne = nb;
472
+ while (!equiv && *ne) {
473
+ for (nb = ne; *ne; ++ne) {
474
+ if (*ne == '|') break;
475
+ }
476
+ equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
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 equal, -1 if nb < tb, 1 if nb > tb
485
+ */
486
+ SWIGRUNTIME int
487
+ SWIG_TypeCompare(const char *nb, const char *tb) {
488
+ int equiv = 0;
489
+ const char* te = tb + strlen(tb);
490
+ const char* ne = nb;
491
+ while (!equiv && *ne) {
492
+ for (nb = ne; *ne; ++ne) {
493
+ if (*ne == '|') break;
494
+ }
495
+ equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
496
+ if (*ne) ++ne;
497
+ }
498
+ return equiv;
499
+ }
500
+
501
+
502
+ /*
503
+ Check the typename
504
+ */
505
+ SWIGRUNTIME swig_cast_info *
506
+ SWIG_TypeCheck(const char *c, swig_type_info *ty) {
507
+ if (ty) {
508
+ swig_cast_info *iter = ty->cast;
509
+ while (iter) {
510
+ if (strcmp(iter->type->name, c) == 0) {
511
+ if (iter == ty->cast)
512
+ return iter;
513
+ /* Move iter to the top of the linked list */
514
+ iter->prev->next = iter->next;
515
+ if (iter->next)
516
+ iter->next->prev = iter->prev;
517
+ iter->next = ty->cast;
518
+ iter->prev = 0;
519
+ if (ty->cast) ty->cast->prev = iter;
520
+ ty->cast = iter;
521
+ return iter;
522
+ }
523
+ iter = iter->next;
524
+ }
525
+ }
526
+ return 0;
527
+ }
528
+
529
+ /*
530
+ Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
531
+ */
532
+ SWIGRUNTIME swig_cast_info *
533
+ SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
534
+ if (ty) {
535
+ swig_cast_info *iter = ty->cast;
536
+ while (iter) {
537
+ if (iter->type == from) {
538
+ if (iter == ty->cast)
539
+ return iter;
540
+ /* Move iter to the top of the linked list */
541
+ iter->prev->next = iter->next;
542
+ if (iter->next)
543
+ iter->next->prev = iter->prev;
544
+ iter->next = ty->cast;
545
+ iter->prev = 0;
546
+ if (ty->cast) ty->cast->prev = iter;
547
+ ty->cast = iter;
548
+ return iter;
549
+ }
550
+ iter = iter->next;
551
+ }
552
+ }
553
+ return 0;
554
+ }
555
+
556
+ /*
557
+ Cast a pointer up an inheritance hierarchy
558
+ */
559
+ SWIGRUNTIMEINLINE void *
560
+ SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
561
+ return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
562
+ }
563
+
564
+ /*
565
+ Dynamic pointer casting. Down an inheritance hierarchy
566
+ */
567
+ SWIGRUNTIME swig_type_info *
568
+ SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
569
+ swig_type_info *lastty = ty;
570
+ if (!ty || !ty->dcast) return ty;
571
+ while (ty && (ty->dcast)) {
572
+ ty = (*ty->dcast)(ptr);
573
+ if (ty) lastty = ty;
574
+ }
575
+ return lastty;
576
+ }
577
+
578
+ /*
579
+ Return the name associated with this type
580
+ */
581
+ SWIGRUNTIMEINLINE const char *
582
+ SWIG_TypeName(const swig_type_info *ty) {
583
+ return ty->name;
584
+ }
585
+
586
+ /*
587
+ Return the pretty name associated with this type,
588
+ that is an unmangled type name in a form presentable to the user.
589
+ */
590
+ SWIGRUNTIME const char *
591
+ SWIG_TypePrettyName(const swig_type_info *type) {
592
+ /* The "str" field contains the equivalent pretty names of the
593
+ type, separated by vertical-bar characters. We choose
594
+ to print the last name, as it is often (?) the most
595
+ specific. */
596
+ if (!type) return NULL;
597
+ if (type->str != NULL) {
598
+ const char *last_name = type->str;
599
+ const char *s;
600
+ for (s = type->str; *s; s++)
601
+ if (*s == '|') last_name = s+1;
602
+ return last_name;
603
+ }
604
+ else
605
+ return type->name;
606
+ }
607
+
608
+ /*
609
+ Set the clientdata field for a type
610
+ */
611
+ SWIGRUNTIME void
612
+ SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
613
+ swig_cast_info *cast = ti->cast;
614
+ /* if (ti->clientdata == clientdata) return; */
615
+ ti->clientdata = clientdata;
616
+
617
+ while (cast) {
618
+ if (!cast->converter) {
619
+ swig_type_info *tc = cast->type;
620
+ if (!tc->clientdata) {
621
+ SWIG_TypeClientData(tc, clientdata);
622
+ }
623
+ }
624
+ cast = cast->next;
625
+ }
626
+ }
627
+ SWIGRUNTIME void
628
+ SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
629
+ SWIG_TypeClientData(ti, clientdata);
630
+ ti->owndata = 1;
631
+ }
632
+
633
+ /*
634
+ Search for a swig_type_info structure only by mangled name
635
+ Search is a O(log #types)
636
+
637
+ We start searching at module start, and finish searching when start == end.
638
+ Note: if start == end at the beginning of the function, we go all the way around
639
+ the circular list.
640
+ */
641
+ SWIGRUNTIME swig_type_info *
642
+ SWIG_MangledTypeQueryModule(swig_module_info *start,
643
+ swig_module_info *end,
644
+ const char *name) {
645
+ swig_module_info *iter = start;
646
+ do {
647
+ if (iter->size) {
648
+ register size_t l = 0;
649
+ register size_t r = iter->size - 1;
650
+ do {
651
+ /* since l+r >= 0, we can (>> 1) instead (/ 2) */
652
+ register size_t i = (l + r) >> 1;
653
+ const char *iname = iter->types[i]->name;
654
+ if (iname) {
655
+ register int compare = strcmp(name, iname);
656
+ if (compare == 0) {
657
+ return iter->types[i];
658
+ } else if (compare < 0) {
659
+ if (i) {
660
+ r = i - 1;
661
+ } else {
662
+ break;
663
+ }
664
+ } else if (compare > 0) {
665
+ l = i + 1;
666
+ }
667
+ } else {
668
+ break; /* should never happen */
669
+ }
670
+ } while (l <= r);
671
+ }
672
+ iter = iter->next;
673
+ } while (iter != end);
674
+ return 0;
675
+ }
676
+
677
+ /*
678
+ Search for a swig_type_info structure for either a mangled name or a human readable name.
679
+ It first searches the mangled names of the types, which is a O(log #types)
680
+ If a type is not found it then searches the human readable names, which is O(#types).
681
+
682
+ We start searching at module start, and finish searching when start == end.
683
+ Note: if start == end at the beginning of the function, we go all the way around
684
+ the circular list.
685
+ */
686
+ SWIGRUNTIME swig_type_info *
687
+ SWIG_TypeQueryModule(swig_module_info *start,
688
+ swig_module_info *end,
689
+ const char *name) {
690
+ /* STEP 1: Search the name field using binary search */
691
+ swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
692
+ if (ret) {
693
+ return ret;
694
+ } else {
695
+ /* STEP 2: If the type hasn't been found, do a complete search
696
+ of the str field (the human readable name) */
697
+ swig_module_info *iter = start;
698
+ do {
699
+ register size_t i = 0;
700
+ for (; i < iter->size; ++i) {
701
+ if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
702
+ return iter->types[i];
703
+ }
704
+ iter = iter->next;
705
+ } while (iter != end);
706
+ }
707
+
708
+ /* neither found a match */
709
+ return 0;
710
+ }
711
+
712
+ /*
713
+ Pack binary data into a string
714
+ */
715
+ SWIGRUNTIME char *
716
+ SWIG_PackData(char *c, void *ptr, size_t sz) {
717
+ static const char hex[17] = "0123456789abcdef";
718
+ register const unsigned char *u = (unsigned char *) ptr;
719
+ register const unsigned char *eu = u + sz;
720
+ for (; u != eu; ++u) {
721
+ register unsigned char uu = *u;
722
+ *(c++) = hex[(uu & 0xf0) >> 4];
723
+ *(c++) = hex[uu & 0xf];
724
+ }
725
+ return c;
726
+ }
727
+
728
+ /*
729
+ Unpack binary data from a string
730
+ */
731
+ SWIGRUNTIME const char *
732
+ SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
733
+ register unsigned char *u = (unsigned char *) ptr;
734
+ register const unsigned char *eu = u + sz;
735
+ for (; u != eu; ++u) {
736
+ register char d = *(c++);
737
+ register unsigned char uu;
738
+ if ((d >= '0') && (d <= '9'))
739
+ uu = ((d - '0') << 4);
740
+ else if ((d >= 'a') && (d <= 'f'))
741
+ uu = ((d - ('a'-10)) << 4);
742
+ else
743
+ return (char *) 0;
744
+ d = *(c++);
745
+ if ((d >= '0') && (d <= '9'))
746
+ uu |= (d - '0');
747
+ else if ((d >= 'a') && (d <= 'f'))
748
+ uu |= (d - ('a'-10));
749
+ else
750
+ return (char *) 0;
751
+ *u = uu;
752
+ }
753
+ return c;
754
+ }
755
+
756
+ /*
757
+ Pack 'void *' into a string buffer.
758
+ */
759
+ SWIGRUNTIME char *
760
+ SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
761
+ char *r = buff;
762
+ if ((2*sizeof(void *) + 2) > bsz) return 0;
763
+ *(r++) = '_';
764
+ r = SWIG_PackData(r,&ptr,sizeof(void *));
765
+ if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
766
+ strcpy(r,name);
767
+ return buff;
768
+ }
769
+
770
+ SWIGRUNTIME const char *
771
+ SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
772
+ if (*c != '_') {
773
+ if (strcmp(c,"NULL") == 0) {
774
+ *ptr = (void *) 0;
775
+ return name;
776
+ } else {
777
+ return 0;
778
+ }
779
+ }
780
+ return SWIG_UnpackData(++c,ptr,sizeof(void *));
781
+ }
782
+
783
+ SWIGRUNTIME char *
784
+ SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
785
+ char *r = buff;
786
+ size_t lname = (name ? strlen(name) : 0);
787
+ if ((2*sz + 2 + lname) > bsz) return 0;
788
+ *(r++) = '_';
789
+ r = SWIG_PackData(r,ptr,sz);
790
+ if (lname) {
791
+ strncpy(r,name,lname+1);
792
+ } else {
793
+ *r = 0;
794
+ }
795
+ return buff;
796
+ }
797
+
798
+ SWIGRUNTIME const char *
799
+ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
800
+ if (*c != '_') {
801
+ if (strcmp(c,"NULL") == 0) {
802
+ memset(ptr,0,sz);
803
+ return name;
804
+ } else {
805
+ return 0;
806
+ }
807
+ }
808
+ return SWIG_UnpackData(++c,ptr,sz);
809
+ }
810
+
811
+ #ifdef __cplusplus
812
+ }
813
+ #endif
814
+
815
+ /* Errors in SWIG */
816
+ #define SWIG_UnknownError -1
817
+ #define SWIG_IOError -2
818
+ #define SWIG_RuntimeError -3
819
+ #define SWIG_IndexError -4
820
+ #define SWIG_TypeError -5
821
+ #define SWIG_DivisionByZero -6
822
+ #define SWIG_OverflowError -7
823
+ #define SWIG_SyntaxError -8
824
+ #define SWIG_ValueError -9
825
+ #define SWIG_SystemError -10
826
+ #define SWIG_AttributeError -11
827
+ #define SWIG_MemoryError -12
828
+ #define SWIG_NullReferenceError -13
829
+
830
+
831
+
832
+ #include <ruby.h>
833
+
834
+ /* Ruby 1.9.1 has a "memoisation optimisation" when compiling with GCC which
835
+ * breaks using rb_intern as an lvalue, as SWIG does. We work around this
836
+ * issue for now by disabling this.
837
+ * https://sourceforge.net/tracker/?func=detail&aid=2859614&group_id=1645&atid=101645
838
+ */
839
+ #ifdef rb_intern
840
+ # undef rb_intern
841
+ #endif
842
+
843
+ /* Remove global macros defined in Ruby's win32.h */
844
+ #ifdef write
845
+ # undef write
846
+ #endif
847
+ #ifdef read
848
+ # undef read
849
+ #endif
850
+ #ifdef bind
851
+ # undef bind
852
+ #endif
853
+ #ifdef close
854
+ # undef close
855
+ #endif
856
+ #ifdef connect
857
+ # undef connect
858
+ #endif
859
+
860
+
861
+ /* Ruby 1.7 defines NUM2LL(), LL2NUM() and ULL2NUM() macros */
862
+ #ifndef NUM2LL
863
+ #define NUM2LL(x) NUM2LONG((x))
864
+ #endif
865
+ #ifndef LL2NUM
866
+ #define LL2NUM(x) INT2NUM((long) (x))
867
+ #endif
868
+ #ifndef ULL2NUM
869
+ #define ULL2NUM(x) UINT2NUM((unsigned long) (x))
870
+ #endif
871
+
872
+ /* Ruby 1.7 doesn't (yet) define NUM2ULL() */
873
+ #ifndef NUM2ULL
874
+ #ifdef HAVE_LONG_LONG
875
+ #define NUM2ULL(x) rb_num2ull((x))
876
+ #else
877
+ #define NUM2ULL(x) NUM2ULONG(x)
878
+ #endif
879
+ #endif
880
+
881
+ /* RSTRING_LEN, etc are new in Ruby 1.9, but ->ptr and ->len no longer work */
882
+ /* Define these for older versions so we can just write code the new way */
883
+ #ifndef RSTRING_LEN
884
+ # define RSTRING_LEN(x) RSTRING(x)->len
885
+ #endif
886
+ #ifndef RSTRING_PTR
887
+ # define RSTRING_PTR(x) RSTRING(x)->ptr
888
+ #endif
889
+ #ifndef RSTRING_END
890
+ # define RSTRING_END(x) (RSTRING_PTR(x) + RSTRING_LEN(x))
891
+ #endif
892
+ #ifndef RARRAY_LEN
893
+ # define RARRAY_LEN(x) RARRAY(x)->len
894
+ #endif
895
+ #ifndef RARRAY_PTR
896
+ # define RARRAY_PTR(x) RARRAY(x)->ptr
897
+ #endif
898
+ #ifndef RFLOAT_VALUE
899
+ # define RFLOAT_VALUE(x) RFLOAT(x)->value
900
+ #endif
901
+ #ifndef DOUBLE2NUM
902
+ # define DOUBLE2NUM(x) rb_float_new(x)
903
+ #endif
904
+ #ifndef RHASH_TBL
905
+ # define RHASH_TBL(x) (RHASH(x)->tbl)
906
+ #endif
907
+ #ifndef RHASH_ITER_LEV
908
+ # define RHASH_ITER_LEV(x) (RHASH(x)->iter_lev)
909
+ #endif
910
+ #ifndef RHASH_IFNONE
911
+ # define RHASH_IFNONE(x) (RHASH(x)->ifnone)
912
+ #endif
913
+ #ifndef RHASH_SIZE
914
+ # define RHASH_SIZE(x) (RHASH(x)->tbl->num_entries)
915
+ #endif
916
+ #ifndef RHASH_EMPTY_P
917
+ # define RHASH_EMPTY_P(x) (RHASH_SIZE(x) == 0)
918
+ #endif
919
+ #ifndef RSTRUCT_LEN
920
+ # define RSTRUCT_LEN(x) RSTRUCT(x)->len
921
+ #endif
922
+ #ifndef RSTRUCT_PTR
923
+ # define RSTRUCT_PTR(x) RSTRUCT(x)->ptr
924
+ #endif
925
+
926
+
927
+
928
+ /*
929
+ * Need to be very careful about how these macros are defined, especially
930
+ * when compiling C++ code or C code with an ANSI C compiler.
931
+ *
932
+ * VALUEFUNC(f) is a macro used to typecast a C function that implements
933
+ * a Ruby method so that it can be passed as an argument to API functions
934
+ * like rb_define_method() and rb_define_singleton_method().
935
+ *
936
+ * VOIDFUNC(f) is a macro used to typecast a C function that implements
937
+ * either the "mark" or "free" stuff for a Ruby Data object, so that it
938
+ * can be passed as an argument to API functions like Data_Wrap_Struct()
939
+ * and Data_Make_Struct().
940
+ */
941
+
942
+ #ifdef __cplusplus
943
+ # ifndef RUBY_METHOD_FUNC /* These definitions should work for Ruby 1.4.6 */
944
+ # define PROTECTFUNC(f) ((VALUE (*)()) f)
945
+ # define VALUEFUNC(f) ((VALUE (*)()) f)
946
+ # define VOIDFUNC(f) ((void (*)()) f)
947
+ # else
948
+ # ifndef ANYARGS /* These definitions should work for Ruby 1.6 */
949
+ # define PROTECTFUNC(f) ((VALUE (*)()) f)
950
+ # define VALUEFUNC(f) ((VALUE (*)()) f)
951
+ # define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
952
+ # else /* These definitions should work for Ruby 1.7+ */
953
+ # define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f)
954
+ # define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f)
955
+ # define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
956
+ # endif
957
+ # endif
958
+ #else
959
+ # define VALUEFUNC(f) (f)
960
+ # define VOIDFUNC(f) (f)
961
+ #endif
962
+
963
+ /* Don't use for expressions have side effect */
964
+ #ifndef RB_STRING_VALUE
965
+ #define RB_STRING_VALUE(s) (TYPE(s) == T_STRING ? (s) : (*(volatile VALUE *)&(s) = rb_str_to_str(s)))
966
+ #endif
967
+ #ifndef StringValue
968
+ #define StringValue(s) RB_STRING_VALUE(s)
969
+ #endif
970
+ #ifndef StringValuePtr
971
+ #define StringValuePtr(s) RSTRING_PTR(RB_STRING_VALUE(s))
972
+ #endif
973
+ #ifndef StringValueLen
974
+ #define StringValueLen(s) RSTRING_LEN(RB_STRING_VALUE(s))
975
+ #endif
976
+ #ifndef SafeStringValue
977
+ #define SafeStringValue(v) do {\
978
+ StringValue(v);\
979
+ rb_check_safe_str(v);\
980
+ } while (0)
981
+ #endif
982
+
983
+ #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
984
+ #define rb_define_alloc_func(klass, func) rb_define_singleton_method((klass), "new", VALUEFUNC((func)), -1)
985
+ #define rb_undef_alloc_func(klass) rb_undef_method(CLASS_OF((klass)), "new")
986
+ #endif
987
+
988
+ static VALUE _mSWIG = Qnil;
989
+
990
+ /* -----------------------------------------------------------------------------
991
+ * error manipulation
992
+ * ----------------------------------------------------------------------------- */
993
+
994
+
995
+ /* Define some additional error types */
996
+ #define SWIG_ObjectPreviouslyDeletedError -100
997
+
998
+
999
+ /* Define custom exceptions for errors that do not map to existing Ruby
1000
+ exceptions. Note this only works for C++ since a global cannot be
1001
+ initialized by a function in C. For C, fallback to rb_eRuntimeError.*/
1002
+
1003
+ SWIGINTERN VALUE
1004
+ getNullReferenceError(void) {
1005
+ static int init = 0;
1006
+ static VALUE rb_eNullReferenceError ;
1007
+ if (!init) {
1008
+ init = 1;
1009
+ rb_eNullReferenceError = rb_define_class("NullReferenceError", rb_eRuntimeError);
1010
+ }
1011
+ return rb_eNullReferenceError;
1012
+ }
1013
+
1014
+ SWIGINTERN VALUE
1015
+ getObjectPreviouslyDeletedError(void) {
1016
+ static int init = 0;
1017
+ static VALUE rb_eObjectPreviouslyDeleted ;
1018
+ if (!init) {
1019
+ init = 1;
1020
+ rb_eObjectPreviouslyDeleted = rb_define_class("ObjectPreviouslyDeleted", rb_eRuntimeError);
1021
+ }
1022
+ return rb_eObjectPreviouslyDeleted;
1023
+ }
1024
+
1025
+
1026
+ SWIGINTERN VALUE
1027
+ SWIG_Ruby_ErrorType(int SWIG_code) {
1028
+ VALUE type;
1029
+ switch (SWIG_code) {
1030
+ case SWIG_MemoryError:
1031
+ type = rb_eNoMemError;
1032
+ break;
1033
+ case SWIG_IOError:
1034
+ type = rb_eIOError;
1035
+ break;
1036
+ case SWIG_RuntimeError:
1037
+ type = rb_eRuntimeError;
1038
+ break;
1039
+ case SWIG_IndexError:
1040
+ type = rb_eIndexError;
1041
+ break;
1042
+ case SWIG_TypeError:
1043
+ type = rb_eTypeError;
1044
+ break;
1045
+ case SWIG_DivisionByZero:
1046
+ type = rb_eZeroDivError;
1047
+ break;
1048
+ case SWIG_OverflowError:
1049
+ type = rb_eRangeError;
1050
+ break;
1051
+ case SWIG_SyntaxError:
1052
+ type = rb_eSyntaxError;
1053
+ break;
1054
+ case SWIG_ValueError:
1055
+ type = rb_eArgError;
1056
+ break;
1057
+ case SWIG_SystemError:
1058
+ type = rb_eFatal;
1059
+ break;
1060
+ case SWIG_AttributeError:
1061
+ type = rb_eRuntimeError;
1062
+ break;
1063
+ case SWIG_NullReferenceError:
1064
+ type = getNullReferenceError();
1065
+ break;
1066
+ case SWIG_ObjectPreviouslyDeletedError:
1067
+ type = getObjectPreviouslyDeletedError();
1068
+ break;
1069
+ case SWIG_UnknownError:
1070
+ type = rb_eRuntimeError;
1071
+ break;
1072
+ default:
1073
+ type = rb_eRuntimeError;
1074
+ }
1075
+ return type;
1076
+ }
1077
+
1078
+
1079
+ /* This function is called when a user inputs a wrong argument to
1080
+ a method.
1081
+ */
1082
+ SWIGINTERN
1083
+ const char* Ruby_Format_TypeError( const char* msg,
1084
+ const char* type,
1085
+ const char* name,
1086
+ const int argn,
1087
+ VALUE input )
1088
+ {
1089
+ char buf[128];
1090
+ VALUE str;
1091
+ VALUE asStr;
1092
+ if ( msg && *msg )
1093
+ {
1094
+ str = rb_str_new2(msg);
1095
+ }
1096
+ else
1097
+ {
1098
+ str = rb_str_new(NULL, 0);
1099
+ }
1100
+
1101
+ str = rb_str_cat2( str, "Expected argument " );
1102
+ sprintf( buf, "%d of type ", argn-1 );
1103
+ str = rb_str_cat2( str, buf );
1104
+ str = rb_str_cat2( str, type );
1105
+ str = rb_str_cat2( str, ", but got " );
1106
+ str = rb_str_cat2( str, rb_obj_classname(input) );
1107
+ str = rb_str_cat2( str, " " );
1108
+ asStr = rb_inspect(input);
1109
+ if ( RSTRING_LEN(asStr) > 30 )
1110
+ {
1111
+ str = rb_str_cat( str, StringValuePtr(asStr), 30 );
1112
+ str = rb_str_cat2( str, "..." );
1113
+ }
1114
+ else
1115
+ {
1116
+ str = rb_str_append( str, asStr );
1117
+ }
1118
+
1119
+ if ( name )
1120
+ {
1121
+ str = rb_str_cat2( str, "\n\tin SWIG method '" );
1122
+ str = rb_str_cat2( str, name );
1123
+ str = rb_str_cat2( str, "'" );
1124
+ }
1125
+
1126
+ return StringValuePtr( str );
1127
+ }
1128
+
1129
+ /* This function is called when an overloaded method fails */
1130
+ SWIGINTERN
1131
+ void Ruby_Format_OverloadedError(
1132
+ const int argc,
1133
+ const int maxargs,
1134
+ const char* method,
1135
+ const char* prototypes
1136
+ )
1137
+ {
1138
+ const char* msg = "Wrong # of arguments";
1139
+ if ( argc <= maxargs ) msg = "Wrong arguments";
1140
+ rb_raise(rb_eArgError,"%s for overloaded method '%s'.\n"
1141
+ "Possible C/C++ prototypes are:\n%s",
1142
+ msg, method, prototypes);
1143
+ }
1144
+
1145
+ /* -----------------------------------------------------------------------------
1146
+ * rubytracking.swg
1147
+ *
1148
+ * This file contains support for tracking mappings from
1149
+ * Ruby objects to C++ objects. This functionality is needed
1150
+ * to implement mark functions for Ruby's mark and sweep
1151
+ * garbage collector.
1152
+ * ----------------------------------------------------------------------------- */
1153
+
1154
+ #ifdef __cplusplus
1155
+ extern "C" {
1156
+ #endif
1157
+
1158
+ /* Ruby 1.8 actually assumes the first case. */
1159
+ #if SIZEOF_VOIDP == SIZEOF_LONG
1160
+ # define SWIG2NUM(v) LONG2NUM((unsigned long)v)
1161
+ # define NUM2SWIG(x) (unsigned long)NUM2LONG(x)
1162
+ #elif SIZEOF_VOIDP == SIZEOF_LONG_LONG
1163
+ # define SWIG2NUM(v) LL2NUM((unsigned long long)v)
1164
+ # define NUM2SWIG(x) (unsigned long long)NUM2LL(x)
1165
+ #else
1166
+ # error sizeof(void*) is not the same as long or long long
1167
+ #endif
1168
+
1169
+
1170
+ /* Global Ruby hash table to store Trackings from C/C++
1171
+ structs to Ruby Objects.
1172
+ */
1173
+ static VALUE swig_ruby_trackings = Qnil;
1174
+
1175
+ /* Global variable that stores a reference to the ruby
1176
+ hash table delete function. */
1177
+ static ID swig_ruby_hash_delete;
1178
+
1179
+ /* Setup a Ruby hash table to store Trackings */
1180
+ SWIGRUNTIME void SWIG_RubyInitializeTrackings(void) {
1181
+ /* Create a ruby hash table to store Trackings from C++
1182
+ objects to Ruby objects. */
1183
+
1184
+ /* Try to see if some other .so has already created a
1185
+ tracking hash table, which we keep hidden in an instance var
1186
+ in the SWIG module.
1187
+ This is done to allow multiple DSOs to share the same
1188
+ tracking table.
1189
+ */
1190
+ ID trackings_id = rb_intern( "@__trackings__" );
1191
+ VALUE verbose = rb_gv_get("VERBOSE");
1192
+ rb_gv_set("VERBOSE", Qfalse);
1193
+ swig_ruby_trackings = rb_ivar_get( _mSWIG, trackings_id );
1194
+ rb_gv_set("VERBOSE", verbose);
1195
+
1196
+ /* No, it hasn't. Create one ourselves */
1197
+ if ( swig_ruby_trackings == Qnil )
1198
+ {
1199
+ swig_ruby_trackings = rb_hash_new();
1200
+ rb_ivar_set( _mSWIG, trackings_id, swig_ruby_trackings );
1201
+ }
1202
+
1203
+ /* Now store a reference to the hash table delete function
1204
+ so that we only have to look it up once.*/
1205
+ swig_ruby_hash_delete = rb_intern("delete");
1206
+ }
1207
+
1208
+ /* Get a Ruby number to reference a pointer */
1209
+ SWIGRUNTIME VALUE SWIG_RubyPtrToReference(void* ptr) {
1210
+ /* We cast the pointer to an unsigned long
1211
+ and then store a reference to it using
1212
+ a Ruby number object. */
1213
+
1214
+ /* Convert the pointer to a Ruby number */
1215
+ return SWIG2NUM(ptr);
1216
+ }
1217
+
1218
+ /* Get a Ruby number to reference an object */
1219
+ SWIGRUNTIME VALUE SWIG_RubyObjectToReference(VALUE object) {
1220
+ /* We cast the object to an unsigned long
1221
+ and then store a reference to it using
1222
+ a Ruby number object. */
1223
+
1224
+ /* Convert the Object to a Ruby number */
1225
+ return SWIG2NUM(object);
1226
+ }
1227
+
1228
+ /* Get a Ruby object from a previously stored reference */
1229
+ SWIGRUNTIME VALUE SWIG_RubyReferenceToObject(VALUE reference) {
1230
+ /* The provided Ruby number object is a reference
1231
+ to the Ruby object we want.*/
1232
+
1233
+ /* Convert the Ruby number to a Ruby object */
1234
+ return NUM2SWIG(reference);
1235
+ }
1236
+
1237
+ /* Add a Tracking from a C/C++ struct to a Ruby object */
1238
+ SWIGRUNTIME void SWIG_RubyAddTracking(void* ptr, VALUE object) {
1239
+ /* In a Ruby hash table we store the pointer and
1240
+ the associated Ruby object. The trick here is
1241
+ that we cannot store the Ruby object directly - if
1242
+ we do then it cannot be garbage collected. So
1243
+ instead we typecast it as a unsigned long and
1244
+ convert it to a Ruby number object.*/
1245
+
1246
+ /* Get a reference to the pointer as a Ruby number */
1247
+ VALUE key = SWIG_RubyPtrToReference(ptr);
1248
+
1249
+ /* Get a reference to the Ruby object as a Ruby number */
1250
+ VALUE value = SWIG_RubyObjectToReference(object);
1251
+
1252
+ /* Store the mapping to the global hash table. */
1253
+ rb_hash_aset(swig_ruby_trackings, key, value);
1254
+ }
1255
+
1256
+ /* Get the Ruby object that owns the specified C/C++ struct */
1257
+ SWIGRUNTIME VALUE SWIG_RubyInstanceFor(void* ptr) {
1258
+ /* Get a reference to the pointer as a Ruby number */
1259
+ VALUE key = SWIG_RubyPtrToReference(ptr);
1260
+
1261
+ /* Now lookup the value stored in the global hash table */
1262
+ VALUE value = rb_hash_aref(swig_ruby_trackings, key);
1263
+
1264
+ if (value == Qnil) {
1265
+ /* No object exists - return nil. */
1266
+ return Qnil;
1267
+ }
1268
+ else {
1269
+ /* Convert this value to Ruby object */
1270
+ return SWIG_RubyReferenceToObject(value);
1271
+ }
1272
+ }
1273
+
1274
+ /* Remove a Tracking from a C/C++ struct to a Ruby object. It
1275
+ is very important to remove objects once they are destroyed
1276
+ since the same memory address may be reused later to create
1277
+ a new object. */
1278
+ SWIGRUNTIME void SWIG_RubyRemoveTracking(void* ptr) {
1279
+ /* Get a reference to the pointer as a Ruby number */
1280
+ VALUE key = SWIG_RubyPtrToReference(ptr);
1281
+
1282
+ /* Delete the object from the hash table by calling Ruby's
1283
+ do this we need to call the Hash.delete method.*/
1284
+ rb_funcall(swig_ruby_trackings, swig_ruby_hash_delete, 1, key);
1285
+ }
1286
+
1287
+ /* This is a helper method that unlinks a Ruby object from its
1288
+ underlying C++ object. This is needed if the lifetime of the
1289
+ Ruby object is longer than the C++ object */
1290
+ SWIGRUNTIME void SWIG_RubyUnlinkObjects(void* ptr) {
1291
+ VALUE object = SWIG_RubyInstanceFor(ptr);
1292
+
1293
+ if (object != Qnil) {
1294
+ DATA_PTR(object) = 0;
1295
+ }
1296
+ }
1297
+
1298
+
1299
+ #ifdef __cplusplus
1300
+ }
1301
+ #endif
1302
+
1303
+ /* -----------------------------------------------------------------------------
1304
+ * Ruby API portion that goes into the runtime
1305
+ * ----------------------------------------------------------------------------- */
1306
+
1307
+ #ifdef __cplusplus
1308
+ extern "C" {
1309
+ #endif
1310
+
1311
+ SWIGINTERN VALUE
1312
+ SWIG_Ruby_AppendOutput(VALUE target, VALUE o) {
1313
+ if (NIL_P(target)) {
1314
+ target = o;
1315
+ } else {
1316
+ if (TYPE(target) != T_ARRAY) {
1317
+ VALUE o2 = target;
1318
+ target = rb_ary_new();
1319
+ rb_ary_push(target, o2);
1320
+ }
1321
+ rb_ary_push(target, o);
1322
+ }
1323
+ return target;
1324
+ }
1325
+
1326
+ /* For ruby1.8.4 and earlier. */
1327
+ #ifndef RUBY_INIT_STACK
1328
+ RUBY_EXTERN void Init_stack(VALUE* addr);
1329
+ # define RUBY_INIT_STACK \
1330
+ VALUE variable_in_this_stack_frame; \
1331
+ Init_stack(&variable_in_this_stack_frame);
1332
+ #endif
1333
+
1334
+
1335
+ #ifdef __cplusplus
1336
+ }
1337
+ #endif
1338
+
1339
+
1340
+ /* -----------------------------------------------------------------------------
1341
+ * rubyrun.swg
1342
+ *
1343
+ * This file contains the runtime support for Ruby modules
1344
+ * and includes code for managing global variables and pointer
1345
+ * type checking.
1346
+ * ----------------------------------------------------------------------------- */
1347
+
1348
+ /* For backward compatibility only */
1349
+ #define SWIG_POINTER_EXCEPTION 0
1350
+
1351
+ /* for raw pointers */
1352
+ #define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
1353
+ #define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, own)
1354
+ #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Ruby_NewPointerObj(ptr, type, flags)
1355
+ #define SWIG_AcquirePtr(ptr, own) SWIG_Ruby_AcquirePtr(ptr, own)
1356
+ #define swig_owntype ruby_owntype
1357
+
1358
+ /* for raw packed data */
1359
+ #define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty, flags)
1360
+ #define SWIG_NewPackedObj(ptr, sz, type) SWIG_Ruby_NewPackedObj(ptr, sz, type)
1361
+
1362
+ /* for class or struct pointers */
1363
+ #define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags)
1364
+ #define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags)
1365
+
1366
+ /* for C or C++ function pointers */
1367
+ #define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_ConvertPtr(obj, pptr, type, 0)
1368
+ #define SWIG_NewFunctionPtrObj(ptr, type) SWIG_NewPointerObj(ptr, type, 0)
1369
+
1370
+ /* for C++ member pointers, ie, member methods */
1371
+ #define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty)
1372
+ #define SWIG_NewMemberObj(ptr, sz, type) SWIG_Ruby_NewPackedObj(ptr, sz, type)
1373
+
1374
+
1375
+ /* Runtime API */
1376
+
1377
+ #define SWIG_GetModule(clientdata) SWIG_Ruby_GetModule()
1378
+ #define SWIG_SetModule(clientdata, pointer) SWIG_Ruby_SetModule(pointer)
1379
+
1380
+
1381
+ /* Error manipulation */
1382
+
1383
+ #define SWIG_ErrorType(code) SWIG_Ruby_ErrorType(code)
1384
+ #define SWIG_Error(code, msg) rb_raise(SWIG_Ruby_ErrorType(code), "%s", msg)
1385
+ #define SWIG_fail goto fail
1386
+
1387
+
1388
+ /* Ruby-specific SWIG API */
1389
+
1390
+ #define SWIG_InitRuntime() SWIG_Ruby_InitRuntime()
1391
+ #define SWIG_define_class(ty) SWIG_Ruby_define_class(ty)
1392
+ #define SWIG_NewClassInstance(value, ty) SWIG_Ruby_NewClassInstance(value, ty)
1393
+ #define SWIG_MangleStr(value) SWIG_Ruby_MangleStr(value)
1394
+ #define SWIG_CheckConvert(value, ty) SWIG_Ruby_CheckConvert(value, ty)
1395
+
1396
+ #include "assert.h"
1397
+
1398
+ /* -----------------------------------------------------------------------------
1399
+ * pointers/data manipulation
1400
+ * ----------------------------------------------------------------------------- */
1401
+
1402
+ #ifdef __cplusplus
1403
+ extern "C" {
1404
+ #endif
1405
+
1406
+ typedef struct {
1407
+ VALUE klass;
1408
+ VALUE mImpl;
1409
+ void (*mark)(void *);
1410
+ void (*destroy)(void *);
1411
+ int trackObjects;
1412
+ } swig_class;
1413
+
1414
+
1415
+ /* Global pointer used to keep some internal SWIG stuff */
1416
+ static VALUE _cSWIG_Pointer = Qnil;
1417
+ static VALUE swig_runtime_data_type_pointer = Qnil;
1418
+
1419
+ /* Global IDs used to keep some internal SWIG stuff */
1420
+ static ID swig_arity_id = 0;
1421
+ static ID swig_call_id = 0;
1422
+
1423
+ /*
1424
+ If your swig extension is to be run within an embedded ruby and has
1425
+ director callbacks, you should set -DRUBY_EMBEDDED during compilation.
1426
+ This will reset ruby's stack frame on each entry point from the main
1427
+ program the first time a virtual director function is invoked (in a
1428
+ non-recursive way).
1429
+ If this is not done, you run the risk of Ruby trashing the stack.
1430
+ */
1431
+
1432
+ #ifdef RUBY_EMBEDDED
1433
+
1434
+ # define SWIG_INIT_STACK \
1435
+ if ( !swig_virtual_calls ) { RUBY_INIT_STACK } \
1436
+ ++swig_virtual_calls;
1437
+ # define SWIG_RELEASE_STACK --swig_virtual_calls;
1438
+ # define Ruby_DirectorTypeMismatchException(x) \
1439
+ rb_raise( rb_eTypeError, "%s", x ); return c_result;
1440
+
1441
+ static unsigned int swig_virtual_calls = 0;
1442
+
1443
+ #else /* normal non-embedded extension */
1444
+
1445
+ # define SWIG_INIT_STACK
1446
+ # define SWIG_RELEASE_STACK
1447
+ # define Ruby_DirectorTypeMismatchException(x) \
1448
+ throw Swig::DirectorTypeMismatchException( x );
1449
+
1450
+ #endif /* RUBY_EMBEDDED */
1451
+
1452
+
1453
+ SWIGRUNTIME VALUE
1454
+ getExceptionClass(void) {
1455
+ static int init = 0;
1456
+ static VALUE rubyExceptionClass ;
1457
+ if (!init) {
1458
+ init = 1;
1459
+ rubyExceptionClass = rb_const_get(_mSWIG, rb_intern("Exception"));
1460
+ }
1461
+ return rubyExceptionClass;
1462
+ }
1463
+
1464
+ /* This code checks to see if the Ruby object being raised as part
1465
+ of an exception inherits from the Ruby class Exception. If so,
1466
+ the object is simply returned. If not, then a new Ruby exception
1467
+ object is created and that will be returned to Ruby.*/
1468
+ SWIGRUNTIME VALUE
1469
+ SWIG_Ruby_ExceptionType(swig_type_info *desc, VALUE obj) {
1470
+ VALUE exceptionClass = getExceptionClass();
1471
+ if (rb_obj_is_kind_of(obj, exceptionClass)) {
1472
+ return obj;
1473
+ } else {
1474
+ return rb_exc_new3(rb_eRuntimeError, rb_obj_as_string(obj));
1475
+ }
1476
+ }
1477
+
1478
+ /* Initialize Ruby runtime support */
1479
+ SWIGRUNTIME void
1480
+ SWIG_Ruby_InitRuntime(void)
1481
+ {
1482
+ if (_mSWIG == Qnil) {
1483
+ _mSWIG = rb_define_module("SWIG");
1484
+ swig_call_id = rb_intern("call");
1485
+ swig_arity_id = rb_intern("arity");
1486
+ }
1487
+ }
1488
+
1489
+ /* Define Ruby class for C type */
1490
+ SWIGRUNTIME void
1491
+ SWIG_Ruby_define_class(swig_type_info *type)
1492
+ {
1493
+ VALUE klass;
1494
+ char *klass_name = (char *) malloc(4 + strlen(type->name) + 1);
1495
+ sprintf(klass_name, "TYPE%s", type->name);
1496
+ if (NIL_P(_cSWIG_Pointer)) {
1497
+ _cSWIG_Pointer = rb_define_class_under(_mSWIG, "Pointer", rb_cObject);
1498
+ rb_undef_method(CLASS_OF(_cSWIG_Pointer), "new");
1499
+ }
1500
+ klass = rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer);
1501
+ free((void *) klass_name);
1502
+ }
1503
+
1504
+ /* Create a new pointer object */
1505
+ SWIGRUNTIME VALUE
1506
+ SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags)
1507
+ {
1508
+ int own = flags & SWIG_POINTER_OWN;
1509
+ int track;
1510
+ char *klass_name;
1511
+ swig_class *sklass;
1512
+ VALUE klass;
1513
+ VALUE obj;
1514
+
1515
+ if (!ptr)
1516
+ return Qnil;
1517
+
1518
+ if (type->clientdata) {
1519
+ sklass = (swig_class *) type->clientdata;
1520
+
1521
+ /* Are we tracking this class and have we already returned this Ruby object? */
1522
+ track = sklass->trackObjects;
1523
+ if (track) {
1524
+ obj = SWIG_RubyInstanceFor(ptr);
1525
+
1526
+ /* Check the object's type and make sure it has the correct type.
1527
+ It might not in cases where methods do things like
1528
+ downcast methods. */
1529
+ if (obj != Qnil) {
1530
+ VALUE value = rb_iv_get(obj, "@__swigtype__");
1531
+ const char* type_name = RSTRING_PTR(value);
1532
+
1533
+ if (strcmp(type->name, type_name) == 0) {
1534
+ return obj;
1535
+ }
1536
+ }
1537
+ }
1538
+
1539
+ /* Create a new Ruby object */
1540
+ obj = Data_Wrap_Struct(sklass->klass, VOIDFUNC(sklass->mark),
1541
+ ( own ? VOIDFUNC(sklass->destroy) :
1542
+ (track ? VOIDFUNC(SWIG_RubyRemoveTracking) : 0 )
1543
+ ), ptr);
1544
+
1545
+ /* If tracking is on for this class then track this object. */
1546
+ if (track) {
1547
+ SWIG_RubyAddTracking(ptr, obj);
1548
+ }
1549
+ } else {
1550
+ klass_name = (char *) malloc(4 + strlen(type->name) + 1);
1551
+ sprintf(klass_name, "TYPE%s", type->name);
1552
+ klass = rb_const_get(_mSWIG, rb_intern(klass_name));
1553
+ free((void *) klass_name);
1554
+ obj = Data_Wrap_Struct(klass, 0, 0, ptr);
1555
+ }
1556
+ rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name));
1557
+
1558
+ return obj;
1559
+ }
1560
+
1561
+ /* Create a new class instance (always owned) */
1562
+ SWIGRUNTIME VALUE
1563
+ SWIG_Ruby_NewClassInstance(VALUE klass, swig_type_info *type)
1564
+ {
1565
+ VALUE obj;
1566
+ swig_class *sklass = (swig_class *) type->clientdata;
1567
+ obj = Data_Wrap_Struct(klass, VOIDFUNC(sklass->mark), VOIDFUNC(sklass->destroy), 0);
1568
+ rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name));
1569
+ return obj;
1570
+ }
1571
+
1572
+ /* Get type mangle from class name */
1573
+ SWIGRUNTIMEINLINE char *
1574
+ SWIG_Ruby_MangleStr(VALUE obj)
1575
+ {
1576
+ VALUE stype = rb_iv_get(obj, "@__swigtype__");
1577
+ return StringValuePtr(stype);
1578
+ }
1579
+
1580
+ /* Acquire a pointer value */
1581
+ typedef void (*ruby_owntype)(void*);
1582
+
1583
+ SWIGRUNTIME ruby_owntype
1584
+ SWIG_Ruby_AcquirePtr(VALUE obj, ruby_owntype own) {
1585
+ if (obj) {
1586
+ ruby_owntype oldown = RDATA(obj)->dfree;
1587
+ RDATA(obj)->dfree = own;
1588
+ return oldown;
1589
+ } else {
1590
+ return 0;
1591
+ }
1592
+ }
1593
+
1594
+ /* Convert a pointer value */
1595
+ SWIGRUNTIME int
1596
+ SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags, ruby_owntype *own)
1597
+ {
1598
+ char *c;
1599
+ swig_cast_info *tc;
1600
+ void *vptr = 0;
1601
+
1602
+ /* Grab the pointer */
1603
+ if (NIL_P(obj)) {
1604
+ *ptr = 0;
1605
+ return SWIG_OK;
1606
+ } else {
1607
+ if (TYPE(obj) != T_DATA) {
1608
+ return SWIG_ERROR;
1609
+ }
1610
+ Data_Get_Struct(obj, void, vptr);
1611
+ }
1612
+
1613
+ if (own) *own = RDATA(obj)->dfree;
1614
+
1615
+ /* Check to see if the input object is giving up ownership
1616
+ of the underlying C struct or C++ object. If so then we
1617
+ need to reset the destructor since the Ruby object no
1618
+ longer owns the underlying C++ object.*/
1619
+ if (flags & SWIG_POINTER_DISOWN) {
1620
+ /* Is tracking on for this class? */
1621
+ int track = 0;
1622
+ if (ty && ty->clientdata) {
1623
+ swig_class *sklass = (swig_class *) ty->clientdata;
1624
+ track = sklass->trackObjects;
1625
+ }
1626
+
1627
+ if (track) {
1628
+ /* We are tracking objects for this class. Thus we change the destructor
1629
+ * to SWIG_RubyRemoveTracking. This allows us to
1630
+ * remove the mapping from the C++ to Ruby object
1631
+ * when the Ruby object is garbage collected. If we don't
1632
+ * do this, then it is possible we will return a reference
1633
+ * to a Ruby object that no longer exists thereby crashing Ruby. */
1634
+ RDATA(obj)->dfree = SWIG_RubyRemoveTracking;
1635
+ } else {
1636
+ RDATA(obj)->dfree = 0;
1637
+ }
1638
+ }
1639
+
1640
+ /* Do type-checking if type info was provided */
1641
+ if (ty) {
1642
+ if (ty->clientdata) {
1643
+ if (rb_obj_is_kind_of(obj, ((swig_class *) (ty->clientdata))->klass)) {
1644
+ if (vptr == 0) {
1645
+ /* The object has already been deleted */
1646
+ return SWIG_ObjectPreviouslyDeletedError;
1647
+ }
1648
+ *ptr = vptr;
1649
+ return SWIG_OK;
1650
+ }
1651
+ }
1652
+ if ((c = SWIG_MangleStr(obj)) == NULL) {
1653
+ return SWIG_ERROR;
1654
+ }
1655
+ tc = SWIG_TypeCheck(c, ty);
1656
+ if (!tc) {
1657
+ return SWIG_ERROR;
1658
+ } else {
1659
+ int newmemory = 0;
1660
+ *ptr = SWIG_TypeCast(tc, vptr, &newmemory);
1661
+ assert(!newmemory); /* newmemory handling not yet implemented */
1662
+ }
1663
+ } else {
1664
+ *ptr = vptr;
1665
+ }
1666
+
1667
+ return SWIG_OK;
1668
+ }
1669
+
1670
+ /* Check convert */
1671
+ SWIGRUNTIMEINLINE int
1672
+ SWIG_Ruby_CheckConvert(VALUE obj, swig_type_info *ty)
1673
+ {
1674
+ char *c = SWIG_MangleStr(obj);
1675
+ if (!c) return 0;
1676
+ return SWIG_TypeCheck(c,ty) != 0;
1677
+ }
1678
+
1679
+ SWIGRUNTIME VALUE
1680
+ SWIG_Ruby_NewPackedObj(void *ptr, int sz, swig_type_info *type) {
1681
+ char result[1024];
1682
+ char *r = result;
1683
+ if ((2*sz + 1 + strlen(type->name)) > 1000) return 0;
1684
+ *(r++) = '_';
1685
+ r = SWIG_PackData(r, ptr, sz);
1686
+ strcpy(r, type->name);
1687
+ return rb_str_new2(result);
1688
+ }
1689
+
1690
+ /* Convert a packed value value */
1691
+ SWIGRUNTIME int
1692
+ SWIG_Ruby_ConvertPacked(VALUE obj, void *ptr, int sz, swig_type_info *ty) {
1693
+ swig_cast_info *tc;
1694
+ const char *c;
1695
+
1696
+ if (TYPE(obj) != T_STRING) goto type_error;
1697
+ c = StringValuePtr(obj);
1698
+ /* Pointer values must start with leading underscore */
1699
+ if (*c != '_') goto type_error;
1700
+ c++;
1701
+ c = SWIG_UnpackData(c, ptr, sz);
1702
+ if (ty) {
1703
+ tc = SWIG_TypeCheck(c, ty);
1704
+ if (!tc) goto type_error;
1705
+ }
1706
+ return SWIG_OK;
1707
+
1708
+ type_error:
1709
+ return SWIG_ERROR;
1710
+ }
1711
+
1712
+ SWIGRUNTIME swig_module_info *
1713
+ SWIG_Ruby_GetModule(void)
1714
+ {
1715
+ VALUE pointer;
1716
+ swig_module_info *ret = 0;
1717
+ VALUE verbose = rb_gv_get("VERBOSE");
1718
+
1719
+ /* temporarily disable warnings, since the pointer check causes warnings with 'ruby -w' */
1720
+ rb_gv_set("VERBOSE", Qfalse);
1721
+
1722
+ /* first check if pointer already created */
1723
+ pointer = rb_gv_get("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
1724
+ if (pointer != Qnil) {
1725
+ Data_Get_Struct(pointer, swig_module_info, ret);
1726
+ }
1727
+
1728
+ /* reinstate warnings */
1729
+ rb_gv_set("VERBOSE", verbose);
1730
+ return ret;
1731
+ }
1732
+
1733
+ SWIGRUNTIME void
1734
+ SWIG_Ruby_SetModule(swig_module_info *pointer)
1735
+ {
1736
+ /* register a new class */
1737
+ VALUE cl = rb_define_class("swig_runtime_data", rb_cObject);
1738
+ /* create and store the structure pointer to a global variable */
1739
+ swig_runtime_data_type_pointer = Data_Wrap_Struct(cl, 0, 0, pointer);
1740
+ rb_define_readonly_variable("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, &swig_runtime_data_type_pointer);
1741
+ }
1742
+
1743
+ /* This function can be used to check whether a proc or method or similarly
1744
+ callable function has been passed. Usually used in a %typecheck, like:
1745
+
1746
+ %typecheck(c_callback_t, precedence=SWIG_TYPECHECK_POINTER) {
1747
+ $result = SWIG_Ruby_isCallable( $input );
1748
+ }
1749
+ */
1750
+ SWIGINTERN
1751
+ int SWIG_Ruby_isCallable( VALUE proc )
1752
+ {
1753
+ if ( rb_respond_to( proc, swig_call_id ) == Qtrue )
1754
+ return 1;
1755
+ return 0;
1756
+ }
1757
+
1758
+ /* This function can be used to check the arity (number of arguments)
1759
+ a proc or method can take. Usually used in a %typecheck.
1760
+ Valid arities will be that equal to minimal or those < 0
1761
+ which indicate a variable number of parameters at the end.
1762
+ */
1763
+ SWIGINTERN
1764
+ int SWIG_Ruby_arity( VALUE proc, int minimal )
1765
+ {
1766
+ if ( rb_respond_to( proc, swig_arity_id ) == Qtrue )
1767
+ {
1768
+ VALUE num = rb_funcall( proc, swig_arity_id, 0 );
1769
+ int arity = NUM2INT(num);
1770
+ if ( arity < 0 && (arity+1) < -minimal ) return 1;
1771
+ if ( arity == minimal ) return 1;
1772
+ return 1;
1773
+ }
1774
+ return 0;
1775
+ }
1776
+
1777
+
1778
+ #ifdef __cplusplus
1779
+ }
1780
+ #endif
1781
+
1782
+
1783
+
1784
+ #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0)
1785
+
1786
+ #define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else
1787
+
1788
+
1789
+
1790
+ /* -------- TYPES TABLE (BEGIN) -------- */
1791
+
1792
+ #define SWIGTYPE_p_char swig_types[0]
1793
+ #define SWIGTYPE_p_int swig_types[1]
1794
+ #define SWIGTYPE_p_long_long swig_types[2]
1795
+ #define SWIGTYPE_p_short swig_types[3]
1796
+ #define SWIGTYPE_p_signed_char swig_types[4]
1797
+ #define SWIGTYPE_p_unsigned_char swig_types[5]
1798
+ #define SWIGTYPE_p_unsigned_int swig_types[6]
1799
+ #define SWIGTYPE_p_unsigned_long_long swig_types[7]
1800
+ #define SWIGTYPE_p_unsigned_short swig_types[8]
1801
+ #define SWIGTYPE_p_ws2811_channel_t swig_types[9]
1802
+ #define SWIGTYPE_p_ws2811_device swig_types[10]
1803
+ #define SWIGTYPE_p_ws2811_t swig_types[11]
1804
+ static swig_type_info *swig_types[13];
1805
+ static swig_module_info swig_module = {swig_types, 12, 0, 0, 0, 0};
1806
+ #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
1807
+ #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
1808
+
1809
+ /* -------- TYPES TABLE (END) -------- */
1810
+
1811
+ #define SWIG_init Init_lowlevel
1812
+ #define SWIG_name "Ws2812::Lowlevel"
1813
+
1814
+ static VALUE mLowlevel;
1815
+
1816
+ #define SWIG_RUBY_THREAD_BEGIN_BLOCK
1817
+ #define SWIG_RUBY_THREAD_END_BLOCK
1818
+
1819
+
1820
+ #define SWIGVERSION 0x020007
1821
+ #define SWIG_VERSION SWIGVERSION
1822
+
1823
+
1824
+ #define SWIG_as_voidptr(a) (void *)((const void *)(a))
1825
+ #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a))
1826
+
1827
+
1828
+ #include <stdint.h> // Use the C99 official header
1829
+
1830
+
1831
+ #include "ws2811.h"
1832
+
1833
+
1834
+ #include <limits.h>
1835
+ #if !defined(SWIG_NO_LLONG_MAX)
1836
+ # if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
1837
+ # define LLONG_MAX __LONG_LONG_MAX__
1838
+ # define LLONG_MIN (-LLONG_MAX - 1LL)
1839
+ # define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
1840
+ # endif
1841
+ #endif
1842
+
1843
+
1844
+ #define SWIG_From_long LONG2NUM
1845
+
1846
+
1847
+ SWIGINTERNINLINE VALUE
1848
+ SWIG_From_int (int value)
1849
+ {
1850
+ return SWIG_From_long (value);
1851
+ }
1852
+
1853
+
1854
+ SWIGINTERN VALUE
1855
+ SWIG_ruby_failed(void)
1856
+ {
1857
+ return Qnil;
1858
+ }
1859
+
1860
+
1861
+ /*@SWIG:/usr/share/swig2.0/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
1862
+ SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE *args)
1863
+ {
1864
+ VALUE obj = args[0];
1865
+ VALUE type = TYPE(obj);
1866
+ long *res = (long *)(args[1]);
1867
+ *res = type == T_FIXNUM ? NUM2LONG(obj) : rb_big2long(obj);
1868
+ return obj;
1869
+ }
1870
+ /*@SWIG@*/
1871
+
1872
+ SWIGINTERN int
1873
+ SWIG_AsVal_long (VALUE obj, long* val)
1874
+ {
1875
+ VALUE type = TYPE(obj);
1876
+ if ((type == T_FIXNUM) || (type == T_BIGNUM)) {
1877
+ long v;
1878
+ VALUE a[2];
1879
+ a[0] = obj;
1880
+ a[1] = (VALUE)(&v);
1881
+ if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2LONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
1882
+ if (val) *val = v;
1883
+ return SWIG_OK;
1884
+ }
1885
+ }
1886
+ return SWIG_TypeError;
1887
+ }
1888
+
1889
+
1890
+ SWIGINTERN int
1891
+ SWIG_AsVal_int (VALUE obj, int *val)
1892
+ {
1893
+ long v;
1894
+ int res = SWIG_AsVal_long (obj, &v);
1895
+ if (SWIG_IsOK(res)) {
1896
+ if ((v < INT_MIN || v > INT_MAX)) {
1897
+ return SWIG_OverflowError;
1898
+ } else {
1899
+ if (val) *val = (int)(v);
1900
+ }
1901
+ }
1902
+ return res;
1903
+ }
1904
+
1905
+
1906
+ /*@SWIG:/usr/share/swig2.0/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
1907
+ SWIGINTERN VALUE SWIG_AUX_NUM2ULONG(VALUE *args)
1908
+ {
1909
+ VALUE obj = args[0];
1910
+ VALUE type = TYPE(obj);
1911
+ unsigned long *res = (unsigned long *)(args[1]);
1912
+ *res = type == T_FIXNUM ? NUM2ULONG(obj) : rb_big2ulong(obj);
1913
+ return obj;
1914
+ }
1915
+ /*@SWIG@*/
1916
+
1917
+ SWIGINTERN int
1918
+ SWIG_AsVal_unsigned_SS_long (VALUE obj, unsigned long *val)
1919
+ {
1920
+ VALUE type = TYPE(obj);
1921
+ if ((type == T_FIXNUM) || (type == T_BIGNUM)) {
1922
+ unsigned long v;
1923
+ VALUE a[2];
1924
+ a[0] = obj;
1925
+ a[1] = (VALUE)(&v);
1926
+ if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2ULONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
1927
+ if (val) *val = v;
1928
+ return SWIG_OK;
1929
+ }
1930
+ }
1931
+ return SWIG_TypeError;
1932
+ }
1933
+
1934
+
1935
+ SWIGINTERN int
1936
+ SWIG_AsVal_unsigned_SS_int (VALUE obj, unsigned int *val)
1937
+ {
1938
+ unsigned long v;
1939
+ int res = SWIG_AsVal_unsigned_SS_long (obj, &v);
1940
+ if (SWIG_IsOK(res)) {
1941
+ if ((v > UINT_MAX)) {
1942
+ return SWIG_OverflowError;
1943
+ } else {
1944
+ if (val) *val = (unsigned int)(v);
1945
+ }
1946
+ }
1947
+ return res;
1948
+ }
1949
+
1950
+
1951
+ SWIGINTERNINLINE VALUE
1952
+ SWIG_From_unsigned_SS_long (unsigned long value)
1953
+ {
1954
+ return ULONG2NUM(value);
1955
+ }
1956
+
1957
+
1958
+ SWIGINTERNINLINE VALUE
1959
+ SWIG_From_unsigned_SS_int (unsigned int value)
1960
+ {
1961
+ return SWIG_From_unsigned_SS_long (value);
1962
+ }
1963
+
1964
+
1965
+ SWIGINTERNINLINE VALUE
1966
+ SWIG_From_unsigned_SS_char (unsigned char value)
1967
+ {
1968
+ return SWIG_From_unsigned_SS_long (value);
1969
+ }
1970
+
1971
+
1972
+ SWIGINTERN int
1973
+ SWIG_AsVal_unsigned_SS_char (VALUE obj, unsigned char *val)
1974
+ {
1975
+ unsigned long v;
1976
+ int res = SWIG_AsVal_unsigned_SS_long (obj, &v);
1977
+ if (SWIG_IsOK(res)) {
1978
+ if ((v > UCHAR_MAX)) {
1979
+ return SWIG_OverflowError;
1980
+ } else {
1981
+ if (val) *val = (unsigned char)(v);
1982
+ }
1983
+ }
1984
+ return res;
1985
+ }
1986
+
1987
+
1988
+ uint32_t ws2811_led_get(ws2811_channel_t *channel, int lednum)
1989
+ {
1990
+ if (lednum >= channel->count)
1991
+ {
1992
+ return -1;
1993
+ }
1994
+
1995
+ return channel->leds[lednum];
1996
+ }
1997
+
1998
+ int ws2811_led_set(ws2811_channel_t *channel, int lednum, uint32_t color)
1999
+ {
2000
+ if (lednum >= channel->count)
2001
+ {
2002
+ return -1;
2003
+ }
2004
+
2005
+ channel->leds[lednum] = color;
2006
+
2007
+ return 0;
2008
+ }
2009
+
2010
+ ws2811_channel_t *ws2811_channel_get(ws2811_t *ws, int channelnum)
2011
+ {
2012
+ return &ws->channel[channelnum];
2013
+ }
2014
+
2015
+ static swig_class SwigClassWs2811_channel_t;
2016
+
2017
+ SWIGINTERN VALUE
2018
+ _wrap_ws2811_channel_t_gpionum_set(int argc, VALUE *argv, VALUE self) {
2019
+ ws2811_channel_t *arg1 = (ws2811_channel_t *) 0 ;
2020
+ int arg2 ;
2021
+ void *argp1 = 0 ;
2022
+ int res1 = 0 ;
2023
+ int val2 ;
2024
+ int ecode2 = 0 ;
2025
+
2026
+ if ((argc < 1) || (argc > 1)) {
2027
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2028
+ }
2029
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ws2811_channel_t, 0 | 0 );
2030
+ if (!SWIG_IsOK(res1)) {
2031
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ws2811_channel_t *","gpionum", 1, self ));
2032
+ }
2033
+ arg1 = (ws2811_channel_t *)(argp1);
2034
+ ecode2 = SWIG_AsVal_int(argv[0], &val2);
2035
+ if (!SWIG_IsOK(ecode2)) {
2036
+ SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","gpionum", 2, argv[0] ));
2037
+ }
2038
+ arg2 = (int)(val2);
2039
+ if (arg1) (arg1)->gpionum = arg2;
2040
+ return Qnil;
2041
+ fail:
2042
+ return Qnil;
2043
+ }
2044
+
2045
+
2046
+ SWIGINTERN VALUE
2047
+ _wrap_ws2811_channel_t_gpionum_get(int argc, VALUE *argv, VALUE self) {
2048
+ ws2811_channel_t *arg1 = (ws2811_channel_t *) 0 ;
2049
+ void *argp1 = 0 ;
2050
+ int res1 = 0 ;
2051
+ int result;
2052
+ VALUE vresult = Qnil;
2053
+
2054
+ if ((argc < 0) || (argc > 0)) {
2055
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2056
+ }
2057
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ws2811_channel_t, 0 | 0 );
2058
+ if (!SWIG_IsOK(res1)) {
2059
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ws2811_channel_t *","gpionum", 1, self ));
2060
+ }
2061
+ arg1 = (ws2811_channel_t *)(argp1);
2062
+ result = (int) ((arg1)->gpionum);
2063
+ vresult = SWIG_From_int((int)(result));
2064
+ return vresult;
2065
+ fail:
2066
+ return Qnil;
2067
+ }
2068
+
2069
+
2070
+ SWIGINTERN VALUE
2071
+ _wrap_ws2811_channel_t_invert_set(int argc, VALUE *argv, VALUE self) {
2072
+ ws2811_channel_t *arg1 = (ws2811_channel_t *) 0 ;
2073
+ int arg2 ;
2074
+ void *argp1 = 0 ;
2075
+ int res1 = 0 ;
2076
+ int val2 ;
2077
+ int ecode2 = 0 ;
2078
+
2079
+ if ((argc < 1) || (argc > 1)) {
2080
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2081
+ }
2082
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ws2811_channel_t, 0 | 0 );
2083
+ if (!SWIG_IsOK(res1)) {
2084
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ws2811_channel_t *","invert", 1, self ));
2085
+ }
2086
+ arg1 = (ws2811_channel_t *)(argp1);
2087
+ ecode2 = SWIG_AsVal_int(argv[0], &val2);
2088
+ if (!SWIG_IsOK(ecode2)) {
2089
+ SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","invert", 2, argv[0] ));
2090
+ }
2091
+ arg2 = (int)(val2);
2092
+ if (arg1) (arg1)->invert = arg2;
2093
+ return Qnil;
2094
+ fail:
2095
+ return Qnil;
2096
+ }
2097
+
2098
+
2099
+ SWIGINTERN VALUE
2100
+ _wrap_ws2811_channel_t_invert_get(int argc, VALUE *argv, VALUE self) {
2101
+ ws2811_channel_t *arg1 = (ws2811_channel_t *) 0 ;
2102
+ void *argp1 = 0 ;
2103
+ int res1 = 0 ;
2104
+ int result;
2105
+ VALUE vresult = Qnil;
2106
+
2107
+ if ((argc < 0) || (argc > 0)) {
2108
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2109
+ }
2110
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ws2811_channel_t, 0 | 0 );
2111
+ if (!SWIG_IsOK(res1)) {
2112
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ws2811_channel_t *","invert", 1, self ));
2113
+ }
2114
+ arg1 = (ws2811_channel_t *)(argp1);
2115
+ result = (int) ((arg1)->invert);
2116
+ vresult = SWIG_From_int((int)(result));
2117
+ return vresult;
2118
+ fail:
2119
+ return Qnil;
2120
+ }
2121
+
2122
+
2123
+ SWIGINTERN VALUE
2124
+ _wrap_ws2811_channel_t_count_set(int argc, VALUE *argv, VALUE self) {
2125
+ ws2811_channel_t *arg1 = (ws2811_channel_t *) 0 ;
2126
+ int arg2 ;
2127
+ void *argp1 = 0 ;
2128
+ int res1 = 0 ;
2129
+ int val2 ;
2130
+ int ecode2 = 0 ;
2131
+
2132
+ if ((argc < 1) || (argc > 1)) {
2133
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2134
+ }
2135
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ws2811_channel_t, 0 | 0 );
2136
+ if (!SWIG_IsOK(res1)) {
2137
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ws2811_channel_t *","count", 1, self ));
2138
+ }
2139
+ arg1 = (ws2811_channel_t *)(argp1);
2140
+ ecode2 = SWIG_AsVal_int(argv[0], &val2);
2141
+ if (!SWIG_IsOK(ecode2)) {
2142
+ SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","count", 2, argv[0] ));
2143
+ }
2144
+ arg2 = (int)(val2);
2145
+ if (arg1) (arg1)->count = arg2;
2146
+ return Qnil;
2147
+ fail:
2148
+ return Qnil;
2149
+ }
2150
+
2151
+
2152
+ SWIGINTERN VALUE
2153
+ _wrap_ws2811_channel_t_count_get(int argc, VALUE *argv, VALUE self) {
2154
+ ws2811_channel_t *arg1 = (ws2811_channel_t *) 0 ;
2155
+ void *argp1 = 0 ;
2156
+ int res1 = 0 ;
2157
+ int result;
2158
+ VALUE vresult = Qnil;
2159
+
2160
+ if ((argc < 0) || (argc > 0)) {
2161
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2162
+ }
2163
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ws2811_channel_t, 0 | 0 );
2164
+ if (!SWIG_IsOK(res1)) {
2165
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ws2811_channel_t *","count", 1, self ));
2166
+ }
2167
+ arg1 = (ws2811_channel_t *)(argp1);
2168
+ result = (int) ((arg1)->count);
2169
+ vresult = SWIG_From_int((int)(result));
2170
+ return vresult;
2171
+ fail:
2172
+ return Qnil;
2173
+ }
2174
+
2175
+
2176
+ SWIGINTERN VALUE
2177
+ _wrap_ws2811_channel_t_brightness_set(int argc, VALUE *argv, VALUE self) {
2178
+ ws2811_channel_t *arg1 = (ws2811_channel_t *) 0 ;
2179
+ int arg2 ;
2180
+ void *argp1 = 0 ;
2181
+ int res1 = 0 ;
2182
+ int val2 ;
2183
+ int ecode2 = 0 ;
2184
+
2185
+ if ((argc < 1) || (argc > 1)) {
2186
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2187
+ }
2188
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ws2811_channel_t, 0 | 0 );
2189
+ if (!SWIG_IsOK(res1)) {
2190
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ws2811_channel_t *","brightness", 1, self ));
2191
+ }
2192
+ arg1 = (ws2811_channel_t *)(argp1);
2193
+ ecode2 = SWIG_AsVal_int(argv[0], &val2);
2194
+ if (!SWIG_IsOK(ecode2)) {
2195
+ SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","brightness", 2, argv[0] ));
2196
+ }
2197
+ arg2 = (int)(val2);
2198
+ if (arg1) (arg1)->brightness = arg2;
2199
+ return Qnil;
2200
+ fail:
2201
+ return Qnil;
2202
+ }
2203
+
2204
+
2205
+ SWIGINTERN VALUE
2206
+ _wrap_ws2811_channel_t_brightness_get(int argc, VALUE *argv, VALUE self) {
2207
+ ws2811_channel_t *arg1 = (ws2811_channel_t *) 0 ;
2208
+ void *argp1 = 0 ;
2209
+ int res1 = 0 ;
2210
+ int result;
2211
+ VALUE vresult = Qnil;
2212
+
2213
+ if ((argc < 0) || (argc > 0)) {
2214
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2215
+ }
2216
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ws2811_channel_t, 0 | 0 );
2217
+ if (!SWIG_IsOK(res1)) {
2218
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ws2811_channel_t *","brightness", 1, self ));
2219
+ }
2220
+ arg1 = (ws2811_channel_t *)(argp1);
2221
+ result = (int) ((arg1)->brightness);
2222
+ vresult = SWIG_From_int((int)(result));
2223
+ return vresult;
2224
+ fail:
2225
+ return Qnil;
2226
+ }
2227
+
2228
+
2229
+ SWIGINTERN VALUE
2230
+ _wrap_ws2811_channel_t_leds_set(int argc, VALUE *argv, VALUE self) {
2231
+ ws2811_channel_t *arg1 = (ws2811_channel_t *) 0 ;
2232
+ ws2811_led_t *arg2 = (ws2811_led_t *) 0 ;
2233
+ void *argp1 = 0 ;
2234
+ int res1 = 0 ;
2235
+ void *argp2 = 0 ;
2236
+ int res2 = 0 ;
2237
+
2238
+ if ((argc < 1) || (argc > 1)) {
2239
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2240
+ }
2241
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ws2811_channel_t, 0 | 0 );
2242
+ if (!SWIG_IsOK(res1)) {
2243
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ws2811_channel_t *","leds", 1, self ));
2244
+ }
2245
+ arg1 = (ws2811_channel_t *)(argp1);
2246
+ res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_unsigned_int, SWIG_POINTER_DISOWN | 0 );
2247
+ if (!SWIG_IsOK(res2)) {
2248
+ SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "ws2811_led_t *","leds", 2, argv[0] ));
2249
+ }
2250
+ arg2 = (ws2811_led_t *)(argp2);
2251
+ if (arg1) (arg1)->leds = arg2;
2252
+ return Qnil;
2253
+ fail:
2254
+ return Qnil;
2255
+ }
2256
+
2257
+
2258
+ SWIGINTERN VALUE
2259
+ _wrap_ws2811_channel_t_leds_get(int argc, VALUE *argv, VALUE self) {
2260
+ ws2811_channel_t *arg1 = (ws2811_channel_t *) 0 ;
2261
+ void *argp1 = 0 ;
2262
+ int res1 = 0 ;
2263
+ ws2811_led_t *result = 0 ;
2264
+ VALUE vresult = Qnil;
2265
+
2266
+ if ((argc < 0) || (argc > 0)) {
2267
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2268
+ }
2269
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ws2811_channel_t, 0 | 0 );
2270
+ if (!SWIG_IsOK(res1)) {
2271
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ws2811_channel_t *","leds", 1, self ));
2272
+ }
2273
+ arg1 = (ws2811_channel_t *)(argp1);
2274
+ result = (ws2811_led_t *) ((arg1)->leds);
2275
+ vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_unsigned_int, 0 | 0 );
2276
+ return vresult;
2277
+ fail:
2278
+ return Qnil;
2279
+ }
2280
+
2281
+
2282
+ #ifdef HAVE_RB_DEFINE_ALLOC_FUNC
2283
+ SWIGINTERN VALUE
2284
+ _wrap_ws2811_channel_t_allocate(VALUE self) {
2285
+ #else
2286
+ SWIGINTERN VALUE
2287
+ _wrap_ws2811_channel_t_allocate(int argc, VALUE *argv, VALUE self) {
2288
+ #endif
2289
+
2290
+
2291
+ VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_ws2811_channel_t);
2292
+ #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
2293
+ rb_obj_call_init(vresult, argc, argv);
2294
+ #endif
2295
+ return vresult;
2296
+ }
2297
+
2298
+
2299
+ SWIGINTERN VALUE
2300
+ _wrap_new_ws2811_channel_t(int argc, VALUE *argv, VALUE self) {
2301
+ ws2811_channel_t *result = 0 ;
2302
+
2303
+ if ((argc < 0) || (argc > 0)) {
2304
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2305
+ }
2306
+ result = (ws2811_channel_t *)calloc(1, sizeof(ws2811_channel_t));
2307
+ DATA_PTR(self) = result;
2308
+ return self;
2309
+ fail:
2310
+ return Qnil;
2311
+ }
2312
+
2313
+
2314
+ SWIGINTERN void
2315
+ free_ws2811_channel_t(ws2811_channel_t *arg1) {
2316
+ free((char *) arg1);
2317
+ }
2318
+
2319
+ static swig_class SwigClassWs2811_t;
2320
+
2321
+ SWIGINTERN VALUE
2322
+ _wrap_ws2811_t_device_set(int argc, VALUE *argv, VALUE self) {
2323
+ ws2811_t *arg1 = (ws2811_t *) 0 ;
2324
+ struct ws2811_device *arg2 = (struct ws2811_device *) 0 ;
2325
+ void *argp1 = 0 ;
2326
+ int res1 = 0 ;
2327
+ void *argp2 = 0 ;
2328
+ int res2 = 0 ;
2329
+
2330
+ if ((argc < 1) || (argc > 1)) {
2331
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2332
+ }
2333
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ws2811_t, 0 | 0 );
2334
+ if (!SWIG_IsOK(res1)) {
2335
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ws2811_t *","device", 1, self ));
2336
+ }
2337
+ arg1 = (ws2811_t *)(argp1);
2338
+ res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_ws2811_device, SWIG_POINTER_DISOWN | 0 );
2339
+ if (!SWIG_IsOK(res2)) {
2340
+ SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "struct ws2811_device *","device", 2, argv[0] ));
2341
+ }
2342
+ arg2 = (struct ws2811_device *)(argp2);
2343
+ if (arg1) (arg1)->device = arg2;
2344
+ return Qnil;
2345
+ fail:
2346
+ return Qnil;
2347
+ }
2348
+
2349
+
2350
+ SWIGINTERN VALUE
2351
+ _wrap_ws2811_t_device_get(int argc, VALUE *argv, VALUE self) {
2352
+ ws2811_t *arg1 = (ws2811_t *) 0 ;
2353
+ void *argp1 = 0 ;
2354
+ int res1 = 0 ;
2355
+ struct ws2811_device *result = 0 ;
2356
+ VALUE vresult = Qnil;
2357
+
2358
+ if ((argc < 0) || (argc > 0)) {
2359
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2360
+ }
2361
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ws2811_t, 0 | 0 );
2362
+ if (!SWIG_IsOK(res1)) {
2363
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ws2811_t *","device", 1, self ));
2364
+ }
2365
+ arg1 = (ws2811_t *)(argp1);
2366
+ result = (struct ws2811_device *) ((arg1)->device);
2367
+ vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ws2811_device, 0 | 0 );
2368
+ return vresult;
2369
+ fail:
2370
+ return Qnil;
2371
+ }
2372
+
2373
+
2374
+ SWIGINTERN VALUE
2375
+ _wrap_ws2811_t_freq_set(int argc, VALUE *argv, VALUE self) {
2376
+ ws2811_t *arg1 = (ws2811_t *) 0 ;
2377
+ uint32_t arg2 ;
2378
+ void *argp1 = 0 ;
2379
+ int res1 = 0 ;
2380
+ unsigned int val2 ;
2381
+ int ecode2 = 0 ;
2382
+
2383
+ if ((argc < 1) || (argc > 1)) {
2384
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2385
+ }
2386
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ws2811_t, 0 | 0 );
2387
+ if (!SWIG_IsOK(res1)) {
2388
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ws2811_t *","freq", 1, self ));
2389
+ }
2390
+ arg1 = (ws2811_t *)(argp1);
2391
+ ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
2392
+ if (!SWIG_IsOK(ecode2)) {
2393
+ SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "uint32_t","freq", 2, argv[0] ));
2394
+ }
2395
+ arg2 = (uint32_t)(val2);
2396
+ if (arg1) (arg1)->freq = arg2;
2397
+ return Qnil;
2398
+ fail:
2399
+ return Qnil;
2400
+ }
2401
+
2402
+
2403
+ SWIGINTERN VALUE
2404
+ _wrap_ws2811_t_freq_get(int argc, VALUE *argv, VALUE self) {
2405
+ ws2811_t *arg1 = (ws2811_t *) 0 ;
2406
+ void *argp1 = 0 ;
2407
+ int res1 = 0 ;
2408
+ uint32_t result;
2409
+ VALUE vresult = Qnil;
2410
+
2411
+ if ((argc < 0) || (argc > 0)) {
2412
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2413
+ }
2414
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ws2811_t, 0 | 0 );
2415
+ if (!SWIG_IsOK(res1)) {
2416
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ws2811_t *","freq", 1, self ));
2417
+ }
2418
+ arg1 = (ws2811_t *)(argp1);
2419
+ result = (uint32_t) ((arg1)->freq);
2420
+ vresult = SWIG_From_unsigned_SS_int((unsigned int)(result));
2421
+ return vresult;
2422
+ fail:
2423
+ return Qnil;
2424
+ }
2425
+
2426
+
2427
+ SWIGINTERN VALUE
2428
+ _wrap_ws2811_t_dmanum_set(int argc, VALUE *argv, VALUE self) {
2429
+ ws2811_t *arg1 = (ws2811_t *) 0 ;
2430
+ int arg2 ;
2431
+ void *argp1 = 0 ;
2432
+ int res1 = 0 ;
2433
+ int val2 ;
2434
+ int ecode2 = 0 ;
2435
+
2436
+ if ((argc < 1) || (argc > 1)) {
2437
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2438
+ }
2439
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ws2811_t, 0 | 0 );
2440
+ if (!SWIG_IsOK(res1)) {
2441
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ws2811_t *","dmanum", 1, self ));
2442
+ }
2443
+ arg1 = (ws2811_t *)(argp1);
2444
+ ecode2 = SWIG_AsVal_int(argv[0], &val2);
2445
+ if (!SWIG_IsOK(ecode2)) {
2446
+ SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","dmanum", 2, argv[0] ));
2447
+ }
2448
+ arg2 = (int)(val2);
2449
+ if (arg1) (arg1)->dmanum = arg2;
2450
+ return Qnil;
2451
+ fail:
2452
+ return Qnil;
2453
+ }
2454
+
2455
+
2456
+ SWIGINTERN VALUE
2457
+ _wrap_ws2811_t_dmanum_get(int argc, VALUE *argv, VALUE self) {
2458
+ ws2811_t *arg1 = (ws2811_t *) 0 ;
2459
+ void *argp1 = 0 ;
2460
+ int res1 = 0 ;
2461
+ int result;
2462
+ VALUE vresult = Qnil;
2463
+
2464
+ if ((argc < 0) || (argc > 0)) {
2465
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2466
+ }
2467
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ws2811_t, 0 | 0 );
2468
+ if (!SWIG_IsOK(res1)) {
2469
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ws2811_t *","dmanum", 1, self ));
2470
+ }
2471
+ arg1 = (ws2811_t *)(argp1);
2472
+ result = (int) ((arg1)->dmanum);
2473
+ vresult = SWIG_From_int((int)(result));
2474
+ return vresult;
2475
+ fail:
2476
+ return Qnil;
2477
+ }
2478
+
2479
+
2480
+ SWIGINTERN VALUE
2481
+ _wrap_ws2811_t_channel_set(int argc, VALUE *argv, VALUE self) {
2482
+ ws2811_t *arg1 = (ws2811_t *) 0 ;
2483
+ ws2811_channel_t *arg2 ;
2484
+ void *argp1 = 0 ;
2485
+ int res1 = 0 ;
2486
+ void *argp2 = 0 ;
2487
+ int res2 = 0 ;
2488
+
2489
+ if ((argc < 1) || (argc > 1)) {
2490
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2491
+ }
2492
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ws2811_t, 0 | 0 );
2493
+ if (!SWIG_IsOK(res1)) {
2494
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ws2811_t *","channel", 1, self ));
2495
+ }
2496
+ arg1 = (ws2811_t *)(argp1);
2497
+ res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_ws2811_channel_t, 0 | 0 );
2498
+ if (!SWIG_IsOK(res2)) {
2499
+ SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "ws2811_channel_t [RPI_PWM_CHANNELS]","channel", 2, argv[0] ));
2500
+ }
2501
+ arg2 = (ws2811_channel_t *)(argp2);
2502
+ {
2503
+ if (arg2) {
2504
+ size_t ii = 0;
2505
+ for (; ii < (size_t)RPI_PWM_CHANNELS; ++ii) arg1->channel[ii] = arg2[ii];
2506
+ } else {
2507
+ SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in variable '""channel""' of type '""ws2811_channel_t [RPI_PWM_CHANNELS]""'");
2508
+ }
2509
+ }
2510
+ return Qnil;
2511
+ fail:
2512
+ return Qnil;
2513
+ }
2514
+
2515
+
2516
+ SWIGINTERN VALUE
2517
+ _wrap_ws2811_t_channel_get(int argc, VALUE *argv, VALUE self) {
2518
+ ws2811_t *arg1 = (ws2811_t *) 0 ;
2519
+ void *argp1 = 0 ;
2520
+ int res1 = 0 ;
2521
+ ws2811_channel_t *result = 0 ;
2522
+ VALUE vresult = Qnil;
2523
+
2524
+ if ((argc < 0) || (argc > 0)) {
2525
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2526
+ }
2527
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ws2811_t, 0 | 0 );
2528
+ if (!SWIG_IsOK(res1)) {
2529
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ws2811_t *","channel", 1, self ));
2530
+ }
2531
+ arg1 = (ws2811_t *)(argp1);
2532
+ result = (ws2811_channel_t *)(ws2811_channel_t *) ((arg1)->channel);
2533
+ vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ws2811_channel_t, 0 | 0 );
2534
+ return vresult;
2535
+ fail:
2536
+ return Qnil;
2537
+ }
2538
+
2539
+
2540
+ #ifdef HAVE_RB_DEFINE_ALLOC_FUNC
2541
+ SWIGINTERN VALUE
2542
+ _wrap_ws2811_t_allocate(VALUE self) {
2543
+ #else
2544
+ SWIGINTERN VALUE
2545
+ _wrap_ws2811_t_allocate(int argc, VALUE *argv, VALUE self) {
2546
+ #endif
2547
+
2548
+
2549
+ VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_ws2811_t);
2550
+ #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
2551
+ rb_obj_call_init(vresult, argc, argv);
2552
+ #endif
2553
+ return vresult;
2554
+ }
2555
+
2556
+
2557
+ SWIGINTERN VALUE
2558
+ _wrap_new_ws2811_t(int argc, VALUE *argv, VALUE self) {
2559
+ ws2811_t *result = 0 ;
2560
+
2561
+ if ((argc < 0) || (argc > 0)) {
2562
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2563
+ }
2564
+ result = (ws2811_t *)calloc(1, sizeof(ws2811_t));
2565
+ DATA_PTR(self) = result;
2566
+ return self;
2567
+ fail:
2568
+ return Qnil;
2569
+ }
2570
+
2571
+
2572
+ SWIGINTERN void
2573
+ free_ws2811_t(ws2811_t *arg1) {
2574
+ free((char *) arg1);
2575
+ }
2576
+
2577
+ SWIGINTERN VALUE
2578
+ _wrap_ws2811_init(int argc, VALUE *argv, VALUE self) {
2579
+ ws2811_t *arg1 = (ws2811_t *) 0 ;
2580
+ void *argp1 = 0 ;
2581
+ int res1 = 0 ;
2582
+ int result;
2583
+ VALUE vresult = Qnil;
2584
+
2585
+ if ((argc < 1) || (argc > 1)) {
2586
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2587
+ }
2588
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_ws2811_t, 0 | 0 );
2589
+ if (!SWIG_IsOK(res1)) {
2590
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ws2811_t *","ws2811_init", 1, argv[0] ));
2591
+ }
2592
+ arg1 = (ws2811_t *)(argp1);
2593
+ result = (int)ws2811_init(arg1);
2594
+ vresult = SWIG_From_int((int)(result));
2595
+ return vresult;
2596
+ fail:
2597
+ return Qnil;
2598
+ }
2599
+
2600
+
2601
+ SWIGINTERN VALUE
2602
+ _wrap_ws2811_fini(int argc, VALUE *argv, VALUE self) {
2603
+ ws2811_t *arg1 = (ws2811_t *) 0 ;
2604
+ void *argp1 = 0 ;
2605
+ int res1 = 0 ;
2606
+
2607
+ if ((argc < 1) || (argc > 1)) {
2608
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2609
+ }
2610
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_ws2811_t, 0 | 0 );
2611
+ if (!SWIG_IsOK(res1)) {
2612
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ws2811_t *","ws2811_fini", 1, argv[0] ));
2613
+ }
2614
+ arg1 = (ws2811_t *)(argp1);
2615
+ ws2811_fini(arg1);
2616
+ return Qnil;
2617
+ fail:
2618
+ return Qnil;
2619
+ }
2620
+
2621
+
2622
+ SWIGINTERN VALUE
2623
+ _wrap_ws2811_direct_colors_get(VALUE self) {
2624
+ VALUE _val;
2625
+
2626
+ _val = SWIG_From_unsigned_SS_char((unsigned char)(ws2811_direct_colors));
2627
+ return _val;
2628
+ }
2629
+
2630
+
2631
+ SWIGINTERN VALUE
2632
+ _wrap_ws2811_direct_colors_set(VALUE self, VALUE _val) {
2633
+ {
2634
+ unsigned char val;
2635
+ int res = SWIG_AsVal_unsigned_SS_char(_val, &val);
2636
+ if (!SWIG_IsOK(res)) {
2637
+ SWIG_exception_fail(SWIG_ArgError(res), "in variable '""ws2811_direct_colors""' of type '""uint8_t""'");
2638
+ }
2639
+ ws2811_direct_colors = (uint8_t)(val);
2640
+ }
2641
+ return _val;
2642
+ fail:
2643
+ return Qnil;
2644
+ }
2645
+
2646
+
2647
+ SWIGINTERN VALUE
2648
+ _wrap_ws2811_render(int argc, VALUE *argv, VALUE self) {
2649
+ ws2811_t *arg1 = (ws2811_t *) 0 ;
2650
+ void *argp1 = 0 ;
2651
+ int res1 = 0 ;
2652
+ int result;
2653
+ VALUE vresult = Qnil;
2654
+
2655
+ if ((argc < 1) || (argc > 1)) {
2656
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2657
+ }
2658
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_ws2811_t, 0 | 0 );
2659
+ if (!SWIG_IsOK(res1)) {
2660
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ws2811_t *","ws2811_render", 1, argv[0] ));
2661
+ }
2662
+ arg1 = (ws2811_t *)(argp1);
2663
+ result = (int)ws2811_render(arg1);
2664
+ vresult = SWIG_From_int((int)(result));
2665
+ return vresult;
2666
+ fail:
2667
+ return Qnil;
2668
+ }
2669
+
2670
+
2671
+ SWIGINTERN VALUE
2672
+ _wrap_ws2811_dma_error_get(VALUE self) {
2673
+ VALUE _val;
2674
+
2675
+ _val = SWIG_From_unsigned_SS_int((unsigned int)(ws2811_dma_error));
2676
+ return _val;
2677
+ }
2678
+
2679
+
2680
+ SWIGINTERN VALUE
2681
+ _wrap_ws2811_dma_error_set(VALUE self, VALUE _val) {
2682
+ {
2683
+ unsigned int val;
2684
+ int res = SWIG_AsVal_unsigned_SS_int(_val, &val);
2685
+ if (!SWIG_IsOK(res)) {
2686
+ SWIG_exception_fail(SWIG_ArgError(res), "in variable '""ws2811_dma_error""' of type '""uint32_t""'");
2687
+ }
2688
+ ws2811_dma_error = (uint32_t)(val);
2689
+ }
2690
+ return _val;
2691
+ fail:
2692
+ return Qnil;
2693
+ }
2694
+
2695
+
2696
+ SWIGINTERN VALUE
2697
+ _wrap_ws2811_wait(int argc, VALUE *argv, VALUE self) {
2698
+ ws2811_t *arg1 = (ws2811_t *) 0 ;
2699
+ void *argp1 = 0 ;
2700
+ int res1 = 0 ;
2701
+ int result;
2702
+ VALUE vresult = Qnil;
2703
+
2704
+ if ((argc < 1) || (argc > 1)) {
2705
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2706
+ }
2707
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_ws2811_t, 0 | 0 );
2708
+ if (!SWIG_IsOK(res1)) {
2709
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ws2811_t *","ws2811_wait", 1, argv[0] ));
2710
+ }
2711
+ arg1 = (ws2811_t *)(argp1);
2712
+ result = (int)ws2811_wait(arg1);
2713
+ vresult = SWIG_From_int((int)(result));
2714
+ return vresult;
2715
+ fail:
2716
+ return Qnil;
2717
+ }
2718
+
2719
+
2720
+ SWIGINTERN VALUE
2721
+ _wrap_ws2811_led_get(int argc, VALUE *argv, VALUE self) {
2722
+ ws2811_channel_t *arg1 = (ws2811_channel_t *) 0 ;
2723
+ int arg2 ;
2724
+ void *argp1 = 0 ;
2725
+ int res1 = 0 ;
2726
+ int val2 ;
2727
+ int ecode2 = 0 ;
2728
+ uint32_t result;
2729
+ VALUE vresult = Qnil;
2730
+
2731
+ if ((argc < 2) || (argc > 2)) {
2732
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
2733
+ }
2734
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_ws2811_channel_t, 0 | 0 );
2735
+ if (!SWIG_IsOK(res1)) {
2736
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ws2811_channel_t *","ws2811_led_get", 1, argv[0] ));
2737
+ }
2738
+ arg1 = (ws2811_channel_t *)(argp1);
2739
+ ecode2 = SWIG_AsVal_int(argv[1], &val2);
2740
+ if (!SWIG_IsOK(ecode2)) {
2741
+ SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","ws2811_led_get", 2, argv[1] ));
2742
+ }
2743
+ arg2 = (int)(val2);
2744
+ result = (uint32_t)ws2811_led_get(arg1,arg2);
2745
+ vresult = SWIG_From_unsigned_SS_int((unsigned int)(result));
2746
+ return vresult;
2747
+ fail:
2748
+ return Qnil;
2749
+ }
2750
+
2751
+
2752
+ SWIGINTERN VALUE
2753
+ _wrap_ws2811_led_set(int argc, VALUE *argv, VALUE self) {
2754
+ ws2811_channel_t *arg1 = (ws2811_channel_t *) 0 ;
2755
+ int arg2 ;
2756
+ uint32_t arg3 ;
2757
+ void *argp1 = 0 ;
2758
+ int res1 = 0 ;
2759
+ int val2 ;
2760
+ int ecode2 = 0 ;
2761
+ unsigned int val3 ;
2762
+ int ecode3 = 0 ;
2763
+ int result;
2764
+ VALUE vresult = Qnil;
2765
+
2766
+ if ((argc < 3) || (argc > 3)) {
2767
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
2768
+ }
2769
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_ws2811_channel_t, 0 | 0 );
2770
+ if (!SWIG_IsOK(res1)) {
2771
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ws2811_channel_t *","ws2811_led_set", 1, argv[0] ));
2772
+ }
2773
+ arg1 = (ws2811_channel_t *)(argp1);
2774
+ ecode2 = SWIG_AsVal_int(argv[1], &val2);
2775
+ if (!SWIG_IsOK(ecode2)) {
2776
+ SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","ws2811_led_set", 2, argv[1] ));
2777
+ }
2778
+ arg2 = (int)(val2);
2779
+ ecode3 = SWIG_AsVal_unsigned_SS_int(argv[2], &val3);
2780
+ if (!SWIG_IsOK(ecode3)) {
2781
+ SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "uint32_t","ws2811_led_set", 3, argv[2] ));
2782
+ }
2783
+ arg3 = (uint32_t)(val3);
2784
+ result = (int)ws2811_led_set(arg1,arg2,arg3);
2785
+ vresult = SWIG_From_int((int)(result));
2786
+ return vresult;
2787
+ fail:
2788
+ return Qnil;
2789
+ }
2790
+
2791
+
2792
+ SWIGINTERN VALUE
2793
+ _wrap_ws2811_channel_get(int argc, VALUE *argv, VALUE self) {
2794
+ ws2811_t *arg1 = (ws2811_t *) 0 ;
2795
+ int arg2 ;
2796
+ void *argp1 = 0 ;
2797
+ int res1 = 0 ;
2798
+ int val2 ;
2799
+ int ecode2 = 0 ;
2800
+ ws2811_channel_t *result = 0 ;
2801
+ VALUE vresult = Qnil;
2802
+
2803
+ if ((argc < 2) || (argc > 2)) {
2804
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
2805
+ }
2806
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_ws2811_t, 0 | 0 );
2807
+ if (!SWIG_IsOK(res1)) {
2808
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ws2811_t *","ws2811_channel_get", 1, argv[0] ));
2809
+ }
2810
+ arg1 = (ws2811_t *)(argp1);
2811
+ ecode2 = SWIG_AsVal_int(argv[1], &val2);
2812
+ if (!SWIG_IsOK(ecode2)) {
2813
+ SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","ws2811_channel_get", 2, argv[1] ));
2814
+ }
2815
+ arg2 = (int)(val2);
2816
+ result = (ws2811_channel_t *)ws2811_channel_get(arg1,arg2);
2817
+ vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ws2811_channel_t, 0 | 0 );
2818
+ return vresult;
2819
+ fail:
2820
+ return Qnil;
2821
+ }
2822
+
2823
+
2824
+
2825
+ /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
2826
+
2827
+ static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
2828
+ static swig_type_info _swigt__p_int = {"_p_int", "intptr_t *|int *|int_least32_t *|int_fast32_t *|int32_t *|int_fast16_t *", 0, 0, (void*)0, 0};
2829
+ static swig_type_info _swigt__p_long_long = {"_p_long_long", "int_least64_t *|int_fast64_t *|int64_t *|long long *|intmax_t *", 0, 0, (void*)0, 0};
2830
+ static swig_type_info _swigt__p_short = {"_p_short", "short *|int_least16_t *|int16_t *", 0, 0, (void*)0, 0};
2831
+ static swig_type_info _swigt__p_signed_char = {"_p_signed_char", "signed char *|int_least8_t *|int_fast8_t *|int8_t *", 0, 0, (void*)0, 0};
2832
+ static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "unsigned char *|uint_least8_t *|uint_fast8_t *|uint8_t *", 0, 0, (void*)0, 0};
2833
+ static swig_type_info _swigt__p_unsigned_int = {"_p_unsigned_int", "uintptr_t *|uint_least32_t *|uint_fast32_t *|uint32_t *|unsigned int *|ws2811_led_t *|uint_fast16_t *", 0, 0, (void*)0, 0};
2834
+ static swig_type_info _swigt__p_unsigned_long_long = {"_p_unsigned_long_long", "uint_least64_t *|uint_fast64_t *|uint64_t *|unsigned long long *|uintmax_t *", 0, 0, (void*)0, 0};
2835
+ static swig_type_info _swigt__p_unsigned_short = {"_p_unsigned_short", "unsigned short *|uint_least16_t *|uint16_t *", 0, 0, (void*)0, 0};
2836
+ static swig_type_info _swigt__p_ws2811_channel_t = {"_p_ws2811_channel_t", "ws2811_channel_t *", 0, 0, (void*)0, 0};
2837
+ static swig_type_info _swigt__p_ws2811_device = {"_p_ws2811_device", "struct ws2811_device *", 0, 0, (void*)0, 0};
2838
+ static swig_type_info _swigt__p_ws2811_t = {"_p_ws2811_t", "ws2811_t *", 0, 0, (void*)0, 0};
2839
+
2840
+ static swig_type_info *swig_type_initial[] = {
2841
+ &_swigt__p_char,
2842
+ &_swigt__p_int,
2843
+ &_swigt__p_long_long,
2844
+ &_swigt__p_short,
2845
+ &_swigt__p_signed_char,
2846
+ &_swigt__p_unsigned_char,
2847
+ &_swigt__p_unsigned_int,
2848
+ &_swigt__p_unsigned_long_long,
2849
+ &_swigt__p_unsigned_short,
2850
+ &_swigt__p_ws2811_channel_t,
2851
+ &_swigt__p_ws2811_device,
2852
+ &_swigt__p_ws2811_t,
2853
+ };
2854
+
2855
+ static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
2856
+ static swig_cast_info _swigc__p_int[] = { {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};
2857
+ static swig_cast_info _swigc__p_long_long[] = { {&_swigt__p_long_long, 0, 0, 0},{0, 0, 0, 0}};
2858
+ static swig_cast_info _swigc__p_short[] = { {&_swigt__p_short, 0, 0, 0},{0, 0, 0, 0}};
2859
+ static swig_cast_info _swigc__p_signed_char[] = { {&_swigt__p_signed_char, 0, 0, 0},{0, 0, 0, 0}};
2860
+ static swig_cast_info _swigc__p_unsigned_char[] = { {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}};
2861
+ static swig_cast_info _swigc__p_unsigned_int[] = { {&_swigt__p_unsigned_int, 0, 0, 0},{0, 0, 0, 0}};
2862
+ static swig_cast_info _swigc__p_unsigned_long_long[] = { {&_swigt__p_unsigned_long_long, 0, 0, 0},{0, 0, 0, 0}};
2863
+ static swig_cast_info _swigc__p_unsigned_short[] = { {&_swigt__p_unsigned_short, 0, 0, 0},{0, 0, 0, 0}};
2864
+ static swig_cast_info _swigc__p_ws2811_channel_t[] = { {&_swigt__p_ws2811_channel_t, 0, 0, 0},{0, 0, 0, 0}};
2865
+ static swig_cast_info _swigc__p_ws2811_device[] = { {&_swigt__p_ws2811_device, 0, 0, 0},{0, 0, 0, 0}};
2866
+ static swig_cast_info _swigc__p_ws2811_t[] = { {&_swigt__p_ws2811_t, 0, 0, 0},{0, 0, 0, 0}};
2867
+
2868
+ static swig_cast_info *swig_cast_initial[] = {
2869
+ _swigc__p_char,
2870
+ _swigc__p_int,
2871
+ _swigc__p_long_long,
2872
+ _swigc__p_short,
2873
+ _swigc__p_signed_char,
2874
+ _swigc__p_unsigned_char,
2875
+ _swigc__p_unsigned_int,
2876
+ _swigc__p_unsigned_long_long,
2877
+ _swigc__p_unsigned_short,
2878
+ _swigc__p_ws2811_channel_t,
2879
+ _swigc__p_ws2811_device,
2880
+ _swigc__p_ws2811_t,
2881
+ };
2882
+
2883
+
2884
+ /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
2885
+
2886
+ /* -----------------------------------------------------------------------------
2887
+ * Type initialization:
2888
+ * This problem is tough by the requirement that no dynamic
2889
+ * memory is used. Also, since swig_type_info structures store pointers to
2890
+ * swig_cast_info structures and swig_cast_info structures store pointers back
2891
+ * to swig_type_info structures, we need some lookup code at initialization.
2892
+ * The idea is that swig generates all the structures that are needed.
2893
+ * The runtime then collects these partially filled structures.
2894
+ * The SWIG_InitializeModule function takes these initial arrays out of
2895
+ * swig_module, and does all the lookup, filling in the swig_module.types
2896
+ * array with the correct data and linking the correct swig_cast_info
2897
+ * structures together.
2898
+ *
2899
+ * The generated swig_type_info structures are assigned staticly to an initial
2900
+ * array. We just loop through that array, and handle each type individually.
2901
+ * First we lookup if this type has been already loaded, and if so, use the
2902
+ * loaded structure instead of the generated one. Then we have to fill in the
2903
+ * cast linked list. The cast data is initially stored in something like a
2904
+ * two-dimensional array. Each row corresponds to a type (there are the same
2905
+ * number of rows as there are in the swig_type_initial array). Each entry in
2906
+ * a column is one of the swig_cast_info structures for that type.
2907
+ * The cast_initial array is actually an array of arrays, because each row has
2908
+ * a variable number of columns. So to actually build the cast linked list,
2909
+ * we find the array of casts associated with the type, and loop through it
2910
+ * adding the casts to the list. The one last trick we need to do is making
2911
+ * sure the type pointer in the swig_cast_info struct is correct.
2912
+ *
2913
+ * First off, we lookup the cast->type name to see if it is already loaded.
2914
+ * There are three cases to handle:
2915
+ * 1) If the cast->type has already been loaded AND the type we are adding
2916
+ * casting info to has not been loaded (it is in this module), THEN we
2917
+ * replace the cast->type pointer with the type pointer that has already
2918
+ * been loaded.
2919
+ * 2) If BOTH types (the one we are adding casting info to, and the
2920
+ * cast->type) are loaded, THEN the cast info has already been loaded by
2921
+ * the previous module so we just ignore it.
2922
+ * 3) Finally, if cast->type has not already been loaded, then we add that
2923
+ * swig_cast_info to the linked list (because the cast->type) pointer will
2924
+ * be correct.
2925
+ * ----------------------------------------------------------------------------- */
2926
+
2927
+ #ifdef __cplusplus
2928
+ extern "C" {
2929
+ #if 0
2930
+ } /* c-mode */
2931
+ #endif
2932
+ #endif
2933
+
2934
+ #if 0
2935
+ #define SWIGRUNTIME_DEBUG
2936
+ #endif
2937
+
2938
+
2939
+ SWIGRUNTIME void
2940
+ SWIG_InitializeModule(void *clientdata) {
2941
+ size_t i;
2942
+ swig_module_info *module_head, *iter;
2943
+ int found, init;
2944
+
2945
+ clientdata = clientdata;
2946
+
2947
+ /* check to see if the circular list has been setup, if not, set it up */
2948
+ if (swig_module.next==0) {
2949
+ /* Initialize the swig_module */
2950
+ swig_module.type_initial = swig_type_initial;
2951
+ swig_module.cast_initial = swig_cast_initial;
2952
+ swig_module.next = &swig_module;
2953
+ init = 1;
2954
+ } else {
2955
+ init = 0;
2956
+ }
2957
+
2958
+ /* Try and load any already created modules */
2959
+ module_head = SWIG_GetModule(clientdata);
2960
+ if (!module_head) {
2961
+ /* This is the first module loaded for this interpreter */
2962
+ /* so set the swig module into the interpreter */
2963
+ SWIG_SetModule(clientdata, &swig_module);
2964
+ module_head = &swig_module;
2965
+ } else {
2966
+ /* the interpreter has loaded a SWIG module, but has it loaded this one? */
2967
+ found=0;
2968
+ iter=module_head;
2969
+ do {
2970
+ if (iter==&swig_module) {
2971
+ found=1;
2972
+ break;
2973
+ }
2974
+ iter=iter->next;
2975
+ } while (iter!= module_head);
2976
+
2977
+ /* if the is found in the list, then all is done and we may leave */
2978
+ if (found) return;
2979
+ /* otherwise we must add out module into the list */
2980
+ swig_module.next = module_head->next;
2981
+ module_head->next = &swig_module;
2982
+ }
2983
+
2984
+ /* When multiple interpeters are used, a module could have already been initialized in
2985
+ a different interpreter, but not yet have a pointer in this interpreter.
2986
+ In this case, we do not want to continue adding types... everything should be
2987
+ set up already */
2988
+ if (init == 0) return;
2989
+
2990
+ /* Now work on filling in swig_module.types */
2991
+ #ifdef SWIGRUNTIME_DEBUG
2992
+ printf("SWIG_InitializeModule: size %d\n", swig_module.size);
2993
+ #endif
2994
+ for (i = 0; i < swig_module.size; ++i) {
2995
+ swig_type_info *type = 0;
2996
+ swig_type_info *ret;
2997
+ swig_cast_info *cast;
2998
+
2999
+ #ifdef SWIGRUNTIME_DEBUG
3000
+ printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
3001
+ #endif
3002
+
3003
+ /* if there is another module already loaded */
3004
+ if (swig_module.next != &swig_module) {
3005
+ type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
3006
+ }
3007
+ if (type) {
3008
+ /* Overwrite clientdata field */
3009
+ #ifdef SWIGRUNTIME_DEBUG
3010
+ printf("SWIG_InitializeModule: found type %s\n", type->name);
3011
+ #endif
3012
+ if (swig_module.type_initial[i]->clientdata) {
3013
+ type->clientdata = swig_module.type_initial[i]->clientdata;
3014
+ #ifdef SWIGRUNTIME_DEBUG
3015
+ printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
3016
+ #endif
3017
+ }
3018
+ } else {
3019
+ type = swig_module.type_initial[i];
3020
+ }
3021
+
3022
+ /* Insert casting types */
3023
+ cast = swig_module.cast_initial[i];
3024
+ while (cast->type) {
3025
+
3026
+ /* Don't need to add information already in the list */
3027
+ ret = 0;
3028
+ #ifdef SWIGRUNTIME_DEBUG
3029
+ printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
3030
+ #endif
3031
+ if (swig_module.next != &swig_module) {
3032
+ ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
3033
+ #ifdef SWIGRUNTIME_DEBUG
3034
+ if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
3035
+ #endif
3036
+ }
3037
+ if (ret) {
3038
+ if (type == swig_module.type_initial[i]) {
3039
+ #ifdef SWIGRUNTIME_DEBUG
3040
+ printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
3041
+ #endif
3042
+ cast->type = ret;
3043
+ ret = 0;
3044
+ } else {
3045
+ /* Check for casting already in the list */
3046
+ swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
3047
+ #ifdef SWIGRUNTIME_DEBUG
3048
+ if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
3049
+ #endif
3050
+ if (!ocast) ret = 0;
3051
+ }
3052
+ }
3053
+
3054
+ if (!ret) {
3055
+ #ifdef SWIGRUNTIME_DEBUG
3056
+ printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
3057
+ #endif
3058
+ if (type->cast) {
3059
+ type->cast->prev = cast;
3060
+ cast->next = type->cast;
3061
+ }
3062
+ type->cast = cast;
3063
+ }
3064
+ cast++;
3065
+ }
3066
+ /* Set entry in modules->types array equal to the type */
3067
+ swig_module.types[i] = type;
3068
+ }
3069
+ swig_module.types[i] = 0;
3070
+
3071
+ #ifdef SWIGRUNTIME_DEBUG
3072
+ printf("**** SWIG_InitializeModule: Cast List ******\n");
3073
+ for (i = 0; i < swig_module.size; ++i) {
3074
+ int j = 0;
3075
+ swig_cast_info *cast = swig_module.cast_initial[i];
3076
+ printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
3077
+ while (cast->type) {
3078
+ printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
3079
+ cast++;
3080
+ ++j;
3081
+ }
3082
+ printf("---- Total casts: %d\n",j);
3083
+ }
3084
+ printf("**** SWIG_InitializeModule: Cast List ******\n");
3085
+ #endif
3086
+ }
3087
+
3088
+ /* This function will propagate the clientdata field of type to
3089
+ * any new swig_type_info structures that have been added into the list
3090
+ * of equivalent types. It is like calling
3091
+ * SWIG_TypeClientData(type, clientdata) a second time.
3092
+ */
3093
+ SWIGRUNTIME void
3094
+ SWIG_PropagateClientData(void) {
3095
+ size_t i;
3096
+ swig_cast_info *equiv;
3097
+ static int init_run = 0;
3098
+
3099
+ if (init_run) return;
3100
+ init_run = 1;
3101
+
3102
+ for (i = 0; i < swig_module.size; i++) {
3103
+ if (swig_module.types[i]->clientdata) {
3104
+ equiv = swig_module.types[i]->cast;
3105
+ while (equiv) {
3106
+ if (!equiv->converter) {
3107
+ if (equiv->type && !equiv->type->clientdata)
3108
+ SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
3109
+ }
3110
+ equiv = equiv->next;
3111
+ }
3112
+ }
3113
+ }
3114
+ }
3115
+
3116
+ #ifdef __cplusplus
3117
+ #if 0
3118
+ { /* c-mode */
3119
+ #endif
3120
+ }
3121
+ #endif
3122
+
3123
+ /*
3124
+
3125
+ */
3126
+ #ifdef __cplusplus
3127
+ extern "C"
3128
+ #endif
3129
+ SWIGEXPORT void Init_lowlevel(void) {
3130
+ size_t i;
3131
+
3132
+ SWIG_InitRuntime();
3133
+ mLowlevel = rb_define_module("Ws2812");
3134
+ mLowlevel = rb_define_module_under(mLowlevel, "Lowlevel");
3135
+
3136
+ SWIG_InitializeModule(0);
3137
+ for (i = 0; i < swig_module.size; i++) {
3138
+ SWIG_define_class(swig_module.types[i]);
3139
+ }
3140
+
3141
+ SWIG_RubyInitializeTrackings();
3142
+ rb_define_const(mLowlevel, "WS2811_TARGET_FREQ", SWIG_From_int((int)(800000)));
3143
+
3144
+ SwigClassWs2811_channel_t.klass = rb_define_class_under(mLowlevel, "Ws2811_channel_t", rb_cObject);
3145
+ SWIG_TypeClientData(SWIGTYPE_p_ws2811_channel_t, (void *) &SwigClassWs2811_channel_t);
3146
+ rb_define_alloc_func(SwigClassWs2811_channel_t.klass, _wrap_ws2811_channel_t_allocate);
3147
+ rb_define_method(SwigClassWs2811_channel_t.klass, "initialize", _wrap_new_ws2811_channel_t, -1);
3148
+ rb_define_method(SwigClassWs2811_channel_t.klass, "gpionum=", _wrap_ws2811_channel_t_gpionum_set, -1);
3149
+ rb_define_method(SwigClassWs2811_channel_t.klass, "gpionum", _wrap_ws2811_channel_t_gpionum_get, -1);
3150
+ rb_define_method(SwigClassWs2811_channel_t.klass, "invert=", _wrap_ws2811_channel_t_invert_set, -1);
3151
+ rb_define_method(SwigClassWs2811_channel_t.klass, "invert", _wrap_ws2811_channel_t_invert_get, -1);
3152
+ rb_define_method(SwigClassWs2811_channel_t.klass, "count=", _wrap_ws2811_channel_t_count_set, -1);
3153
+ rb_define_method(SwigClassWs2811_channel_t.klass, "count", _wrap_ws2811_channel_t_count_get, -1);
3154
+ rb_define_method(SwigClassWs2811_channel_t.klass, "brightness=", _wrap_ws2811_channel_t_brightness_set, -1);
3155
+ rb_define_method(SwigClassWs2811_channel_t.klass, "brightness", _wrap_ws2811_channel_t_brightness_get, -1);
3156
+ rb_define_method(SwigClassWs2811_channel_t.klass, "leds=", _wrap_ws2811_channel_t_leds_set, -1);
3157
+ rb_define_method(SwigClassWs2811_channel_t.klass, "leds", _wrap_ws2811_channel_t_leds_get, -1);
3158
+ SwigClassWs2811_channel_t.mark = 0;
3159
+ SwigClassWs2811_channel_t.destroy = (void (*)(void *)) free_ws2811_channel_t;
3160
+ SwigClassWs2811_channel_t.trackObjects = 0;
3161
+
3162
+ SwigClassWs2811_t.klass = rb_define_class_under(mLowlevel, "Ws2811_t", rb_cObject);
3163
+ SWIG_TypeClientData(SWIGTYPE_p_ws2811_t, (void *) &SwigClassWs2811_t);
3164
+ rb_define_alloc_func(SwigClassWs2811_t.klass, _wrap_ws2811_t_allocate);
3165
+ rb_define_method(SwigClassWs2811_t.klass, "initialize", _wrap_new_ws2811_t, -1);
3166
+ rb_define_method(SwigClassWs2811_t.klass, "device=", _wrap_ws2811_t_device_set, -1);
3167
+ rb_define_method(SwigClassWs2811_t.klass, "device", _wrap_ws2811_t_device_get, -1);
3168
+ rb_define_method(SwigClassWs2811_t.klass, "freq=", _wrap_ws2811_t_freq_set, -1);
3169
+ rb_define_method(SwigClassWs2811_t.klass, "freq", _wrap_ws2811_t_freq_get, -1);
3170
+ rb_define_method(SwigClassWs2811_t.klass, "dmanum=", _wrap_ws2811_t_dmanum_set, -1);
3171
+ rb_define_method(SwigClassWs2811_t.klass, "dmanum", _wrap_ws2811_t_dmanum_get, -1);
3172
+ rb_define_method(SwigClassWs2811_t.klass, "channel=", _wrap_ws2811_t_channel_set, -1);
3173
+ rb_define_method(SwigClassWs2811_t.klass, "channel", _wrap_ws2811_t_channel_get, -1);
3174
+ SwigClassWs2811_t.mark = 0;
3175
+ SwigClassWs2811_t.destroy = (void (*)(void *)) free_ws2811_t;
3176
+ SwigClassWs2811_t.trackObjects = 0;
3177
+ rb_define_module_function(mLowlevel, "ws2811_init", _wrap_ws2811_init, -1);
3178
+ rb_define_module_function(mLowlevel, "ws2811_fini", _wrap_ws2811_fini, -1);
3179
+ rb_define_singleton_method(mLowlevel, "ws2811_direct_colors", _wrap_ws2811_direct_colors_get, 0);
3180
+ rb_define_singleton_method(mLowlevel, "ws2811_direct_colors=", _wrap_ws2811_direct_colors_set, 1);
3181
+ rb_define_module_function(mLowlevel, "ws2811_render", _wrap_ws2811_render, -1);
3182
+ rb_define_singleton_method(mLowlevel, "ws2811_dma_error", _wrap_ws2811_dma_error_get, 0);
3183
+ rb_define_singleton_method(mLowlevel, "ws2811_dma_error=", _wrap_ws2811_dma_error_set, 1);
3184
+ rb_define_module_function(mLowlevel, "ws2811_wait", _wrap_ws2811_wait, -1);
3185
+ rb_define_module_function(mLowlevel, "ws2811_led_get", _wrap_ws2811_led_get, -1);
3186
+ rb_define_module_function(mLowlevel, "ws2811_led_set", _wrap_ws2811_led_set, -1);
3187
+ rb_define_module_function(mLowlevel, "ws2811_channel_get", _wrap_ws2811_channel_get, -1);
3188
+ }
3189
+