taglib-ruby 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. data/CHANGES.md +7 -0
  2. data/Gemfile +1 -2
  3. data/Gemfile.lock +9 -8
  4. data/README.md +22 -7
  5. data/Rakefile +9 -15
  6. data/docs/taglib/base.rb +31 -8
  7. data/docs/taglib/id3v1.rb +5 -0
  8. data/docs/taglib/mpeg.rb +8 -0
  9. data/docs/taglib/ogg.rb +77 -0
  10. data/docs/taglib/vorbis.rb +43 -0
  11. data/ext/taglib_base/includes.i +25 -1
  12. data/ext/taglib_base/taglib_base.i +46 -2
  13. data/ext/taglib_base/taglib_base_wrap.cxx +176 -185
  14. data/ext/taglib_id3v1/extconf.rb +4 -0
  15. data/ext/taglib_id3v1/taglib_id3v1.i +11 -0
  16. data/ext/taglib_id3v1/taglib_id3v1_wrap.cxx +3092 -0
  17. data/ext/taglib_id3v2/taglib_id3v2.i +0 -8
  18. data/ext/taglib_id3v2/taglib_id3v2_wrap.cxx +194 -248
  19. data/ext/taglib_mpeg/taglib_mpeg.i +16 -2
  20. data/ext/taglib_mpeg/taglib_mpeg_wrap.cxx +157 -149
  21. data/ext/taglib_ogg/extconf.rb +4 -0
  22. data/ext/taglib_ogg/taglib_ogg.i +36 -0
  23. data/ext/taglib_ogg/taglib_ogg_wrap.cxx +3613 -0
  24. data/ext/taglib_vorbis/extconf.rb +4 -0
  25. data/ext/taglib_vorbis/taglib_vorbis.i +48 -0
  26. data/ext/taglib_vorbis/taglib_vorbis_wrap.cxx +3056 -0
  27. data/ext/win.cmake +6 -0
  28. data/lib/taglib/id3v1.rb +1 -0
  29. data/lib/taglib/ogg.rb +1 -0
  30. data/lib/taglib/version.rb +2 -2
  31. data/lib/taglib/vorbis.rb +1 -0
  32. data/lib/taglib.rb +10 -0
  33. data/taglib-ruby.gemspec +35 -11
  34. data/tasks/ext.rake +79 -0
  35. data/tasks/swig.rake +43 -0
  36. data/test/data/Makefile +15 -0
  37. data/test/data/id3v1-create.cpp +31 -0
  38. data/test/data/id3v1.mp3 +0 -0
  39. data/test/data/vorbis-create.cpp +42 -0
  40. data/test/data/vorbis.oga +0 -0
  41. data/test/test_fileref_write.rb +38 -0
  42. data/test/test_id3v1_tag.rb +36 -0
  43. data/test/test_id3v2_frames.rb +5 -0
  44. data/test/test_id3v2_memory.rb +23 -0
  45. data/test/test_id3v2_relative_volume.rb +5 -0
  46. data/test/test_id3v2_tag.rb +5 -0
  47. data/test/test_id3v2_unicode.rb +5 -0
  48. data/test/test_id3v2_write.rb +6 -1
  49. data/test/test_mpeg_file.rb +18 -1
  50. data/test/test_vorbis_file.rb +44 -0
  51. data/test/test_vorbis_tag.rb +79 -0
  52. metadata +113 -137
  53. data/ext/Rakefile +0 -32
@@ -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,3056 @@
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
+ const char *filename = StringValuePtr(s);
1933
+ return TagLib::FileName(filename);
1934
+ #else
1935
+ return StringValuePtr(s);
1936
+ #endif
1937
+ }
1938
+
1939
+
1940
+
1941
+ #include <limits.h>
1942
+ #if !defined(SWIG_NO_LLONG_MAX)
1943
+ # if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
1944
+ # define LLONG_MAX __LONG_LONG_MAX__
1945
+ # define LLONG_MIN (-LLONG_MAX - 1LL)
1946
+ # define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
1947
+ # endif
1948
+ #endif
1949
+
1950
+
1951
+ SWIGINTERN VALUE
1952
+ SWIG_ruby_failed(void)
1953
+ {
1954
+ return Qnil;
1955
+ }
1956
+
1957
+
1958
+ /*@SWIG:/usr/local/share/swig/2.0.5/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
1959
+ SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE *args)
1960
+ {
1961
+ VALUE obj = args[0];
1962
+ VALUE type = TYPE(obj);
1963
+ long *res = (long *)(args[1]);
1964
+ *res = type == T_FIXNUM ? NUM2LONG(obj) : rb_big2long(obj);
1965
+ return obj;
1966
+ }
1967
+ /*@SWIG@*/
1968
+
1969
+ SWIGINTERN int
1970
+ SWIG_AsVal_long (VALUE obj, long* val)
1971
+ {
1972
+ VALUE type = TYPE(obj);
1973
+ if ((type == T_FIXNUM) || (type == T_BIGNUM)) {
1974
+ long v;
1975
+ VALUE a[2];
1976
+ a[0] = obj;
1977
+ a[1] = (VALUE)(&v);
1978
+ if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2LONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
1979
+ if (val) *val = v;
1980
+ return SWIG_OK;
1981
+ }
1982
+ }
1983
+ return SWIG_TypeError;
1984
+ }
1985
+
1986
+
1987
+ SWIGINTERN int
1988
+ SWIG_AsVal_int (VALUE obj, int *val)
1989
+ {
1990
+ long v;
1991
+ int res = SWIG_AsVal_long (obj, &v);
1992
+ if (SWIG_IsOK(res)) {
1993
+ if ((v < INT_MIN || v > INT_MAX)) {
1994
+ return SWIG_OverflowError;
1995
+ } else {
1996
+ if (val) *val = static_cast< int >(v);
1997
+ }
1998
+ }
1999
+ return res;
2000
+ }
2001
+
2002
+
2003
+ #define SWIG_From_long LONG2NUM
2004
+
2005
+
2006
+ SWIGINTERNINLINE VALUE
2007
+ SWIG_From_int (int value)
2008
+ {
2009
+ return SWIG_From_long (value);
2010
+ }
2011
+
2012
+
2013
+ SWIGINTERN int
2014
+ SWIG_AsVal_bool (VALUE obj, bool *val)
2015
+ {
2016
+ if (obj == Qtrue) {
2017
+ if (val) *val = true;
2018
+ return SWIG_OK;
2019
+ } else if (obj == Qfalse) {
2020
+ if (val) *val = false;
2021
+ return SWIG_OK;
2022
+ } else {
2023
+ int res = 0;
2024
+ if (SWIG_AsVal_int (obj, &res) == SWIG_OK) {
2025
+ if (val) *val = res ? true : false;
2026
+ return SWIG_OK;
2027
+ }
2028
+ }
2029
+ return SWIG_TypeError;
2030
+ }
2031
+
2032
+
2033
+ SWIGINTERN swig_type_info*
2034
+ SWIG_pchar_descriptor(void)
2035
+ {
2036
+ static int init = 0;
2037
+ static swig_type_info* info = 0;
2038
+ if (!init) {
2039
+ info = SWIG_TypeQuery("_p_char");
2040
+ init = 1;
2041
+ }
2042
+ return info;
2043
+ }
2044
+
2045
+
2046
+ SWIGINTERN int
2047
+ SWIG_AsCharPtrAndSize(VALUE obj, char** cptr, size_t* psize, int *alloc)
2048
+ {
2049
+ if (TYPE(obj) == T_STRING) {
2050
+ #if defined(StringValuePtr)
2051
+ char *cstr = StringValuePtr(obj);
2052
+ #else
2053
+ char *cstr = STR2CSTR(obj);
2054
+ #endif
2055
+ size_t size = RSTRING_LEN(obj) + 1;
2056
+ if (cptr) {
2057
+ if (alloc) {
2058
+ if (*alloc == SWIG_NEWOBJ) {
2059
+ *cptr = reinterpret_cast< char* >(memcpy((new char[size]), cstr, sizeof(char)*(size)));
2060
+ } else {
2061
+ *cptr = cstr;
2062
+ *alloc = SWIG_OLDOBJ;
2063
+ }
2064
+ }
2065
+ }
2066
+ if (psize) *psize = size;
2067
+ return SWIG_OK;
2068
+ } else {
2069
+ swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
2070
+ if (pchar_descriptor) {
2071
+ void* vptr = 0;
2072
+ if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
2073
+ if (cptr) *cptr = (char *)vptr;
2074
+ if (psize) *psize = vptr ? (strlen((char*)vptr) + 1) : 0;
2075
+ if (alloc) *alloc = SWIG_OLDOBJ;
2076
+ return SWIG_OK;
2077
+ }
2078
+ }
2079
+ }
2080
+ return SWIG_TypeError;
2081
+ }
2082
+
2083
+
2084
+
2085
+
2086
+
2087
+ SWIGINTERNINLINE VALUE
2088
+ SWIG_From_bool (bool value)
2089
+ {
2090
+ return value ? Qtrue : Qfalse;
2091
+ }
2092
+
2093
+ SWIGINTERN void TagLib_Vorbis_File_close(TagLib::Vorbis::File *self){
2094
+ free_taglib_vorbis_file(self);
2095
+ }
2096
+
2097
+ static void free_taglib_vorbis_file(void *ptr) {
2098
+ TagLib::Ogg::Vorbis::File *file = (TagLib::Ogg::Vorbis::File *) ptr;
2099
+
2100
+ TagLib::Ogg::XiphComment *tag = file->tag();
2101
+ if (tag) {
2102
+ SWIG_RubyUnlinkObjects(tag);
2103
+ SWIG_RubyRemoveTracking(tag);
2104
+ }
2105
+
2106
+ TagLib::Vorbis::Properties *properties = file->audioProperties();
2107
+ if (properties) {
2108
+ SWIG_RubyUnlinkObjects(properties);
2109
+ SWIG_RubyRemoveTracking(properties);
2110
+ }
2111
+
2112
+ SWIG_RubyUnlinkObjects(file);
2113
+ SWIG_RubyRemoveTracking(file);
2114
+
2115
+ delete file;
2116
+ }
2117
+
2118
+ static swig_class SwigClassProperties;
2119
+
2120
+ SWIGINTERN VALUE
2121
+ _wrap_new_Properties__SWIG_0(int argc, VALUE *argv, VALUE self) {
2122
+ TagLib::Vorbis::File *arg1 = (TagLib::Vorbis::File *) 0 ;
2123
+ TagLib::AudioProperties::ReadStyle arg2 ;
2124
+ void *argp1 = 0 ;
2125
+ int res1 = 0 ;
2126
+ int val2 ;
2127
+ int ecode2 = 0 ;
2128
+ TagLib::Vorbis::Properties *result = 0 ;
2129
+
2130
+ if ((argc < 2) || (argc > 2)) {
2131
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
2132
+ }
2133
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_TagLib__Vorbis__File, 0 | 0 );
2134
+ if (!SWIG_IsOK(res1)) {
2135
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TagLib::Vorbis::File *","TagLib::Vorbis::Properties", 1, argv[0] ));
2136
+ }
2137
+ arg1 = reinterpret_cast< TagLib::Vorbis::File * >(argp1);
2138
+ ecode2 = SWIG_AsVal_int(argv[1], &val2);
2139
+ if (!SWIG_IsOK(ecode2)) {
2140
+ SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "TagLib::AudioProperties::ReadStyle","TagLib::Vorbis::Properties", 2, argv[1] ));
2141
+ }
2142
+ arg2 = static_cast< TagLib::AudioProperties::ReadStyle >(val2);
2143
+ result = (TagLib::Vorbis::Properties *)new TagLib::Vorbis::Properties(arg1,arg2);
2144
+ DATA_PTR(self) = result;
2145
+ SWIG_RubyAddTracking(result, self);
2146
+ return self;
2147
+ fail:
2148
+ return Qnil;
2149
+ }
2150
+
2151
+
2152
+ #ifdef HAVE_RB_DEFINE_ALLOC_FUNC
2153
+ SWIGINTERN VALUE
2154
+ _wrap_Properties_allocate(VALUE self) {
2155
+ #else
2156
+ SWIGINTERN VALUE
2157
+ _wrap_Properties_allocate(int argc, VALUE *argv, VALUE self) {
2158
+ #endif
2159
+
2160
+
2161
+ VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_TagLib__Vorbis__Properties);
2162
+ #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
2163
+ rb_obj_call_init(vresult, argc, argv);
2164
+ #endif
2165
+ return vresult;
2166
+ }
2167
+
2168
+
2169
+ SWIGINTERN VALUE
2170
+ _wrap_new_Properties__SWIG_1(int argc, VALUE *argv, VALUE self) {
2171
+ TagLib::Vorbis::File *arg1 = (TagLib::Vorbis::File *) 0 ;
2172
+ void *argp1 = 0 ;
2173
+ int res1 = 0 ;
2174
+ TagLib::Vorbis::Properties *result = 0 ;
2175
+
2176
+ if ((argc < 1) || (argc > 1)) {
2177
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2178
+ }
2179
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_TagLib__Vorbis__File, 0 | 0 );
2180
+ if (!SWIG_IsOK(res1)) {
2181
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TagLib::Vorbis::File *","TagLib::Vorbis::Properties", 1, argv[0] ));
2182
+ }
2183
+ arg1 = reinterpret_cast< TagLib::Vorbis::File * >(argp1);
2184
+ result = (TagLib::Vorbis::Properties *)new TagLib::Vorbis::Properties(arg1);
2185
+ DATA_PTR(self) = result;
2186
+ SWIG_RubyAddTracking(result, self);
2187
+ return self;
2188
+ fail:
2189
+ return Qnil;
2190
+ }
2191
+
2192
+
2193
+ SWIGINTERN VALUE _wrap_new_Properties(int nargs, VALUE *args, VALUE self) {
2194
+ int argc;
2195
+ VALUE argv[2];
2196
+ int ii;
2197
+
2198
+ argc = nargs;
2199
+ if (argc > 2) SWIG_fail;
2200
+ for (ii = 0; (ii < argc); ++ii) {
2201
+ argv[ii] = args[ii];
2202
+ }
2203
+ if (argc == 1) {
2204
+ int _v;
2205
+ void *vptr = 0;
2206
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_TagLib__Vorbis__File, 0);
2207
+ _v = SWIG_CheckState(res);
2208
+ if (_v) {
2209
+ return _wrap_new_Properties__SWIG_1(nargs, args, self);
2210
+ }
2211
+ }
2212
+ if (argc == 2) {
2213
+ int _v;
2214
+ void *vptr = 0;
2215
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_TagLib__Vorbis__File, 0);
2216
+ _v = SWIG_CheckState(res);
2217
+ if (_v) {
2218
+ {
2219
+ int res = SWIG_AsVal_int(argv[1], NULL);
2220
+ _v = SWIG_CheckState(res);
2221
+ }
2222
+ if (_v) {
2223
+ return _wrap_new_Properties__SWIG_0(nargs, args, self);
2224
+ }
2225
+ }
2226
+ }
2227
+
2228
+ fail:
2229
+ Ruby_Format_OverloadedError( argc, 2, "Properties.new",
2230
+ " Properties.new(TagLib::Vorbis::File *file, TagLib::AudioProperties::ReadStyle style)\n"
2231
+ " Properties.new(TagLib::Vorbis::File *file)\n");
2232
+
2233
+ return Qnil;
2234
+ }
2235
+
2236
+
2237
+ SWIGINTERN void
2238
+ free_TagLib_Vorbis_Properties(TagLib::Vorbis::Properties *arg1) {
2239
+ SWIG_RubyRemoveTracking(arg1);
2240
+ delete arg1;
2241
+ }
2242
+
2243
+ SWIGINTERN VALUE
2244
+ _wrap_Properties_length(int argc, VALUE *argv, VALUE self) {
2245
+ TagLib::Vorbis::Properties *arg1 = (TagLib::Vorbis::Properties *) 0 ;
2246
+ void *argp1 = 0 ;
2247
+ int res1 = 0 ;
2248
+ int result;
2249
+ VALUE vresult = Qnil;
2250
+
2251
+ if ((argc < 0) || (argc > 0)) {
2252
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2253
+ }
2254
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_TagLib__Vorbis__Properties, 0 | 0 );
2255
+ if (!SWIG_IsOK(res1)) {
2256
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TagLib::Vorbis::Properties const *","length", 1, self ));
2257
+ }
2258
+ arg1 = reinterpret_cast< TagLib::Vorbis::Properties * >(argp1);
2259
+ result = (int)((TagLib::Vorbis::Properties const *)arg1)->length();
2260
+ vresult = SWIG_From_int(static_cast< int >(result));
2261
+ return vresult;
2262
+ fail:
2263
+ return Qnil;
2264
+ }
2265
+
2266
+
2267
+ SWIGINTERN VALUE
2268
+ _wrap_Properties_bitrate(int argc, VALUE *argv, VALUE self) {
2269
+ TagLib::Vorbis::Properties *arg1 = (TagLib::Vorbis::Properties *) 0 ;
2270
+ void *argp1 = 0 ;
2271
+ int res1 = 0 ;
2272
+ int result;
2273
+ VALUE vresult = Qnil;
2274
+
2275
+ if ((argc < 0) || (argc > 0)) {
2276
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2277
+ }
2278
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_TagLib__Vorbis__Properties, 0 | 0 );
2279
+ if (!SWIG_IsOK(res1)) {
2280
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TagLib::Vorbis::Properties const *","bitrate", 1, self ));
2281
+ }
2282
+ arg1 = reinterpret_cast< TagLib::Vorbis::Properties * >(argp1);
2283
+ result = (int)((TagLib::Vorbis::Properties const *)arg1)->bitrate();
2284
+ vresult = SWIG_From_int(static_cast< int >(result));
2285
+ return vresult;
2286
+ fail:
2287
+ return Qnil;
2288
+ }
2289
+
2290
+
2291
+ SWIGINTERN VALUE
2292
+ _wrap_Properties_sample_rate(int argc, VALUE *argv, VALUE self) {
2293
+ TagLib::Vorbis::Properties *arg1 = (TagLib::Vorbis::Properties *) 0 ;
2294
+ void *argp1 = 0 ;
2295
+ int res1 = 0 ;
2296
+ int result;
2297
+ VALUE vresult = Qnil;
2298
+
2299
+ if ((argc < 0) || (argc > 0)) {
2300
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2301
+ }
2302
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_TagLib__Vorbis__Properties, 0 | 0 );
2303
+ if (!SWIG_IsOK(res1)) {
2304
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TagLib::Vorbis::Properties const *","sampleRate", 1, self ));
2305
+ }
2306
+ arg1 = reinterpret_cast< TagLib::Vorbis::Properties * >(argp1);
2307
+ result = (int)((TagLib::Vorbis::Properties const *)arg1)->sampleRate();
2308
+ vresult = SWIG_From_int(static_cast< int >(result));
2309
+ return vresult;
2310
+ fail:
2311
+ return Qnil;
2312
+ }
2313
+
2314
+
2315
+ SWIGINTERN VALUE
2316
+ _wrap_Properties_channels(int argc, VALUE *argv, VALUE self) {
2317
+ TagLib::Vorbis::Properties *arg1 = (TagLib::Vorbis::Properties *) 0 ;
2318
+ void *argp1 = 0 ;
2319
+ int res1 = 0 ;
2320
+ int result;
2321
+ VALUE vresult = Qnil;
2322
+
2323
+ if ((argc < 0) || (argc > 0)) {
2324
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2325
+ }
2326
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_TagLib__Vorbis__Properties, 0 | 0 );
2327
+ if (!SWIG_IsOK(res1)) {
2328
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TagLib::Vorbis::Properties const *","channels", 1, self ));
2329
+ }
2330
+ arg1 = reinterpret_cast< TagLib::Vorbis::Properties * >(argp1);
2331
+ result = (int)((TagLib::Vorbis::Properties const *)arg1)->channels();
2332
+ vresult = SWIG_From_int(static_cast< int >(result));
2333
+ return vresult;
2334
+ fail:
2335
+ return Qnil;
2336
+ }
2337
+
2338
+
2339
+ SWIGINTERN VALUE
2340
+ _wrap_Properties_vorbis_version(int argc, VALUE *argv, VALUE self) {
2341
+ TagLib::Vorbis::Properties *arg1 = (TagLib::Vorbis::Properties *) 0 ;
2342
+ void *argp1 = 0 ;
2343
+ int res1 = 0 ;
2344
+ int result;
2345
+ VALUE vresult = Qnil;
2346
+
2347
+ if ((argc < 0) || (argc > 0)) {
2348
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2349
+ }
2350
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_TagLib__Vorbis__Properties, 0 | 0 );
2351
+ if (!SWIG_IsOK(res1)) {
2352
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TagLib::Vorbis::Properties const *","vorbisVersion", 1, self ));
2353
+ }
2354
+ arg1 = reinterpret_cast< TagLib::Vorbis::Properties * >(argp1);
2355
+ result = (int)((TagLib::Vorbis::Properties const *)arg1)->vorbisVersion();
2356
+ vresult = SWIG_From_int(static_cast< int >(result));
2357
+ return vresult;
2358
+ fail:
2359
+ return Qnil;
2360
+ }
2361
+
2362
+
2363
+ SWIGINTERN VALUE
2364
+ _wrap_Properties_bitrate_maximum(int argc, VALUE *argv, VALUE self) {
2365
+ TagLib::Vorbis::Properties *arg1 = (TagLib::Vorbis::Properties *) 0 ;
2366
+ void *argp1 = 0 ;
2367
+ int res1 = 0 ;
2368
+ int result;
2369
+ VALUE vresult = Qnil;
2370
+
2371
+ if ((argc < 0) || (argc > 0)) {
2372
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2373
+ }
2374
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_TagLib__Vorbis__Properties, 0 | 0 );
2375
+ if (!SWIG_IsOK(res1)) {
2376
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TagLib::Vorbis::Properties const *","bitrateMaximum", 1, self ));
2377
+ }
2378
+ arg1 = reinterpret_cast< TagLib::Vorbis::Properties * >(argp1);
2379
+ result = (int)((TagLib::Vorbis::Properties const *)arg1)->bitrateMaximum();
2380
+ vresult = SWIG_From_int(static_cast< int >(result));
2381
+ return vresult;
2382
+ fail:
2383
+ return Qnil;
2384
+ }
2385
+
2386
+
2387
+ SWIGINTERN VALUE
2388
+ _wrap_Properties_bitrate_nominal(int argc, VALUE *argv, VALUE self) {
2389
+ TagLib::Vorbis::Properties *arg1 = (TagLib::Vorbis::Properties *) 0 ;
2390
+ void *argp1 = 0 ;
2391
+ int res1 = 0 ;
2392
+ int result;
2393
+ VALUE vresult = Qnil;
2394
+
2395
+ if ((argc < 0) || (argc > 0)) {
2396
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2397
+ }
2398
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_TagLib__Vorbis__Properties, 0 | 0 );
2399
+ if (!SWIG_IsOK(res1)) {
2400
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TagLib::Vorbis::Properties const *","bitrateNominal", 1, self ));
2401
+ }
2402
+ arg1 = reinterpret_cast< TagLib::Vorbis::Properties * >(argp1);
2403
+ result = (int)((TagLib::Vorbis::Properties const *)arg1)->bitrateNominal();
2404
+ vresult = SWIG_From_int(static_cast< int >(result));
2405
+ return vresult;
2406
+ fail:
2407
+ return Qnil;
2408
+ }
2409
+
2410
+
2411
+ SWIGINTERN VALUE
2412
+ _wrap_Properties_bitrate_minimum(int argc, VALUE *argv, VALUE self) {
2413
+ TagLib::Vorbis::Properties *arg1 = (TagLib::Vorbis::Properties *) 0 ;
2414
+ void *argp1 = 0 ;
2415
+ int res1 = 0 ;
2416
+ int result;
2417
+ VALUE vresult = Qnil;
2418
+
2419
+ if ((argc < 0) || (argc > 0)) {
2420
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2421
+ }
2422
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_TagLib__Vorbis__Properties, 0 | 0 );
2423
+ if (!SWIG_IsOK(res1)) {
2424
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TagLib::Vorbis::Properties const *","bitrateMinimum", 1, self ));
2425
+ }
2426
+ arg1 = reinterpret_cast< TagLib::Vorbis::Properties * >(argp1);
2427
+ result = (int)((TagLib::Vorbis::Properties const *)arg1)->bitrateMinimum();
2428
+ vresult = SWIG_From_int(static_cast< int >(result));
2429
+ return vresult;
2430
+ fail:
2431
+ return Qnil;
2432
+ }
2433
+
2434
+
2435
+ static swig_class SwigClassFile;
2436
+
2437
+ SWIGINTERN VALUE
2438
+ _wrap_new_File__SWIG_0(int argc, VALUE *argv, VALUE self) {
2439
+ SwigValueWrapper< TagLib::FileName > arg1 ;
2440
+ bool arg2 ;
2441
+ TagLib::Vorbis::Properties::ReadStyle arg3 ;
2442
+ bool val2 ;
2443
+ int ecode2 = 0 ;
2444
+ int val3 ;
2445
+ int ecode3 = 0 ;
2446
+ TagLib::Vorbis::File *result = 0 ;
2447
+
2448
+ if ((argc < 3) || (argc > 3)) {
2449
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
2450
+ }
2451
+ {
2452
+ arg1 = ruby_string_to_taglib_filename(argv[0]);
2453
+ }
2454
+ ecode2 = SWIG_AsVal_bool(argv[1], &val2);
2455
+ if (!SWIG_IsOK(ecode2)) {
2456
+ SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "bool","TagLib::Vorbis::File", 2, argv[1] ));
2457
+ }
2458
+ arg2 = static_cast< bool >(val2);
2459
+ ecode3 = SWIG_AsVal_int(argv[2], &val3);
2460
+ if (!SWIG_IsOK(ecode3)) {
2461
+ SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "TagLib::Vorbis::Properties::ReadStyle","TagLib::Vorbis::File", 3, argv[2] ));
2462
+ }
2463
+ arg3 = static_cast< TagLib::Vorbis::Properties::ReadStyle >(val3);
2464
+ result = (TagLib::Vorbis::File *)new TagLib::Vorbis::File(arg1,arg2,arg3);
2465
+ DATA_PTR(self) = result;
2466
+ SWIG_RubyAddTracking(result, self);
2467
+ return self;
2468
+ fail:
2469
+ return Qnil;
2470
+ }
2471
+
2472
+
2473
+ SWIGINTERN VALUE
2474
+ _wrap_new_File__SWIG_1(int argc, VALUE *argv, VALUE self) {
2475
+ SwigValueWrapper< TagLib::FileName > arg1 ;
2476
+ bool arg2 ;
2477
+ bool val2 ;
2478
+ int ecode2 = 0 ;
2479
+ TagLib::Vorbis::File *result = 0 ;
2480
+
2481
+ if ((argc < 2) || (argc > 2)) {
2482
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
2483
+ }
2484
+ {
2485
+ arg1 = ruby_string_to_taglib_filename(argv[0]);
2486
+ }
2487
+ ecode2 = SWIG_AsVal_bool(argv[1], &val2);
2488
+ if (!SWIG_IsOK(ecode2)) {
2489
+ SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "bool","TagLib::Vorbis::File", 2, argv[1] ));
2490
+ }
2491
+ arg2 = static_cast< bool >(val2);
2492
+ result = (TagLib::Vorbis::File *)new TagLib::Vorbis::File(arg1,arg2);
2493
+ DATA_PTR(self) = result;
2494
+ SWIG_RubyAddTracking(result, self);
2495
+ return self;
2496
+ fail:
2497
+ return Qnil;
2498
+ }
2499
+
2500
+
2501
+ #ifdef HAVE_RB_DEFINE_ALLOC_FUNC
2502
+ SWIGINTERN VALUE
2503
+ _wrap_File_allocate(VALUE self) {
2504
+ #else
2505
+ SWIGINTERN VALUE
2506
+ _wrap_File_allocate(int argc, VALUE *argv, VALUE self) {
2507
+ #endif
2508
+
2509
+
2510
+ VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_TagLib__Vorbis__File);
2511
+ #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
2512
+ rb_obj_call_init(vresult, argc, argv);
2513
+ #endif
2514
+ return vresult;
2515
+ }
2516
+
2517
+
2518
+ SWIGINTERN VALUE
2519
+ _wrap_new_File__SWIG_2(int argc, VALUE *argv, VALUE self) {
2520
+ SwigValueWrapper< TagLib::FileName > arg1 ;
2521
+ TagLib::Vorbis::File *result = 0 ;
2522
+
2523
+ if ((argc < 1) || (argc > 1)) {
2524
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2525
+ }
2526
+ {
2527
+ arg1 = ruby_string_to_taglib_filename(argv[0]);
2528
+ }
2529
+ result = (TagLib::Vorbis::File *)new TagLib::Vorbis::File(arg1);
2530
+ DATA_PTR(self) = result;
2531
+ SWIG_RubyAddTracking(result, self);
2532
+ return self;
2533
+ fail:
2534
+ return Qnil;
2535
+ }
2536
+
2537
+
2538
+ SWIGINTERN VALUE _wrap_new_File(int nargs, VALUE *args, VALUE self) {
2539
+ int argc;
2540
+ VALUE argv[3];
2541
+ int ii;
2542
+
2543
+ argc = nargs;
2544
+ if (argc > 3) SWIG_fail;
2545
+ for (ii = 0; (ii < argc); ++ii) {
2546
+ argv[ii] = args[ii];
2547
+ }
2548
+ if (argc == 1) {
2549
+ int _v;
2550
+ int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
2551
+ _v = SWIG_CheckState(res);
2552
+ if (_v) {
2553
+ return _wrap_new_File__SWIG_2(nargs, args, self);
2554
+ }
2555
+ }
2556
+ if (argc == 2) {
2557
+ int _v;
2558
+ int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
2559
+ _v = SWIG_CheckState(res);
2560
+ if (_v) {
2561
+ {
2562
+ int res = SWIG_AsVal_bool(argv[1], NULL);
2563
+ _v = SWIG_CheckState(res);
2564
+ }
2565
+ if (_v) {
2566
+ return _wrap_new_File__SWIG_1(nargs, args, self);
2567
+ }
2568
+ }
2569
+ }
2570
+ if (argc == 3) {
2571
+ int _v;
2572
+ int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
2573
+ _v = SWIG_CheckState(res);
2574
+ if (_v) {
2575
+ {
2576
+ int res = SWIG_AsVal_bool(argv[1], NULL);
2577
+ _v = SWIG_CheckState(res);
2578
+ }
2579
+ if (_v) {
2580
+ {
2581
+ int res = SWIG_AsVal_int(argv[2], NULL);
2582
+ _v = SWIG_CheckState(res);
2583
+ }
2584
+ if (_v) {
2585
+ return _wrap_new_File__SWIG_0(nargs, args, self);
2586
+ }
2587
+ }
2588
+ }
2589
+ }
2590
+
2591
+ fail:
2592
+ Ruby_Format_OverloadedError( argc, 3, "File.new",
2593
+ " File.new(TagLib::FileName file, bool readProperties, TagLib::Vorbis::Properties::ReadStyle propertiesStyle)\n"
2594
+ " File.new(TagLib::FileName file, bool readProperties)\n"
2595
+ " File.new(TagLib::FileName file)\n");
2596
+
2597
+ return Qnil;
2598
+ }
2599
+
2600
+
2601
+ SWIGINTERN VALUE
2602
+ _wrap_File_tag(int argc, VALUE *argv, VALUE self) {
2603
+ TagLib::Vorbis::File *arg1 = (TagLib::Vorbis::File *) 0 ;
2604
+ void *argp1 = 0 ;
2605
+ int res1 = 0 ;
2606
+ TagLib::Ogg::XiphComment *result = 0 ;
2607
+ VALUE vresult = Qnil;
2608
+
2609
+ if ((argc < 0) || (argc > 0)) {
2610
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2611
+ }
2612
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_TagLib__Vorbis__File, 0 | 0 );
2613
+ if (!SWIG_IsOK(res1)) {
2614
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TagLib::Vorbis::File const *","tag", 1, self ));
2615
+ }
2616
+ arg1 = reinterpret_cast< TagLib::Vorbis::File * >(argp1);
2617
+ result = (TagLib::Ogg::XiphComment *)((TagLib::Vorbis::File const *)arg1)->tag();
2618
+ vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_TagLib__Ogg__XiphComment, 0 | 0 );
2619
+ return vresult;
2620
+ fail:
2621
+ return Qnil;
2622
+ }
2623
+
2624
+
2625
+ SWIGINTERN VALUE
2626
+ _wrap_File_audio_properties(int argc, VALUE *argv, VALUE self) {
2627
+ TagLib::Vorbis::File *arg1 = (TagLib::Vorbis::File *) 0 ;
2628
+ void *argp1 = 0 ;
2629
+ int res1 = 0 ;
2630
+ TagLib::Vorbis::Properties *result = 0 ;
2631
+ VALUE vresult = Qnil;
2632
+
2633
+ if ((argc < 0) || (argc > 0)) {
2634
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2635
+ }
2636
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_TagLib__Vorbis__File, 0 | 0 );
2637
+ if (!SWIG_IsOK(res1)) {
2638
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TagLib::Vorbis::File const *","audioProperties", 1, self ));
2639
+ }
2640
+ arg1 = reinterpret_cast< TagLib::Vorbis::File * >(argp1);
2641
+ result = (TagLib::Vorbis::Properties *)((TagLib::Vorbis::File const *)arg1)->audioProperties();
2642
+ vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_TagLib__Vorbis__Properties, 0 | 0 );
2643
+ return vresult;
2644
+ fail:
2645
+ return Qnil;
2646
+ }
2647
+
2648
+
2649
+ SWIGINTERN VALUE
2650
+ _wrap_File_save(int argc, VALUE *argv, VALUE self) {
2651
+ TagLib::Vorbis::File *arg1 = (TagLib::Vorbis::File *) 0 ;
2652
+ void *argp1 = 0 ;
2653
+ int res1 = 0 ;
2654
+ bool result;
2655
+ VALUE vresult = Qnil;
2656
+
2657
+ if ((argc < 0) || (argc > 0)) {
2658
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2659
+ }
2660
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_TagLib__Vorbis__File, 0 | 0 );
2661
+ if (!SWIG_IsOK(res1)) {
2662
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TagLib::Vorbis::File *","save", 1, self ));
2663
+ }
2664
+ arg1 = reinterpret_cast< TagLib::Vorbis::File * >(argp1);
2665
+ result = (bool)(arg1)->save();
2666
+ vresult = SWIG_From_bool(static_cast< bool >(result));
2667
+ return vresult;
2668
+ fail:
2669
+ return Qnil;
2670
+ }
2671
+
2672
+
2673
+ SWIGINTERN VALUE
2674
+ _wrap_File_close(int argc, VALUE *argv, VALUE self) {
2675
+ TagLib::Vorbis::File *arg1 = (TagLib::Vorbis::File *) 0 ;
2676
+ void *argp1 = 0 ;
2677
+ int res1 = 0 ;
2678
+
2679
+ if ((argc < 0) || (argc > 0)) {
2680
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2681
+ }
2682
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_TagLib__Vorbis__File, 0 | 0 );
2683
+ if (!SWIG_IsOK(res1)) {
2684
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TagLib::Vorbis::File *","close", 1, self ));
2685
+ }
2686
+ arg1 = reinterpret_cast< TagLib::Vorbis::File * >(argp1);
2687
+ TagLib_Vorbis_File_close(arg1);
2688
+ return Qnil;
2689
+ fail:
2690
+ return Qnil;
2691
+ }
2692
+
2693
+
2694
+
2695
+ /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
2696
+
2697
+ static void *_p_TagLib__Vorbis__PropertiesTo_p_TagLib__AudioProperties(void *x, int *SWIGUNUSEDPARM(newmemory)) {
2698
+ return (void *)((TagLib::AudioProperties *) ((TagLib::Vorbis::Properties *) x));
2699
+ }
2700
+ static void *_p_TagLib__Vorbis__FileTo_p_TagLib__Ogg__File(void *x, int *SWIGUNUSEDPARM(newmemory)) {
2701
+ return (void *)((TagLib::Ogg::File *) ((TagLib::Vorbis::File *) x));
2702
+ }
2703
+ static void *_p_TagLib__Ogg__FileTo_p_TagLib__File(void *x, int *SWIGUNUSEDPARM(newmemory)) {
2704
+ return (void *)((TagLib::File *) ((TagLib::Ogg::File *) x));
2705
+ }
2706
+ static void *_p_TagLib__Vorbis__FileTo_p_TagLib__File(void *x, int *SWIGUNUSEDPARM(newmemory)) {
2707
+ return (void *)((TagLib::File *) (TagLib::Ogg::File *) ((TagLib::Vorbis::File *) x));
2708
+ }
2709
+ 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};
2710
+ static swig_type_info _swigt__p_TagLib__AudioProperties = {"_p_TagLib__AudioProperties", "TagLib::AudioProperties *|TagLib::Ogg::Vorbis::AudioProperties *", 0, 0, (void*)0, 0};
2711
+ static swig_type_info _swigt__p_TagLib__File = {"_p_TagLib__File", "TagLib::File *", 0, 0, (void*)0, 0};
2712
+ static swig_type_info _swigt__p_TagLib__Ogg__File = {"_p_TagLib__Ogg__File", "TagLib::Ogg::File *", 0, 0, (void*)0, 0};
2713
+ static swig_type_info _swigt__p_TagLib__Ogg__XiphComment = {"_p_TagLib__Ogg__XiphComment", "TagLib::Ogg::XiphComment *", 0, 0, (void*)0, 0};
2714
+ 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};
2715
+ static swig_type_info _swigt__p_TagLib__Vorbis__Properties = {"_p_TagLib__Vorbis__Properties", "TagLib::Vorbis::Properties *", 0, 0, (void*)0, 0};
2716
+ static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
2717
+ static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "TagLib::uchar *|unsigned char *", 0, 0, (void*)0, 0};
2718
+ static swig_type_info _swigt__p_unsigned_int = {"_p_unsigned_int", "unsigned int *|TagLib::uint *", 0, 0, (void*)0, 0};
2719
+ static swig_type_info _swigt__p_unsigned_long = {"_p_unsigned_long", "TagLib::ulong *|unsigned long *", 0, 0, (void*)0, 0};
2720
+ static swig_type_info _swigt__p_wchar_t = {"_p_wchar_t", "TagLib::wchar *|wchar_t *", 0, 0, (void*)0, 0};
2721
+
2722
+ static swig_type_info *swig_type_initial[] = {
2723
+ &_swigt__p_MapT_TagLib__String_TagLib__StringList_t,
2724
+ &_swigt__p_TagLib__AudioProperties,
2725
+ &_swigt__p_TagLib__File,
2726
+ &_swigt__p_TagLib__Ogg__File,
2727
+ &_swigt__p_TagLib__Ogg__XiphComment,
2728
+ &_swigt__p_TagLib__Vorbis__File,
2729
+ &_swigt__p_TagLib__Vorbis__Properties,
2730
+ &_swigt__p_char,
2731
+ &_swigt__p_unsigned_char,
2732
+ &_swigt__p_unsigned_int,
2733
+ &_swigt__p_unsigned_long,
2734
+ &_swigt__p_wchar_t,
2735
+ };
2736
+
2737
+ 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}};
2738
+ 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}};
2739
+ 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}};
2740
+ 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}};
2741
+ static swig_cast_info _swigc__p_TagLib__Ogg__XiphComment[] = { {&_swigt__p_TagLib__Ogg__XiphComment, 0, 0, 0},{0, 0, 0, 0}};
2742
+ static swig_cast_info _swigc__p_TagLib__Vorbis__File[] = { {&_swigt__p_TagLib__Vorbis__File, 0, 0, 0},{0, 0, 0, 0}};
2743
+ static swig_cast_info _swigc__p_TagLib__Vorbis__Properties[] = { {&_swigt__p_TagLib__Vorbis__Properties, 0, 0, 0},{0, 0, 0, 0}};
2744
+ static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
2745
+ static swig_cast_info _swigc__p_unsigned_char[] = { {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}};
2746
+ static swig_cast_info _swigc__p_unsigned_int[] = { {&_swigt__p_unsigned_int, 0, 0, 0},{0, 0, 0, 0}};
2747
+ static swig_cast_info _swigc__p_unsigned_long[] = { {&_swigt__p_unsigned_long, 0, 0, 0},{0, 0, 0, 0}};
2748
+ static swig_cast_info _swigc__p_wchar_t[] = { {&_swigt__p_wchar_t, 0, 0, 0},{0, 0, 0, 0}};
2749
+
2750
+ static swig_cast_info *swig_cast_initial[] = {
2751
+ _swigc__p_MapT_TagLib__String_TagLib__StringList_t,
2752
+ _swigc__p_TagLib__AudioProperties,
2753
+ _swigc__p_TagLib__File,
2754
+ _swigc__p_TagLib__Ogg__File,
2755
+ _swigc__p_TagLib__Ogg__XiphComment,
2756
+ _swigc__p_TagLib__Vorbis__File,
2757
+ _swigc__p_TagLib__Vorbis__Properties,
2758
+ _swigc__p_char,
2759
+ _swigc__p_unsigned_char,
2760
+ _swigc__p_unsigned_int,
2761
+ _swigc__p_unsigned_long,
2762
+ _swigc__p_wchar_t,
2763
+ };
2764
+
2765
+
2766
+ /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
2767
+
2768
+ /* -----------------------------------------------------------------------------
2769
+ * Type initialization:
2770
+ * This problem is tough by the requirement that no dynamic
2771
+ * memory is used. Also, since swig_type_info structures store pointers to
2772
+ * swig_cast_info structures and swig_cast_info structures store pointers back
2773
+ * to swig_type_info structures, we need some lookup code at initialization.
2774
+ * The idea is that swig generates all the structures that are needed.
2775
+ * The runtime then collects these partially filled structures.
2776
+ * The SWIG_InitializeModule function takes these initial arrays out of
2777
+ * swig_module, and does all the lookup, filling in the swig_module.types
2778
+ * array with the correct data and linking the correct swig_cast_info
2779
+ * structures together.
2780
+ *
2781
+ * The generated swig_type_info structures are assigned staticly to an initial
2782
+ * array. We just loop through that array, and handle each type individually.
2783
+ * First we lookup if this type has been already loaded, and if so, use the
2784
+ * loaded structure instead of the generated one. Then we have to fill in the
2785
+ * cast linked list. The cast data is initially stored in something like a
2786
+ * two-dimensional array. Each row corresponds to a type (there are the same
2787
+ * number of rows as there are in the swig_type_initial array). Each entry in
2788
+ * a column is one of the swig_cast_info structures for that type.
2789
+ * The cast_initial array is actually an array of arrays, because each row has
2790
+ * a variable number of columns. So to actually build the cast linked list,
2791
+ * we find the array of casts associated with the type, and loop through it
2792
+ * adding the casts to the list. The one last trick we need to do is making
2793
+ * sure the type pointer in the swig_cast_info struct is correct.
2794
+ *
2795
+ * First off, we lookup the cast->type name to see if it is already loaded.
2796
+ * There are three cases to handle:
2797
+ * 1) If the cast->type has already been loaded AND the type we are adding
2798
+ * casting info to has not been loaded (it is in this module), THEN we
2799
+ * replace the cast->type pointer with the type pointer that has already
2800
+ * been loaded.
2801
+ * 2) If BOTH types (the one we are adding casting info to, and the
2802
+ * cast->type) are loaded, THEN the cast info has already been loaded by
2803
+ * the previous module so we just ignore it.
2804
+ * 3) Finally, if cast->type has not already been loaded, then we add that
2805
+ * swig_cast_info to the linked list (because the cast->type) pointer will
2806
+ * be correct.
2807
+ * ----------------------------------------------------------------------------- */
2808
+
2809
+ #ifdef __cplusplus
2810
+ extern "C" {
2811
+ #if 0
2812
+ } /* c-mode */
2813
+ #endif
2814
+ #endif
2815
+
2816
+ #if 0
2817
+ #define SWIGRUNTIME_DEBUG
2818
+ #endif
2819
+
2820
+
2821
+ SWIGRUNTIME void
2822
+ SWIG_InitializeModule(void *clientdata) {
2823
+ size_t i;
2824
+ swig_module_info *module_head, *iter;
2825
+ int found, init;
2826
+
2827
+ clientdata = clientdata;
2828
+
2829
+ /* check to see if the circular list has been setup, if not, set it up */
2830
+ if (swig_module.next==0) {
2831
+ /* Initialize the swig_module */
2832
+ swig_module.type_initial = swig_type_initial;
2833
+ swig_module.cast_initial = swig_cast_initial;
2834
+ swig_module.next = &swig_module;
2835
+ init = 1;
2836
+ } else {
2837
+ init = 0;
2838
+ }
2839
+
2840
+ /* Try and load any already created modules */
2841
+ module_head = SWIG_GetModule(clientdata);
2842
+ if (!module_head) {
2843
+ /* This is the first module loaded for this interpreter */
2844
+ /* so set the swig module into the interpreter */
2845
+ SWIG_SetModule(clientdata, &swig_module);
2846
+ module_head = &swig_module;
2847
+ } else {
2848
+ /* the interpreter has loaded a SWIG module, but has it loaded this one? */
2849
+ found=0;
2850
+ iter=module_head;
2851
+ do {
2852
+ if (iter==&swig_module) {
2853
+ found=1;
2854
+ break;
2855
+ }
2856
+ iter=iter->next;
2857
+ } while (iter!= module_head);
2858
+
2859
+ /* if the is found in the list, then all is done and we may leave */
2860
+ if (found) return;
2861
+ /* otherwise we must add out module into the list */
2862
+ swig_module.next = module_head->next;
2863
+ module_head->next = &swig_module;
2864
+ }
2865
+
2866
+ /* When multiple interpeters are used, a module could have already been initialized in
2867
+ a different interpreter, but not yet have a pointer in this interpreter.
2868
+ In this case, we do not want to continue adding types... everything should be
2869
+ set up already */
2870
+ if (init == 0) return;
2871
+
2872
+ /* Now work on filling in swig_module.types */
2873
+ #ifdef SWIGRUNTIME_DEBUG
2874
+ printf("SWIG_InitializeModule: size %d\n", swig_module.size);
2875
+ #endif
2876
+ for (i = 0; i < swig_module.size; ++i) {
2877
+ swig_type_info *type = 0;
2878
+ swig_type_info *ret;
2879
+ swig_cast_info *cast;
2880
+
2881
+ #ifdef SWIGRUNTIME_DEBUG
2882
+ printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
2883
+ #endif
2884
+
2885
+ /* if there is another module already loaded */
2886
+ if (swig_module.next != &swig_module) {
2887
+ type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
2888
+ }
2889
+ if (type) {
2890
+ /* Overwrite clientdata field */
2891
+ #ifdef SWIGRUNTIME_DEBUG
2892
+ printf("SWIG_InitializeModule: found type %s\n", type->name);
2893
+ #endif
2894
+ if (swig_module.type_initial[i]->clientdata) {
2895
+ type->clientdata = swig_module.type_initial[i]->clientdata;
2896
+ #ifdef SWIGRUNTIME_DEBUG
2897
+ printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
2898
+ #endif
2899
+ }
2900
+ } else {
2901
+ type = swig_module.type_initial[i];
2902
+ }
2903
+
2904
+ /* Insert casting types */
2905
+ cast = swig_module.cast_initial[i];
2906
+ while (cast->type) {
2907
+
2908
+ /* Don't need to add information already in the list */
2909
+ ret = 0;
2910
+ #ifdef SWIGRUNTIME_DEBUG
2911
+ printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
2912
+ #endif
2913
+ if (swig_module.next != &swig_module) {
2914
+ ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
2915
+ #ifdef SWIGRUNTIME_DEBUG
2916
+ if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
2917
+ #endif
2918
+ }
2919
+ if (ret) {
2920
+ if (type == swig_module.type_initial[i]) {
2921
+ #ifdef SWIGRUNTIME_DEBUG
2922
+ printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
2923
+ #endif
2924
+ cast->type = ret;
2925
+ ret = 0;
2926
+ } else {
2927
+ /* Check for casting already in the list */
2928
+ swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
2929
+ #ifdef SWIGRUNTIME_DEBUG
2930
+ if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
2931
+ #endif
2932
+ if (!ocast) ret = 0;
2933
+ }
2934
+ }
2935
+
2936
+ if (!ret) {
2937
+ #ifdef SWIGRUNTIME_DEBUG
2938
+ printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
2939
+ #endif
2940
+ if (type->cast) {
2941
+ type->cast->prev = cast;
2942
+ cast->next = type->cast;
2943
+ }
2944
+ type->cast = cast;
2945
+ }
2946
+ cast++;
2947
+ }
2948
+ /* Set entry in modules->types array equal to the type */
2949
+ swig_module.types[i] = type;
2950
+ }
2951
+ swig_module.types[i] = 0;
2952
+
2953
+ #ifdef SWIGRUNTIME_DEBUG
2954
+ printf("**** SWIG_InitializeModule: Cast List ******\n");
2955
+ for (i = 0; i < swig_module.size; ++i) {
2956
+ int j = 0;
2957
+ swig_cast_info *cast = swig_module.cast_initial[i];
2958
+ printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
2959
+ while (cast->type) {
2960
+ printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
2961
+ cast++;
2962
+ ++j;
2963
+ }
2964
+ printf("---- Total casts: %d\n",j);
2965
+ }
2966
+ printf("**** SWIG_InitializeModule: Cast List ******\n");
2967
+ #endif
2968
+ }
2969
+
2970
+ /* This function will propagate the clientdata field of type to
2971
+ * any new swig_type_info structures that have been added into the list
2972
+ * of equivalent types. It is like calling
2973
+ * SWIG_TypeClientData(type, clientdata) a second time.
2974
+ */
2975
+ SWIGRUNTIME void
2976
+ SWIG_PropagateClientData(void) {
2977
+ size_t i;
2978
+ swig_cast_info *equiv;
2979
+ static int init_run = 0;
2980
+
2981
+ if (init_run) return;
2982
+ init_run = 1;
2983
+
2984
+ for (i = 0; i < swig_module.size; i++) {
2985
+ if (swig_module.types[i]->clientdata) {
2986
+ equiv = swig_module.types[i]->cast;
2987
+ while (equiv) {
2988
+ if (!equiv->converter) {
2989
+ if (equiv->type && !equiv->type->clientdata)
2990
+ SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
2991
+ }
2992
+ equiv = equiv->next;
2993
+ }
2994
+ }
2995
+ }
2996
+ }
2997
+
2998
+ #ifdef __cplusplus
2999
+ #if 0
3000
+ { /* c-mode */
3001
+ #endif
3002
+ }
3003
+ #endif
3004
+
3005
+ /*
3006
+
3007
+ */
3008
+ #ifdef __cplusplus
3009
+ extern "C"
3010
+ #endif
3011
+ SWIGEXPORT void Init_taglib_vorbis(void) {
3012
+ size_t i;
3013
+
3014
+ SWIG_InitRuntime();
3015
+ mVorbis = rb_define_module("TagLib");
3016
+ mVorbis = rb_define_module_under(mVorbis, "Ogg");
3017
+ mVorbis = rb_define_module_under(mVorbis, "Vorbis");
3018
+
3019
+ SWIG_InitializeModule(0);
3020
+ for (i = 0; i < swig_module.size; i++) {
3021
+ SWIG_define_class(swig_module.types[i]);
3022
+ }
3023
+
3024
+ SWIG_RubyInitializeTrackings();
3025
+ rb_require("taglib_ogg");
3026
+ rb_require("taglib_base");
3027
+
3028
+ SwigClassProperties.klass = rb_define_class_under(mVorbis, "Properties", ((swig_class *) SWIGTYPE_p_TagLib__AudioProperties->clientdata)->klass);
3029
+ SWIG_TypeClientData(SWIGTYPE_p_TagLib__Vorbis__Properties, (void *) &SwigClassProperties);
3030
+ rb_define_alloc_func(SwigClassProperties.klass, _wrap_Properties_allocate);
3031
+ rb_define_method(SwigClassProperties.klass, "initialize", VALUEFUNC(_wrap_new_Properties), -1);
3032
+ rb_define_method(SwigClassProperties.klass, "length", VALUEFUNC(_wrap_Properties_length), -1);
3033
+ rb_define_method(SwigClassProperties.klass, "bitrate", VALUEFUNC(_wrap_Properties_bitrate), -1);
3034
+ rb_define_method(SwigClassProperties.klass, "sample_rate", VALUEFUNC(_wrap_Properties_sample_rate), -1);
3035
+ rb_define_method(SwigClassProperties.klass, "channels", VALUEFUNC(_wrap_Properties_channels), -1);
3036
+ rb_define_method(SwigClassProperties.klass, "vorbis_version", VALUEFUNC(_wrap_Properties_vorbis_version), -1);
3037
+ rb_define_method(SwigClassProperties.klass, "bitrate_maximum", VALUEFUNC(_wrap_Properties_bitrate_maximum), -1);
3038
+ rb_define_method(SwigClassProperties.klass, "bitrate_nominal", VALUEFUNC(_wrap_Properties_bitrate_nominal), -1);
3039
+ rb_define_method(SwigClassProperties.klass, "bitrate_minimum", VALUEFUNC(_wrap_Properties_bitrate_minimum), -1);
3040
+ SwigClassProperties.mark = 0;
3041
+ SwigClassProperties.destroy = (void (*)(void *)) free_TagLib_Vorbis_Properties;
3042
+ SwigClassProperties.trackObjects = 1;
3043
+
3044
+ SwigClassFile.klass = rb_define_class_under(mVorbis, "File", ((swig_class *) SWIGTYPE_p_TagLib__Ogg__File->clientdata)->klass);
3045
+ SWIG_TypeClientData(SWIGTYPE_p_TagLib__Vorbis__File, (void *) &SwigClassFile);
3046
+ rb_define_alloc_func(SwigClassFile.klass, _wrap_File_allocate);
3047
+ rb_define_method(SwigClassFile.klass, "initialize", VALUEFUNC(_wrap_new_File), -1);
3048
+ rb_define_method(SwigClassFile.klass, "tag", VALUEFUNC(_wrap_File_tag), -1);
3049
+ rb_define_method(SwigClassFile.klass, "audio_properties", VALUEFUNC(_wrap_File_audio_properties), -1);
3050
+ rb_define_method(SwigClassFile.klass, "save", VALUEFUNC(_wrap_File_save), -1);
3051
+ rb_define_method(SwigClassFile.klass, "close", VALUEFUNC(_wrap_File_close), -1);
3052
+ SwigClassFile.mark = 0;
3053
+ SwigClassFile.destroy = (void (*)(void *)) free_taglib_vorbis_file;
3054
+ SwigClassFile.trackObjects = 1;
3055
+ }
3056
+