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