taglib-ruby 0.4.0-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. data/.yardopts +9 -0
  2. data/CHANGES.md +53 -0
  3. data/Gemfile +4 -0
  4. data/Guardfile +8 -0
  5. data/LICENSE.txt +22 -0
  6. data/README.md +87 -0
  7. data/Rakefile +29 -0
  8. data/docs/default/fulldoc/html/css/common.css +1 -0
  9. data/docs/taglib/base.rb +202 -0
  10. data/docs/taglib/id3v1.rb +5 -0
  11. data/docs/taglib/id3v2.rb +444 -0
  12. data/docs/taglib/mpeg.rb +120 -0
  13. data/docs/taglib/ogg.rb +77 -0
  14. data/docs/taglib/vorbis.rb +62 -0
  15. data/ext/extconf_common.rb +29 -0
  16. data/ext/taglib_base/extconf.rb +4 -0
  17. data/ext/taglib_base/includes.i +115 -0
  18. data/ext/taglib_base/taglib_base.i +139 -0
  19. data/ext/taglib_base/taglib_base_wrap.cxx +5153 -0
  20. data/ext/taglib_id3v1/extconf.rb +4 -0
  21. data/ext/taglib_id3v1/taglib_id3v1.i +11 -0
  22. data/ext/taglib_id3v1/taglib_id3v1_wrap.cxx +3110 -0
  23. data/ext/taglib_id3v2/extconf.rb +4 -0
  24. data/ext/taglib_id3v2/relativevolumeframe.i +35 -0
  25. data/ext/taglib_id3v2/taglib_id3v2.i +112 -0
  26. data/ext/taglib_id3v2/taglib_id3v2_wrap.cxx +9033 -0
  27. data/ext/taglib_mpeg/extconf.rb +4 -0
  28. data/ext/taglib_mpeg/taglib_mpeg.i +75 -0
  29. data/ext/taglib_mpeg/taglib_mpeg_wrap.cxx +4726 -0
  30. data/ext/taglib_ogg/extconf.rb +4 -0
  31. data/ext/taglib_ogg/taglib_ogg.i +36 -0
  32. data/ext/taglib_ogg/taglib_ogg_wrap.cxx +3631 -0
  33. data/ext/taglib_vorbis/extconf.rb +4 -0
  34. data/ext/taglib_vorbis/taglib_vorbis.i +48 -0
  35. data/ext/taglib_vorbis/taglib_vorbis_wrap.cxx +3083 -0
  36. data/ext/valgrind-suppressions.txt +170 -0
  37. data/ext/win.cmake +5 -0
  38. data/lib/libtag.dll +0 -0
  39. data/lib/taglib.rb +14 -0
  40. data/lib/taglib/base.rb +19 -0
  41. data/lib/taglib/id3v1.rb +1 -0
  42. data/lib/taglib/id3v2.rb +20 -0
  43. data/lib/taglib/mpeg.rb +7 -0
  44. data/lib/taglib/ogg.rb +1 -0
  45. data/lib/taglib/version.rb +10 -0
  46. data/lib/taglib/vorbis.rb +7 -0
  47. data/lib/taglib_base.so +0 -0
  48. data/lib/taglib_id3v1.so +0 -0
  49. data/lib/taglib_id3v2.so +0 -0
  50. data/lib/taglib_mpeg.so +0 -0
  51. data/lib/taglib_ogg.so +0 -0
  52. data/lib/taglib_vorbis.so +0 -0
  53. data/taglib-ruby.gemspec +122 -0
  54. data/tasks/docs_coverage.rake +26 -0
  55. data/tasks/ext.rake +81 -0
  56. data/tasks/gemspec_check.rake +19 -0
  57. data/tasks/swig.rake +43 -0
  58. data/test/data/Makefile +15 -0
  59. data/test/data/add-relative-volume.cpp +40 -0
  60. data/test/data/crash.mp3 +0 -0
  61. data/test/data/globe_east_540.jpg +0 -0
  62. data/test/data/id3v1-create.cpp +31 -0
  63. data/test/data/id3v1.mp3 +0 -0
  64. data/test/data/relative-volume.mp3 +0 -0
  65. data/test/data/sample.mp3 +0 -0
  66. data/test/data/unicode.mp3 +0 -0
  67. data/test/data/vorbis-create.cpp +42 -0
  68. data/test/data/vorbis.oga +0 -0
  69. data/test/fileref_open_test.rb +32 -0
  70. data/test/fileref_properties_test.rb +21 -0
  71. data/test/fileref_write_test.rb +62 -0
  72. data/test/helper.rb +10 -0
  73. data/test/id3v1_tag_test.rb +36 -0
  74. data/test/id3v2_frames_test.rb +115 -0
  75. data/test/id3v2_memory_test.rb +87 -0
  76. data/test/id3v2_relative_volume_test.rb +62 -0
  77. data/test/id3v2_tag_test.rb +59 -0
  78. data/test/id3v2_unicode_test.rb +47 -0
  79. data/test/id3v2_write_test.rb +100 -0
  80. data/test/mpeg_file_test.rb +76 -0
  81. data/test/tag_test.rb +21 -0
  82. data/test/unicode_filename_test.rb +29 -0
  83. data/test/vorbis_file_test.rb +54 -0
  84. data/test/vorbis_tag_test.rb +79 -0
  85. metadata +191 -0
@@ -0,0 +1,4 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..'))
2
+ require 'extconf_common'
3
+
4
+ create_makefile('taglib_vorbis')
@@ -0,0 +1,48 @@
1
+ %module "TagLib::Ogg::Vorbis"
2
+ %{
3
+ #include <taglib/taglib.h>
4
+ #include <taglib/vorbisproperties.h>
5
+ #include <taglib/vorbisfile.h>
6
+ %}
7
+
8
+ %include "../taglib_base/includes.i"
9
+ %import(module="taglib_ogg") "../taglib_ogg/taglib_ogg.i"
10
+
11
+ %freefunc TagLib::Vorbis::File "free_taglib_vorbis_file";
12
+
13
+ %include <taglib/vorbisproperties.h>
14
+ %include <taglib/vorbisfile.h>
15
+
16
+ %begin %{
17
+ static void free_taglib_vorbis_file(void *ptr);
18
+ %}
19
+ %header %{
20
+ static void free_taglib_vorbis_file(void *ptr) {
21
+ TagLib::Ogg::Vorbis::File *file = (TagLib::Ogg::Vorbis::File *) ptr;
22
+
23
+ TagLib::Ogg::XiphComment *tag = file->tag();
24
+ if (tag) {
25
+ SWIG_RubyUnlinkObjects(tag);
26
+ SWIG_RubyRemoveTracking(tag);
27
+ }
28
+
29
+ TagLib::Vorbis::Properties *properties = file->audioProperties();
30
+ if (properties) {
31
+ SWIG_RubyUnlinkObjects(properties);
32
+ SWIG_RubyRemoveTracking(properties);
33
+ }
34
+
35
+ SWIG_RubyUnlinkObjects(file);
36
+ SWIG_RubyRemoveTracking(file);
37
+
38
+ delete file;
39
+ }
40
+ %}
41
+
42
+ %extend TagLib::Vorbis::File {
43
+ void close() {
44
+ free_taglib_vorbis_file($self);
45
+ }
46
+ }
47
+
48
+ // vim: set filetype=cpp sw=2 ts=2 expandtab:
@@ -0,0 +1,3083 @@
1
+ /* ----------------------------------------------------------------------------
2
+ * This file was automatically generated by SWIG (http://www.swig.org).
3
+ * Version 2.0.5
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
+ static void free_taglib_vorbis_file(void *ptr);
12
+
13
+
14
+ #define SWIGRUBY
15
+
16
+
17
+ #ifdef __cplusplus
18
+ /* SwigValueWrapper is described in swig.swg */
19
+ template<typename T> class SwigValueWrapper {
20
+ struct SwigMovePointer {
21
+ T *ptr;
22
+ SwigMovePointer(T *p) : ptr(p) { }
23
+ ~SwigMovePointer() { delete ptr; }
24
+ SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; }
25
+ } pointer;
26
+ SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
27
+ SwigValueWrapper(const SwigValueWrapper<T>& rhs);
28
+ public:
29
+ SwigValueWrapper() : pointer(0) { }
30
+ SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; }
31
+ operator T&() const { return *pointer.ptr; }
32
+ T *operator&() { return pointer.ptr; }
33
+ };
34
+
35
+ template <typename T> T SwigValueInit() {
36
+ return T();
37
+ }
38
+ #endif
39
+
40
+ /* -----------------------------------------------------------------------------
41
+ * This section contains generic SWIG labels for method/variable
42
+ * declarations/attributes, and other compiler dependent labels.
43
+ * ----------------------------------------------------------------------------- */
44
+
45
+ /* template workaround for compilers that cannot correctly implement the C++ standard */
46
+ #ifndef SWIGTEMPLATEDISAMBIGUATOR
47
+ # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
48
+ # define SWIGTEMPLATEDISAMBIGUATOR template
49
+ # elif defined(__HP_aCC)
50
+ /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
51
+ /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
52
+ # define SWIGTEMPLATEDISAMBIGUATOR template
53
+ # else
54
+ # define SWIGTEMPLATEDISAMBIGUATOR
55
+ # endif
56
+ #endif
57
+
58
+ /* inline attribute */
59
+ #ifndef SWIGINLINE
60
+ # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
61
+ # define SWIGINLINE inline
62
+ # else
63
+ # define SWIGINLINE
64
+ # endif
65
+ #endif
66
+
67
+ /* attribute recognised by some compilers to avoid 'unused' warnings */
68
+ #ifndef SWIGUNUSED
69
+ # if defined(__GNUC__)
70
+ # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
71
+ # define SWIGUNUSED __attribute__ ((__unused__))
72
+ # else
73
+ # define SWIGUNUSED
74
+ # endif
75
+ # elif defined(__ICC)
76
+ # define SWIGUNUSED __attribute__ ((__unused__))
77
+ # else
78
+ # define SWIGUNUSED
79
+ # endif
80
+ #endif
81
+
82
+ #ifndef SWIG_MSC_UNSUPPRESS_4505
83
+ # if defined(_MSC_VER)
84
+ # pragma warning(disable : 4505) /* unreferenced local function has been removed */
85
+ # endif
86
+ #endif
87
+
88
+ #ifndef SWIGUNUSEDPARM
89
+ # ifdef __cplusplus
90
+ # define SWIGUNUSEDPARM(p)
91
+ # else
92
+ # define SWIGUNUSEDPARM(p) p SWIGUNUSED
93
+ # endif
94
+ #endif
95
+
96
+ /* internal SWIG method */
97
+ #ifndef SWIGINTERN
98
+ # define SWIGINTERN static SWIGUNUSED
99
+ #endif
100
+
101
+ /* internal inline SWIG method */
102
+ #ifndef SWIGINTERNINLINE
103
+ # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
104
+ #endif
105
+
106
+ /* exporting methods */
107
+ #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
108
+ # ifndef GCC_HASCLASSVISIBILITY
109
+ # define GCC_HASCLASSVISIBILITY
110
+ # endif
111
+ #endif
112
+
113
+ #ifndef SWIGEXPORT
114
+ # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
115
+ # if defined(STATIC_LINKED)
116
+ # define SWIGEXPORT
117
+ # else
118
+ # define SWIGEXPORT __declspec(dllexport)
119
+ # endif
120
+ # else
121
+ # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
122
+ # define SWIGEXPORT __attribute__ ((visibility("default")))
123
+ # else
124
+ # define SWIGEXPORT
125
+ # endif
126
+ # endif
127
+ #endif
128
+
129
+ /* calling conventions for Windows */
130
+ #ifndef SWIGSTDCALL
131
+ # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
132
+ # define SWIGSTDCALL __stdcall
133
+ # else
134
+ # define SWIGSTDCALL
135
+ # endif
136
+ #endif
137
+
138
+ /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
139
+ #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
140
+ # define _CRT_SECURE_NO_DEPRECATE
141
+ #endif
142
+
143
+ /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
144
+ #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
145
+ # define _SCL_SECURE_NO_DEPRECATE
146
+ #endif
147
+
148
+
149
+ /* -----------------------------------------------------------------------------
150
+ * This section contains generic SWIG labels for method/variable
151
+ * declarations/attributes, and other compiler dependent labels.
152
+ * ----------------------------------------------------------------------------- */
153
+
154
+ /* template workaround for compilers that cannot correctly implement the C++ standard */
155
+ #ifndef SWIGTEMPLATEDISAMBIGUATOR
156
+ # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
157
+ # define SWIGTEMPLATEDISAMBIGUATOR template
158
+ # elif defined(__HP_aCC)
159
+ /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
160
+ /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
161
+ # define SWIGTEMPLATEDISAMBIGUATOR template
162
+ # else
163
+ # define SWIGTEMPLATEDISAMBIGUATOR
164
+ # endif
165
+ #endif
166
+
167
+ /* inline attribute */
168
+ #ifndef SWIGINLINE
169
+ # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
170
+ # define SWIGINLINE inline
171
+ # else
172
+ # define SWIGINLINE
173
+ # endif
174
+ #endif
175
+
176
+ /* attribute recognised by some compilers to avoid 'unused' warnings */
177
+ #ifndef SWIGUNUSED
178
+ # if defined(__GNUC__)
179
+ # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
180
+ # define SWIGUNUSED __attribute__ ((__unused__))
181
+ # else
182
+ # define SWIGUNUSED
183
+ # endif
184
+ # elif defined(__ICC)
185
+ # define SWIGUNUSED __attribute__ ((__unused__))
186
+ # else
187
+ # define SWIGUNUSED
188
+ # endif
189
+ #endif
190
+
191
+ #ifndef SWIG_MSC_UNSUPPRESS_4505
192
+ # if defined(_MSC_VER)
193
+ # pragma warning(disable : 4505) /* unreferenced local function has been removed */
194
+ # endif
195
+ #endif
196
+
197
+ #ifndef SWIGUNUSEDPARM
198
+ # ifdef __cplusplus
199
+ # define SWIGUNUSEDPARM(p)
200
+ # else
201
+ # define SWIGUNUSEDPARM(p) p SWIGUNUSED
202
+ # endif
203
+ #endif
204
+
205
+ /* internal SWIG method */
206
+ #ifndef SWIGINTERN
207
+ # define SWIGINTERN static SWIGUNUSED
208
+ #endif
209
+
210
+ /* internal inline SWIG method */
211
+ #ifndef SWIGINTERNINLINE
212
+ # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
213
+ #endif
214
+
215
+ /* exporting methods */
216
+ #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
217
+ # ifndef GCC_HASCLASSVISIBILITY
218
+ # define GCC_HASCLASSVISIBILITY
219
+ # endif
220
+ #endif
221
+
222
+ #ifndef SWIGEXPORT
223
+ # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
224
+ # if defined(STATIC_LINKED)
225
+ # define SWIGEXPORT
226
+ # else
227
+ # define SWIGEXPORT __declspec(dllexport)
228
+ # endif
229
+ # else
230
+ # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
231
+ # define SWIGEXPORT __attribute__ ((visibility("default")))
232
+ # else
233
+ # define SWIGEXPORT
234
+ # endif
235
+ # endif
236
+ #endif
237
+
238
+ /* calling conventions for Windows */
239
+ #ifndef SWIGSTDCALL
240
+ # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
241
+ # define SWIGSTDCALL __stdcall
242
+ # else
243
+ # define SWIGSTDCALL
244
+ # endif
245
+ #endif
246
+
247
+ /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
248
+ #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
249
+ # define _CRT_SECURE_NO_DEPRECATE
250
+ #endif
251
+
252
+ /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
253
+ #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
254
+ # define _SCL_SECURE_NO_DEPRECATE
255
+ #endif
256
+
257
+
258
+ /* -----------------------------------------------------------------------------
259
+ * swigrun.swg
260
+ *
261
+ * This file contains generic C API SWIG runtime support for pointer
262
+ * type checking.
263
+ * ----------------------------------------------------------------------------- */
264
+
265
+ /* This should only be incremented when either the layout of swig_type_info changes,
266
+ or for whatever reason, the runtime changes incompatibly */
267
+ #define SWIG_RUNTIME_VERSION "4"
268
+
269
+ /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
270
+ #ifdef SWIG_TYPE_TABLE
271
+ # define SWIG_QUOTE_STRING(x) #x
272
+ # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
273
+ # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
274
+ #else
275
+ # define SWIG_TYPE_TABLE_NAME
276
+ #endif
277
+
278
+ /*
279
+ You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
280
+ creating a static or dynamic library from the SWIG runtime code.
281
+ In 99.9% of the cases, SWIG just needs to declare them as 'static'.
282
+
283
+ But only do this if strictly necessary, ie, if you have problems
284
+ with your compiler or suchlike.
285
+ */
286
+
287
+ #ifndef SWIGRUNTIME
288
+ # define SWIGRUNTIME SWIGINTERN
289
+ #endif
290
+
291
+ #ifndef SWIGRUNTIMEINLINE
292
+ # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
293
+ #endif
294
+
295
+ /* Generic buffer size */
296
+ #ifndef SWIG_BUFFER_SIZE
297
+ # define SWIG_BUFFER_SIZE 1024
298
+ #endif
299
+
300
+ /* Flags for pointer conversions */
301
+ #define SWIG_POINTER_DISOWN 0x1
302
+ #define SWIG_CAST_NEW_MEMORY 0x2
303
+
304
+ /* Flags for new pointer objects */
305
+ #define SWIG_POINTER_OWN 0x1
306
+
307
+
308
+ /*
309
+ Flags/methods for returning states.
310
+
311
+ The SWIG conversion methods, as ConvertPtr, return an integer
312
+ that tells if the conversion was successful or not. And if not,
313
+ an error code can be returned (see swigerrors.swg for the codes).
314
+
315
+ Use the following macros/flags to set or process the returning
316
+ states.
317
+
318
+ In old versions of SWIG, code such as the following was usually written:
319
+
320
+ if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
321
+ // success code
322
+ } else {
323
+ //fail code
324
+ }
325
+
326
+ Now you can be more explicit:
327
+
328
+ int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
329
+ if (SWIG_IsOK(res)) {
330
+ // success code
331
+ } else {
332
+ // fail code
333
+ }
334
+
335
+ which is the same really, but now you can also do
336
+
337
+ Type *ptr;
338
+ int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
339
+ if (SWIG_IsOK(res)) {
340
+ // success code
341
+ if (SWIG_IsNewObj(res) {
342
+ ...
343
+ delete *ptr;
344
+ } else {
345
+ ...
346
+ }
347
+ } else {
348
+ // fail code
349
+ }
350
+
351
+ I.e., now SWIG_ConvertPtr can return new objects and you can
352
+ identify the case and take care of the deallocation. Of course that
353
+ also requires SWIG_ConvertPtr to return new result values, such as
354
+
355
+ int SWIG_ConvertPtr(obj, ptr,...) {
356
+ if (<obj is ok>) {
357
+ if (<need new object>) {
358
+ *ptr = <ptr to new allocated object>;
359
+ return SWIG_NEWOBJ;
360
+ } else {
361
+ *ptr = <ptr to old object>;
362
+ return SWIG_OLDOBJ;
363
+ }
364
+ } else {
365
+ return SWIG_BADOBJ;
366
+ }
367
+ }
368
+
369
+ Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
370
+ more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
371
+ SWIG errors code.
372
+
373
+ Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
374
+ allows to return the 'cast rank', for example, if you have this
375
+
376
+ int food(double)
377
+ int fooi(int);
378
+
379
+ and you call
380
+
381
+ food(1) // cast rank '1' (1 -> 1.0)
382
+ fooi(1) // cast rank '0'
383
+
384
+ just use the SWIG_AddCast()/SWIG_CheckState()
385
+ */
386
+
387
+ #define SWIG_OK (0)
388
+ #define SWIG_ERROR (-1)
389
+ #define SWIG_IsOK(r) (r >= 0)
390
+ #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
391
+
392
+ /* The CastRankLimit says how many bits are used for the cast rank */
393
+ #define SWIG_CASTRANKLIMIT (1 << 8)
394
+ /* The NewMask denotes the object was created (using new/malloc) */
395
+ #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1)
396
+ /* The TmpMask is for in/out typemaps that use temporal objects */
397
+ #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1)
398
+ /* Simple returning values */
399
+ #define SWIG_BADOBJ (SWIG_ERROR)
400
+ #define SWIG_OLDOBJ (SWIG_OK)
401
+ #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK)
402
+ #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK)
403
+ /* Check, add and del mask methods */
404
+ #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
405
+ #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
406
+ #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
407
+ #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
408
+ #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
409
+ #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
410
+
411
+ /* Cast-Rank Mode */
412
+ #if defined(SWIG_CASTRANK_MODE)
413
+ # ifndef SWIG_TypeRank
414
+ # define SWIG_TypeRank unsigned long
415
+ # endif
416
+ # ifndef SWIG_MAXCASTRANK /* Default cast allowed */
417
+ # define SWIG_MAXCASTRANK (2)
418
+ # endif
419
+ # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
420
+ # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
421
+ SWIGINTERNINLINE int SWIG_AddCast(int r) {
422
+ return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
423
+ }
424
+ SWIGINTERNINLINE int SWIG_CheckState(int r) {
425
+ return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
426
+ }
427
+ #else /* no cast-rank mode */
428
+ # define SWIG_AddCast
429
+ # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
430
+ #endif
431
+
432
+
433
+ #include <string.h>
434
+
435
+ #ifdef __cplusplus
436
+ extern "C" {
437
+ #endif
438
+
439
+ typedef void *(*swig_converter_func)(void *, int *);
440
+ typedef struct swig_type_info *(*swig_dycast_func)(void **);
441
+
442
+ /* Structure to store information on one type */
443
+ typedef struct swig_type_info {
444
+ const char *name; /* mangled name of this type */
445
+ const char *str; /* human readable name of this type */
446
+ swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
447
+ struct swig_cast_info *cast; /* linked list of types that can cast into this type */
448
+ void *clientdata; /* language specific type data */
449
+ int owndata; /* flag if the structure owns the clientdata */
450
+ } swig_type_info;
451
+
452
+ /* Structure to store a type and conversion function used for casting */
453
+ typedef struct swig_cast_info {
454
+ swig_type_info *type; /* pointer to type that is equivalent to this type */
455
+ swig_converter_func converter; /* function to cast the void pointers */
456
+ struct swig_cast_info *next; /* pointer to next cast in linked list */
457
+ struct swig_cast_info *prev; /* pointer to the previous cast */
458
+ } swig_cast_info;
459
+
460
+ /* Structure used to store module information
461
+ * Each module generates one structure like this, and the runtime collects
462
+ * all of these structures and stores them in a circularly linked list.*/
463
+ typedef struct swig_module_info {
464
+ swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
465
+ size_t size; /* Number of types in this module */
466
+ struct swig_module_info *next; /* Pointer to next element in circularly linked list */
467
+ swig_type_info **type_initial; /* Array of initially generated type structures */
468
+ swig_cast_info **cast_initial; /* Array of initially generated casting structures */
469
+ void *clientdata; /* Language specific module data */
470
+ } swig_module_info;
471
+
472
+ /*
473
+ Compare two type names skipping the space characters, therefore
474
+ "char*" == "char *" and "Class<int>" == "Class<int >", etc.
475
+
476
+ Return 0 when the two name types are equivalent, as in
477
+ strncmp, but skipping ' '.
478
+ */
479
+ SWIGRUNTIME int
480
+ SWIG_TypeNameComp(const char *f1, const char *l1,
481
+ const char *f2, const char *l2) {
482
+ for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
483
+ while ((*f1 == ' ') && (f1 != l1)) ++f1;
484
+ while ((*f2 == ' ') && (f2 != l2)) ++f2;
485
+ if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
486
+ }
487
+ return (int)((l1 - f1) - (l2 - f2));
488
+ }
489
+
490
+ /*
491
+ Check type equivalence in a name list like <name1>|<name2>|...
492
+ Return 0 if not equal, 1 if equal
493
+ */
494
+ SWIGRUNTIME int
495
+ SWIG_TypeEquiv(const char *nb, const char *tb) {
496
+ int equiv = 0;
497
+ const char* te = tb + strlen(tb);
498
+ const char* ne = nb;
499
+ while (!equiv && *ne) {
500
+ for (nb = ne; *ne; ++ne) {
501
+ if (*ne == '|') break;
502
+ }
503
+ equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
504
+ if (*ne) ++ne;
505
+ }
506
+ return equiv;
507
+ }
508
+
509
+ /*
510
+ Check type equivalence in a name list like <name1>|<name2>|...
511
+ Return 0 if equal, -1 if nb < tb, 1 if nb > tb
512
+ */
513
+ SWIGRUNTIME int
514
+ SWIG_TypeCompare(const char *nb, const char *tb) {
515
+ int equiv = 0;
516
+ const char* te = tb + strlen(tb);
517
+ const char* ne = nb;
518
+ while (!equiv && *ne) {
519
+ for (nb = ne; *ne; ++ne) {
520
+ if (*ne == '|') break;
521
+ }
522
+ equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
523
+ if (*ne) ++ne;
524
+ }
525
+ return equiv;
526
+ }
527
+
528
+
529
+ /*
530
+ Check the typename
531
+ */
532
+ SWIGRUNTIME swig_cast_info *
533
+ SWIG_TypeCheck(const char *c, swig_type_info *ty) {
534
+ if (ty) {
535
+ swig_cast_info *iter = ty->cast;
536
+ while (iter) {
537
+ if (strcmp(iter->type->name, c) == 0) {
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
+ Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
558
+ */
559
+ SWIGRUNTIME swig_cast_info *
560
+ SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
561
+ if (ty) {
562
+ swig_cast_info *iter = ty->cast;
563
+ while (iter) {
564
+ if (iter->type == from) {
565
+ if (iter == ty->cast)
566
+ return iter;
567
+ /* Move iter to the top of the linked list */
568
+ iter->prev->next = iter->next;
569
+ if (iter->next)
570
+ iter->next->prev = iter->prev;
571
+ iter->next = ty->cast;
572
+ iter->prev = 0;
573
+ if (ty->cast) ty->cast->prev = iter;
574
+ ty->cast = iter;
575
+ return iter;
576
+ }
577
+ iter = iter->next;
578
+ }
579
+ }
580
+ return 0;
581
+ }
582
+
583
+ /*
584
+ Cast a pointer up an inheritance hierarchy
585
+ */
586
+ SWIGRUNTIMEINLINE void *
587
+ SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
588
+ return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
589
+ }
590
+
591
+ /*
592
+ Dynamic pointer casting. Down an inheritance hierarchy
593
+ */
594
+ SWIGRUNTIME swig_type_info *
595
+ SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
596
+ swig_type_info *lastty = ty;
597
+ if (!ty || !ty->dcast) return ty;
598
+ while (ty && (ty->dcast)) {
599
+ ty = (*ty->dcast)(ptr);
600
+ if (ty) lastty = ty;
601
+ }
602
+ return lastty;
603
+ }
604
+
605
+ /*
606
+ Return the name associated with this type
607
+ */
608
+ SWIGRUNTIMEINLINE const char *
609
+ SWIG_TypeName(const swig_type_info *ty) {
610
+ return ty->name;
611
+ }
612
+
613
+ /*
614
+ Return the pretty name associated with this type,
615
+ that is an unmangled type name in a form presentable to the user.
616
+ */
617
+ SWIGRUNTIME const char *
618
+ SWIG_TypePrettyName(const swig_type_info *type) {
619
+ /* The "str" field contains the equivalent pretty names of the
620
+ type, separated by vertical-bar characters. We choose
621
+ to print the last name, as it is often (?) the most
622
+ specific. */
623
+ if (!type) return NULL;
624
+ if (type->str != NULL) {
625
+ const char *last_name = type->str;
626
+ const char *s;
627
+ for (s = type->str; *s; s++)
628
+ if (*s == '|') last_name = s+1;
629
+ return last_name;
630
+ }
631
+ else
632
+ return type->name;
633
+ }
634
+
635
+ /*
636
+ Set the clientdata field for a type
637
+ */
638
+ SWIGRUNTIME void
639
+ SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
640
+ swig_cast_info *cast = ti->cast;
641
+ /* if (ti->clientdata == clientdata) return; */
642
+ ti->clientdata = clientdata;
643
+
644
+ while (cast) {
645
+ if (!cast->converter) {
646
+ swig_type_info *tc = cast->type;
647
+ if (!tc->clientdata) {
648
+ SWIG_TypeClientData(tc, clientdata);
649
+ }
650
+ }
651
+ cast = cast->next;
652
+ }
653
+ }
654
+ SWIGRUNTIME void
655
+ SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
656
+ SWIG_TypeClientData(ti, clientdata);
657
+ ti->owndata = 1;
658
+ }
659
+
660
+ /*
661
+ Search for a swig_type_info structure only by mangled name
662
+ Search is a O(log #types)
663
+
664
+ We start searching at module start, and finish searching when start == end.
665
+ Note: if start == end at the beginning of the function, we go all the way around
666
+ the circular list.
667
+ */
668
+ SWIGRUNTIME swig_type_info *
669
+ SWIG_MangledTypeQueryModule(swig_module_info *start,
670
+ swig_module_info *end,
671
+ const char *name) {
672
+ swig_module_info *iter = start;
673
+ do {
674
+ if (iter->size) {
675
+ register size_t l = 0;
676
+ register size_t r = iter->size - 1;
677
+ do {
678
+ /* since l+r >= 0, we can (>> 1) instead (/ 2) */
679
+ register size_t i = (l + r) >> 1;
680
+ const char *iname = iter->types[i]->name;
681
+ if (iname) {
682
+ register int compare = strcmp(name, iname);
683
+ if (compare == 0) {
684
+ return iter->types[i];
685
+ } else if (compare < 0) {
686
+ if (i) {
687
+ r = i - 1;
688
+ } else {
689
+ break;
690
+ }
691
+ } else if (compare > 0) {
692
+ l = i + 1;
693
+ }
694
+ } else {
695
+ break; /* should never happen */
696
+ }
697
+ } while (l <= r);
698
+ }
699
+ iter = iter->next;
700
+ } while (iter != end);
701
+ return 0;
702
+ }
703
+
704
+ /*
705
+ Search for a swig_type_info structure for either a mangled name or a human readable name.
706
+ It first searches the mangled names of the types, which is a O(log #types)
707
+ If a type is not found it then searches the human readable names, which is O(#types).
708
+
709
+ We start searching at module start, and finish searching when start == end.
710
+ Note: if start == end at the beginning of the function, we go all the way around
711
+ the circular list.
712
+ */
713
+ SWIGRUNTIME swig_type_info *
714
+ SWIG_TypeQueryModule(swig_module_info *start,
715
+ swig_module_info *end,
716
+ const char *name) {
717
+ /* STEP 1: Search the name field using binary search */
718
+ swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
719
+ if (ret) {
720
+ return ret;
721
+ } else {
722
+ /* STEP 2: If the type hasn't been found, do a complete search
723
+ of the str field (the human readable name) */
724
+ swig_module_info *iter = start;
725
+ do {
726
+ register size_t i = 0;
727
+ for (; i < iter->size; ++i) {
728
+ if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
729
+ return iter->types[i];
730
+ }
731
+ iter = iter->next;
732
+ } while (iter != end);
733
+ }
734
+
735
+ /* neither found a match */
736
+ return 0;
737
+ }
738
+
739
+ /*
740
+ Pack binary data into a string
741
+ */
742
+ SWIGRUNTIME char *
743
+ SWIG_PackData(char *c, void *ptr, size_t sz) {
744
+ static const char hex[17] = "0123456789abcdef";
745
+ register const unsigned char *u = (unsigned char *) ptr;
746
+ register const unsigned char *eu = u + sz;
747
+ for (; u != eu; ++u) {
748
+ register unsigned char uu = *u;
749
+ *(c++) = hex[(uu & 0xf0) >> 4];
750
+ *(c++) = hex[uu & 0xf];
751
+ }
752
+ return c;
753
+ }
754
+
755
+ /*
756
+ Unpack binary data from a string
757
+ */
758
+ SWIGRUNTIME const char *
759
+ SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
760
+ register unsigned char *u = (unsigned char *) ptr;
761
+ register const unsigned char *eu = u + sz;
762
+ for (; u != eu; ++u) {
763
+ register char d = *(c++);
764
+ register unsigned char uu;
765
+ if ((d >= '0') && (d <= '9'))
766
+ uu = ((d - '0') << 4);
767
+ else if ((d >= 'a') && (d <= 'f'))
768
+ uu = ((d - ('a'-10)) << 4);
769
+ else
770
+ return (char *) 0;
771
+ d = *(c++);
772
+ if ((d >= '0') && (d <= '9'))
773
+ uu |= (d - '0');
774
+ else if ((d >= 'a') && (d <= 'f'))
775
+ uu |= (d - ('a'-10));
776
+ else
777
+ return (char *) 0;
778
+ *u = uu;
779
+ }
780
+ return c;
781
+ }
782
+
783
+ /*
784
+ Pack 'void *' into a string buffer.
785
+ */
786
+ SWIGRUNTIME char *
787
+ SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
788
+ char *r = buff;
789
+ if ((2*sizeof(void *) + 2) > bsz) return 0;
790
+ *(r++) = '_';
791
+ r = SWIG_PackData(r,&ptr,sizeof(void *));
792
+ if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
793
+ strcpy(r,name);
794
+ return buff;
795
+ }
796
+
797
+ SWIGRUNTIME const char *
798
+ SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
799
+ if (*c != '_') {
800
+ if (strcmp(c,"NULL") == 0) {
801
+ *ptr = (void *) 0;
802
+ return name;
803
+ } else {
804
+ return 0;
805
+ }
806
+ }
807
+ return SWIG_UnpackData(++c,ptr,sizeof(void *));
808
+ }
809
+
810
+ SWIGRUNTIME char *
811
+ SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
812
+ char *r = buff;
813
+ size_t lname = (name ? strlen(name) : 0);
814
+ if ((2*sz + 2 + lname) > bsz) return 0;
815
+ *(r++) = '_';
816
+ r = SWIG_PackData(r,ptr,sz);
817
+ if (lname) {
818
+ strncpy(r,name,lname+1);
819
+ } else {
820
+ *r = 0;
821
+ }
822
+ return buff;
823
+ }
824
+
825
+ SWIGRUNTIME const char *
826
+ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
827
+ if (*c != '_') {
828
+ if (strcmp(c,"NULL") == 0) {
829
+ memset(ptr,0,sz);
830
+ return name;
831
+ } else {
832
+ return 0;
833
+ }
834
+ }
835
+ return SWIG_UnpackData(++c,ptr,sz);
836
+ }
837
+
838
+ #ifdef __cplusplus
839
+ }
840
+ #endif
841
+
842
+ /* Errors in SWIG */
843
+ #define SWIG_UnknownError -1
844
+ #define SWIG_IOError -2
845
+ #define SWIG_RuntimeError -3
846
+ #define SWIG_IndexError -4
847
+ #define SWIG_TypeError -5
848
+ #define SWIG_DivisionByZero -6
849
+ #define SWIG_OverflowError -7
850
+ #define SWIG_SyntaxError -8
851
+ #define SWIG_ValueError -9
852
+ #define SWIG_SystemError -10
853
+ #define SWIG_AttributeError -11
854
+ #define SWIG_MemoryError -12
855
+ #define SWIG_NullReferenceError -13
856
+
857
+
858
+
859
+ #include <ruby.h>
860
+
861
+ /* Ruby 1.9.1 has a "memoisation optimisation" when compiling with GCC which
862
+ * breaks using rb_intern as an lvalue, as SWIG does. We work around this
863
+ * issue for now by disabling this.
864
+ * https://sourceforge.net/tracker/?func=detail&aid=2859614&group_id=1645&atid=101645
865
+ */
866
+ #ifdef rb_intern
867
+ # undef rb_intern
868
+ #endif
869
+
870
+ /* Remove global macros defined in Ruby's win32.h */
871
+ #ifdef write
872
+ # undef write
873
+ #endif
874
+ #ifdef read
875
+ # undef read
876
+ #endif
877
+ #ifdef bind
878
+ # undef bind
879
+ #endif
880
+ #ifdef close
881
+ # undef close
882
+ #endif
883
+ #ifdef connect
884
+ # undef connect
885
+ #endif
886
+
887
+
888
+ /* Ruby 1.7 defines NUM2LL(), LL2NUM() and ULL2NUM() macros */
889
+ #ifndef NUM2LL
890
+ #define NUM2LL(x) NUM2LONG((x))
891
+ #endif
892
+ #ifndef LL2NUM
893
+ #define LL2NUM(x) INT2NUM((long) (x))
894
+ #endif
895
+ #ifndef ULL2NUM
896
+ #define ULL2NUM(x) UINT2NUM((unsigned long) (x))
897
+ #endif
898
+
899
+ /* Ruby 1.7 doesn't (yet) define NUM2ULL() */
900
+ #ifndef NUM2ULL
901
+ #ifdef HAVE_LONG_LONG
902
+ #define NUM2ULL(x) rb_num2ull((x))
903
+ #else
904
+ #define NUM2ULL(x) NUM2ULONG(x)
905
+ #endif
906
+ #endif
907
+
908
+ /* RSTRING_LEN, etc are new in Ruby 1.9, but ->ptr and ->len no longer work */
909
+ /* Define these for older versions so we can just write code the new way */
910
+ #ifndef RSTRING_LEN
911
+ # define RSTRING_LEN(x) RSTRING(x)->len
912
+ #endif
913
+ #ifndef RSTRING_PTR
914
+ # define RSTRING_PTR(x) RSTRING(x)->ptr
915
+ #endif
916
+ #ifndef RSTRING_END
917
+ # define RSTRING_END(x) (RSTRING_PTR(x) + RSTRING_LEN(x))
918
+ #endif
919
+ #ifndef RARRAY_LEN
920
+ # define RARRAY_LEN(x) RARRAY(x)->len
921
+ #endif
922
+ #ifndef RARRAY_PTR
923
+ # define RARRAY_PTR(x) RARRAY(x)->ptr
924
+ #endif
925
+ #ifndef RFLOAT_VALUE
926
+ # define RFLOAT_VALUE(x) RFLOAT(x)->value
927
+ #endif
928
+ #ifndef DOUBLE2NUM
929
+ # define DOUBLE2NUM(x) rb_float_new(x)
930
+ #endif
931
+ #ifndef RHASH_TBL
932
+ # define RHASH_TBL(x) (RHASH(x)->tbl)
933
+ #endif
934
+ #ifndef RHASH_ITER_LEV
935
+ # define RHASH_ITER_LEV(x) (RHASH(x)->iter_lev)
936
+ #endif
937
+ #ifndef RHASH_IFNONE
938
+ # define RHASH_IFNONE(x) (RHASH(x)->ifnone)
939
+ #endif
940
+ #ifndef RHASH_SIZE
941
+ # define RHASH_SIZE(x) (RHASH(x)->tbl->num_entries)
942
+ #endif
943
+ #ifndef RHASH_EMPTY_P
944
+ # define RHASH_EMPTY_P(x) (RHASH_SIZE(x) == 0)
945
+ #endif
946
+ #ifndef RSTRUCT_LEN
947
+ # define RSTRUCT_LEN(x) RSTRUCT(x)->len
948
+ #endif
949
+ #ifndef RSTRUCT_PTR
950
+ # define RSTRUCT_PTR(x) RSTRUCT(x)->ptr
951
+ #endif
952
+
953
+
954
+
955
+ /*
956
+ * Need to be very careful about how these macros are defined, especially
957
+ * when compiling C++ code or C code with an ANSI C compiler.
958
+ *
959
+ * VALUEFUNC(f) is a macro used to typecast a C function that implements
960
+ * a Ruby method so that it can be passed as an argument to API functions
961
+ * like rb_define_method() and rb_define_singleton_method().
962
+ *
963
+ * VOIDFUNC(f) is a macro used to typecast a C function that implements
964
+ * either the "mark" or "free" stuff for a Ruby Data object, so that it
965
+ * can be passed as an argument to API functions like Data_Wrap_Struct()
966
+ * and Data_Make_Struct().
967
+ */
968
+
969
+ #ifdef __cplusplus
970
+ # ifndef RUBY_METHOD_FUNC /* These definitions should work for Ruby 1.4.6 */
971
+ # define PROTECTFUNC(f) ((VALUE (*)()) f)
972
+ # define VALUEFUNC(f) ((VALUE (*)()) f)
973
+ # define VOIDFUNC(f) ((void (*)()) f)
974
+ # else
975
+ # ifndef ANYARGS /* These definitions should work for Ruby 1.6 */
976
+ # define PROTECTFUNC(f) ((VALUE (*)()) f)
977
+ # define VALUEFUNC(f) ((VALUE (*)()) f)
978
+ # define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
979
+ # else /* These definitions should work for Ruby 1.7+ */
980
+ # define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f)
981
+ # define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f)
982
+ # define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
983
+ # endif
984
+ # endif
985
+ #else
986
+ # define VALUEFUNC(f) (f)
987
+ # define VOIDFUNC(f) (f)
988
+ #endif
989
+
990
+ /* Don't use for expressions have side effect */
991
+ #ifndef RB_STRING_VALUE
992
+ #define RB_STRING_VALUE(s) (TYPE(s) == T_STRING ? (s) : (*(volatile VALUE *)&(s) = rb_str_to_str(s)))
993
+ #endif
994
+ #ifndef StringValue
995
+ #define StringValue(s) RB_STRING_VALUE(s)
996
+ #endif
997
+ #ifndef StringValuePtr
998
+ #define StringValuePtr(s) RSTRING_PTR(RB_STRING_VALUE(s))
999
+ #endif
1000
+ #ifndef StringValueLen
1001
+ #define StringValueLen(s) RSTRING_LEN(RB_STRING_VALUE(s))
1002
+ #endif
1003
+ #ifndef SafeStringValue
1004
+ #define SafeStringValue(v) do {\
1005
+ StringValue(v);\
1006
+ rb_check_safe_str(v);\
1007
+ } while (0)
1008
+ #endif
1009
+
1010
+ #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
1011
+ #define rb_define_alloc_func(klass, func) rb_define_singleton_method((klass), "new", VALUEFUNC((func)), -1)
1012
+ #define rb_undef_alloc_func(klass) rb_undef_method(CLASS_OF((klass)), "new")
1013
+ #endif
1014
+
1015
+ static VALUE _mSWIG = Qnil;
1016
+
1017
+ /* -----------------------------------------------------------------------------
1018
+ * error manipulation
1019
+ * ----------------------------------------------------------------------------- */
1020
+
1021
+
1022
+ /* Define some additional error types */
1023
+ #define SWIG_ObjectPreviouslyDeletedError -100
1024
+
1025
+
1026
+ /* Define custom exceptions for errors that do not map to existing Ruby
1027
+ exceptions. Note this only works for C++ since a global cannot be
1028
+ initialized by a function in C. For C, fallback to rb_eRuntimeError.*/
1029
+
1030
+ SWIGINTERN VALUE
1031
+ getNullReferenceError(void) {
1032
+ static int init = 0;
1033
+ static VALUE rb_eNullReferenceError ;
1034
+ if (!init) {
1035
+ init = 1;
1036
+ rb_eNullReferenceError = rb_define_class("NullReferenceError", rb_eRuntimeError);
1037
+ }
1038
+ return rb_eNullReferenceError;
1039
+ }
1040
+
1041
+ SWIGINTERN VALUE
1042
+ getObjectPreviouslyDeletedError(void) {
1043
+ static int init = 0;
1044
+ static VALUE rb_eObjectPreviouslyDeleted ;
1045
+ if (!init) {
1046
+ init = 1;
1047
+ rb_eObjectPreviouslyDeleted = rb_define_class("ObjectPreviouslyDeleted", rb_eRuntimeError);
1048
+ }
1049
+ return rb_eObjectPreviouslyDeleted;
1050
+ }
1051
+
1052
+
1053
+ SWIGINTERN VALUE
1054
+ SWIG_Ruby_ErrorType(int SWIG_code) {
1055
+ VALUE type;
1056
+ switch (SWIG_code) {
1057
+ case SWIG_MemoryError:
1058
+ type = rb_eNoMemError;
1059
+ break;
1060
+ case SWIG_IOError:
1061
+ type = rb_eIOError;
1062
+ break;
1063
+ case SWIG_RuntimeError:
1064
+ type = rb_eRuntimeError;
1065
+ break;
1066
+ case SWIG_IndexError:
1067
+ type = rb_eIndexError;
1068
+ break;
1069
+ case SWIG_TypeError:
1070
+ type = rb_eTypeError;
1071
+ break;
1072
+ case SWIG_DivisionByZero:
1073
+ type = rb_eZeroDivError;
1074
+ break;
1075
+ case SWIG_OverflowError:
1076
+ type = rb_eRangeError;
1077
+ break;
1078
+ case SWIG_SyntaxError:
1079
+ type = rb_eSyntaxError;
1080
+ break;
1081
+ case SWIG_ValueError:
1082
+ type = rb_eArgError;
1083
+ break;
1084
+ case SWIG_SystemError:
1085
+ type = rb_eFatal;
1086
+ break;
1087
+ case SWIG_AttributeError:
1088
+ type = rb_eRuntimeError;
1089
+ break;
1090
+ case SWIG_NullReferenceError:
1091
+ type = getNullReferenceError();
1092
+ break;
1093
+ case SWIG_ObjectPreviouslyDeletedError:
1094
+ type = getObjectPreviouslyDeletedError();
1095
+ break;
1096
+ case SWIG_UnknownError:
1097
+ type = rb_eRuntimeError;
1098
+ break;
1099
+ default:
1100
+ type = rb_eRuntimeError;
1101
+ }
1102
+ return type;
1103
+ }
1104
+
1105
+
1106
+ /* This function is called when a user inputs a wrong argument to
1107
+ a method.
1108
+ */
1109
+ SWIGINTERN
1110
+ const char* Ruby_Format_TypeError( const char* msg,
1111
+ const char* type,
1112
+ const char* name,
1113
+ const int argn,
1114
+ VALUE input )
1115
+ {
1116
+ char buf[128];
1117
+ VALUE str;
1118
+ VALUE asStr;
1119
+ if ( msg && *msg )
1120
+ {
1121
+ str = rb_str_new2(msg);
1122
+ }
1123
+ else
1124
+ {
1125
+ str = rb_str_new(NULL, 0);
1126
+ }
1127
+
1128
+ str = rb_str_cat2( str, "Expected argument " );
1129
+ sprintf( buf, "%d of type ", argn-1 );
1130
+ str = rb_str_cat2( str, buf );
1131
+ str = rb_str_cat2( str, type );
1132
+ str = rb_str_cat2( str, ", but got " );
1133
+ str = rb_str_cat2( str, rb_obj_classname(input) );
1134
+ str = rb_str_cat2( str, " " );
1135
+ asStr = rb_inspect(input);
1136
+ if ( RSTRING_LEN(asStr) > 30 )
1137
+ {
1138
+ str = rb_str_cat( str, StringValuePtr(asStr), 30 );
1139
+ str = rb_str_cat2( str, "..." );
1140
+ }
1141
+ else
1142
+ {
1143
+ str = rb_str_append( str, asStr );
1144
+ }
1145
+
1146
+ if ( name )
1147
+ {
1148
+ str = rb_str_cat2( str, "\n\tin SWIG method '" );
1149
+ str = rb_str_cat2( str, name );
1150
+ str = rb_str_cat2( str, "'" );
1151
+ }
1152
+
1153
+ return StringValuePtr( str );
1154
+ }
1155
+
1156
+ /* This function is called when an overloaded method fails */
1157
+ SWIGINTERN
1158
+ void Ruby_Format_OverloadedError(
1159
+ const int argc,
1160
+ const int maxargs,
1161
+ const char* method,
1162
+ const char* prototypes
1163
+ )
1164
+ {
1165
+ const char* msg = "Wrong # of arguments";
1166
+ if ( argc <= maxargs ) msg = "Wrong arguments";
1167
+ rb_raise(rb_eArgError,"%s for overloaded method '%s'.\n"
1168
+ "Possible C/C++ prototypes are:\n%s",
1169
+ msg, method, prototypes);
1170
+ }
1171
+
1172
+ /* -----------------------------------------------------------------------------
1173
+ * rubytracking.swg
1174
+ *
1175
+ * This file contains support for tracking mappings from
1176
+ * Ruby objects to C++ objects. This functionality is needed
1177
+ * to implement mark functions for Ruby's mark and sweep
1178
+ * garbage collector.
1179
+ * ----------------------------------------------------------------------------- */
1180
+
1181
+ #ifdef __cplusplus
1182
+ extern "C" {
1183
+ #endif
1184
+
1185
+ /* Ruby 1.8 actually assumes the first case. */
1186
+ #if SIZEOF_VOIDP == SIZEOF_LONG
1187
+ # define SWIG2NUM(v) LONG2NUM((unsigned long)v)
1188
+ # define NUM2SWIG(x) (unsigned long)NUM2LONG(x)
1189
+ #elif SIZEOF_VOIDP == SIZEOF_LONG_LONG
1190
+ # define SWIG2NUM(v) LL2NUM((unsigned long long)v)
1191
+ # define NUM2SWIG(x) (unsigned long long)NUM2LL(x)
1192
+ #else
1193
+ # error sizeof(void*) is not the same as long or long long
1194
+ #endif
1195
+
1196
+
1197
+ /* Global Ruby hash table to store Trackings from C/C++
1198
+ structs to Ruby Objects.
1199
+ */
1200
+ static VALUE swig_ruby_trackings = Qnil;
1201
+
1202
+ /* Global variable that stores a reference to the ruby
1203
+ hash table delete function. */
1204
+ static ID swig_ruby_hash_delete;
1205
+
1206
+ /* Setup a Ruby hash table to store Trackings */
1207
+ SWIGRUNTIME void SWIG_RubyInitializeTrackings(void) {
1208
+ /* Create a ruby hash table to store Trackings from C++
1209
+ objects to Ruby objects. */
1210
+
1211
+ /* Try to see if some other .so has already created a
1212
+ tracking hash table, which we keep hidden in an instance var
1213
+ in the SWIG module.
1214
+ This is done to allow multiple DSOs to share the same
1215
+ tracking table.
1216
+ */
1217
+ ID trackings_id = rb_intern( "@__trackings__" );
1218
+ VALUE verbose = rb_gv_get("VERBOSE");
1219
+ rb_gv_set("VERBOSE", Qfalse);
1220
+ swig_ruby_trackings = rb_ivar_get( _mSWIG, trackings_id );
1221
+ rb_gv_set("VERBOSE", verbose);
1222
+
1223
+ /* No, it hasn't. Create one ourselves */
1224
+ if ( swig_ruby_trackings == Qnil )
1225
+ {
1226
+ swig_ruby_trackings = rb_hash_new();
1227
+ rb_ivar_set( _mSWIG, trackings_id, swig_ruby_trackings );
1228
+ }
1229
+
1230
+ /* Now store a reference to the hash table delete function
1231
+ so that we only have to look it up once.*/
1232
+ swig_ruby_hash_delete = rb_intern("delete");
1233
+ }
1234
+
1235
+ /* Get a Ruby number to reference a pointer */
1236
+ SWIGRUNTIME VALUE SWIG_RubyPtrToReference(void* ptr) {
1237
+ /* We cast the pointer to an unsigned long
1238
+ and then store a reference to it using
1239
+ a Ruby number object. */
1240
+
1241
+ /* Convert the pointer to a Ruby number */
1242
+ return SWIG2NUM(ptr);
1243
+ }
1244
+
1245
+ /* Get a Ruby number to reference an object */
1246
+ SWIGRUNTIME VALUE SWIG_RubyObjectToReference(VALUE object) {
1247
+ /* We cast the object to an unsigned long
1248
+ and then store a reference to it using
1249
+ a Ruby number object. */
1250
+
1251
+ /* Convert the Object to a Ruby number */
1252
+ return SWIG2NUM(object);
1253
+ }
1254
+
1255
+ /* Get a Ruby object from a previously stored reference */
1256
+ SWIGRUNTIME VALUE SWIG_RubyReferenceToObject(VALUE reference) {
1257
+ /* The provided Ruby number object is a reference
1258
+ to the Ruby object we want.*/
1259
+
1260
+ /* Convert the Ruby number to a Ruby object */
1261
+ return NUM2SWIG(reference);
1262
+ }
1263
+
1264
+ /* Add a Tracking from a C/C++ struct to a Ruby object */
1265
+ SWIGRUNTIME void SWIG_RubyAddTracking(void* ptr, VALUE object) {
1266
+ /* In a Ruby hash table we store the pointer and
1267
+ the associated Ruby object. The trick here is
1268
+ that we cannot store the Ruby object directly - if
1269
+ we do then it cannot be garbage collected. So
1270
+ instead we typecast it as a unsigned long and
1271
+ convert it to a Ruby number object.*/
1272
+
1273
+ /* Get a reference to the pointer as a Ruby number */
1274
+ VALUE key = SWIG_RubyPtrToReference(ptr);
1275
+
1276
+ /* Get a reference to the Ruby object as a Ruby number */
1277
+ VALUE value = SWIG_RubyObjectToReference(object);
1278
+
1279
+ /* Store the mapping to the global hash table. */
1280
+ rb_hash_aset(swig_ruby_trackings, key, value);
1281
+ }
1282
+
1283
+ /* Get the Ruby object that owns the specified C/C++ struct */
1284
+ SWIGRUNTIME VALUE SWIG_RubyInstanceFor(void* ptr) {
1285
+ /* Get a reference to the pointer as a Ruby number */
1286
+ VALUE key = SWIG_RubyPtrToReference(ptr);
1287
+
1288
+ /* Now lookup the value stored in the global hash table */
1289
+ VALUE value = rb_hash_aref(swig_ruby_trackings, key);
1290
+
1291
+ if (value == Qnil) {
1292
+ /* No object exists - return nil. */
1293
+ return Qnil;
1294
+ }
1295
+ else {
1296
+ /* Convert this value to Ruby object */
1297
+ return SWIG_RubyReferenceToObject(value);
1298
+ }
1299
+ }
1300
+
1301
+ /* Remove a Tracking from a C/C++ struct to a Ruby object. It
1302
+ is very important to remove objects once they are destroyed
1303
+ since the same memory address may be reused later to create
1304
+ a new object. */
1305
+ SWIGRUNTIME void SWIG_RubyRemoveTracking(void* ptr) {
1306
+ /* Get a reference to the pointer as a Ruby number */
1307
+ VALUE key = SWIG_RubyPtrToReference(ptr);
1308
+
1309
+ /* Delete the object from the hash table by calling Ruby's
1310
+ do this we need to call the Hash.delete method.*/
1311
+ rb_funcall(swig_ruby_trackings, swig_ruby_hash_delete, 1, key);
1312
+ }
1313
+
1314
+ /* This is a helper method that unlinks a Ruby object from its
1315
+ underlying C++ object. This is needed if the lifetime of the
1316
+ Ruby object is longer than the C++ object */
1317
+ SWIGRUNTIME void SWIG_RubyUnlinkObjects(void* ptr) {
1318
+ VALUE object = SWIG_RubyInstanceFor(ptr);
1319
+
1320
+ if (object != Qnil) {
1321
+ DATA_PTR(object) = 0;
1322
+ }
1323
+ }
1324
+
1325
+
1326
+ #ifdef __cplusplus
1327
+ }
1328
+ #endif
1329
+
1330
+ /* -----------------------------------------------------------------------------
1331
+ * Ruby API portion that goes into the runtime
1332
+ * ----------------------------------------------------------------------------- */
1333
+
1334
+ #ifdef __cplusplus
1335
+ extern "C" {
1336
+ #endif
1337
+
1338
+ SWIGINTERN VALUE
1339
+ SWIG_Ruby_AppendOutput(VALUE target, VALUE o) {
1340
+ if (NIL_P(target)) {
1341
+ target = o;
1342
+ } else {
1343
+ if (TYPE(target) != T_ARRAY) {
1344
+ VALUE o2 = target;
1345
+ target = rb_ary_new();
1346
+ rb_ary_push(target, o2);
1347
+ }
1348
+ rb_ary_push(target, o);
1349
+ }
1350
+ return target;
1351
+ }
1352
+
1353
+ /* For ruby1.8.4 and earlier. */
1354
+ #ifndef RUBY_INIT_STACK
1355
+ RUBY_EXTERN void Init_stack(VALUE* addr);
1356
+ # define RUBY_INIT_STACK \
1357
+ VALUE variable_in_this_stack_frame; \
1358
+ Init_stack(&variable_in_this_stack_frame);
1359
+ #endif
1360
+
1361
+
1362
+ #ifdef __cplusplus
1363
+ }
1364
+ #endif
1365
+
1366
+
1367
+ /* -----------------------------------------------------------------------------
1368
+ * rubyrun.swg
1369
+ *
1370
+ * This file contains the runtime support for Ruby modules
1371
+ * and includes code for managing global variables and pointer
1372
+ * type checking.
1373
+ * ----------------------------------------------------------------------------- */
1374
+
1375
+ /* For backward compatibility only */
1376
+ #define SWIG_POINTER_EXCEPTION 0
1377
+
1378
+ /* for raw pointers */
1379
+ #define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
1380
+ #define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, own)
1381
+ #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Ruby_NewPointerObj(ptr, type, flags)
1382
+ #define SWIG_AcquirePtr(ptr, own) SWIG_Ruby_AcquirePtr(ptr, own)
1383
+ #define swig_owntype ruby_owntype
1384
+
1385
+ /* for raw packed data */
1386
+ #define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty, flags)
1387
+ #define SWIG_NewPackedObj(ptr, sz, type) SWIG_Ruby_NewPackedObj(ptr, sz, type)
1388
+
1389
+ /* for class or struct pointers */
1390
+ #define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags)
1391
+ #define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags)
1392
+
1393
+ /* for C or C++ function pointers */
1394
+ #define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_ConvertPtr(obj, pptr, type, 0)
1395
+ #define SWIG_NewFunctionPtrObj(ptr, type) SWIG_NewPointerObj(ptr, type, 0)
1396
+
1397
+ /* for C++ member pointers, ie, member methods */
1398
+ #define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty)
1399
+ #define SWIG_NewMemberObj(ptr, sz, type) SWIG_Ruby_NewPackedObj(ptr, sz, type)
1400
+
1401
+
1402
+ /* Runtime API */
1403
+
1404
+ #define SWIG_GetModule(clientdata) SWIG_Ruby_GetModule()
1405
+ #define SWIG_SetModule(clientdata, pointer) SWIG_Ruby_SetModule(pointer)
1406
+
1407
+
1408
+ /* Error manipulation */
1409
+
1410
+ #define SWIG_ErrorType(code) SWIG_Ruby_ErrorType(code)
1411
+ #define SWIG_Error(code, msg) rb_raise(SWIG_Ruby_ErrorType(code), "%s", msg)
1412
+ #define SWIG_fail goto fail
1413
+
1414
+
1415
+ /* Ruby-specific SWIG API */
1416
+
1417
+ #define SWIG_InitRuntime() SWIG_Ruby_InitRuntime()
1418
+ #define SWIG_define_class(ty) SWIG_Ruby_define_class(ty)
1419
+ #define SWIG_NewClassInstance(value, ty) SWIG_Ruby_NewClassInstance(value, ty)
1420
+ #define SWIG_MangleStr(value) SWIG_Ruby_MangleStr(value)
1421
+ #define SWIG_CheckConvert(value, ty) SWIG_Ruby_CheckConvert(value, ty)
1422
+
1423
+ #include "assert.h"
1424
+
1425
+ /* -----------------------------------------------------------------------------
1426
+ * pointers/data manipulation
1427
+ * ----------------------------------------------------------------------------- */
1428
+
1429
+ #ifdef __cplusplus
1430
+ extern "C" {
1431
+ #endif
1432
+
1433
+ typedef struct {
1434
+ VALUE klass;
1435
+ VALUE mImpl;
1436
+ void (*mark)(void *);
1437
+ void (*destroy)(void *);
1438
+ int trackObjects;
1439
+ } swig_class;
1440
+
1441
+
1442
+ /* Global pointer used to keep some internal SWIG stuff */
1443
+ static VALUE _cSWIG_Pointer = Qnil;
1444
+ static VALUE swig_runtime_data_type_pointer = Qnil;
1445
+
1446
+ /* Global IDs used to keep some internal SWIG stuff */
1447
+ static ID swig_arity_id = 0;
1448
+ static ID swig_call_id = 0;
1449
+
1450
+ /*
1451
+ If your swig extension is to be run within an embedded ruby and has
1452
+ director callbacks, you should set -DRUBY_EMBEDDED during compilation.
1453
+ This will reset ruby's stack frame on each entry point from the main
1454
+ program the first time a virtual director function is invoked (in a
1455
+ non-recursive way).
1456
+ If this is not done, you run the risk of Ruby trashing the stack.
1457
+ */
1458
+
1459
+ #ifdef RUBY_EMBEDDED
1460
+
1461
+ # define SWIG_INIT_STACK \
1462
+ if ( !swig_virtual_calls ) { RUBY_INIT_STACK } \
1463
+ ++swig_virtual_calls;
1464
+ # define SWIG_RELEASE_STACK --swig_virtual_calls;
1465
+ # define Ruby_DirectorTypeMismatchException(x) \
1466
+ rb_raise( rb_eTypeError, "%s", x ); return c_result;
1467
+
1468
+ static unsigned int swig_virtual_calls = 0;
1469
+
1470
+ #else /* normal non-embedded extension */
1471
+
1472
+ # define SWIG_INIT_STACK
1473
+ # define SWIG_RELEASE_STACK
1474
+ # define Ruby_DirectorTypeMismatchException(x) \
1475
+ throw Swig::DirectorTypeMismatchException( x );
1476
+
1477
+ #endif /* RUBY_EMBEDDED */
1478
+
1479
+
1480
+ SWIGRUNTIME VALUE
1481
+ getExceptionClass(void) {
1482
+ static int init = 0;
1483
+ static VALUE rubyExceptionClass ;
1484
+ if (!init) {
1485
+ init = 1;
1486
+ rubyExceptionClass = rb_const_get(_mSWIG, rb_intern("Exception"));
1487
+ }
1488
+ return rubyExceptionClass;
1489
+ }
1490
+
1491
+ /* This code checks to see if the Ruby object being raised as part
1492
+ of an exception inherits from the Ruby class Exception. If so,
1493
+ the object is simply returned. If not, then a new Ruby exception
1494
+ object is created and that will be returned to Ruby.*/
1495
+ SWIGRUNTIME VALUE
1496
+ SWIG_Ruby_ExceptionType(swig_type_info *desc, VALUE obj) {
1497
+ VALUE exceptionClass = getExceptionClass();
1498
+ if (rb_obj_is_kind_of(obj, exceptionClass)) {
1499
+ return obj;
1500
+ } else {
1501
+ return rb_exc_new3(rb_eRuntimeError, rb_obj_as_string(obj));
1502
+ }
1503
+ }
1504
+
1505
+ /* Initialize Ruby runtime support */
1506
+ SWIGRUNTIME void
1507
+ SWIG_Ruby_InitRuntime(void)
1508
+ {
1509
+ if (_mSWIG == Qnil) {
1510
+ _mSWIG = rb_define_module("SWIG");
1511
+ swig_call_id = rb_intern("call");
1512
+ swig_arity_id = rb_intern("arity");
1513
+ }
1514
+ }
1515
+
1516
+ /* Define Ruby class for C type */
1517
+ SWIGRUNTIME void
1518
+ SWIG_Ruby_define_class(swig_type_info *type)
1519
+ {
1520
+ VALUE klass;
1521
+ char *klass_name = (char *) malloc(4 + strlen(type->name) + 1);
1522
+ sprintf(klass_name, "TYPE%s", type->name);
1523
+ if (NIL_P(_cSWIG_Pointer)) {
1524
+ _cSWIG_Pointer = rb_define_class_under(_mSWIG, "Pointer", rb_cObject);
1525
+ rb_undef_method(CLASS_OF(_cSWIG_Pointer), "new");
1526
+ }
1527
+ klass = rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer);
1528
+ free((void *) klass_name);
1529
+ }
1530
+
1531
+ /* Create a new pointer object */
1532
+ SWIGRUNTIME VALUE
1533
+ SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags)
1534
+ {
1535
+ int own = flags & SWIG_POINTER_OWN;
1536
+ int track;
1537
+ char *klass_name;
1538
+ swig_class *sklass;
1539
+ VALUE klass;
1540
+ VALUE obj;
1541
+
1542
+ if (!ptr)
1543
+ return Qnil;
1544
+
1545
+ if (type->clientdata) {
1546
+ sklass = (swig_class *) type->clientdata;
1547
+
1548
+ /* Are we tracking this class and have we already returned this Ruby object? */
1549
+ track = sklass->trackObjects;
1550
+ if (track) {
1551
+ obj = SWIG_RubyInstanceFor(ptr);
1552
+
1553
+ /* Check the object's type and make sure it has the correct type.
1554
+ It might not in cases where methods do things like
1555
+ downcast methods. */
1556
+ if (obj != Qnil) {
1557
+ VALUE value = rb_iv_get(obj, "@__swigtype__");
1558
+ char* type_name = RSTRING_PTR(value);
1559
+
1560
+ if (strcmp(type->name, type_name) == 0) {
1561
+ return obj;
1562
+ }
1563
+ }
1564
+ }
1565
+
1566
+ /* Create a new Ruby object */
1567
+ obj = Data_Wrap_Struct(sklass->klass, VOIDFUNC(sklass->mark),
1568
+ ( own ? VOIDFUNC(sklass->destroy) :
1569
+ (track ? VOIDFUNC(SWIG_RubyRemoveTracking) : 0 )
1570
+ ), ptr);
1571
+
1572
+ /* If tracking is on for this class then track this object. */
1573
+ if (track) {
1574
+ SWIG_RubyAddTracking(ptr, obj);
1575
+ }
1576
+ } else {
1577
+ klass_name = (char *) malloc(4 + strlen(type->name) + 1);
1578
+ sprintf(klass_name, "TYPE%s", type->name);
1579
+ klass = rb_const_get(_mSWIG, rb_intern(klass_name));
1580
+ free((void *) klass_name);
1581
+ obj = Data_Wrap_Struct(klass, 0, 0, ptr);
1582
+ }
1583
+ rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name));
1584
+
1585
+ return obj;
1586
+ }
1587
+
1588
+ /* Create a new class instance (always owned) */
1589
+ SWIGRUNTIME VALUE
1590
+ SWIG_Ruby_NewClassInstance(VALUE klass, swig_type_info *type)
1591
+ {
1592
+ VALUE obj;
1593
+ swig_class *sklass = (swig_class *) type->clientdata;
1594
+ obj = Data_Wrap_Struct(klass, VOIDFUNC(sklass->mark), VOIDFUNC(sklass->destroy), 0);
1595
+ rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name));
1596
+ return obj;
1597
+ }
1598
+
1599
+ /* Get type mangle from class name */
1600
+ SWIGRUNTIMEINLINE char *
1601
+ SWIG_Ruby_MangleStr(VALUE obj)
1602
+ {
1603
+ VALUE stype = rb_iv_get(obj, "@__swigtype__");
1604
+ return StringValuePtr(stype);
1605
+ }
1606
+
1607
+ /* Acquire a pointer value */
1608
+ typedef void (*ruby_owntype)(void*);
1609
+
1610
+ SWIGRUNTIME ruby_owntype
1611
+ SWIG_Ruby_AcquirePtr(VALUE obj, ruby_owntype own) {
1612
+ if (obj) {
1613
+ ruby_owntype oldown = RDATA(obj)->dfree;
1614
+ RDATA(obj)->dfree = own;
1615
+ return oldown;
1616
+ } else {
1617
+ return 0;
1618
+ }
1619
+ }
1620
+
1621
+ /* Convert a pointer value */
1622
+ SWIGRUNTIME int
1623
+ SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags, ruby_owntype *own)
1624
+ {
1625
+ char *c;
1626
+ swig_cast_info *tc;
1627
+ void *vptr = 0;
1628
+
1629
+ /* Grab the pointer */
1630
+ if (NIL_P(obj)) {
1631
+ *ptr = 0;
1632
+ return SWIG_OK;
1633
+ } else {
1634
+ if (TYPE(obj) != T_DATA) {
1635
+ return SWIG_ERROR;
1636
+ }
1637
+ Data_Get_Struct(obj, void, vptr);
1638
+ }
1639
+
1640
+ if (own) *own = RDATA(obj)->dfree;
1641
+
1642
+ /* Check to see if the input object is giving up ownership
1643
+ of the underlying C struct or C++ object. If so then we
1644
+ need to reset the destructor since the Ruby object no
1645
+ longer owns the underlying C++ object.*/
1646
+ if (flags & SWIG_POINTER_DISOWN) {
1647
+ /* Is tracking on for this class? */
1648
+ int track = 0;
1649
+ if (ty && ty->clientdata) {
1650
+ swig_class *sklass = (swig_class *) ty->clientdata;
1651
+ track = sklass->trackObjects;
1652
+ }
1653
+
1654
+ if (track) {
1655
+ /* We are tracking objects for this class. Thus we change the destructor
1656
+ * to SWIG_RubyRemoveTracking. This allows us to
1657
+ * remove the mapping from the C++ to Ruby object
1658
+ * when the Ruby object is garbage collected. If we don't
1659
+ * do this, then it is possible we will return a reference
1660
+ * to a Ruby object that no longer exists thereby crashing Ruby. */
1661
+ RDATA(obj)->dfree = SWIG_RubyRemoveTracking;
1662
+ } else {
1663
+ RDATA(obj)->dfree = 0;
1664
+ }
1665
+ }
1666
+
1667
+ /* Do type-checking if type info was provided */
1668
+ if (ty) {
1669
+ if (ty->clientdata) {
1670
+ if (rb_obj_is_kind_of(obj, ((swig_class *) (ty->clientdata))->klass)) {
1671
+ if (vptr == 0) {
1672
+ /* The object has already been deleted */
1673
+ return SWIG_ObjectPreviouslyDeletedError;
1674
+ }
1675
+ *ptr = vptr;
1676
+ return SWIG_OK;
1677
+ }
1678
+ }
1679
+ if ((c = SWIG_MangleStr(obj)) == NULL) {
1680
+ return SWIG_ERROR;
1681
+ }
1682
+ tc = SWIG_TypeCheck(c, ty);
1683
+ if (!tc) {
1684
+ return SWIG_ERROR;
1685
+ } else {
1686
+ int newmemory = 0;
1687
+ *ptr = SWIG_TypeCast(tc, vptr, &newmemory);
1688
+ assert(!newmemory); /* newmemory handling not yet implemented */
1689
+ }
1690
+ } else {
1691
+ *ptr = vptr;
1692
+ }
1693
+
1694
+ return SWIG_OK;
1695
+ }
1696
+
1697
+ /* Check convert */
1698
+ SWIGRUNTIMEINLINE int
1699
+ SWIG_Ruby_CheckConvert(VALUE obj, swig_type_info *ty)
1700
+ {
1701
+ char *c = SWIG_MangleStr(obj);
1702
+ if (!c) return 0;
1703
+ return SWIG_TypeCheck(c,ty) != 0;
1704
+ }
1705
+
1706
+ SWIGRUNTIME VALUE
1707
+ SWIG_Ruby_NewPackedObj(void *ptr, int sz, swig_type_info *type) {
1708
+ char result[1024];
1709
+ char *r = result;
1710
+ if ((2*sz + 1 + strlen(type->name)) > 1000) return 0;
1711
+ *(r++) = '_';
1712
+ r = SWIG_PackData(r, ptr, sz);
1713
+ strcpy(r, type->name);
1714
+ return rb_str_new2(result);
1715
+ }
1716
+
1717
+ /* Convert a packed value value */
1718
+ SWIGRUNTIME int
1719
+ SWIG_Ruby_ConvertPacked(VALUE obj, void *ptr, int sz, swig_type_info *ty) {
1720
+ swig_cast_info *tc;
1721
+ const char *c;
1722
+
1723
+ if (TYPE(obj) != T_STRING) goto type_error;
1724
+ c = StringValuePtr(obj);
1725
+ /* Pointer values must start with leading underscore */
1726
+ if (*c != '_') goto type_error;
1727
+ c++;
1728
+ c = SWIG_UnpackData(c, ptr, sz);
1729
+ if (ty) {
1730
+ tc = SWIG_TypeCheck(c, ty);
1731
+ if (!tc) goto type_error;
1732
+ }
1733
+ return SWIG_OK;
1734
+
1735
+ type_error:
1736
+ return SWIG_ERROR;
1737
+ }
1738
+
1739
+ SWIGRUNTIME swig_module_info *
1740
+ SWIG_Ruby_GetModule(void)
1741
+ {
1742
+ VALUE pointer;
1743
+ swig_module_info *ret = 0;
1744
+ VALUE verbose = rb_gv_get("VERBOSE");
1745
+
1746
+ /* temporarily disable warnings, since the pointer check causes warnings with 'ruby -w' */
1747
+ rb_gv_set("VERBOSE", Qfalse);
1748
+
1749
+ /* first check if pointer already created */
1750
+ pointer = rb_gv_get("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
1751
+ if (pointer != Qnil) {
1752
+ Data_Get_Struct(pointer, swig_module_info, ret);
1753
+ }
1754
+
1755
+ /* reinstate warnings */
1756
+ rb_gv_set("VERBOSE", verbose);
1757
+ return ret;
1758
+ }
1759
+
1760
+ SWIGRUNTIME void
1761
+ SWIG_Ruby_SetModule(swig_module_info *pointer)
1762
+ {
1763
+ /* register a new class */
1764
+ VALUE cl = rb_define_class("swig_runtime_data", rb_cObject);
1765
+ /* create and store the structure pointer to a global variable */
1766
+ swig_runtime_data_type_pointer = Data_Wrap_Struct(cl, 0, 0, pointer);
1767
+ rb_define_readonly_variable("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, &swig_runtime_data_type_pointer);
1768
+ }
1769
+
1770
+ /* This function can be used to check whether a proc or method or similarly
1771
+ callable function has been passed. Usually used in a %typecheck, like:
1772
+
1773
+ %typecheck(c_callback_t, precedence=SWIG_TYPECHECK_POINTER) {
1774
+ $result = SWIG_Ruby_isCallable( $input );
1775
+ }
1776
+ */
1777
+ SWIGINTERN
1778
+ int SWIG_Ruby_isCallable( VALUE proc )
1779
+ {
1780
+ if ( rb_respond_to( proc, swig_call_id ) == Qtrue )
1781
+ return 1;
1782
+ return 0;
1783
+ }
1784
+
1785
+ /* This function can be used to check the arity (number of arguments)
1786
+ a proc or method can take. Usually used in a %typecheck.
1787
+ Valid arities will be that equal to minimal or those < 0
1788
+ which indicate a variable number of parameters at the end.
1789
+ */
1790
+ SWIGINTERN
1791
+ int SWIG_Ruby_arity( VALUE proc, int minimal )
1792
+ {
1793
+ if ( rb_respond_to( proc, swig_arity_id ) == Qtrue )
1794
+ {
1795
+ VALUE num = rb_funcall( proc, swig_arity_id, 0 );
1796
+ int arity = NUM2INT(num);
1797
+ if ( arity < 0 && (arity+1) < -minimal ) return 1;
1798
+ if ( arity == minimal ) return 1;
1799
+ return 1;
1800
+ }
1801
+ return 0;
1802
+ }
1803
+
1804
+
1805
+ #ifdef __cplusplus
1806
+ }
1807
+ #endif
1808
+
1809
+
1810
+
1811
+ #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0)
1812
+
1813
+ #define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else
1814
+
1815
+
1816
+
1817
+ /* -------- TYPES TABLE (BEGIN) -------- */
1818
+
1819
+ #define SWIGTYPE_p_MapT_TagLib__String_TagLib__StringList_t swig_types[0]
1820
+ #define SWIGTYPE_p_TagLib__AudioProperties swig_types[1]
1821
+ #define SWIGTYPE_p_TagLib__File swig_types[2]
1822
+ #define SWIGTYPE_p_TagLib__Ogg__File swig_types[3]
1823
+ #define SWIGTYPE_p_TagLib__Ogg__XiphComment swig_types[4]
1824
+ #define SWIGTYPE_p_TagLib__Vorbis__File swig_types[5]
1825
+ #define SWIGTYPE_p_TagLib__Vorbis__Properties swig_types[6]
1826
+ #define SWIGTYPE_p_char swig_types[7]
1827
+ #define SWIGTYPE_p_unsigned_char swig_types[8]
1828
+ #define SWIGTYPE_p_unsigned_int swig_types[9]
1829
+ #define SWIGTYPE_p_unsigned_long swig_types[10]
1830
+ #define SWIGTYPE_p_wchar_t swig_types[11]
1831
+ static swig_type_info *swig_types[13];
1832
+ static swig_module_info swig_module = {swig_types, 12, 0, 0, 0, 0};
1833
+ #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
1834
+ #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
1835
+
1836
+ /* -------- TYPES TABLE (END) -------- */
1837
+
1838
+ #define SWIG_init Init_taglib_vorbis
1839
+ #define SWIG_name "TagLib::Ogg::Vorbis"
1840
+
1841
+ static VALUE mVorbis;
1842
+
1843
+ #define SWIG_RUBY_THREAD_BEGIN_BLOCK
1844
+ #define SWIG_RUBY_THREAD_END_BLOCK
1845
+
1846
+
1847
+ #define SWIGVERSION 0x020005
1848
+ #define SWIG_VERSION SWIGVERSION
1849
+
1850
+
1851
+ #define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a))
1852
+ #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a))
1853
+
1854
+
1855
+ #include <stdexcept>
1856
+
1857
+
1858
+ #include <taglib/taglib.h>
1859
+ #include <taglib/vorbisproperties.h>
1860
+ #include <taglib/vorbisfile.h>
1861
+
1862
+
1863
+ #include <taglib/tstring.h>
1864
+ #include <taglib/tstringlist.h>
1865
+ #include <taglib/tfile.h>
1866
+
1867
+ #if defined(HAVE_RUBY_ENCODING_H) && HAVE_RUBY_ENCODING_H
1868
+ # include <ruby/encoding.h>
1869
+ # define ASSOCIATE_UTF8_ENCODING(value) rb_enc_associate(value, rb_utf8_encoding());
1870
+ # define CONVERT_TO_UTF8(value) rb_str_export_to_enc(value, rb_utf8_encoding())
1871
+ #else
1872
+ # define ASSOCIATE_UTF8_ENCODING(value) /* nothing */
1873
+ # define CONVERT_TO_UTF8(value) value
1874
+ #endif
1875
+
1876
+ VALUE taglib_bytevector_to_ruby_string(const TagLib::ByteVector &byteVector) {
1877
+ if (byteVector.isNull()) {
1878
+ return Qnil;
1879
+ } else {
1880
+ return rb_tainted_str_new(byteVector.data(), byteVector.size());
1881
+ }
1882
+ }
1883
+
1884
+ TagLib::ByteVector ruby_string_to_taglib_bytevector(VALUE s) {
1885
+ return TagLib::ByteVector(RSTRING_PTR(s), RSTRING_LEN(s));
1886
+ }
1887
+
1888
+ VALUE taglib_string_to_ruby_string(const TagLib::String & string) {
1889
+ if (string.isNull()) {
1890
+ return Qnil;
1891
+ } else {
1892
+ VALUE result = rb_tainted_str_new2(string.toCString(true));
1893
+ ASSOCIATE_UTF8_ENCODING(result);
1894
+ return result;
1895
+ }
1896
+ }
1897
+
1898
+ TagLib::String ruby_string_to_taglib_string(VALUE s) {
1899
+ return TagLib::String(RSTRING_PTR(CONVERT_TO_UTF8(s)), TagLib::String::UTF8);
1900
+ }
1901
+
1902
+ VALUE taglib_string_list_to_ruby_array(const TagLib::StringList & list) {
1903
+ VALUE ary = rb_ary_new2(list.size());
1904
+ for (TagLib::StringList::ConstIterator it = list.begin(); it != list.end(); it++) {
1905
+ VALUE s = taglib_string_to_ruby_string(*it);
1906
+ rb_ary_push(ary, s);
1907
+ }
1908
+ return ary;
1909
+ }
1910
+
1911
+ TagLib::StringList ruby_array_to_taglib_string_list(VALUE ary) {
1912
+ TagLib::StringList result = TagLib::StringList();
1913
+ for (long i = 0; i < RARRAY_LEN(ary); i++) {
1914
+ VALUE e = RARRAY_PTR(ary)[i];
1915
+ TagLib::String s = ruby_string_to_taglib_string(e);
1916
+ result.append(s);
1917
+ }
1918
+ return result;
1919
+ }
1920
+
1921
+ VALUE taglib_filename_to_ruby_string(TagLib::FileName filename) {
1922
+ #ifdef _WIN32
1923
+ const char *s = (const char *) filename;
1924
+ return rb_tainted_str_new2(s);
1925
+ #else
1926
+ return rb_tainted_str_new2(filename);
1927
+ #endif
1928
+ }
1929
+
1930
+ TagLib::FileName ruby_string_to_taglib_filename(VALUE s) {
1931
+ #ifdef _WIN32
1932
+ #if defined(HAVE_RUBY_ENCODING_H) && HAVE_RUBY_ENCODING_H
1933
+ VALUE ospath;
1934
+ const char *utf8;
1935
+ int len;
1936
+ wchar_t *wide;
1937
+
1938
+ ospath = rb_str_encode_ospath(s);
1939
+ utf8 = StringValuePtr(ospath);
1940
+ len = MultiByteToWideChar(CP_UTF8, 0, utf8, -1, NULL, 0);
1941
+ if (!(wide = (wchar_t *) xmalloc(sizeof(wchar_t) * len))) {
1942
+ return TagLib::FileName((const char *) NULL);
1943
+ }
1944
+ MultiByteToWideChar(CP_UTF8, 0, utf8, -1, wide, len);
1945
+ TagLib::FileName filename(wide);
1946
+ xfree(wide);
1947
+ return filename;
1948
+ #else
1949
+ const char *filename = StringValuePtr(s);
1950
+ return TagLib::FileName(filename);
1951
+ #endif
1952
+ #else
1953
+ return StringValuePtr(s);
1954
+ #endif
1955
+ }
1956
+
1957
+
1958
+
1959
+ #include <limits.h>
1960
+ #if !defined(SWIG_NO_LLONG_MAX)
1961
+ # if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
1962
+ # define LLONG_MAX __LONG_LONG_MAX__
1963
+ # define LLONG_MIN (-LLONG_MAX - 1LL)
1964
+ # define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
1965
+ # endif
1966
+ #endif
1967
+
1968
+
1969
+ SWIGINTERN VALUE
1970
+ SWIG_ruby_failed(void)
1971
+ {
1972
+ return Qnil;
1973
+ }
1974
+
1975
+
1976
+ /*@SWIG:/usr/local/share/swig/2.0.5/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
1977
+ SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE *args)
1978
+ {
1979
+ VALUE obj = args[0];
1980
+ VALUE type = TYPE(obj);
1981
+ long *res = (long *)(args[1]);
1982
+ *res = type == T_FIXNUM ? NUM2LONG(obj) : rb_big2long(obj);
1983
+ return obj;
1984
+ }
1985
+ /*@SWIG@*/
1986
+
1987
+ SWIGINTERN int
1988
+ SWIG_AsVal_long (VALUE obj, long* val)
1989
+ {
1990
+ VALUE type = TYPE(obj);
1991
+ if ((type == T_FIXNUM) || (type == T_BIGNUM)) {
1992
+ long v;
1993
+ VALUE a[2];
1994
+ a[0] = obj;
1995
+ a[1] = (VALUE)(&v);
1996
+ if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2LONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
1997
+ if (val) *val = v;
1998
+ return SWIG_OK;
1999
+ }
2000
+ }
2001
+ return SWIG_TypeError;
2002
+ }
2003
+
2004
+
2005
+ SWIGINTERN int
2006
+ SWIG_AsVal_int (VALUE obj, int *val)
2007
+ {
2008
+ long v;
2009
+ int res = SWIG_AsVal_long (obj, &v);
2010
+ if (SWIG_IsOK(res)) {
2011
+ if ((v < INT_MIN || v > INT_MAX)) {
2012
+ return SWIG_OverflowError;
2013
+ } else {
2014
+ if (val) *val = static_cast< int >(v);
2015
+ }
2016
+ }
2017
+ return res;
2018
+ }
2019
+
2020
+
2021
+ #define SWIG_From_long LONG2NUM
2022
+
2023
+
2024
+ SWIGINTERNINLINE VALUE
2025
+ SWIG_From_int (int value)
2026
+ {
2027
+ return SWIG_From_long (value);
2028
+ }
2029
+
2030
+
2031
+ SWIGINTERN int
2032
+ SWIG_AsVal_bool (VALUE obj, bool *val)
2033
+ {
2034
+ if (obj == Qtrue) {
2035
+ if (val) *val = true;
2036
+ return SWIG_OK;
2037
+ } else if (obj == Qfalse) {
2038
+ if (val) *val = false;
2039
+ return SWIG_OK;
2040
+ } else {
2041
+ int res = 0;
2042
+ if (SWIG_AsVal_int (obj, &res) == SWIG_OK) {
2043
+ if (val) *val = res ? true : false;
2044
+ return SWIG_OK;
2045
+ }
2046
+ }
2047
+ return SWIG_TypeError;
2048
+ }
2049
+
2050
+
2051
+ SWIGINTERN swig_type_info*
2052
+ SWIG_pchar_descriptor(void)
2053
+ {
2054
+ static int init = 0;
2055
+ static swig_type_info* info = 0;
2056
+ if (!init) {
2057
+ info = SWIG_TypeQuery("_p_char");
2058
+ init = 1;
2059
+ }
2060
+ return info;
2061
+ }
2062
+
2063
+
2064
+ SWIGINTERN int
2065
+ SWIG_AsCharPtrAndSize(VALUE obj, char** cptr, size_t* psize, int *alloc)
2066
+ {
2067
+ if (TYPE(obj) == T_STRING) {
2068
+ #if defined(StringValuePtr)
2069
+ char *cstr = StringValuePtr(obj);
2070
+ #else
2071
+ char *cstr = STR2CSTR(obj);
2072
+ #endif
2073
+ size_t size = RSTRING_LEN(obj) + 1;
2074
+ if (cptr) {
2075
+ if (alloc) {
2076
+ if (*alloc == SWIG_NEWOBJ) {
2077
+ *cptr = reinterpret_cast< char* >(memcpy((new char[size]), cstr, sizeof(char)*(size)));
2078
+ } else {
2079
+ *cptr = cstr;
2080
+ *alloc = SWIG_OLDOBJ;
2081
+ }
2082
+ }
2083
+ }
2084
+ if (psize) *psize = size;
2085
+ return SWIG_OK;
2086
+ } else {
2087
+ swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
2088
+ if (pchar_descriptor) {
2089
+ void* vptr = 0;
2090
+ if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
2091
+ if (cptr) *cptr = (char *)vptr;
2092
+ if (psize) *psize = vptr ? (strlen((char*)vptr) + 1) : 0;
2093
+ if (alloc) *alloc = SWIG_OLDOBJ;
2094
+ return SWIG_OK;
2095
+ }
2096
+ }
2097
+ }
2098
+ return SWIG_TypeError;
2099
+ }
2100
+
2101
+
2102
+
2103
+
2104
+
2105
+ SWIGINTERNINLINE VALUE
2106
+ SWIG_From_bool (bool value)
2107
+ {
2108
+ return value ? Qtrue : Qfalse;
2109
+ }
2110
+
2111
+ SWIGINTERN void TagLib_Vorbis_File_close(TagLib::Vorbis::File *self){
2112
+ free_taglib_vorbis_file(self);
2113
+ }
2114
+
2115
+ static void free_taglib_vorbis_file(void *ptr) {
2116
+ TagLib::Ogg::Vorbis::File *file = (TagLib::Ogg::Vorbis::File *) ptr;
2117
+
2118
+ TagLib::Ogg::XiphComment *tag = file->tag();
2119
+ if (tag) {
2120
+ SWIG_RubyUnlinkObjects(tag);
2121
+ SWIG_RubyRemoveTracking(tag);
2122
+ }
2123
+
2124
+ TagLib::Vorbis::Properties *properties = file->audioProperties();
2125
+ if (properties) {
2126
+ SWIG_RubyUnlinkObjects(properties);
2127
+ SWIG_RubyRemoveTracking(properties);
2128
+ }
2129
+
2130
+ SWIG_RubyUnlinkObjects(file);
2131
+ SWIG_RubyRemoveTracking(file);
2132
+
2133
+ delete file;
2134
+ }
2135
+
2136
+ static swig_class SwigClassProperties;
2137
+
2138
+ SWIGINTERN VALUE
2139
+ _wrap_new_Properties__SWIG_0(int argc, VALUE *argv, VALUE self) {
2140
+ TagLib::Vorbis::File *arg1 = (TagLib::Vorbis::File *) 0 ;
2141
+ TagLib::AudioProperties::ReadStyle arg2 ;
2142
+ void *argp1 = 0 ;
2143
+ int res1 = 0 ;
2144
+ int val2 ;
2145
+ int ecode2 = 0 ;
2146
+ TagLib::Vorbis::Properties *result = 0 ;
2147
+
2148
+ if ((argc < 2) || (argc > 2)) {
2149
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
2150
+ }
2151
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_TagLib__Vorbis__File, 0 | 0 );
2152
+ if (!SWIG_IsOK(res1)) {
2153
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TagLib::Vorbis::File *","TagLib::Vorbis::Properties", 1, argv[0] ));
2154
+ }
2155
+ arg1 = reinterpret_cast< TagLib::Vorbis::File * >(argp1);
2156
+ ecode2 = SWIG_AsVal_int(argv[1], &val2);
2157
+ if (!SWIG_IsOK(ecode2)) {
2158
+ SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "TagLib::AudioProperties::ReadStyle","TagLib::Vorbis::Properties", 2, argv[1] ));
2159
+ }
2160
+ arg2 = static_cast< TagLib::AudioProperties::ReadStyle >(val2);
2161
+ result = (TagLib::Vorbis::Properties *)new TagLib::Vorbis::Properties(arg1,arg2);
2162
+ DATA_PTR(self) = result;
2163
+ SWIG_RubyAddTracking(result, self);
2164
+ return self;
2165
+ fail:
2166
+ return Qnil;
2167
+ }
2168
+
2169
+
2170
+ #ifdef HAVE_RB_DEFINE_ALLOC_FUNC
2171
+ SWIGINTERN VALUE
2172
+ _wrap_Properties_allocate(VALUE self) {
2173
+ #else
2174
+ SWIGINTERN VALUE
2175
+ _wrap_Properties_allocate(int argc, VALUE *argv, VALUE self) {
2176
+ #endif
2177
+
2178
+
2179
+ VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_TagLib__Vorbis__Properties);
2180
+ #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
2181
+ rb_obj_call_init(vresult, argc, argv);
2182
+ #endif
2183
+ return vresult;
2184
+ }
2185
+
2186
+
2187
+ SWIGINTERN VALUE
2188
+ _wrap_new_Properties__SWIG_1(int argc, VALUE *argv, VALUE self) {
2189
+ TagLib::Vorbis::File *arg1 = (TagLib::Vorbis::File *) 0 ;
2190
+ void *argp1 = 0 ;
2191
+ int res1 = 0 ;
2192
+ TagLib::Vorbis::Properties *result = 0 ;
2193
+
2194
+ if ((argc < 1) || (argc > 1)) {
2195
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2196
+ }
2197
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_TagLib__Vorbis__File, 0 | 0 );
2198
+ if (!SWIG_IsOK(res1)) {
2199
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TagLib::Vorbis::File *","TagLib::Vorbis::Properties", 1, argv[0] ));
2200
+ }
2201
+ arg1 = reinterpret_cast< TagLib::Vorbis::File * >(argp1);
2202
+ result = (TagLib::Vorbis::Properties *)new TagLib::Vorbis::Properties(arg1);
2203
+ DATA_PTR(self) = result;
2204
+ SWIG_RubyAddTracking(result, self);
2205
+ return self;
2206
+ fail:
2207
+ return Qnil;
2208
+ }
2209
+
2210
+
2211
+ SWIGINTERN VALUE _wrap_new_Properties(int nargs, VALUE *args, VALUE self) {
2212
+ int argc;
2213
+ VALUE argv[2];
2214
+ int ii;
2215
+
2216
+ argc = nargs;
2217
+ if (argc > 2) SWIG_fail;
2218
+ for (ii = 0; (ii < argc); ++ii) {
2219
+ argv[ii] = args[ii];
2220
+ }
2221
+ if (argc == 1) {
2222
+ int _v;
2223
+ void *vptr = 0;
2224
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_TagLib__Vorbis__File, 0);
2225
+ _v = SWIG_CheckState(res);
2226
+ if (_v) {
2227
+ return _wrap_new_Properties__SWIG_1(nargs, args, self);
2228
+ }
2229
+ }
2230
+ if (argc == 2) {
2231
+ int _v;
2232
+ void *vptr = 0;
2233
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_TagLib__Vorbis__File, 0);
2234
+ _v = SWIG_CheckState(res);
2235
+ if (_v) {
2236
+ {
2237
+ int res = SWIG_AsVal_int(argv[1], NULL);
2238
+ _v = SWIG_CheckState(res);
2239
+ }
2240
+ if (_v) {
2241
+ return _wrap_new_Properties__SWIG_0(nargs, args, self);
2242
+ }
2243
+ }
2244
+ }
2245
+
2246
+ fail:
2247
+ Ruby_Format_OverloadedError( argc, 2, "Properties.new",
2248
+ " Properties.new(TagLib::Vorbis::File *file, TagLib::AudioProperties::ReadStyle style)\n"
2249
+ " Properties.new(TagLib::Vorbis::File *file)\n");
2250
+
2251
+ return Qnil;
2252
+ }
2253
+
2254
+
2255
+ SWIGINTERN void
2256
+ free_TagLib_Vorbis_Properties(TagLib::Vorbis::Properties *arg1) {
2257
+ SWIG_RubyRemoveTracking(arg1);
2258
+ delete arg1;
2259
+ }
2260
+
2261
+ SWIGINTERN VALUE
2262
+ _wrap_Properties_length(int argc, VALUE *argv, VALUE self) {
2263
+ TagLib::Vorbis::Properties *arg1 = (TagLib::Vorbis::Properties *) 0 ;
2264
+ void *argp1 = 0 ;
2265
+ int res1 = 0 ;
2266
+ int result;
2267
+ VALUE vresult = Qnil;
2268
+
2269
+ if ((argc < 0) || (argc > 0)) {
2270
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2271
+ }
2272
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_TagLib__Vorbis__Properties, 0 | 0 );
2273
+ if (!SWIG_IsOK(res1)) {
2274
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TagLib::Vorbis::Properties const *","length", 1, self ));
2275
+ }
2276
+ arg1 = reinterpret_cast< TagLib::Vorbis::Properties * >(argp1);
2277
+ result = (int)((TagLib::Vorbis::Properties const *)arg1)->length();
2278
+ vresult = SWIG_From_int(static_cast< int >(result));
2279
+ return vresult;
2280
+ fail:
2281
+ return Qnil;
2282
+ }
2283
+
2284
+
2285
+ SWIGINTERN VALUE
2286
+ _wrap_Properties_bitrate(int argc, VALUE *argv, VALUE self) {
2287
+ TagLib::Vorbis::Properties *arg1 = (TagLib::Vorbis::Properties *) 0 ;
2288
+ void *argp1 = 0 ;
2289
+ int res1 = 0 ;
2290
+ int result;
2291
+ VALUE vresult = Qnil;
2292
+
2293
+ if ((argc < 0) || (argc > 0)) {
2294
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2295
+ }
2296
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_TagLib__Vorbis__Properties, 0 | 0 );
2297
+ if (!SWIG_IsOK(res1)) {
2298
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TagLib::Vorbis::Properties const *","bitrate", 1, self ));
2299
+ }
2300
+ arg1 = reinterpret_cast< TagLib::Vorbis::Properties * >(argp1);
2301
+ result = (int)((TagLib::Vorbis::Properties const *)arg1)->bitrate();
2302
+ vresult = SWIG_From_int(static_cast< int >(result));
2303
+ return vresult;
2304
+ fail:
2305
+ return Qnil;
2306
+ }
2307
+
2308
+
2309
+ SWIGINTERN VALUE
2310
+ _wrap_Properties_sample_rate(int argc, VALUE *argv, VALUE self) {
2311
+ TagLib::Vorbis::Properties *arg1 = (TagLib::Vorbis::Properties *) 0 ;
2312
+ void *argp1 = 0 ;
2313
+ int res1 = 0 ;
2314
+ int result;
2315
+ VALUE vresult = Qnil;
2316
+
2317
+ if ((argc < 0) || (argc > 0)) {
2318
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2319
+ }
2320
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_TagLib__Vorbis__Properties, 0 | 0 );
2321
+ if (!SWIG_IsOK(res1)) {
2322
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TagLib::Vorbis::Properties const *","sampleRate", 1, self ));
2323
+ }
2324
+ arg1 = reinterpret_cast< TagLib::Vorbis::Properties * >(argp1);
2325
+ result = (int)((TagLib::Vorbis::Properties const *)arg1)->sampleRate();
2326
+ vresult = SWIG_From_int(static_cast< int >(result));
2327
+ return vresult;
2328
+ fail:
2329
+ return Qnil;
2330
+ }
2331
+
2332
+
2333
+ SWIGINTERN VALUE
2334
+ _wrap_Properties_channels(int argc, VALUE *argv, VALUE self) {
2335
+ TagLib::Vorbis::Properties *arg1 = (TagLib::Vorbis::Properties *) 0 ;
2336
+ void *argp1 = 0 ;
2337
+ int res1 = 0 ;
2338
+ int result;
2339
+ VALUE vresult = Qnil;
2340
+
2341
+ if ((argc < 0) || (argc > 0)) {
2342
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2343
+ }
2344
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_TagLib__Vorbis__Properties, 0 | 0 );
2345
+ if (!SWIG_IsOK(res1)) {
2346
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TagLib::Vorbis::Properties const *","channels", 1, self ));
2347
+ }
2348
+ arg1 = reinterpret_cast< TagLib::Vorbis::Properties * >(argp1);
2349
+ result = (int)((TagLib::Vorbis::Properties const *)arg1)->channels();
2350
+ vresult = SWIG_From_int(static_cast< int >(result));
2351
+ return vresult;
2352
+ fail:
2353
+ return Qnil;
2354
+ }
2355
+
2356
+
2357
+ SWIGINTERN VALUE
2358
+ _wrap_Properties_vorbis_version(int argc, VALUE *argv, VALUE self) {
2359
+ TagLib::Vorbis::Properties *arg1 = (TagLib::Vorbis::Properties *) 0 ;
2360
+ void *argp1 = 0 ;
2361
+ int res1 = 0 ;
2362
+ int result;
2363
+ VALUE vresult = Qnil;
2364
+
2365
+ if ((argc < 0) || (argc > 0)) {
2366
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2367
+ }
2368
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_TagLib__Vorbis__Properties, 0 | 0 );
2369
+ if (!SWIG_IsOK(res1)) {
2370
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TagLib::Vorbis::Properties const *","vorbisVersion", 1, self ));
2371
+ }
2372
+ arg1 = reinterpret_cast< TagLib::Vorbis::Properties * >(argp1);
2373
+ result = (int)((TagLib::Vorbis::Properties const *)arg1)->vorbisVersion();
2374
+ vresult = SWIG_From_int(static_cast< int >(result));
2375
+ return vresult;
2376
+ fail:
2377
+ return Qnil;
2378
+ }
2379
+
2380
+
2381
+ SWIGINTERN VALUE
2382
+ _wrap_Properties_bitrate_maximum(int argc, VALUE *argv, VALUE self) {
2383
+ TagLib::Vorbis::Properties *arg1 = (TagLib::Vorbis::Properties *) 0 ;
2384
+ void *argp1 = 0 ;
2385
+ int res1 = 0 ;
2386
+ int result;
2387
+ VALUE vresult = Qnil;
2388
+
2389
+ if ((argc < 0) || (argc > 0)) {
2390
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2391
+ }
2392
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_TagLib__Vorbis__Properties, 0 | 0 );
2393
+ if (!SWIG_IsOK(res1)) {
2394
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TagLib::Vorbis::Properties const *","bitrateMaximum", 1, self ));
2395
+ }
2396
+ arg1 = reinterpret_cast< TagLib::Vorbis::Properties * >(argp1);
2397
+ result = (int)((TagLib::Vorbis::Properties const *)arg1)->bitrateMaximum();
2398
+ vresult = SWIG_From_int(static_cast< int >(result));
2399
+ return vresult;
2400
+ fail:
2401
+ return Qnil;
2402
+ }
2403
+
2404
+
2405
+ SWIGINTERN VALUE
2406
+ _wrap_Properties_bitrate_nominal(int argc, VALUE *argv, VALUE self) {
2407
+ TagLib::Vorbis::Properties *arg1 = (TagLib::Vorbis::Properties *) 0 ;
2408
+ void *argp1 = 0 ;
2409
+ int res1 = 0 ;
2410
+ int result;
2411
+ VALUE vresult = Qnil;
2412
+
2413
+ if ((argc < 0) || (argc > 0)) {
2414
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2415
+ }
2416
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_TagLib__Vorbis__Properties, 0 | 0 );
2417
+ if (!SWIG_IsOK(res1)) {
2418
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TagLib::Vorbis::Properties const *","bitrateNominal", 1, self ));
2419
+ }
2420
+ arg1 = reinterpret_cast< TagLib::Vorbis::Properties * >(argp1);
2421
+ result = (int)((TagLib::Vorbis::Properties const *)arg1)->bitrateNominal();
2422
+ vresult = SWIG_From_int(static_cast< int >(result));
2423
+ return vresult;
2424
+ fail:
2425
+ return Qnil;
2426
+ }
2427
+
2428
+
2429
+ SWIGINTERN VALUE
2430
+ _wrap_Properties_bitrate_minimum(int argc, VALUE *argv, VALUE self) {
2431
+ TagLib::Vorbis::Properties *arg1 = (TagLib::Vorbis::Properties *) 0 ;
2432
+ void *argp1 = 0 ;
2433
+ int res1 = 0 ;
2434
+ int result;
2435
+ VALUE vresult = Qnil;
2436
+
2437
+ if ((argc < 0) || (argc > 0)) {
2438
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2439
+ }
2440
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_TagLib__Vorbis__Properties, 0 | 0 );
2441
+ if (!SWIG_IsOK(res1)) {
2442
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TagLib::Vorbis::Properties const *","bitrateMinimum", 1, self ));
2443
+ }
2444
+ arg1 = reinterpret_cast< TagLib::Vorbis::Properties * >(argp1);
2445
+ result = (int)((TagLib::Vorbis::Properties const *)arg1)->bitrateMinimum();
2446
+ vresult = SWIG_From_int(static_cast< int >(result));
2447
+ return vresult;
2448
+ fail:
2449
+ return Qnil;
2450
+ }
2451
+
2452
+
2453
+ static swig_class SwigClassFile;
2454
+
2455
+ SWIGINTERN VALUE
2456
+ _wrap_new_File__SWIG_0(int argc, VALUE *argv, VALUE self) {
2457
+ SwigValueWrapper< TagLib::FileName > arg1 ;
2458
+ bool arg2 ;
2459
+ TagLib::Vorbis::Properties::ReadStyle arg3 ;
2460
+ bool val2 ;
2461
+ int ecode2 = 0 ;
2462
+ int val3 ;
2463
+ int ecode3 = 0 ;
2464
+ TagLib::Vorbis::File *result = 0 ;
2465
+
2466
+ if ((argc < 3) || (argc > 3)) {
2467
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
2468
+ }
2469
+ {
2470
+ arg1 = ruby_string_to_taglib_filename(argv[0]);
2471
+ if ((const char *)(TagLib::FileName)(arg1) == NULL) {
2472
+ SWIG_exception_fail(SWIG_MemoryError, "Failed to allocate memory for file name.");
2473
+ }
2474
+ }
2475
+ ecode2 = SWIG_AsVal_bool(argv[1], &val2);
2476
+ if (!SWIG_IsOK(ecode2)) {
2477
+ SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "bool","TagLib::Vorbis::File", 2, argv[1] ));
2478
+ }
2479
+ arg2 = static_cast< bool >(val2);
2480
+ ecode3 = SWIG_AsVal_int(argv[2], &val3);
2481
+ if (!SWIG_IsOK(ecode3)) {
2482
+ SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "TagLib::Vorbis::Properties::ReadStyle","TagLib::Vorbis::File", 3, argv[2] ));
2483
+ }
2484
+ arg3 = static_cast< TagLib::Vorbis::Properties::ReadStyle >(val3);
2485
+ result = (TagLib::Vorbis::File *)new TagLib::Vorbis::File(arg1,arg2,arg3);
2486
+ DATA_PTR(self) = result;
2487
+ SWIG_RubyAddTracking(result, self);
2488
+ return self;
2489
+ fail:
2490
+ return Qnil;
2491
+ }
2492
+
2493
+
2494
+ SWIGINTERN VALUE
2495
+ _wrap_new_File__SWIG_1(int argc, VALUE *argv, VALUE self) {
2496
+ SwigValueWrapper< TagLib::FileName > arg1 ;
2497
+ bool arg2 ;
2498
+ bool val2 ;
2499
+ int ecode2 = 0 ;
2500
+ TagLib::Vorbis::File *result = 0 ;
2501
+
2502
+ if ((argc < 2) || (argc > 2)) {
2503
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
2504
+ }
2505
+ {
2506
+ arg1 = ruby_string_to_taglib_filename(argv[0]);
2507
+ if ((const char *)(TagLib::FileName)(arg1) == NULL) {
2508
+ SWIG_exception_fail(SWIG_MemoryError, "Failed to allocate memory for file name.");
2509
+ }
2510
+ }
2511
+ ecode2 = SWIG_AsVal_bool(argv[1], &val2);
2512
+ if (!SWIG_IsOK(ecode2)) {
2513
+ SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "bool","TagLib::Vorbis::File", 2, argv[1] ));
2514
+ }
2515
+ arg2 = static_cast< bool >(val2);
2516
+ result = (TagLib::Vorbis::File *)new TagLib::Vorbis::File(arg1,arg2);
2517
+ DATA_PTR(self) = result;
2518
+ SWIG_RubyAddTracking(result, self);
2519
+ return self;
2520
+ fail:
2521
+ return Qnil;
2522
+ }
2523
+
2524
+
2525
+ #ifdef HAVE_RB_DEFINE_ALLOC_FUNC
2526
+ SWIGINTERN VALUE
2527
+ _wrap_File_allocate(VALUE self) {
2528
+ #else
2529
+ SWIGINTERN VALUE
2530
+ _wrap_File_allocate(int argc, VALUE *argv, VALUE self) {
2531
+ #endif
2532
+
2533
+
2534
+ VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_TagLib__Vorbis__File);
2535
+ #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
2536
+ rb_obj_call_init(vresult, argc, argv);
2537
+ #endif
2538
+ return vresult;
2539
+ }
2540
+
2541
+
2542
+ SWIGINTERN VALUE
2543
+ _wrap_new_File__SWIG_2(int argc, VALUE *argv, VALUE self) {
2544
+ SwigValueWrapper< TagLib::FileName > arg1 ;
2545
+ TagLib::Vorbis::File *result = 0 ;
2546
+
2547
+ if ((argc < 1) || (argc > 1)) {
2548
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2549
+ }
2550
+ {
2551
+ arg1 = ruby_string_to_taglib_filename(argv[0]);
2552
+ if ((const char *)(TagLib::FileName)(arg1) == NULL) {
2553
+ SWIG_exception_fail(SWIG_MemoryError, "Failed to allocate memory for file name.");
2554
+ }
2555
+ }
2556
+ result = (TagLib::Vorbis::File *)new TagLib::Vorbis::File(arg1);
2557
+ DATA_PTR(self) = result;
2558
+ SWIG_RubyAddTracking(result, self);
2559
+ return self;
2560
+ fail:
2561
+ return Qnil;
2562
+ }
2563
+
2564
+
2565
+ SWIGINTERN VALUE _wrap_new_File(int nargs, VALUE *args, VALUE self) {
2566
+ int argc;
2567
+ VALUE argv[3];
2568
+ int ii;
2569
+
2570
+ argc = nargs;
2571
+ if (argc > 3) SWIG_fail;
2572
+ for (ii = 0; (ii < argc); ++ii) {
2573
+ argv[ii] = args[ii];
2574
+ }
2575
+ if (argc == 1) {
2576
+ int _v;
2577
+ int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
2578
+ _v = SWIG_CheckState(res);
2579
+ if (_v) {
2580
+ return _wrap_new_File__SWIG_2(nargs, args, self);
2581
+ }
2582
+ }
2583
+ if (argc == 2) {
2584
+ int _v;
2585
+ int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
2586
+ _v = SWIG_CheckState(res);
2587
+ if (_v) {
2588
+ {
2589
+ int res = SWIG_AsVal_bool(argv[1], NULL);
2590
+ _v = SWIG_CheckState(res);
2591
+ }
2592
+ if (_v) {
2593
+ return _wrap_new_File__SWIG_1(nargs, args, self);
2594
+ }
2595
+ }
2596
+ }
2597
+ if (argc == 3) {
2598
+ int _v;
2599
+ int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
2600
+ _v = SWIG_CheckState(res);
2601
+ if (_v) {
2602
+ {
2603
+ int res = SWIG_AsVal_bool(argv[1], NULL);
2604
+ _v = SWIG_CheckState(res);
2605
+ }
2606
+ if (_v) {
2607
+ {
2608
+ int res = SWIG_AsVal_int(argv[2], NULL);
2609
+ _v = SWIG_CheckState(res);
2610
+ }
2611
+ if (_v) {
2612
+ return _wrap_new_File__SWIG_0(nargs, args, self);
2613
+ }
2614
+ }
2615
+ }
2616
+ }
2617
+
2618
+ fail:
2619
+ Ruby_Format_OverloadedError( argc, 3, "File.new",
2620
+ " File.new(TagLib::FileName file, bool readProperties, TagLib::Vorbis::Properties::ReadStyle propertiesStyle)\n"
2621
+ " File.new(TagLib::FileName file, bool readProperties)\n"
2622
+ " File.new(TagLib::FileName file)\n");
2623
+
2624
+ return Qnil;
2625
+ }
2626
+
2627
+
2628
+ SWIGINTERN VALUE
2629
+ _wrap_File_tag(int argc, VALUE *argv, VALUE self) {
2630
+ TagLib::Vorbis::File *arg1 = (TagLib::Vorbis::File *) 0 ;
2631
+ void *argp1 = 0 ;
2632
+ int res1 = 0 ;
2633
+ TagLib::Ogg::XiphComment *result = 0 ;
2634
+ VALUE vresult = Qnil;
2635
+
2636
+ if ((argc < 0) || (argc > 0)) {
2637
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2638
+ }
2639
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_TagLib__Vorbis__File, 0 | 0 );
2640
+ if (!SWIG_IsOK(res1)) {
2641
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TagLib::Vorbis::File const *","tag", 1, self ));
2642
+ }
2643
+ arg1 = reinterpret_cast< TagLib::Vorbis::File * >(argp1);
2644
+ result = (TagLib::Ogg::XiphComment *)((TagLib::Vorbis::File const *)arg1)->tag();
2645
+ vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_TagLib__Ogg__XiphComment, 0 | 0 );
2646
+ return vresult;
2647
+ fail:
2648
+ return Qnil;
2649
+ }
2650
+
2651
+
2652
+ SWIGINTERN VALUE
2653
+ _wrap_File_audio_properties(int argc, VALUE *argv, VALUE self) {
2654
+ TagLib::Vorbis::File *arg1 = (TagLib::Vorbis::File *) 0 ;
2655
+ void *argp1 = 0 ;
2656
+ int res1 = 0 ;
2657
+ TagLib::Vorbis::Properties *result = 0 ;
2658
+ VALUE vresult = Qnil;
2659
+
2660
+ if ((argc < 0) || (argc > 0)) {
2661
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2662
+ }
2663
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_TagLib__Vorbis__File, 0 | 0 );
2664
+ if (!SWIG_IsOK(res1)) {
2665
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TagLib::Vorbis::File const *","audioProperties", 1, self ));
2666
+ }
2667
+ arg1 = reinterpret_cast< TagLib::Vorbis::File * >(argp1);
2668
+ result = (TagLib::Vorbis::Properties *)((TagLib::Vorbis::File const *)arg1)->audioProperties();
2669
+ vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_TagLib__Vorbis__Properties, 0 | 0 );
2670
+ return vresult;
2671
+ fail:
2672
+ return Qnil;
2673
+ }
2674
+
2675
+
2676
+ SWIGINTERN VALUE
2677
+ _wrap_File_save(int argc, VALUE *argv, VALUE self) {
2678
+ TagLib::Vorbis::File *arg1 = (TagLib::Vorbis::File *) 0 ;
2679
+ void *argp1 = 0 ;
2680
+ int res1 = 0 ;
2681
+ bool result;
2682
+ VALUE vresult = Qnil;
2683
+
2684
+ if ((argc < 0) || (argc > 0)) {
2685
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2686
+ }
2687
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_TagLib__Vorbis__File, 0 | 0 );
2688
+ if (!SWIG_IsOK(res1)) {
2689
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TagLib::Vorbis::File *","save", 1, self ));
2690
+ }
2691
+ arg1 = reinterpret_cast< TagLib::Vorbis::File * >(argp1);
2692
+ result = (bool)(arg1)->save();
2693
+ vresult = SWIG_From_bool(static_cast< bool >(result));
2694
+ return vresult;
2695
+ fail:
2696
+ return Qnil;
2697
+ }
2698
+
2699
+
2700
+ SWIGINTERN VALUE
2701
+ _wrap_File_close(int argc, VALUE *argv, VALUE self) {
2702
+ TagLib::Vorbis::File *arg1 = (TagLib::Vorbis::File *) 0 ;
2703
+ void *argp1 = 0 ;
2704
+ int res1 = 0 ;
2705
+
2706
+ if ((argc < 0) || (argc > 0)) {
2707
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2708
+ }
2709
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_TagLib__Vorbis__File, 0 | 0 );
2710
+ if (!SWIG_IsOK(res1)) {
2711
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TagLib::Vorbis::File *","close", 1, self ));
2712
+ }
2713
+ arg1 = reinterpret_cast< TagLib::Vorbis::File * >(argp1);
2714
+ TagLib_Vorbis_File_close(arg1);
2715
+ return Qnil;
2716
+ fail:
2717
+ return Qnil;
2718
+ }
2719
+
2720
+
2721
+
2722
+ /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
2723
+
2724
+ static void *_p_TagLib__Vorbis__PropertiesTo_p_TagLib__AudioProperties(void *x, int *SWIGUNUSEDPARM(newmemory)) {
2725
+ return (void *)((TagLib::AudioProperties *) ((TagLib::Vorbis::Properties *) x));
2726
+ }
2727
+ static void *_p_TagLib__Vorbis__FileTo_p_TagLib__Ogg__File(void *x, int *SWIGUNUSEDPARM(newmemory)) {
2728
+ return (void *)((TagLib::Ogg::File *) ((TagLib::Vorbis::File *) x));
2729
+ }
2730
+ static void *_p_TagLib__Ogg__FileTo_p_TagLib__File(void *x, int *SWIGUNUSEDPARM(newmemory)) {
2731
+ return (void *)((TagLib::File *) ((TagLib::Ogg::File *) x));
2732
+ }
2733
+ static void *_p_TagLib__Vorbis__FileTo_p_TagLib__File(void *x, int *SWIGUNUSEDPARM(newmemory)) {
2734
+ return (void *)((TagLib::File *) (TagLib::Ogg::File *) ((TagLib::Vorbis::File *) x));
2735
+ }
2736
+ static swig_type_info _swigt__p_MapT_TagLib__String_TagLib__StringList_t = {"_p_MapT_TagLib__String_TagLib__StringList_t", "Map< TagLib::String,TagLib::StringList > *|TagLib::Ogg::FieldListMap *", 0, 0, (void*)0, 0};
2737
+ static swig_type_info _swigt__p_TagLib__AudioProperties = {"_p_TagLib__AudioProperties", "TagLib::AudioProperties *|TagLib::Ogg::Vorbis::AudioProperties *", 0, 0, (void*)0, 0};
2738
+ static swig_type_info _swigt__p_TagLib__File = {"_p_TagLib__File", "TagLib::File *", 0, 0, (void*)0, 0};
2739
+ static swig_type_info _swigt__p_TagLib__Ogg__File = {"_p_TagLib__Ogg__File", "TagLib::Ogg::File *", 0, 0, (void*)0, 0};
2740
+ static swig_type_info _swigt__p_TagLib__Ogg__XiphComment = {"_p_TagLib__Ogg__XiphComment", "TagLib::Ogg::XiphComment *", 0, 0, (void*)0, 0};
2741
+ static swig_type_info _swigt__p_TagLib__Vorbis__File = {"_p_TagLib__Vorbis__File", "TagLib::Vorbis::File *|TagLib::Ogg::Vorbis::File *", 0, 0, (void*)0, 0};
2742
+ static swig_type_info _swigt__p_TagLib__Vorbis__Properties = {"_p_TagLib__Vorbis__Properties", "TagLib::Vorbis::Properties *", 0, 0, (void*)0, 0};
2743
+ static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
2744
+ static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "TagLib::uchar *|unsigned char *", 0, 0, (void*)0, 0};
2745
+ static swig_type_info _swigt__p_unsigned_int = {"_p_unsigned_int", "unsigned int *|TagLib::uint *", 0, 0, (void*)0, 0};
2746
+ static swig_type_info _swigt__p_unsigned_long = {"_p_unsigned_long", "TagLib::ulong *|unsigned long *", 0, 0, (void*)0, 0};
2747
+ static swig_type_info _swigt__p_wchar_t = {"_p_wchar_t", "TagLib::wchar *|wchar_t *", 0, 0, (void*)0, 0};
2748
+
2749
+ static swig_type_info *swig_type_initial[] = {
2750
+ &_swigt__p_MapT_TagLib__String_TagLib__StringList_t,
2751
+ &_swigt__p_TagLib__AudioProperties,
2752
+ &_swigt__p_TagLib__File,
2753
+ &_swigt__p_TagLib__Ogg__File,
2754
+ &_swigt__p_TagLib__Ogg__XiphComment,
2755
+ &_swigt__p_TagLib__Vorbis__File,
2756
+ &_swigt__p_TagLib__Vorbis__Properties,
2757
+ &_swigt__p_char,
2758
+ &_swigt__p_unsigned_char,
2759
+ &_swigt__p_unsigned_int,
2760
+ &_swigt__p_unsigned_long,
2761
+ &_swigt__p_wchar_t,
2762
+ };
2763
+
2764
+ static swig_cast_info _swigc__p_MapT_TagLib__String_TagLib__StringList_t[] = { {&_swigt__p_MapT_TagLib__String_TagLib__StringList_t, 0, 0, 0},{0, 0, 0, 0}};
2765
+ static swig_cast_info _swigc__p_TagLib__AudioProperties[] = { {&_swigt__p_TagLib__AudioProperties, 0, 0, 0}, {&_swigt__p_TagLib__Vorbis__Properties, _p_TagLib__Vorbis__PropertiesTo_p_TagLib__AudioProperties, 0, 0},{0, 0, 0, 0}};
2766
+ static swig_cast_info _swigc__p_TagLib__File[] = { {&_swigt__p_TagLib__Ogg__File, _p_TagLib__Ogg__FileTo_p_TagLib__File, 0, 0}, {&_swigt__p_TagLib__Vorbis__File, _p_TagLib__Vorbis__FileTo_p_TagLib__File, 0, 0}, {&_swigt__p_TagLib__File, 0, 0, 0},{0, 0, 0, 0}};
2767
+ static swig_cast_info _swigc__p_TagLib__Ogg__File[] = { {&_swigt__p_TagLib__Ogg__File, 0, 0, 0}, {&_swigt__p_TagLib__Vorbis__File, _p_TagLib__Vorbis__FileTo_p_TagLib__Ogg__File, 0, 0},{0, 0, 0, 0}};
2768
+ static swig_cast_info _swigc__p_TagLib__Ogg__XiphComment[] = { {&_swigt__p_TagLib__Ogg__XiphComment, 0, 0, 0},{0, 0, 0, 0}};
2769
+ static swig_cast_info _swigc__p_TagLib__Vorbis__File[] = { {&_swigt__p_TagLib__Vorbis__File, 0, 0, 0},{0, 0, 0, 0}};
2770
+ static swig_cast_info _swigc__p_TagLib__Vorbis__Properties[] = { {&_swigt__p_TagLib__Vorbis__Properties, 0, 0, 0},{0, 0, 0, 0}};
2771
+ static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
2772
+ static swig_cast_info _swigc__p_unsigned_char[] = { {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}};
2773
+ static swig_cast_info _swigc__p_unsigned_int[] = { {&_swigt__p_unsigned_int, 0, 0, 0},{0, 0, 0, 0}};
2774
+ static swig_cast_info _swigc__p_unsigned_long[] = { {&_swigt__p_unsigned_long, 0, 0, 0},{0, 0, 0, 0}};
2775
+ static swig_cast_info _swigc__p_wchar_t[] = { {&_swigt__p_wchar_t, 0, 0, 0},{0, 0, 0, 0}};
2776
+
2777
+ static swig_cast_info *swig_cast_initial[] = {
2778
+ _swigc__p_MapT_TagLib__String_TagLib__StringList_t,
2779
+ _swigc__p_TagLib__AudioProperties,
2780
+ _swigc__p_TagLib__File,
2781
+ _swigc__p_TagLib__Ogg__File,
2782
+ _swigc__p_TagLib__Ogg__XiphComment,
2783
+ _swigc__p_TagLib__Vorbis__File,
2784
+ _swigc__p_TagLib__Vorbis__Properties,
2785
+ _swigc__p_char,
2786
+ _swigc__p_unsigned_char,
2787
+ _swigc__p_unsigned_int,
2788
+ _swigc__p_unsigned_long,
2789
+ _swigc__p_wchar_t,
2790
+ };
2791
+
2792
+
2793
+ /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
2794
+
2795
+ /* -----------------------------------------------------------------------------
2796
+ * Type initialization:
2797
+ * This problem is tough by the requirement that no dynamic
2798
+ * memory is used. Also, since swig_type_info structures store pointers to
2799
+ * swig_cast_info structures and swig_cast_info structures store pointers back
2800
+ * to swig_type_info structures, we need some lookup code at initialization.
2801
+ * The idea is that swig generates all the structures that are needed.
2802
+ * The runtime then collects these partially filled structures.
2803
+ * The SWIG_InitializeModule function takes these initial arrays out of
2804
+ * swig_module, and does all the lookup, filling in the swig_module.types
2805
+ * array with the correct data and linking the correct swig_cast_info
2806
+ * structures together.
2807
+ *
2808
+ * The generated swig_type_info structures are assigned staticly to an initial
2809
+ * array. We just loop through that array, and handle each type individually.
2810
+ * First we lookup if this type has been already loaded, and if so, use the
2811
+ * loaded structure instead of the generated one. Then we have to fill in the
2812
+ * cast linked list. The cast data is initially stored in something like a
2813
+ * two-dimensional array. Each row corresponds to a type (there are the same
2814
+ * number of rows as there are in the swig_type_initial array). Each entry in
2815
+ * a column is one of the swig_cast_info structures for that type.
2816
+ * The cast_initial array is actually an array of arrays, because each row has
2817
+ * a variable number of columns. So to actually build the cast linked list,
2818
+ * we find the array of casts associated with the type, and loop through it
2819
+ * adding the casts to the list. The one last trick we need to do is making
2820
+ * sure the type pointer in the swig_cast_info struct is correct.
2821
+ *
2822
+ * First off, we lookup the cast->type name to see if it is already loaded.
2823
+ * There are three cases to handle:
2824
+ * 1) If the cast->type has already been loaded AND the type we are adding
2825
+ * casting info to has not been loaded (it is in this module), THEN we
2826
+ * replace the cast->type pointer with the type pointer that has already
2827
+ * been loaded.
2828
+ * 2) If BOTH types (the one we are adding casting info to, and the
2829
+ * cast->type) are loaded, THEN the cast info has already been loaded by
2830
+ * the previous module so we just ignore it.
2831
+ * 3) Finally, if cast->type has not already been loaded, then we add that
2832
+ * swig_cast_info to the linked list (because the cast->type) pointer will
2833
+ * be correct.
2834
+ * ----------------------------------------------------------------------------- */
2835
+
2836
+ #ifdef __cplusplus
2837
+ extern "C" {
2838
+ #if 0
2839
+ } /* c-mode */
2840
+ #endif
2841
+ #endif
2842
+
2843
+ #if 0
2844
+ #define SWIGRUNTIME_DEBUG
2845
+ #endif
2846
+
2847
+
2848
+ SWIGRUNTIME void
2849
+ SWIG_InitializeModule(void *clientdata) {
2850
+ size_t i;
2851
+ swig_module_info *module_head, *iter;
2852
+ int found, init;
2853
+
2854
+ clientdata = clientdata;
2855
+
2856
+ /* check to see if the circular list has been setup, if not, set it up */
2857
+ if (swig_module.next==0) {
2858
+ /* Initialize the swig_module */
2859
+ swig_module.type_initial = swig_type_initial;
2860
+ swig_module.cast_initial = swig_cast_initial;
2861
+ swig_module.next = &swig_module;
2862
+ init = 1;
2863
+ } else {
2864
+ init = 0;
2865
+ }
2866
+
2867
+ /* Try and load any already created modules */
2868
+ module_head = SWIG_GetModule(clientdata);
2869
+ if (!module_head) {
2870
+ /* This is the first module loaded for this interpreter */
2871
+ /* so set the swig module into the interpreter */
2872
+ SWIG_SetModule(clientdata, &swig_module);
2873
+ module_head = &swig_module;
2874
+ } else {
2875
+ /* the interpreter has loaded a SWIG module, but has it loaded this one? */
2876
+ found=0;
2877
+ iter=module_head;
2878
+ do {
2879
+ if (iter==&swig_module) {
2880
+ found=1;
2881
+ break;
2882
+ }
2883
+ iter=iter->next;
2884
+ } while (iter!= module_head);
2885
+
2886
+ /* if the is found in the list, then all is done and we may leave */
2887
+ if (found) return;
2888
+ /* otherwise we must add out module into the list */
2889
+ swig_module.next = module_head->next;
2890
+ module_head->next = &swig_module;
2891
+ }
2892
+
2893
+ /* When multiple interpeters are used, a module could have already been initialized in
2894
+ a different interpreter, but not yet have a pointer in this interpreter.
2895
+ In this case, we do not want to continue adding types... everything should be
2896
+ set up already */
2897
+ if (init == 0) return;
2898
+
2899
+ /* Now work on filling in swig_module.types */
2900
+ #ifdef SWIGRUNTIME_DEBUG
2901
+ printf("SWIG_InitializeModule: size %d\n", swig_module.size);
2902
+ #endif
2903
+ for (i = 0; i < swig_module.size; ++i) {
2904
+ swig_type_info *type = 0;
2905
+ swig_type_info *ret;
2906
+ swig_cast_info *cast;
2907
+
2908
+ #ifdef SWIGRUNTIME_DEBUG
2909
+ printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
2910
+ #endif
2911
+
2912
+ /* if there is another module already loaded */
2913
+ if (swig_module.next != &swig_module) {
2914
+ type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
2915
+ }
2916
+ if (type) {
2917
+ /* Overwrite clientdata field */
2918
+ #ifdef SWIGRUNTIME_DEBUG
2919
+ printf("SWIG_InitializeModule: found type %s\n", type->name);
2920
+ #endif
2921
+ if (swig_module.type_initial[i]->clientdata) {
2922
+ type->clientdata = swig_module.type_initial[i]->clientdata;
2923
+ #ifdef SWIGRUNTIME_DEBUG
2924
+ printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
2925
+ #endif
2926
+ }
2927
+ } else {
2928
+ type = swig_module.type_initial[i];
2929
+ }
2930
+
2931
+ /* Insert casting types */
2932
+ cast = swig_module.cast_initial[i];
2933
+ while (cast->type) {
2934
+
2935
+ /* Don't need to add information already in the list */
2936
+ ret = 0;
2937
+ #ifdef SWIGRUNTIME_DEBUG
2938
+ printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
2939
+ #endif
2940
+ if (swig_module.next != &swig_module) {
2941
+ ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
2942
+ #ifdef SWIGRUNTIME_DEBUG
2943
+ if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
2944
+ #endif
2945
+ }
2946
+ if (ret) {
2947
+ if (type == swig_module.type_initial[i]) {
2948
+ #ifdef SWIGRUNTIME_DEBUG
2949
+ printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
2950
+ #endif
2951
+ cast->type = ret;
2952
+ ret = 0;
2953
+ } else {
2954
+ /* Check for casting already in the list */
2955
+ swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
2956
+ #ifdef SWIGRUNTIME_DEBUG
2957
+ if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
2958
+ #endif
2959
+ if (!ocast) ret = 0;
2960
+ }
2961
+ }
2962
+
2963
+ if (!ret) {
2964
+ #ifdef SWIGRUNTIME_DEBUG
2965
+ printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
2966
+ #endif
2967
+ if (type->cast) {
2968
+ type->cast->prev = cast;
2969
+ cast->next = type->cast;
2970
+ }
2971
+ type->cast = cast;
2972
+ }
2973
+ cast++;
2974
+ }
2975
+ /* Set entry in modules->types array equal to the type */
2976
+ swig_module.types[i] = type;
2977
+ }
2978
+ swig_module.types[i] = 0;
2979
+
2980
+ #ifdef SWIGRUNTIME_DEBUG
2981
+ printf("**** SWIG_InitializeModule: Cast List ******\n");
2982
+ for (i = 0; i < swig_module.size; ++i) {
2983
+ int j = 0;
2984
+ swig_cast_info *cast = swig_module.cast_initial[i];
2985
+ printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
2986
+ while (cast->type) {
2987
+ printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
2988
+ cast++;
2989
+ ++j;
2990
+ }
2991
+ printf("---- Total casts: %d\n",j);
2992
+ }
2993
+ printf("**** SWIG_InitializeModule: Cast List ******\n");
2994
+ #endif
2995
+ }
2996
+
2997
+ /* This function will propagate the clientdata field of type to
2998
+ * any new swig_type_info structures that have been added into the list
2999
+ * of equivalent types. It is like calling
3000
+ * SWIG_TypeClientData(type, clientdata) a second time.
3001
+ */
3002
+ SWIGRUNTIME void
3003
+ SWIG_PropagateClientData(void) {
3004
+ size_t i;
3005
+ swig_cast_info *equiv;
3006
+ static int init_run = 0;
3007
+
3008
+ if (init_run) return;
3009
+ init_run = 1;
3010
+
3011
+ for (i = 0; i < swig_module.size; i++) {
3012
+ if (swig_module.types[i]->clientdata) {
3013
+ equiv = swig_module.types[i]->cast;
3014
+ while (equiv) {
3015
+ if (!equiv->converter) {
3016
+ if (equiv->type && !equiv->type->clientdata)
3017
+ SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
3018
+ }
3019
+ equiv = equiv->next;
3020
+ }
3021
+ }
3022
+ }
3023
+ }
3024
+
3025
+ #ifdef __cplusplus
3026
+ #if 0
3027
+ { /* c-mode */
3028
+ #endif
3029
+ }
3030
+ #endif
3031
+
3032
+ /*
3033
+
3034
+ */
3035
+ #ifdef __cplusplus
3036
+ extern "C"
3037
+ #endif
3038
+ SWIGEXPORT void Init_taglib_vorbis(void) {
3039
+ size_t i;
3040
+
3041
+ SWIG_InitRuntime();
3042
+ mVorbis = rb_define_module("TagLib");
3043
+ mVorbis = rb_define_module_under(mVorbis, "Ogg");
3044
+ mVorbis = rb_define_module_under(mVorbis, "Vorbis");
3045
+
3046
+ SWIG_InitializeModule(0);
3047
+ for (i = 0; i < swig_module.size; i++) {
3048
+ SWIG_define_class(swig_module.types[i]);
3049
+ }
3050
+
3051
+ SWIG_RubyInitializeTrackings();
3052
+ rb_require("taglib_ogg");
3053
+ rb_require("taglib_base");
3054
+
3055
+ SwigClassProperties.klass = rb_define_class_under(mVorbis, "Properties", ((swig_class *) SWIGTYPE_p_TagLib__AudioProperties->clientdata)->klass);
3056
+ SWIG_TypeClientData(SWIGTYPE_p_TagLib__Vorbis__Properties, (void *) &SwigClassProperties);
3057
+ rb_define_alloc_func(SwigClassProperties.klass, _wrap_Properties_allocate);
3058
+ rb_define_method(SwigClassProperties.klass, "initialize", VALUEFUNC(_wrap_new_Properties), -1);
3059
+ rb_define_method(SwigClassProperties.klass, "length", VALUEFUNC(_wrap_Properties_length), -1);
3060
+ rb_define_method(SwigClassProperties.klass, "bitrate", VALUEFUNC(_wrap_Properties_bitrate), -1);
3061
+ rb_define_method(SwigClassProperties.klass, "sample_rate", VALUEFUNC(_wrap_Properties_sample_rate), -1);
3062
+ rb_define_method(SwigClassProperties.klass, "channels", VALUEFUNC(_wrap_Properties_channels), -1);
3063
+ rb_define_method(SwigClassProperties.klass, "vorbis_version", VALUEFUNC(_wrap_Properties_vorbis_version), -1);
3064
+ rb_define_method(SwigClassProperties.klass, "bitrate_maximum", VALUEFUNC(_wrap_Properties_bitrate_maximum), -1);
3065
+ rb_define_method(SwigClassProperties.klass, "bitrate_nominal", VALUEFUNC(_wrap_Properties_bitrate_nominal), -1);
3066
+ rb_define_method(SwigClassProperties.klass, "bitrate_minimum", VALUEFUNC(_wrap_Properties_bitrate_minimum), -1);
3067
+ SwigClassProperties.mark = 0;
3068
+ SwigClassProperties.destroy = (void (*)(void *)) free_TagLib_Vorbis_Properties;
3069
+ SwigClassProperties.trackObjects = 1;
3070
+
3071
+ SwigClassFile.klass = rb_define_class_under(mVorbis, "File", ((swig_class *) SWIGTYPE_p_TagLib__Ogg__File->clientdata)->klass);
3072
+ SWIG_TypeClientData(SWIGTYPE_p_TagLib__Vorbis__File, (void *) &SwigClassFile);
3073
+ rb_define_alloc_func(SwigClassFile.klass, _wrap_File_allocate);
3074
+ rb_define_method(SwigClassFile.klass, "initialize", VALUEFUNC(_wrap_new_File), -1);
3075
+ rb_define_method(SwigClassFile.klass, "tag", VALUEFUNC(_wrap_File_tag), -1);
3076
+ rb_define_method(SwigClassFile.klass, "audio_properties", VALUEFUNC(_wrap_File_audio_properties), -1);
3077
+ rb_define_method(SwigClassFile.klass, "save", VALUEFUNC(_wrap_File_save), -1);
3078
+ rb_define_method(SwigClassFile.klass, "close", VALUEFUNC(_wrap_File_close), -1);
3079
+ SwigClassFile.mark = 0;
3080
+ SwigClassFile.destroy = (void (*)(void *)) free_taglib_vorbis_file;
3081
+ SwigClassFile.trackObjects = 1;
3082
+ }
3083
+