taglib-ruby 0.6.0 → 1.1.0

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