summaryrefslogtreecommitdiff
path: root/share/swig/2.0.11/ruby
diff options
context:
space:
mode:
Diffstat (limited to 'share/swig/2.0.11/ruby')
-rw-r--r--share/swig/2.0.11/ruby/Makefile.swig42
-rw-r--r--share/swig/2.0.11/ruby/argcargv.i48
-rw-r--r--share/swig/2.0.11/ruby/attribute.i1
-rw-r--r--share/swig/2.0.11/ruby/carrays.i6
-rw-r--r--share/swig/2.0.11/ruby/cdata.i1
-rw-r--r--share/swig/2.0.11/ruby/cmalloc.i1
-rw-r--r--share/swig/2.0.11/ruby/cni.i2
-rw-r--r--share/swig/2.0.11/ruby/cpointer.i1
-rw-r--r--share/swig/2.0.11/ruby/cstring.i1
-rw-r--r--share/swig/2.0.11/ruby/director.swg381
-rw-r--r--share/swig/2.0.11/ruby/embed.i16
-rw-r--r--share/swig/2.0.11/ruby/exception.i5
-rw-r--r--share/swig/2.0.11/ruby/extconf.rb9
-rw-r--r--share/swig/2.0.11/ruby/factory.i1
-rw-r--r--share/swig/2.0.11/ruby/file.i39
-rw-r--r--share/swig/2.0.11/ruby/jstring.i44
-rw-r--r--share/swig/2.0.11/ruby/progargcargv.i34
-rw-r--r--share/swig/2.0.11/ruby/ruby.swg72
-rw-r--r--share/swig/2.0.11/ruby/rubyapi.swg36
-rw-r--r--share/swig/2.0.11/ruby/rubyautodoc.swg105
-rw-r--r--share/swig/2.0.11/ruby/rubyclasses.swg404
-rw-r--r--share/swig/2.0.11/ruby/rubycomplex.swg148
-rw-r--r--share/swig/2.0.11/ruby/rubycontainer.swg1096
-rw-r--r--share/swig/2.0.11/ruby/rubycontainer_extended.swg134
-rw-r--r--share/swig/2.0.11/ruby/rubydef.swg1
-rw-r--r--share/swig/2.0.11/ruby/rubyerrors.swg154
-rw-r--r--share/swig/2.0.11/ruby/rubyfragments.swg23
-rw-r--r--share/swig/2.0.11/ruby/rubyhead.swg157
-rw-r--r--share/swig/2.0.11/ruby/rubyinit.swg1
-rw-r--r--share/swig/2.0.11/ruby/rubyiterators.swg932
-rw-r--r--share/swig/2.0.11/ruby/rubykw.swg72
-rw-r--r--share/swig/2.0.11/ruby/rubymacros.swg13
-rw-r--r--share/swig/2.0.11/ruby/rubyopers.swg55
-rw-r--r--share/swig/2.0.11/ruby/rubyprimtypes.swg216
-rw-r--r--share/swig/2.0.11/ruby/rubyrun.swg441
-rw-r--r--share/swig/2.0.11/ruby/rubyruntime.swg9
-rw-r--r--share/swig/2.0.11/ruby/rubystdautodoc.swg33
-rw-r--r--share/swig/2.0.11/ruby/rubystdcommon.swg202
-rw-r--r--share/swig/2.0.11/ruby/rubystdfunctors.swg162
-rw-r--r--share/swig/2.0.11/ruby/rubystrings.swg57
-rw-r--r--share/swig/2.0.11/ruby/rubytracking.swg157
-rw-r--r--share/swig/2.0.11/ruby/rubytypemaps.swg62
-rw-r--r--share/swig/2.0.11/ruby/rubyuserdir.swg20
-rw-r--r--share/swig/2.0.11/ruby/rubywstrings.swg72
-rw-r--r--share/swig/2.0.11/ruby/std_alloc.i1
-rw-r--r--share/swig/2.0.11/ruby/std_basic_string.i97
-rw-r--r--share/swig/2.0.11/ruby/std_char_traits.i1
-rw-r--r--share/swig/2.0.11/ruby/std_common.i74
-rw-r--r--share/swig/2.0.11/ruby/std_complex.i22
-rw-r--r--share/swig/2.0.11/ruby/std_container.i2
-rw-r--r--share/swig/2.0.11/ruby/std_deque.i30
-rw-r--r--share/swig/2.0.11/ruby/std_except.i1
-rw-r--r--share/swig/2.0.11/ruby/std_functors.i29
-rw-r--r--share/swig/2.0.11/ruby/std_ios.i14
-rw-r--r--share/swig/2.0.11/ruby/std_iostream.i12
-rw-r--r--share/swig/2.0.11/ruby/std_list.i41
-rw-r--r--share/swig/2.0.11/ruby/std_map.i423
-rw-r--r--share/swig/2.0.11/ruby/std_multimap.i227
-rw-r--r--share/swig/2.0.11/ruby/std_multiset.i50
-rw-r--r--share/swig/2.0.11/ruby/std_pair.i206
-rw-r--r--share/swig/2.0.11/ruby/std_queue.i33
-rw-r--r--share/swig/2.0.11/ruby/std_set.i231
-rw-r--r--share/swig/2.0.11/ruby/std_sstream.i2
-rw-r--r--share/swig/2.0.11/ruby/std_stack.i35
-rw-r--r--share/swig/2.0.11/ruby/std_streambuf.i1
-rw-r--r--share/swig/2.0.11/ruby/std_string.i9
-rw-r--r--share/swig/2.0.11/ruby/std_vector.i52
-rw-r--r--share/swig/2.0.11/ruby/std_vectora.i36
-rw-r--r--share/swig/2.0.11/ruby/std_wstring.i3
-rw-r--r--share/swig/2.0.11/ruby/stl.i12
-rw-r--r--share/swig/2.0.11/ruby/timeval.i69
-rw-r--r--share/swig/2.0.11/ruby/typemaps.i314
72 files changed, 7493 insertions, 0 deletions
diff --git a/share/swig/2.0.11/ruby/Makefile.swig b/share/swig/2.0.11/ruby/Makefile.swig
new file mode 100644
index 0000000..a7f3ae3
--- /dev/null
+++ b/share/swig/2.0.11/ruby/Makefile.swig
@@ -0,0 +1,42 @@
+# File : Makefile.swig
+# Makefile for a SWIG module. Use this file if you are
+# producing a Ruby extension for general use or distribution.
+#
+# 1. Prepare extconf.rb.
+# 2. Modify this file as appropriate.
+# 3. Type 'make -f Makefile.swig' to generate wrapper code and Makefile.
+# 4. Type 'make' to build your extension.
+# 5. Type 'make install' to install your extension.
+#
+
+MODULE = yourmodule
+FEATURE = $(MODULE)
+INTERFACE = $(MODULE).i
+RUBY = ruby
+SWIG = swig
+
+# for C extension
+SWIGOPT = -ruby
+WRAPPER = $(MODULE)_wrap.c
+
+## for C++ extension
+#SWIGOPT = -ruby -c++
+#WRAPPER = $(MODULE)_wrap.cc
+
+
+swigall: $(WRAPPER) Makefile
+
+$(WRAPPER): $(INTERFACE)
+ $(SWIG) $(SWIGOPT) -o $@ $(INTERFACE)
+
+Makefile: extconf.rb
+ $(RUBY) extconf.rb
+ @if [ -f Makefile ] ; then\
+ echo "include Makefile.swig" >> Makefile;\
+ fi
+
+swigclean:
+ @if [ -f Makefile ] ; then\
+ make -f Makefile clean;\
+ fi
+ rm -f Makefile $(WRAPPER)
diff --git a/share/swig/2.0.11/ruby/argcargv.i b/share/swig/2.0.11/ruby/argcargv.i
new file mode 100644
index 0000000..fc0bc40
--- /dev/null
+++ b/share/swig/2.0.11/ruby/argcargv.i
@@ -0,0 +1,48 @@
+/* ------------------------------------------------------------
+ * --- Argc & Argv ---
+ * ------------------------------------------------------------ */
+
+/* ------------------------------------------------------------
+
+ Use it as follow:
+
+ %apply (int ARGC, char **ARGV) { (size_t argc, const char **argv) }
+
+ %inline %{
+
+ int mainApp(size_t argc, const char **argv)
+ {
+ return argc;
+ }
+
+ then in the ruby side:
+
+ args = ["asdf", "asdf2"]
+ mainApp(args);
+
+ * ------------------------------------------------------------ */
+
+%typemap(in) (int ARGC, char **ARGV) {
+ if (rb_obj_is_kind_of($input,rb_cArray)) {
+ int i;
+ int size = RARRAY_LEN($input);
+ $1 = ($1_ltype) size;
+ $2 = (char **) malloc((size+1)*sizeof(char *));
+ VALUE *ptr = RARRAY_PTR($input);
+ for (i=0; i < size; i++, ptr++) {
+ $2[i]= StringValuePtr(*ptr);
+ }
+ $2[i]=NULL;
+ } else {
+ $1 = 0; $2 = 0;
+ %argument_fail(SWIG_TypeError, "int ARGC, char **ARGV", $symname, $argnum);
+ }
+}
+
+%typemap(typecheck, precedence=SWIG_TYPECHECK_STRING_ARRAY) (int ARGC, char **ARGV) {
+ $1 = rb_obj_is_kind_of($input,rb_cArray);
+}
+
+%typemap(freearg) (int ARGC, char **ARGV) {
+ free((char *) $2);
+}
diff --git a/share/swig/2.0.11/ruby/attribute.i b/share/swig/2.0.11/ruby/attribute.i
new file mode 100644
index 0000000..779716c
--- /dev/null
+++ b/share/swig/2.0.11/ruby/attribute.i
@@ -0,0 +1 @@
+%include <typemaps/attribute.swg>
diff --git a/share/swig/2.0.11/ruby/carrays.i b/share/swig/2.0.11/ruby/carrays.i
new file mode 100644
index 0000000..8f74cd9
--- /dev/null
+++ b/share/swig/2.0.11/ruby/carrays.i
@@ -0,0 +1,6 @@
+%define %array_class(TYPE,NAME)
+ %array_class_wrap(TYPE,NAME,__getitem__,__setitem__)
+%enddef
+
+%include <typemaps/carrays.swg>
+
diff --git a/share/swig/2.0.11/ruby/cdata.i b/share/swig/2.0.11/ruby/cdata.i
new file mode 100644
index 0000000..3679659
--- /dev/null
+++ b/share/swig/2.0.11/ruby/cdata.i
@@ -0,0 +1 @@
+%include <typemaps/cdata.swg>
diff --git a/share/swig/2.0.11/ruby/cmalloc.i b/share/swig/2.0.11/ruby/cmalloc.i
new file mode 100644
index 0000000..248f06b
--- /dev/null
+++ b/share/swig/2.0.11/ruby/cmalloc.i
@@ -0,0 +1 @@
+%include <typemaps/cmalloc.swg>
diff --git a/share/swig/2.0.11/ruby/cni.i b/share/swig/2.0.11/ruby/cni.i
new file mode 100644
index 0000000..10a1403
--- /dev/null
+++ b/share/swig/2.0.11/ruby/cni.i
@@ -0,0 +1,2 @@
+%include <gcj/cni.i>
+%include <jstring.i>
diff --git a/share/swig/2.0.11/ruby/cpointer.i b/share/swig/2.0.11/ruby/cpointer.i
new file mode 100644
index 0000000..d824792
--- /dev/null
+++ b/share/swig/2.0.11/ruby/cpointer.i
@@ -0,0 +1 @@
+%include <typemaps/cpointer.swg>
diff --git a/share/swig/2.0.11/ruby/cstring.i b/share/swig/2.0.11/ruby/cstring.i
new file mode 100644
index 0000000..ede9c59
--- /dev/null
+++ b/share/swig/2.0.11/ruby/cstring.i
@@ -0,0 +1 @@
+%include <typemaps/cstring.swg>
diff --git a/share/swig/2.0.11/ruby/director.swg b/share/swig/2.0.11/ruby/director.swg
new file mode 100644
index 0000000..a5daf21
--- /dev/null
+++ b/share/swig/2.0.11/ruby/director.swg
@@ -0,0 +1,381 @@
+/* -----------------------------------------------------------------------------
+ * director.swg
+ *
+ * This file contains support for director classes that proxy
+ * method calls from C++ to Ruby extensions.
+ * ----------------------------------------------------------------------------- */
+
+/*
+ Use -DSWIG_DIRECTOR_NOUEH if you prefer to avoid the use of the
+ Undefined Exception Handler provided by swig.
+*/
+#ifndef SWIG_DIRECTOR_NOUEH
+#ifndef SWIG_DIRECTOR_UEH
+#define SWIG_DIRECTOR_UEH
+#endif
+#endif
+
+#ifdef __cplusplus
+
+#include <string>
+#include <iostream>
+#include <map>
+
+# define SWIG_DIRECTOR_CAST(ARG) dynamic_cast<Swig::Director *>(ARG)
+
+namespace Swig {
+ /* memory handler */
+ struct GCItem
+ {
+ virtual ~GCItem()
+ {
+ }
+
+ virtual ruby_owntype get_own() const
+ {
+ return 0;
+ }
+ };
+
+ struct GCItem_var
+ {
+ GCItem_var(GCItem *item = 0) : _item(item)
+ {
+ }
+
+ GCItem_var& operator=(GCItem *item)
+ {
+ GCItem *tmp = _item;
+ _item = item;
+ delete tmp;
+ return *this;
+ }
+
+ ~GCItem_var()
+ {
+ delete _item;
+ }
+
+ GCItem * operator->() const
+ {
+ return _item;
+ }
+
+ private:
+ GCItem *_item;
+ };
+
+
+ template <typename Type>
+ struct GCItem_T : GCItem
+ {
+ GCItem_T(Type *ptr) : _ptr(ptr)
+ {
+ }
+
+ virtual ~GCItem_T()
+ {
+ delete _ptr;
+ }
+
+ private:
+ Type *_ptr;
+ };
+
+ struct GCItem_Object : GCItem
+ {
+ GCItem_Object(ruby_owntype own) : _own(own)
+ {
+ }
+
+ virtual ~GCItem_Object()
+ {
+ }
+
+ ruby_owntype get_own() const
+ {
+ return _own;
+ }
+
+ private:
+ ruby_owntype _own;
+ };
+
+
+ template <typename Type>
+ struct GCArray_T : GCItem
+ {
+ GCArray_T(Type *ptr) : _ptr(ptr)
+ {
+ }
+
+ virtual ~GCArray_T()
+ {
+ delete[] _ptr;
+ }
+
+ private:
+ Type *_ptr;
+ };
+
+
+ /* body args */
+ struct body_args {
+ VALUE recv;
+ ID id;
+ int argc;
+ VALUE *argv;
+ };
+
+ /* Base class for director exceptions */
+ class DirectorException {
+ protected:
+ VALUE swig_error;
+ std::string swig_msg;
+ protected:
+ DirectorException(VALUE error)
+ : swig_error(error)
+ {
+ }
+
+ DirectorException(VALUE error, const char* hdr, const char* msg ="")
+ : swig_error(error), swig_msg(hdr) {
+ if (strlen(msg)) {
+ swig_msg += " ";
+ swig_msg += msg;
+ }
+ if (swig_msg.size()) {
+ VALUE str = rb_str_new(swig_msg.data(), swig_msg.size());
+ swig_error = rb_exc_new3(error, str);
+ } else {
+ swig_error = error;
+ }
+ }
+ public:
+ VALUE getType() const {
+ return CLASS_OF(swig_error);
+ }
+ VALUE getError() const {
+ return swig_error;
+ }
+ const std::string& getMessage() const
+ {
+ return swig_msg;
+ }
+
+ virtual ~DirectorException() {}
+ };
+
+ /* unknown exception handler */
+
+ class UnknownExceptionHandler
+ {
+#ifdef SWIG_DIRECTOR_UEH
+ static void handler() {
+ try {
+ throw;
+ } catch (DirectorException& e) {
+ std::cerr << "SWIG Director exception caught:" << std::endl
+ << e.getMessage() << std::endl;
+ } catch (std::exception& e) {
+ std::cerr << "std::exception caught: "<< e.what() << std::endl;
+ } catch (...) {
+ std::cerr << "Unknown exception caught." << std::endl;
+ }
+ std::cerr << std::endl
+ << "Ruby interpreter traceback:" << std::endl;
+ std::cerr << std::endl;
+ std::cerr << "This exception was caught by the SWIG unexpected exception handler." << std::endl
+ << "Try using %feature(\"director:except\") to avoid reaching this point." << std::endl
+ << std::endl
+ << "Exception is being re-thrown, program will like abort/terminate." << std::endl;
+ throw;
+ }
+
+ public:
+ std::unexpected_handler old;
+ UnknownExceptionHandler(std::unexpected_handler nh = handler)
+ {
+ old = std::set_unexpected(nh);
+ }
+
+ ~UnknownExceptionHandler()
+ {
+ std::set_unexpected(old);
+ }
+#endif
+ };
+
+
+ /* Type mismatch in the return value from a Ruby method call */
+ class DirectorTypeMismatchException : public Swig::DirectorException {
+ public:
+ DirectorTypeMismatchException(VALUE error, const char *msg="")
+ : Swig::DirectorException(error, "SWIG director type mismatch", msg)
+ {
+ }
+
+ DirectorTypeMismatchException(const char *msg="")
+ : Swig::DirectorException(rb_eTypeError, "SWIG director type mismatch", msg)
+ {
+ }
+
+ static void raise(VALUE error, const char *msg) {
+ throw DirectorTypeMismatchException(error, msg);
+ }
+
+ static void raise(const char *msg) {
+ throw DirectorTypeMismatchException(msg);
+ }
+ };
+
+ /* Any Ruby exception that occurs during a director method call */
+ class DirectorMethodException : public Swig::DirectorException {
+ public:
+ DirectorMethodException(VALUE error)
+ : Swig::DirectorException(error) {
+ }
+
+ DirectorMethodException(const char* msg = "")
+ : Swig::DirectorException(rb_eRuntimeError, "SWIG director method error.", msg) {
+ }
+
+ static void raise(VALUE error)
+ {
+ throw DirectorMethodException(error);
+ }
+ };
+
+ /* Attempted to call a pure virtual method via a director method */
+ class DirectorPureVirtualException : public Swig::DirectorException
+ {
+ public:
+ DirectorPureVirtualException(const char* msg = "")
+ : DirectorException(rb_eRuntimeError, "SWIG director pure virtual method called", msg)
+ {
+ }
+
+ static void raise(const char *msg)
+ {
+ throw DirectorPureVirtualException(msg);
+ }
+ };
+
+ /* Simple thread abstraction for pthreads on win32 */
+#ifdef __THREAD__
+# define __PTHREAD__
+# if defined(_WIN32) || defined(__WIN32__)
+# define pthread_mutex_lock EnterCriticalSection
+# define pthread_mutex_unlock LeaveCriticalSection
+# define pthread_mutex_t CRITICAL_SECTION
+# define SWIG_MUTEX_INIT(var) var
+# else
+# include <pthread.h>
+# define SWIG_MUTEX_INIT(var) var = PTHREAD_MUTEX_INITIALIZER
+# endif
+#endif
+
+#ifdef __PTHREAD__
+ struct Guard
+ {
+ pthread_mutex_t *_mutex;
+
+ Guard(pthread_mutex_t &mutex) : _mutex(&mutex)
+ {
+ pthread_mutex_lock(_mutex);
+ }
+
+ ~Guard()
+ {
+ pthread_mutex_unlock(_mutex);
+ }
+ };
+# define SWIG_GUARD(mutex) Guard _guard(mutex)
+#else
+# define SWIG_GUARD(mutex)
+#endif
+
+ /* director base class */
+ class Director {
+ private:
+ /* pointer to the wrapped Ruby object */
+ VALUE swig_self;
+ /* flag indicating whether the object is owned by Ruby or c++ */
+ mutable bool swig_disown_flag;
+
+ public:
+ /* wrap a Ruby object, optionally taking ownership */
+ Director(VALUE self) : swig_self(self), swig_disown_flag(false) {
+ }
+
+ /* discard our reference at destruction */
+ virtual ~Director() {
+ }
+
+ /* return a pointer to the wrapped Ruby object */
+ VALUE swig_get_self() const {
+ return swig_self;
+ }
+
+ /* acquire ownership of the wrapped Ruby object (the sense of "disown"
+ * is from Ruby) */
+ void swig_disown() const {
+ if (!swig_disown_flag) {
+ swig_disown_flag = true;
+ }
+ }
+
+ /* ownership management */
+ private:
+ typedef std::map<void*, GCItem_var> swig_ownership_map;
+ mutable swig_ownership_map swig_owner;
+#ifdef __PTHREAD__
+ static pthread_mutex_t swig_mutex_own;
+#endif
+
+ public:
+ template <typename Type>
+ void swig_acquire_ownership_array(Type *vptr) const
+ {
+ if (vptr) {
+ SWIG_GUARD(swig_mutex_own);
+ swig_owner[vptr] = new GCArray_T<Type>(vptr);
+ }
+ }
+
+ template <typename Type>
+ void swig_acquire_ownership(Type *vptr) const
+ {
+ if (vptr) {
+ SWIG_GUARD(swig_mutex_own);
+ swig_owner[vptr] = new GCItem_T<Type>(vptr);
+ }
+ }
+
+ void swig_acquire_ownership_obj(void *vptr, ruby_owntype own) const
+ {
+ if (vptr && own) {
+ SWIG_GUARD(swig_mutex_own);
+ swig_owner[vptr] = new GCItem_Object(own);
+ }
+ }
+
+ ruby_owntype swig_release_ownership(void *vptr) const
+ {
+ ruby_owntype own = 0;
+ if (vptr) {
+ SWIG_GUARD(swig_mutex_own);
+ swig_ownership_map::iterator iter = swig_owner.find(vptr);
+ if (iter != swig_owner.end()) {
+ own = iter->second->get_own();
+ swig_owner.erase(iter);
+ }
+ }
+ return own;
+ }
+ };
+}
+
+#endif /* __cplusplus */
+
+
diff --git a/share/swig/2.0.11/ruby/embed.i b/share/swig/2.0.11/ruby/embed.i
new file mode 100644
index 0000000..9226ef4
--- /dev/null
+++ b/share/swig/2.0.11/ruby/embed.i
@@ -0,0 +1,16 @@
+%wrapper %{
+
+#include <ruby.h>
+
+int
+main(argc, argv)
+ int argc;
+ char **argv;
+{
+ ruby_init();
+ ruby_options(argc, argv);
+ ruby_run();
+ return 0;
+}
+
+%}
diff --git a/share/swig/2.0.11/ruby/exception.i b/share/swig/2.0.11/ruby/exception.i
new file mode 100644
index 0000000..1e80d96
--- /dev/null
+++ b/share/swig/2.0.11/ruby/exception.i
@@ -0,0 +1,5 @@
+%include <typemaps/exception.swg>
+
+%insert("runtime") {
+ %define_as(SWIG_exception(code, msg), %block(%error(code, msg);))
+}
diff --git a/share/swig/2.0.11/ruby/extconf.rb b/share/swig/2.0.11/ruby/extconf.rb
new file mode 100644
index 0000000..3bac8cc
--- /dev/null
+++ b/share/swig/2.0.11/ruby/extconf.rb
@@ -0,0 +1,9 @@
+require 'mkmf'
+
+dir_config('yourlib')
+
+if have_header('yourlib.h') and have_library('yourlib', 'yourlib_init')
+ # If you use swig -c option, you may have to link libswigrb.
+ # have_library('swigrb')
+ create_makefile('yourlib')
+end
diff --git a/share/swig/2.0.11/ruby/factory.i b/share/swig/2.0.11/ruby/factory.i
new file mode 100644
index 0000000..46a0a87
--- /dev/null
+++ b/share/swig/2.0.11/ruby/factory.i
@@ -0,0 +1 @@
+%include <typemaps/factory.swg>
diff --git a/share/swig/2.0.11/ruby/file.i b/share/swig/2.0.11/ruby/file.i
new file mode 100644
index 0000000..d64937e
--- /dev/null
+++ b/share/swig/2.0.11/ruby/file.i
@@ -0,0 +1,39 @@
+// FILE *
+%{
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// Ruby 1.9 changed the file name of this header
+#ifdef HAVE_RUBY_IO_H
+#include "ruby/io.h"
+#else
+#include "rubyio.h"
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+%}
+
+%typemap(in) FILE *READ {
+ OpenFile *of;
+ GetOpenFile($input, of);
+ rb_io_check_readable(of);
+ $1 = GetReadFile(of);
+ rb_read_check($1);
+}
+
+%typemap(in) FILE *READ_NOCHECK {
+ OpenFile *of;
+ GetOpenFile($input, of);
+ rb_io_check_readable(of);
+ $1 = GetReadFile(of);
+}
+
+%typemap(in) FILE *WRITE {
+ OpenFile *of;
+ GetOpenFile($input, of);
+ rb_io_check_writable(of);
+ $1 = GetWriteFile(of);
+}
diff --git a/share/swig/2.0.11/ruby/jstring.i b/share/swig/2.0.11/ruby/jstring.i
new file mode 100644
index 0000000..17efa97
--- /dev/null
+++ b/share/swig/2.0.11/ruby/jstring.i
@@ -0,0 +1,44 @@
+%include <typemaps/valtypes.swg>
+
+%fragment(SWIG_AsVal_frag(jstring),"header") {
+SWIGINTERN int
+SWIG_AsVal(jstring)(VALUE obj, jstring *val)
+{
+ if (NIL_P(obj)){
+ if (val) *val = 0;
+ return SWIG_OK;
+ }
+ if (TYPE(obj) == T_STRING) {
+ if (val) {
+ char *cstr = rb_string_value_ptr(&(obj));
+ jsize len = RSTRING_LEN(obj);
+ *val = JvNewStringLatin1(cstr, len);
+ }
+ return SWIG_NEWOBJ;
+ }
+ return SWIG_TypeError;
+}
+}
+
+%fragment(SWIG_From_frag(jstring),"header") {
+SWIGINTERNINLINE VALUE
+SWIG_From(jstring)(jstring val)
+{
+ if (!val) {
+ return Qnil;
+ } else {
+ jint len = JvGetStringUTFLength(val);
+ char buf[len];
+ JvGetStringUTFRegion(val, 0, len, buf);
+ return rb_str_new(buf,len);
+ }
+}
+}
+
+%typemaps_asvalfrom(%checkcode(STRING),
+ %arg(SWIG_AsVal(jstring)),
+ %arg(SWIG_From(jstring)),
+ %arg(SWIG_AsVal_frag(jstring)),
+ %arg(SWIG_From_frag(jstring)),
+ java::lang::String *);
+
diff --git a/share/swig/2.0.11/ruby/progargcargv.i b/share/swig/2.0.11/ruby/progargcargv.i
new file mode 100644
index 0000000..a2843c3
--- /dev/null
+++ b/share/swig/2.0.11/ruby/progargcargv.i
@@ -0,0 +1,34 @@
+/*
+int PROG_ARGC
+char **PROG_ARGV
+
+ Some C function receive argc and argv from C main function.
+ This typemap provides ignore typemap which pass Ruby ARGV contents
+ as argc and argv to C function.
+*/
+
+
+
+// argc and argv
+%typemap(in,numinputs=0) int PROG_ARGC {
+ $1 = RARRAY_LEN(rb_argv) + 1;
+}
+
+%typemap(in,numinputs=0) char **PROG_ARGV {
+ int i, n;
+ VALUE ary = rb_eval_string("[$0] + ARGV");
+ n = RARRAY_LEN(ary);
+ $1 = (char **)malloc(n + 1);
+ for (i = 0; i < n; i++) {
+ VALUE v = rb_obj_as_string(RARRAY_PTR(ary)[i]);
+ $1[i] = (char *)malloc(RSTRING_LEN(v) + 1);
+ strcpy($1[i], RSTRING_PTR(v));
+ }
+}
+
+%typemap(freearg) char **PROG_ARGV {
+ int i, n = RARRAY_LEN(rb_argv) + 1;
+ for (i = 0; i < n; i++) free($1[i]);
+ free($1);
+}
+
diff --git a/share/swig/2.0.11/ruby/ruby.swg b/share/swig/2.0.11/ruby/ruby.swg
new file mode 100644
index 0000000..efa8ec2
--- /dev/null
+++ b/share/swig/2.0.11/ruby/ruby.swg
@@ -0,0 +1,72 @@
+/* ------------------------------------------------------------
+ * ruby.swg
+ *
+ * Ruby configuration module.
+ * ------------------------------------------------------------ */
+
+/* ------------------------------------------------------------
+ * The Ruby auto rename rules
+ * ------------------------------------------------------------ */
+#if defined(SWIG_RUBY_AUTORENAME)
+/* Class names are CamelCase */
+%rename("%(camelcase)s", %$isclass) "";
+
+/* Constants created by %constant or #define are UPPER_CASE */
+%rename("%(uppercase)s", %$isconstant) "";
+
+/* SWIG only considers static class members with inline intializers
+ to be constants. For examples of what is and isn't considered
+ a constant by SWIG see naming.i in the Ruby test suite. */
+%rename("%(uppercase)s", %$ismember, %$isvariable,%$isimmutable,%$isstatic,%$hasvalue,%$hasconsttype) "";
+
+/* Enums are mapped to constants but all we do is make sure the
+ first letter is uppercase */
+%rename("%(firstuppercase)s", %$isenumitem) "";
+
+/* Method names should be lower_case_with_underscores */
+%rename("%(undercase)s", %$isfunction, %$not %$ismemberget, %$not %$ismemberset) "";
+#endif
+
+/* ------------------------------------------------------------
+ * Inner macros
+ * ------------------------------------------------------------ */
+%include <rubymacros.swg>
+
+
+/* ------------------------------------------------------------
+ * The runtime part
+ * ------------------------------------------------------------ */
+%include <rubyruntime.swg>
+
+/* ------------------------------------------------------------
+ * Special user directives
+ * ------------------------------------------------------------ */
+%include <rubyuserdir.swg>
+
+/* ------------------------------------------------------------
+ * Typemap specializations
+ * ------------------------------------------------------------ */
+%include <rubytypemaps.swg>
+
+/* ------------------------------------------------------------
+ * Overloaded operator support
+ * ------------------------------------------------------------ */
+%include <rubyopers.swg>
+
+/* ------------------------------------------------------------
+ * Warnings for Ruby keywords
+ * ------------------------------------------------------------ */
+%include <rubykw.swg>
+
+/* ------------------------------------------------------------
+ * Documentation for common Ruby methods
+ * ------------------------------------------------------------ */
+%include <rubyautodoc.swg>
+
+/* ------------------------------------------------------------
+ * The Ruby initialization function
+ * ------------------------------------------------------------ */
+%include <rubyinit.swg>
+
+
+
diff --git a/share/swig/2.0.11/ruby/rubyapi.swg b/share/swig/2.0.11/ruby/rubyapi.swg
new file mode 100644
index 0000000..e007757
--- /dev/null
+++ b/share/swig/2.0.11/ruby/rubyapi.swg
@@ -0,0 +1,36 @@
+/* -----------------------------------------------------------------------------
+ * Ruby API portion that goes into the runtime
+ * ----------------------------------------------------------------------------- */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+SWIGINTERN VALUE
+SWIG_Ruby_AppendOutput(VALUE target, VALUE o) {
+ if (NIL_P(target)) {
+ target = o;
+ } else {
+ if (TYPE(target) != T_ARRAY) {
+ VALUE o2 = target;
+ target = rb_ary_new();
+ rb_ary_push(target, o2);
+ }
+ rb_ary_push(target, o);
+ }
+ return target;
+}
+
+/* For ruby1.8.4 and earlier. */
+#ifndef RUBY_INIT_STACK
+ RUBY_EXTERN void Init_stack(VALUE* addr);
+# define RUBY_INIT_STACK \
+ VALUE variable_in_this_stack_frame; \
+ Init_stack(&variable_in_this_stack_frame);
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/share/swig/2.0.11/ruby/rubyautodoc.swg b/share/swig/2.0.11/ruby/rubyautodoc.swg
new file mode 100644
index 0000000..1e6b0d9
--- /dev/null
+++ b/share/swig/2.0.11/ruby/rubyautodoc.swg
@@ -0,0 +1,105 @@
+/* -----------------------------------------------------------------------------
+ * rubyautodoc.swg
+ *
+ * This file implements autodoc typemaps for some common ruby methods.
+ * ----------------------------------------------------------------------------- */
+
+%define AUTODOC(func, str)
+ %feature("autodoc", str) func;
+%enddef
+
+
+AUTODOC(to_i, "Convert $class to an Integer");
+AUTODOC(to_f, "Convert $class to a Float");
+AUTODOC(coerce, "Coerce class to a number");
+AUTODOC(to_a, "Convert $class to an Array");
+AUTODOC(to_s, "Convert class to a String representation");
+AUTODOC(inspect, "Inspect class and its contents");
+
+AUTODOC(at, "Return element at a certain index");
+AUTODOC(__getitem__, "Element accessor/slicing");
+AUTODOC(__setitem__, "Element setter/slicing");
+AUTODOC(slice, "Return a slice (portion of) the $class");
+
+AUTODOC(push, "Add an element at the end of the $class");
+AUTODOC(pop, "Remove and return element at the end of the $class");
+AUTODOC(shift, "Remove and return element at the beginning of the $class");
+AUTODOC(unshift, "Add one or more elements at the beginning of the $class");
+AUTODOC(first, "Return the first element in $class");
+AUTODOC(last, "Return the last element in $class");
+
+
+//
+// Common Object methods
+//
+AUTODOC(hash, "Hashing function for class");
+AUTODOC(dup, "Create a duplicate of the class and unfreeze it if needed");
+AUTODOC(clone, "Create a duplicate of the class");
+
+//
+// Container methods
+//
+AUTODOC(empty, "Check if $class is empty");
+AUTODOC(size, "Size or Length of the $class");
+AUTODOC(insert, "Insert one or more new elements in the $class");
+
+//
+// Iterator methods (block)
+//
+AUTODOC(each, "Iterate thru each element in the $class. A block must be provided");
+AUTODOC(find, "Find an element in the class");
+AUTODOC(each_key, "Iterate thru each key element in the $class. A block must be provided");
+AUTODOC(each_value, "Iterate thru each key element in the $class. A block must be provided");
+AUTODOC(reject, "Iterate thru each element in the $class and reject those that fail a condition returning a new $class. A block must be provided");
+AUTODOC(reject_bang, "Iterate thru each element in the $class and reject those that fail a condition. A block must be provided. $class is modified in place");
+AUTODOC(select, "Iterate thru each element in the $class and select those that match a condition. A block must be provided");
+AUTODOC(delete_at, "Delete an element at a certain index");
+AUTODOC(__delete__, "Delete a matching element");
+
+
+//
+// Hash methods
+//
+AUTODOC(keys, "Return an Array of key elements");
+AUTODOC(values, "Return an Array of value elements");
+AUTODOC(values_at, "Return an Array of value elements matching the conditions");
+
+
+//
+// Operators
+//
+#ifdef __cplusplus
+AUTODOC(operator==, "Equality comparison operator");
+AUTODOC(operator<=, "Lower or equal comparison operator");
+AUTODOC(operator>=, "Higher or equal comparison operator");
+AUTODOC(operator<, "Lower than comparison operator");
+AUTODOC(operator>, "Higher than comparison operator");
+AUTODOC(operator<<, "Left shifting or appending operator");
+AUTODOC(operator>>, "Right shifting operator or extracting operator");
+AUTODOC(operator+, "Add operator");
+AUTODOC(operator-, "Substraction operator");
+AUTODOC(operator+(), "Positive operator");
+AUTODOC(operator-(), "Negation operator");
+AUTODOC(operator&, "AND operator");
+AUTODOC(operator|, "OR operator");
+AUTODOC(operator^, "XOR operator");
+AUTODOC(operator~, "Invert operator");
+#endif
+AUTODOC(__eq__, "Equality comparison operator");
+AUTODOC(__le__, "Lower or equal comparison operator");
+AUTODOC(__ge__, "Higher or equal comparison operator");
+AUTODOC(__lt__, "Lower than comparison operator");
+AUTODOC(__gt__, "Higher than comparison operator");
+AUTODOC(__lshift__, "Left shifting or appending operator");
+AUTODOC(__rshift__, "Right shifting operator or extracting operator");
+AUTODOC(__add___, "Add operator");
+AUTODOC(__sub__, "Substraction operator");
+AUTODOC(__pos__, "Positive operator");
+AUTODOC(__neg__, "Negation operator");
+AUTODOC(__and__, "AND operator");
+AUTODOC(__or__, "OR operator");
+AUTODOC(__xor__, "XOR operator");
+AUTODOC(__negate__, "Invert operator");
+AUTODOC(__pow__, "Exponential operator");
+AUTODOC(__divmod__, "Modulo of division");
+AUTODOC(__cmp__, "Comparison operator. Returns < 0 for less than, 0 for equal or > 1 for higher than.");
diff --git a/share/swig/2.0.11/ruby/rubyclasses.swg b/share/swig/2.0.11/ruby/rubyclasses.swg
new file mode 100644
index 0000000..5537136
--- /dev/null
+++ b/share/swig/2.0.11/ruby/rubyclasses.swg
@@ -0,0 +1,404 @@
+#ifdef __cplusplus
+
+/*
+ GC_VALUE is used as a replacement of Ruby's VALUE.
+ GC_VALUE automatically handles registering and unregistering
+ of the underlying Ruby object with the GC.
+
+ It can be used if you want to create STL containers of VALUEs, such as:
+
+ std::vector< GC_VALUE >;
+
+ or as a member variable:
+
+ struct A {
+ GC_VALUE _obj;
+ A(VALUE o) : _obj(o) {
+ }
+ };
+
+ or as a input/output value (not much use for this, as VALUE works just as
+ well here, thou):
+
+ GC_VALUE func(GC_VALUE obj) {
+ GC_VALUE out = rb_obj_classname(obj);
+ return out;
+ }
+
+
+ GC_VALUE is 'visible' at the wrapped side, so you can do:
+
+ %template(RubyVector) std::vector<swig::GC_VALUE>;
+
+ and all the proper typemaps will be used.
+
+*/
+
+%fragment("GC_VALUE_definition","header") {
+namespace swig {
+ class SwigGCReferences {
+ // Hash of all GC_VALUE's currently in use
+ static SwigGCReferences s_references;
+
+ VALUE _hash;
+
+ SwigGCReferences() : _hash(Qnil) {
+ }
+ ~SwigGCReferences() {
+ if (_hash != Qnil)
+ rb_gc_unregister_address(&_hash);
+ }
+ static void EndProcHandler(VALUE) {
+ // Ruby interpreter ending - _hash can no longer be accessed.
+ s_references._hash = Qnil;
+ }
+ public:
+ static SwigGCReferences& instance() {
+ return s_references;
+ }
+ static void initialize() {
+ if (s_references._hash == Qnil) {
+ rb_set_end_proc(&EndProcHandler, Qnil);
+ s_references._hash = rb_hash_new();
+ rb_gc_register_address(&s_references._hash);
+ }
+ }
+ void GC_register(VALUE& obj) {
+ if (FIXNUM_P(obj) || SPECIAL_CONST_P(obj) || SYMBOL_P(obj))
+ return;
+ if (_hash != Qnil) {
+ VALUE val = rb_hash_aref(_hash, obj);
+ unsigned n = FIXNUM_P(val) ? NUM2UINT(val) : 0;
+ ++n;
+ rb_hash_aset(_hash, obj, INT2NUM(n));
+ }
+ }
+ void GC_unregister(const VALUE& obj) {
+ if (FIXNUM_P(obj) || SPECIAL_CONST_P(obj) || SYMBOL_P(obj))
+ return;
+ // this test should not be needed but I've noticed some very erratic
+ // behavior of none being unregistered in some very rare situations.
+ if (BUILTIN_TYPE(obj) == T_NONE)
+ return;
+ if (_hash != Qnil) {
+ VALUE val = rb_hash_aref(s_references._hash, obj);
+ unsigned n = FIXNUM_P(val) ? NUM2UINT(val) : 1;
+ --n;
+ if (n)
+ rb_hash_aset(s_references._hash, obj, INT2NUM(n));
+ else
+ rb_hash_delete(s_references._hash, obj);
+ }
+ }
+ };
+
+ class GC_VALUE {
+ protected:
+ VALUE _obj;
+
+ static ID hash_id;
+ static ID lt_id;
+ static ID gt_id;
+ static ID eq_id;
+ static ID le_id;
+ static ID ge_id;
+
+ static ID pos_id;
+ static ID neg_id;
+ static ID inv_id;
+
+ static ID add_id;
+ static ID sub_id;
+ static ID mul_id;
+ static ID div_id;
+ static ID mod_id;
+
+ static ID and_id;
+ static ID or_id;
+ static ID xor_id;
+
+ static ID lshift_id;
+ static ID rshift_id;
+
+ struct OpArgs
+ {
+ VALUE src;
+ ID id;
+ int nargs;
+ VALUE target;
+ };
+
+
+ public:
+ GC_VALUE() : _obj(Qnil)
+ {
+ }
+
+ GC_VALUE(const GC_VALUE& item) : _obj(item._obj)
+ {
+ SwigGCReferences::instance().GC_register(_obj);
+ }
+
+ GC_VALUE(VALUE obj) :_obj(obj)
+ {
+ SwigGCReferences::instance().GC_register(_obj);
+ }
+
+ ~GC_VALUE()
+ {
+ SwigGCReferences::instance().GC_unregister(_obj);
+ }
+
+ GC_VALUE & operator=(const GC_VALUE& item)
+ {
+ SwigGCReferences::instance().GC_unregister(_obj);
+ _obj = item._obj;
+ SwigGCReferences::instance().GC_register(_obj);
+ return *this;
+ }
+
+ operator VALUE() const
+ {
+ return _obj;
+ }
+
+ VALUE inspect() const
+ {
+ return rb_inspect(_obj);
+ }
+
+ VALUE to_s() const
+ {
+ return rb_inspect(_obj);
+ }
+
+ static VALUE swig_rescue_swallow(VALUE)
+ {
+ /*
+ VALUE errstr = rb_obj_as_string(rb_errinfo());
+ printf("Swallowing error: '%s'\n", RSTRING_PTR(StringValue(errstr)));
+ */
+ return Qnil; /* Swallow Ruby exception */
+ }
+
+ static VALUE swig_rescue_funcall(VALUE p)
+ {
+ OpArgs* args = (OpArgs*) p;
+ return rb_funcall(args->src, args->id, args->nargs, args->target);
+ }
+
+ bool relational_equal_op(const GC_VALUE& other, const ID& op_id, bool (*op_func)(const VALUE& a, const VALUE& b)) const
+ {
+ if (FIXNUM_P(_obj) && FIXNUM_P(other._obj)) {
+ return op_func(_obj, other._obj);
+ }
+ bool res = false;
+ VALUE ret = Qnil;
+ SWIG_RUBY_THREAD_BEGIN_BLOCK;
+ if (rb_respond_to(_obj, op_id)) {
+ OpArgs args;
+ args.src = _obj;
+ args.id = op_id;
+ args.nargs = 1;
+ args.target = VALUE(other);
+ ret = rb_rescue(RUBY_METHOD_FUNC(swig_rescue_funcall), VALUE(&args),
+ (RUBY_METHOD_FUNC(swig_rescue_swallow)), Qnil);
+ }
+ if (ret == Qnil) {
+ VALUE a = rb_funcall( _obj, hash_id, 0 );
+ VALUE b = rb_funcall( VALUE(other), hash_id, 0 );
+ res = op_func(a, b);
+ } else {
+ res = RTEST(ret);
+ }
+ SWIG_RUBY_THREAD_END_BLOCK;
+ return res;
+ }
+
+ static bool operator_eq(const VALUE& a, const VALUE& b) { return a == b; }
+ static bool operator_lt(const VALUE& a, const VALUE& b) { return a < b; }
+ static bool operator_le(const VALUE& a, const VALUE& b) { return a <= b; }
+ static bool operator_gt(const VALUE& a, const VALUE& b) { return a > b; }
+ static bool operator_ge(const VALUE& a, const VALUE& b) { return a >= b; }
+
+ bool operator==(const GC_VALUE& other) const { return relational_equal_op(other, eq_id, operator_eq); }
+ bool operator<(const GC_VALUE& other) const { return relational_equal_op(other, lt_id, operator_lt); }
+ bool operator<=(const GC_VALUE& other) const { return relational_equal_op(other, le_id, operator_le); }
+ bool operator>(const GC_VALUE& other) const { return relational_equal_op(other, gt_id, operator_gt); }
+ bool operator>=(const GC_VALUE& other) const { return relational_equal_op(other, ge_id, operator_ge); }
+
+ bool operator!=(const GC_VALUE& other) const
+ {
+ return !(this->operator==(other));
+ }
+
+ GC_VALUE unary_op(const ID& op_id) const
+ {
+ VALUE ret = Qnil;
+ SWIG_RUBY_THREAD_BEGIN_BLOCK;
+ OpArgs args;
+ args.src = _obj;
+ args.id = op_id;
+ args.nargs = 0;
+ args.target = Qnil;
+ ret = rb_rescue(RUBY_METHOD_FUNC(swig_rescue_funcall), VALUE(&args),
+ (RUBY_METHOD_FUNC(swig_rescue_swallow)), Qnil);
+ SWIG_RUBY_THREAD_END_BLOCK;
+ return ret;
+ }
+
+ GC_VALUE operator+() const { return unary_op(pos_id); }
+ GC_VALUE operator-() const { return unary_op(neg_id); }
+ GC_VALUE operator~() const { return unary_op(inv_id); }
+
+ GC_VALUE binary_op(const GC_VALUE& other, const ID& op_id) const
+ {
+ VALUE ret = Qnil;
+ SWIG_RUBY_THREAD_BEGIN_BLOCK;
+ OpArgs args;
+ args.src = _obj;
+ args.id = op_id;
+ args.nargs = 1;
+ args.target = VALUE(other);
+ ret = rb_rescue(RUBY_METHOD_FUNC(swig_rescue_funcall), VALUE(&args),
+ (RUBY_METHOD_FUNC(swig_rescue_swallow)), Qnil);
+ SWIG_RUBY_THREAD_END_BLOCK;
+ return GC_VALUE(ret);
+ }
+
+ GC_VALUE operator+(const GC_VALUE& other) const { return binary_op(other, add_id); }
+ GC_VALUE operator-(const GC_VALUE& other) const { return binary_op(other, sub_id); }
+ GC_VALUE operator*(const GC_VALUE& other) const { return binary_op(other, mul_id); }
+ GC_VALUE operator/(const GC_VALUE& other) const { return binary_op(other, div_id); }
+ GC_VALUE operator%(const GC_VALUE& other) const { return binary_op(other, mod_id); }
+ GC_VALUE operator&(const GC_VALUE& other) const { return binary_op(other, and_id); }
+ GC_VALUE operator^(const GC_VALUE& other) const { return binary_op(other, xor_id); }
+ GC_VALUE operator|(const GC_VALUE& other) const { return binary_op(other, or_id); }
+ GC_VALUE operator<<(const GC_VALUE& other) const { return binary_op(other, lshift_id); }
+ GC_VALUE operator>>(const GC_VALUE& other) const { return binary_op(other, rshift_id); }
+ };
+
+ ID GC_VALUE::hash_id = rb_intern("hash");
+ ID GC_VALUE::lt_id = rb_intern("<");
+ ID GC_VALUE::gt_id = rb_intern(">");
+ ID GC_VALUE::eq_id = rb_intern("==");
+ ID GC_VALUE::le_id = rb_intern("<=");
+ ID GC_VALUE::ge_id = rb_intern(">=");
+
+ ID GC_VALUE::pos_id = rb_intern("+@");
+ ID GC_VALUE::neg_id = rb_intern("-@");
+ ID GC_VALUE::inv_id = rb_intern("~");
+
+ ID GC_VALUE::add_id = rb_intern("+");
+ ID GC_VALUE::sub_id = rb_intern("-");
+ ID GC_VALUE::mul_id = rb_intern("*");
+ ID GC_VALUE::div_id = rb_intern("/");
+ ID GC_VALUE::mod_id = rb_intern("%");
+
+ ID GC_VALUE::and_id = rb_intern("&");
+ ID GC_VALUE::or_id = rb_intern("|");
+ ID GC_VALUE::xor_id = rb_intern("^");
+
+ ID GC_VALUE::lshift_id = rb_intern("<<");
+ ID GC_VALUE::rshift_id = rb_intern(">>");
+
+ SwigGCReferences SwigGCReferences::s_references;
+
+ typedef GC_VALUE LANGUAGE_OBJ;
+
+} // namespace swig
+
+} // %fragment(GC_VALUE_definition)
+
+
+
+namespace swig {
+
+ %apply VALUE {GC_VALUE};
+
+ // Make sure this is the last typecheck done
+ %typecheck(999999,fragment="GC_VALUE_definition",noblock=1) GC_VALUE, GC_VALUE&,
+ const GC_VALUE& { $1 = 1; };
+
+ /* For input */
+ %typemap(in,fragment="GC_VALUE_definition",noblock=1) GC_VALUE* (GC_VALUE r), GC_VALUE& (GC_VALUE r) {
+ r = $input; $1 = &r;
+ }
+
+ /* For output */
+ %typemap(out,fragment="GC_VALUE_definition",noblock=1) GC_VALUE {
+ $result = (VALUE)$1;
+ }
+
+ %typemap(out,fragment="GC_VALUE_definition",noblock=1) GC_VALUE*, GC_VALUE const & {
+ $result = (VALUE)*$1;
+ }
+
+ %nodirector GC_VALUE;
+
+ // We ignore the constructor so that user can never create a GC_VALUE
+ // manually
+ %ignore GC_VALUE::GC_VALUE;
+
+ struct GC_VALUE {
+ VALUE inspect() const;
+ VALUE to_s() const;
+ GC_VALUE();
+ protected:
+ GC_VALUE(const GC_VALUE&);
+ ~GC_VALUE();
+ };
+
+ %exception GC_VALUE {};
+
+
+ %ignore LANGUAGE_OBJ;
+ typedef GC_VALUE LANGUAGE_OBJ;
+}
+
+
+%init {
+ swig::SwigGCReferences::initialize();
+}
+
+
+
+//
+// Fragment that contains traits to properly deal with GC_VALUE.
+// These functions may be invoked as a need of the from(), asval(),
+// asptr() and as() template functors, usually used in %typemaps.
+//
+%fragment(SWIG_Traits_frag(swig::GC_VALUE),"header",fragment="StdTraits",fragment="GC_VALUE_definition") {
+namespace swig {
+ template <> struct traits<GC_VALUE > {
+ typedef value_category category;
+ static const char* type_name() { return "GC_VALUE"; }
+ };
+
+ template <> struct traits_from<GC_VALUE> {
+ typedef GC_VALUE value_type;
+ static VALUE from(const value_type& val) {
+ return static_cast<VALUE>(val);
+ }
+ };
+
+ template <>
+ struct traits_check<GC_VALUE, value_category> {
+ static bool check(GC_VALUE) {
+ return true;
+ }
+ };
+
+ template <> struct traits_asval<GC_VALUE > {
+ typedef GC_VALUE value_type;
+ static int asval(VALUE obj, value_type *val) {
+ if (val) *val = obj;
+ return SWIG_OK;
+ }
+ };
+} // swig
+} // %fragment(traits for swig::GC_VALUE)
+
+
+#endif // __cplusplus
+
diff --git a/share/swig/2.0.11/ruby/rubycomplex.swg b/share/swig/2.0.11/ruby/rubycomplex.swg
new file mode 100644
index 0000000..4e249c7
--- /dev/null
+++ b/share/swig/2.0.11/ruby/rubycomplex.swg
@@ -0,0 +1,148 @@
+/*
+ Defines the As/From conversors for double/float complex, you need to
+ provide complex Type, the Name you want to use in the converters,
+ the complex Constructor method, and the Real and Imag complex
+ accessor methods.
+
+ See the std_complex.i and ccomplex.i for concrete examples.
+*/
+
+%fragment("rb_complex_new","header")
+{
+%#if !defined(T_COMPLEX)
+/* Ruby versions prior to 1.9 did not have native complex numbers. They were an extension in the STD library. */
+SWIGINTERN VALUE rb_complex_new(VALUE x, VALUE y) {
+ static ID new_id = rb_intern("new");
+ static VALUE cComplex = rb_const_get(rb_cObject, rb_intern("Complex"));
+ return rb_funcall(cComplex, new_id, 2, x, y);
+}
+%#endif
+}
+
+%fragment("SWIG_Complex_Numbers","header")
+{
+%#if !defined(T_COMPLEX)
+SWIGINTERN int SWIG_Is_Complex( VALUE obj ) {
+ static ID real_id = rb_intern("real");
+ static ID imag_id = rb_intern("imag");
+ return ( (rb_respond_to( obj, real_id ) ) &&
+ (rb_respond_to( obj, imag_id ) ) );
+}
+%#else
+SWIGINTERN int SWIG_Is_Complex( VALUE obj ) {
+ return TYPE(obj) == T_COMPLEX;
+}
+%#endif
+
+SWIGINTERN VALUE SWIG_Complex_Real(VALUE obj) {
+ static ID real_id = rb_intern("real");
+ return rb_funcall(obj, real_id, 0);
+}
+
+SWIGINTERN VALUE SWIG_Complex_Imaginary(VALUE obj) {
+ static ID imag_id = rb_intern("imag");
+ return rb_funcall(obj, imag_id, 0);
+}
+}
+
+%init {
+%#if !defined(T_COMPLEX)
+ rb_require("complex");
+%#endif
+}
+
+/* the common from converter */
+%define %swig_fromcplx_conv(Type, Real, Imag)
+%fragment(SWIG_From_frag(Type),"header",fragment="rb_complex_new")
+{
+SWIGINTERNINLINE VALUE
+SWIG_From(Type)(%ifcplusplus(const Type&, Type) c)
+{
+ VALUE re = rb_float_new(Real(c));
+ VALUE im = rb_float_new(Imag(c));
+ return rb_complex_new(re, im);
+}
+}
+%enddef
+
+/* the double case */
+%define %swig_cplxdbl_conv(Type, Constructor, Real, Imag)
+%fragment(SWIG_AsVal_frag(Type),"header",
+ fragment=SWIG_AsVal_frag(double),
+ fragment="SWIG_Complex_Numbers")
+{
+SWIGINTERN int
+SWIG_AsVal(Type) (VALUE o, Type* val)
+{
+ if ( SWIG_Is_Complex( o ) ) {
+ if (val) {
+ VALUE real = SWIG_Complex_Real(o);
+ VALUE imag = SWIG_Complex_Imaginary(o);
+ double re = 0;
+ SWIG_AsVal_double( real, &re );
+ double im = 0;
+ SWIG_AsVal_double( imag, &im );
+ *val = Constructor(re, im);
+ }
+ return SWIG_OK;
+ } else {
+ double d;
+ int res = SWIG_AddCast(SWIG_AsVal(double)(o, &d));
+ if (SWIG_IsOK(res)) {
+ if (val) *val = Constructor(d, 0.0);
+ return res;
+ }
+ }
+ return SWIG_TypeError;
+}
+}
+%swig_fromcplx_conv(Type, Real, Imag);
+%enddef
+
+/* the float case */
+%define %swig_cplxflt_conv(Type, Constructor, Real, Imag)
+%fragment(SWIG_AsVal_frag(Type),"header",
+ fragment=SWIG_AsVal_frag(float),
+ fragment=SWIG_AsVal_frag(double),
+ fragment="SWIG_Complex_Numbers") {
+SWIGINTERN int
+SWIG_AsVal(Type)(VALUE o, Type *val)
+{
+ if ( SWIG_Is_Complex( o ) ) {
+ VALUE real = SWIG_Complex_Real(o);
+ VALUE imag = SWIG_Complex_Imaginary(o);
+ double re = 0;
+ SWIG_AsVal_double( real, &re );
+ double im = 0;
+ SWIG_AsVal_double( imag, &im );
+ if ((-FLT_MAX <= re && re <= FLT_MAX) &&
+ (-FLT_MAX <= im && im <= FLT_MAX)) {
+ if (val) *val = Constructor(%numeric_cast(re, float),
+ %numeric_cast(im, float));
+ return SWIG_OK;
+ } else {
+ return SWIG_OverflowError;
+ }
+ } else {
+ float re;
+ int res = SWIG_AddCast(SWIG_AsVal(float)(o, &re));
+ if (SWIG_IsOK(res)) {
+ if (val) *val = Constructor(re, 0.0);
+ return res;
+ }
+ }
+ return SWIG_TypeError;
+}
+}
+
+%swig_fromcplx_conv(Type, Real, Imag);
+%enddef
+
+#define %swig_cplxflt_convn(Type, Constructor, Real, Imag) \
+%swig_cplxflt_conv(Type, Constructor, Real, Imag)
+
+
+#define %swig_cplxdbl_convn(Type, Constructor, Real, Imag) \
+%swig_cplxdbl_conv(Type, Constructor, Real, Imag)
+
+
diff --git a/share/swig/2.0.11/ruby/rubycontainer.swg b/share/swig/2.0.11/ruby/rubycontainer.swg
new file mode 100644
index 0000000..d4eaa5f
--- /dev/null
+++ b/share/swig/2.0.11/ruby/rubycontainer.swg
@@ -0,0 +1,1096 @@
+/* -----------------------------------------------------------------------------
+ * rubycontainer.swg
+ *
+ * Ruby sequence <-> C++ container wrapper
+ *
+ * This wrapper, and its iterator, allows a general use (and reuse) of
+ * the mapping between C++ and Ruby, thanks to the C++ templates.
+ *
+ * Of course, it needs the C++ compiler to support templates, but
+ * since we will use this wrapper with the STL containers, that should
+ * be the case.
+ * ----------------------------------------------------------------------------- */
+
+%{
+#include <iostream>
+%}
+
+
+#if !defined(SWIG_NO_EXPORT_ITERATOR_METHODS)
+# if !defined(SWIG_EXPORT_ITERATOR_METHODS)
+# define SWIG_EXPORT_ITERATOR_METHODS SWIG_EXPORT_ITERATOR_METHODS
+# endif
+#endif
+
+%include <rubyiterators.swg>
+
+/**** The RubySequence C++ Wrap ***/
+
+%insert(header) %{
+#include <stdexcept>
+%}
+
+%include <std_except.i>
+
+
+%fragment("RubySequence_Base","header")
+{
+%#include <functional>
+
+
+namespace swig {
+ template < class T >
+ struct yield : public std::unary_function< T, bool >
+ {
+ bool
+ operator()( const T& v ) const
+ {
+ return RTEST( rb_yield( swig::from< T >(v) ) );
+ }
+ };
+
+
+ inline size_t
+ check_index(ptrdiff_t i, size_t size, bool insert = false) {
+ if ( i < 0 ) {
+ if ((size_t) (-i) <= size)
+ return (size_t) (i + size);
+ } else if ( (size_t) i < size ) {
+ return (size_t) i;
+ } else if (insert && ((size_t) i == size)) {
+ return size;
+ }
+
+ throw std::out_of_range("index out of range");
+ }
+
+ inline size_t
+ slice_index(ptrdiff_t i, size_t size) {
+ if ( i < 0 ) {
+ if ((size_t) (-i) <= size) {
+ return (size_t) (i + size);
+ } else {
+ throw std::out_of_range("index out of range");
+ }
+ } else {
+ return ( (size_t) i < size ) ? ((size_t) i) : size;
+ }
+ }
+
+ template <class Sequence, class Difference>
+ inline typename Sequence::iterator
+ getpos(Sequence* self, Difference i) {
+ typename Sequence::iterator pos = self->begin();
+ std::advance(pos, check_index(i,self->size()));
+ return pos;
+ }
+
+ template <class Sequence, class Difference>
+ inline typename Sequence::const_iterator
+ cgetpos(const Sequence* self, Difference i) {
+ typename Sequence::const_iterator pos = self->begin();
+ std::advance(pos, check_index(i,self->size()));
+ return pos;
+ }
+
+ template <class Sequence, class Difference>
+ inline Sequence*
+ getslice(const Sequence* self, Difference i, Difference j) {
+ typename Sequence::size_type size = self->size();
+ typename Sequence::size_type ii = swig::check_index(i, size);
+ typename Sequence::size_type jj = swig::slice_index(j, size);
+
+ if (jj > ii) {
+ typename Sequence::const_iterator vb = self->begin();
+ typename Sequence::const_iterator ve = self->begin();
+ std::advance(vb,ii);
+ std::advance(ve,jj);
+ return new Sequence(vb, ve);
+ } else {
+ return new Sequence();
+ }
+ }
+
+ template <class Sequence, class Difference, class InputSeq>
+ inline void
+ setslice(Sequence* self, Difference i, Difference j, const InputSeq& v) {
+ typename Sequence::size_type size = self->size();
+ typename Sequence::size_type ii = swig::check_index(i, size, true);
+ typename Sequence::size_type jj = swig::slice_index(j, size);
+ if (jj < ii) jj = ii;
+ size_t ssize = jj - ii;
+ if (ssize <= v.size()) {
+ typename Sequence::iterator sb = self->begin();
+ typename InputSeq::const_iterator vmid = v.begin();
+ std::advance(sb,ii);
+ std::advance(vmid, jj - ii);
+ self->insert(std::copy(v.begin(), vmid, sb), vmid, v.end());
+ } else {
+ typename Sequence::iterator sb = self->begin();
+ typename Sequence::iterator se = self->begin();
+ std::advance(sb,ii);
+ std::advance(se,jj);
+ self->erase(sb,se);
+ self->insert(sb, v.begin(), v.end());
+ }
+ }
+
+ template <class Sequence, class Difference>
+ inline void
+ delslice(Sequence* self, Difference i, Difference j) {
+ typename Sequence::size_type size = self->size();
+ typename Sequence::size_type ii = swig::check_index(i, size, true);
+ typename Sequence::size_type jj = swig::slice_index(j, size);
+ if (jj > ii) {
+ typename Sequence::iterator sb = self->begin();
+ typename Sequence::iterator se = self->begin();
+ std::advance(sb,ii);
+ std::advance(se,jj);
+ self->erase(sb,se);
+ }
+ }
+}
+}
+
+%fragment("RubySequence_Cont","header",
+ fragment="<stddef.h>",
+ fragment="StdTraits",
+ fragment="RubySequence_Base",
+ fragment="ConstIterator_T")
+{
+namespace swig
+{
+
+ /**
+ * This class is a proxy class for references, used to return and set values
+ * of an element of a Ruby Array of stuff.
+ * It can be used by RubySequence_InputIterator to make it work with STL
+ * algorithms.
+ *
+ */
+ template <class T>
+ struct RubySequence_Ref
+ {
+ RubySequence_Ref(VALUE seq, int index)
+ : _seq(seq), _index(index)
+ {
+ }
+
+ operator T () const
+ {
+ VALUE item = rb_ary_entry(_seq, _index );
+ try {
+ return swig::as<T>(item, true);
+ } catch (std::exception& e) {
+ char msg[1024];
+ sprintf(msg, "in sequence element %d ", _index);
+ VALUE lastErr = rb_gv_get("$!");
+ if ( lastErr == Qnil ) {
+ %type_error(swig::type_name<T>());
+ }
+ VALUE str = rb_str_new2(msg);
+ str = rb_str_cat2( str, e.what() );
+ SWIG_Ruby_ExceptionType( NULL, str );
+ throw;
+ }
+ }
+
+ RubySequence_Ref& operator=(const T& v)
+ {
+ rb_ary_set(_seq, _index, swig::from< T >(v));
+ return *this;
+ }
+
+ private:
+ VALUE _seq;
+ int _index;
+ };
+
+
+ /**
+ * This class is a proxy to return a pointer to a class, usually
+ * RubySequence_Ref.
+ * It can be used by RubySequence_InputIterator to make it work with STL
+ * algorithms.
+ *
+ */
+ template <class T>
+ struct RubySequence_ArrowProxy
+ {
+ RubySequence_ArrowProxy(const T& x): m_value(x) {}
+ const T* operator->() const { return &m_value; }
+ operator const T*() const { return &m_value; }
+ T m_value;
+ };
+
+
+ /**
+ * Input Iterator. This adapator class is a random access iterator that
+ * allows you to use STL algorithms with a Ruby class (a Ruby Array by default).
+ *
+ */
+ template <class T, class Reference = RubySequence_Ref< T > >
+ struct RubySequence_InputIterator
+ {
+ typedef RubySequence_InputIterator<T, Reference > self;
+
+ typedef std::random_access_iterator_tag iterator_category;
+ typedef Reference reference;
+ typedef T value_type;
+ typedef T* pointer;
+ typedef ptrdiff_t difference_type;
+
+ RubySequence_InputIterator()
+ {
+ }
+
+ RubySequence_InputIterator(VALUE seq, int index)
+ : _seq(seq), _index(index)
+ {
+ }
+
+ reference operator*() const
+ {
+ return reference(_seq, _index);
+ }
+
+ RubySequence_ArrowProxy<T>
+ operator->() const {
+ return RubySequence_ArrowProxy<T>(operator*());
+ }
+
+ bool operator==(const self& ri) const
+ {
+ return (_index == ri._index) && (_seq == ri._seq);
+ }
+
+ bool operator!=(const self& ri) const
+ {
+ return !(operator==(ri));
+ }
+
+ self& operator ++ ()
+ {
+ ++_index;
+ return *this;
+ }
+
+ self& operator -- ()
+ {
+ --_index;
+ return *this;
+ }
+
+ self& operator += (difference_type n)
+ {
+ _index += n;
+ return *this;
+ }
+
+ self operator +(difference_type n) const
+ {
+ return self(_seq, _index + n);
+ }
+
+ self& operator -= (difference_type n)
+ {
+ _index -= n;
+ return *this;
+ }
+
+ self operator -(difference_type n) const
+ {
+ return self(_seq, _index - n);
+ }
+
+ difference_type operator - (const self& ri) const
+ {
+ return _index - ri._index;
+ }
+
+ bool operator < (const self& ri) const
+ {
+ return _index < ri._index;
+ }
+
+ reference
+ operator[](difference_type n) const
+ {
+ return reference(_seq, _index + n);
+ }
+
+ private:
+ VALUE _seq;
+ difference_type _index;
+ };
+
+
+ /**
+ * This adaptor class allows you to use a Ruby Array as if it was an STL
+ * container, giving it begin(), end(), and iterators.
+ *
+ */
+ template <class T>
+ struct RubySequence_Cont
+ {
+ typedef RubySequence_Ref<T> reference;
+ typedef const RubySequence_Ref<T> const_reference;
+ typedef T value_type;
+ typedef T* pointer;
+ typedef int difference_type;
+ typedef int size_type;
+ typedef const pointer const_pointer;
+ typedef RubySequence_InputIterator<T, reference> iterator;
+ typedef RubySequence_InputIterator<T, const_reference> const_iterator;
+
+ RubySequence_Cont(VALUE seq) : _seq(0)
+ {
+ if (!rb_obj_is_kind_of(seq, rb_cArray)) {
+ throw std::invalid_argument("an Array is expected");
+ }
+ _seq = seq;
+ }
+
+ ~RubySequence_Cont()
+ {
+ }
+
+ size_type size() const
+ {
+ return RARRAY_LEN(_seq);
+ }
+
+ bool empty() const
+ {
+ return size() == 0;
+ }
+
+ iterator begin()
+ {
+ return iterator(_seq, 0);
+ }
+
+ const_iterator begin() const
+ {
+ return const_iterator(_seq, 0);
+ }
+
+ iterator end()
+ {
+ return iterator(_seq, size());
+ }
+
+ const_iterator end() const
+ {
+ return const_iterator(_seq, size());
+ }
+
+ reference operator[](difference_type n)
+ {
+ return reference(_seq, n);
+ }
+
+ const_reference operator[](difference_type n) const
+ {
+ return const_reference(_seq, n);
+ }
+
+ bool check(bool set_err = false) const
+ {
+ int s = (int) size();
+ for (int i = 0; i < s; ++i) {
+ VALUE item = rb_ary_entry(_seq, i );
+ if (!swig::check<value_type>(item)) {
+ if (set_err) {
+ char msg[1024];
+ sprintf(msg, "in sequence element %d", i);
+ SWIG_Error(SWIG_RuntimeError, msg);
+ }
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private:
+ VALUE _seq;
+ };
+
+}
+}
+
+/**
+ * Macros used to typemap an STL iterator -> SWIGIterator conversion.
+ *
+ */
+%define %swig_sequence_iterator(Sequence...)
+#if defined(SWIG_EXPORT_ITERATOR_METHODS)
+
+ %typemap(out,noblock=1,fragment="RubySequence_Cont")
+ const_iterator, const_reverse_iterator {
+ $result = SWIG_NewPointerObj(swig::make_const_iterator(%static_cast($1,const $type &),
+ self),
+ swig::ConstIterator::descriptor(),SWIG_POINTER_OWN);
+ }
+
+ %typemap(out,noblock=1,fragment="RubySequence_Cont")
+ iterator, reverse_iterator {
+ $result = SWIG_NewPointerObj(swig::make_nonconst_iterator(%static_cast($1,const $type &),
+ self),
+ swig::Iterator::descriptor(),SWIG_POINTER_OWN);
+ }
+
+ %typemap(out,noblock=1,fragment="RubySequence_Cont")
+ std::pair<const_iterator, const_iterator> {
+ $result = rb_ary_new2(2);
+ rb_ary_push($result, SWIG_NewPointerObj(swig::make_const_iterator(%static_cast($1,const $type &).first),
+ swig::ConstIterator::descriptor(),SWIG_POINTER_OWN));
+ rb_ary_push($result, SWIG_NewPointerObj(swig::make_const_iterator(%static_cast($1,const $type &).second),
+ swig::ConstIterator::descriptor(),SWIG_POINTER_OWN));
+ }
+
+ // std::map/multimap/set allow returning std::pair< iterator, iterator > from
+ // equal_range, but we cannot still modify the key, so the iterator is
+ // const.
+ %typemap(out,noblock=1,fragment="RubySequence_Cont")
+ std::pair<iterator, iterator> {
+ $result = rb_ary_new2(2);
+ rb_ary_push($result, SWIG_NewPointerObj(swig::make_const_iterator(%static_cast($1,const $type &).first),
+ swig::ConstIterator::descriptor(),SWIG_POINTER_OWN));
+ rb_ary_push($result, SWIG_NewPointerObj(swig::make_const_iterator(%static_cast($1,const $type &).second),
+ swig::ConstIterator::descriptor(),SWIG_POINTER_OWN));
+ }
+
+
+ %typemap(in,noblock=1,fragment="RubySequence_Cont")
+ const_iterator(swig::ConstIterator *iter = 0, int res),
+ const_reverse_iterator(swig::ConstIterator *iter = 0, int res) {
+ res = SWIG_ConvertPtr($input, %as_voidptrptr(&iter),
+ swig::ConstIterator::descriptor(), 0);
+ if (!SWIG_IsOK(res) || !iter) {
+ %argument_fail(SWIG_TypeError, "$type", $symname, $argnum);
+ } else {
+ swig::ConstIterator_T<$type > *iter_t = dynamic_cast<swig::ConstIterator_T<$type > *>(iter);
+ if (iter_t) {
+ $1 = iter_t->get_current();
+ } else {
+ %argument_fail(SWIG_TypeError, "$type", $symname, $argnum);
+ }
+ }
+ }
+
+ %typemap(in,noblock=1,fragment="RubySequence_Cont")
+ iterator(swig::Iterator *iter = 0, int res),
+ reverse_iterator(swig::Iterator *iter = 0, int res) {
+ res = SWIG_ConvertPtr($input, %as_voidptrptr(&iter), swig::Iterator::descriptor(), 0);
+ if (!SWIG_IsOK(res) || !iter) {
+ %argument_fail(SWIG_TypeError, "$type", $symname, $argnum);
+ } else {
+ swig::Iterator_T<$type > *iter_t = dynamic_cast<swig::Iterator_T<$type > *>(iter);
+ if (iter_t) {
+ $1 = iter_t->get_current();
+ } else {
+ %argument_fail(SWIG_TypeError, "$type", $symname, $argnum);
+ }
+ }
+ }
+
+ %typecheck(%checkcode(ITERATOR),noblock=1,fragment="RubySequence_Cont")
+ const_iterator, const_reverse_iterator {
+ swig::ConstIterator *iter = 0;
+ int res = SWIG_ConvertPtr($input, %as_voidptrptr(&iter),
+ swig::ConstIterator::descriptor(), 0);
+ $1 = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::ConstIterator_T<$type > *>(iter) != 0));
+ }
+
+ %typecheck(%checkcode(ITERATOR),noblock=1,fragment="RubySequence_Cont")
+ iterator, reverse_iterator {
+ swig::ConstIterator *iter = 0;
+ int res = SWIG_ConvertPtr($input, %as_voidptrptr(&iter),
+ swig::Iterator::descriptor(), 0);
+ $1 = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::Iterator_T<$type > *>(iter) != 0));
+ }
+
+ %fragment("RubySequence_Cont");
+
+// %newobject iterator;
+// %newobject const_iterator;
+// %extend {
+// swig::Iterator* iterator(VALUE* RUBY_SELF) {
+// return swig::make_nonconst_iterator($self->begin(), $self->begin(),
+// $self->end(), *RUBY_SELF);
+// }
+
+// swig::ConstIterator* const_iterator(VALUE* RUBY_SELF) {
+// return swig::make_const_iterator($self->begin(), $self->begin(),
+// $self->end(), *RUBY_SELF);
+// }
+// }
+#endif //SWIG_EXPORT_ITERATOR_METHODS
+%enddef
+
+
+/**** The Ruby container methods ****/
+
+
+
+%define %swig_container_methods(Container...)
+
+ %extend {
+
+ %newobject dup;
+ Container* dup()
+ {
+ return new Container(*$self);
+ }
+
+ }
+
+%enddef
+
+
+/**
+ * Macro used to define common Ruby printing methods for STL container
+ *
+ */
+%define %swig_sequence_printing_methods(Sequence...)
+
+ %extend {
+
+ VALUE inspect()
+ {
+ Sequence::const_iterator i = $self->begin();
+ Sequence::const_iterator e = $self->end();
+ const char *type_name = swig::type_name< Sequence >();
+ VALUE str = rb_str_new2(type_name);
+ str = rb_str_cat2( str, " [" );
+ bool comma = false;
+ VALUE tmp;
+ for ( ; i != e; ++i, comma = true )
+ {
+ if (comma) str = rb_str_cat2( str, "," );
+ tmp = swig::from< Sequence::value_type >( *i );
+ tmp = rb_inspect( tmp );
+ str = rb_str_buf_append( str, tmp );
+ }
+ str = rb_str_cat2( str, "]" );
+ return str;
+ }
+
+ VALUE to_a()
+ {
+ Sequence::const_iterator i = $self->begin();
+ Sequence::const_iterator e = $self->end();
+ VALUE ary = rb_ary_new2( std::distance( i, e ) );
+ VALUE tmp;
+ for ( ; i != e; ++i )
+ {
+ tmp = swig::from< Sequence::value_type >( *i );
+ rb_ary_push( ary, tmp );
+ }
+ return ary;
+ }
+
+ VALUE to_s()
+ {
+ Sequence::iterator i = $self->begin();
+ Sequence::iterator e = $self->end();
+ VALUE str = rb_str_new2( "" );
+ VALUE tmp;
+ for ( ; i != e; ++i )
+ {
+ tmp = swig::from< Sequence::value_type >( *i );
+ tmp = rb_obj_as_string( tmp );
+ str = rb_str_buf_append( str, tmp );
+ }
+ return str;
+ }
+}
+%enddef
+
+
+/**
+ * Macro used to add common methods to all STL sequence-type containers
+ *
+ */
+%define %swig_sequence_methods_common(Sequence...)
+ %swig_container_methods(%arg(Sequence))
+ %swig_sequence_iterator(%arg(Sequence))
+ %swig_sequence_printing_methods(%arg(Sequence))
+
+ %fragment("RubySequence_Base");
+
+ %extend {
+
+
+ VALUE slice( difference_type i, difference_type j )
+ {
+ if ( j <= 0 ) return Qnil;
+ std::size_t len = $self->size();
+ if ( i < 0 ) i = len - i;
+ j += i;
+ if ( static_cast<std::size_t>(j) >= len ) j = len-1;
+
+ VALUE r = Qnil;
+ try {
+ r = swig::from< const Sequence* >( swig::getslice(self, i, j) );
+ }
+ catch( std::out_of_range )
+ {
+ }
+ return r;
+ }
+
+
+ Sequence* each()
+ {
+ if ( !rb_block_given_p() )
+ rb_raise( rb_eArgError, "no block given");
+
+ VALUE r;
+ Sequence::const_iterator i = self->begin();
+ Sequence::const_iterator e = self->end();
+ for ( ; i != e; ++i )
+ {
+ r = swig::from< Sequence::value_type >(*i);
+ rb_yield(r);
+ }
+
+ return self;
+ }
+
+ %newobject select;
+ Sequence* select() {
+ if ( !rb_block_given_p() )
+ rb_raise( rb_eArgError, "no block given" );
+
+ Sequence* r = new Sequence;
+ Sequence::const_iterator i = $self->begin();
+ Sequence::const_iterator e = $self->end();
+ for ( ; i != e; ++i )
+ {
+ VALUE v = swig::from< Sequence::value_type >(*i);
+ if ( RTEST( rb_yield(v) ) )
+ $self->insert( r->end(), *i);
+ }
+
+ return r;
+ }
+
+ VALUE delete_at(difference_type i) {
+ VALUE r = Qnil;
+ try {
+ Sequence::iterator at = swig::getpos(self, i);
+ r = swig::from< Sequence::value_type >( *(at) );
+ $self->erase(at);
+ }
+ catch (std::out_of_range)
+ {
+ }
+ return r;
+ }
+
+
+ VALUE __delete2__(const value_type& i) {
+ VALUE r = Qnil;
+ return r;
+ }
+
+ }
+%enddef
+
+
+/**
+ * Macro used to add functions for back insertion of values in
+ * STL Sequence containers
+ *
+ */
+%define %swig_sequence_back_inserters( Sequence... )
+ %extend {
+
+ VALUE pop() {
+ if ($self->empty()) return Qnil;
+ Sequence::value_type x = self->back();
+ $self->pop_back();
+ return swig::from< Sequence::value_type >( x );
+ }
+
+ %alias push "<<";
+ const value_type push( const value_type& e ) {
+ $self->push_back( e );
+ return e;
+ }
+
+ %newobject reject;
+ Sequence* reject() {
+ if ( !rb_block_given_p() )
+ rb_raise( rb_eArgError, "no block given" );
+
+ Sequence* r = new Sequence;
+ std::remove_copy_if( $self->begin(), $self->end(),
+ std::back_inserter(*r),
+ swig::yield< Sequence::value_type >() );
+ return r;
+ }
+
+ }
+%enddef
+
+%define %swig_sequence_methods_extra(Sequence...)
+ %extend {
+ %alias reject_bang "delete_if";
+ Sequence* reject_bang() {
+ if ( !rb_block_given_p() )
+ rb_raise( rb_eArgError, "no block given" );
+
+ $self->erase( std::remove_if( $self->begin(), $self->end(),
+ swig::yield< Sequence::value_type >() ), $self->end() );
+ return $self;
+ }
+ }
+%enddef
+
+/**
+ * Macro used to add functions for Sequences
+ *
+ */
+%define %swig_sequence_methods(Sequence...)
+ %swig_sequence_methods_common(%arg(Sequence));
+ %swig_sequence_methods_extra(%arg(Sequence));
+ %swig_sequence_back_inserters(%arg(Sequence));
+
+ %extend {
+
+ VALUE at(difference_type i) const {
+ VALUE r = Qnil;
+ try {
+ r = swig::from< Sequence::value_type >( *(swig::cgetpos(self, i)) );
+ }
+ catch( std::out_of_range )
+ {
+ }
+ return r;
+ }
+
+ VALUE __getitem__(difference_type i, difference_type j) const {
+ if ( j <= 0 ) return Qnil;
+ std::size_t len = $self->size();
+ if ( i < 0 ) i = len - i;
+ j += i; if ( static_cast<std::size_t>(j) >= len ) j = len-1;
+
+ VALUE r = Qnil;
+ try {
+ r = swig::from< const Sequence* >( swig::getslice(self, i, j) );
+ }
+ catch( std::out_of_range )
+ {
+ }
+ return r;
+ }
+
+ VALUE __getitem__(difference_type i) const {
+ VALUE r = Qnil;
+ try {
+ r = swig::from< Sequence::value_type >( *(swig::cgetpos(self, i)) );
+ }
+ catch( std::out_of_range )
+ {
+ }
+ return r;
+ }
+
+ VALUE __getitem__(VALUE i) const {
+ if ( rb_obj_is_kind_of( i, rb_cRange ) == Qfalse )
+ {
+ rb_raise( rb_eTypeError, "not a valid index or range" );
+ }
+
+ VALUE r = Qnil;
+ static ID id_end = rb_intern("end");
+ static ID id_start = rb_intern("begin");
+ static ID id_noend = rb_intern("exclude_end?");
+
+ VALUE start = rb_funcall( i, id_start, 0 );
+ VALUE end = rb_funcall( i, id_end, 0 );
+ bool noend = ( rb_funcall( i, id_noend, 0 ) == Qtrue );
+
+ int len = $self->size();
+
+ int s = NUM2INT( start );
+ if ( s < 0 ) s = len + s;
+ else if ( s >= len ) return Qnil;
+
+ int e = NUM2INT( end );
+ if ( e < 0 ) e = len + e;
+
+ if ( e < s ) return Qnil; //std::swap( s, e );
+
+ if ( noend ) e -= 1;
+ if ( e >= len ) e = len - 1;
+
+ return swig::from< Sequence* >( swig::getslice(self, s, e+1) );
+ }
+
+ VALUE __setitem__(difference_type i, const value_type& x)
+ {
+ std::size_t len = $self->size();
+ if ( i < 0 ) i = len - i;
+ else if ( static_cast<std::size_t>(i) >= len )
+ $self->resize( i+1, x );
+ else
+ *(swig::getpos(self,i)) = x;
+
+ return swig::from< Sequence::value_type >( x );
+ }
+
+ VALUE __setitem__(difference_type i, difference_type j, const Sequence& v)
+ throw (std::invalid_argument) {
+
+ if ( j <= 0 ) return Qnil;
+ std::size_t len = $self->size();
+ if ( i < 0 ) i = len - i;
+ j += i;
+ if ( static_cast<std::size_t>(j) >= len ) {
+ $self->resize( j+1, *(v.begin()) );
+ j = len-1;
+ }
+
+ VALUE r = Qnil;
+ swig::setslice(self, i, j, v);
+ r = swig::from< const Sequence* >( &v );
+ return r;
+ }
+
+ }
+%enddef
+
+%define %swig_sequence_methods_val(Sequence...)
+ %swig_sequence_methods(%arg(Sequence))
+%enddef
+
+
+/**
+ * Macro used to add functions for front insertion of
+ * elements in STL sequence containers that support it.
+ *
+ */
+%define %swig_sequence_front_inserters( Sequence... )
+
+%extend {
+
+ VALUE shift()
+ {
+ if ($self->empty()) return Qnil;
+ Sequence::value_type x = self->front();
+ $self->erase( $self->begin() );
+ return swig::from< Sequence::value_type >( x );
+ }
+
+ %typemap(in) (int argc, VALUE* argv) {
+ $1 = argc - 1;
+ $2 = argv + 1;
+ }
+
+ Sequence* insert( difference_type pos, int argc, VALUE* argv, ... )
+ {
+ std::size_t len = $self->size();
+ std::size_t i = swig::check_index( pos, len, true );
+ Sequence::iterator start;
+
+ VALUE elem = argv[0];
+ int idx = 0;
+ try {
+ Sequence::value_type val = swig::as<Sequence::value_type>( elem, true );
+ if ( i >= len ) {
+ $self->resize(i-1, val);
+ return $self;
+ }
+ start = $self->begin();
+ std::advance( start, i );
+ $self->insert( start++, val );
+
+ for ( ++idx; idx < argc; ++idx )
+ {
+ elem = argv[idx];
+ val = swig::as<Sequence::value_type>( elem );
+ $self->insert( start++, val );
+ }
+
+ }
+ catch( std::invalid_argument )
+ {
+ rb_raise( rb_eArgError, "%s",
+ Ruby_Format_TypeError( "",
+ swig::type_name<Sequence::value_type>(),
+ __FUNCTION__, idx+2, elem ));
+ }
+
+
+ return $self;
+ }
+
+ %typemap(in) (int argc, VALUE* argv) {
+ $1 = argc;
+ $2 = argv;
+ }
+
+ Sequence* unshift( int argc, VALUE* argv, ... )
+ {
+ for ( int idx = argc-1; idx >= 0; --idx )
+ {
+ Sequence::iterator start = $self->begin();
+ VALUE elem = argv[idx];
+ try {
+ Sequence::value_type val = swig::as<Sequence::value_type>( elem, true );
+ $self->insert( start, val );
+ }
+ catch( std::invalid_argument )
+ {
+ rb_raise( rb_eArgError, "%s",
+ Ruby_Format_TypeError( "",
+ swig::type_name<Sequence::value_type>(),
+ __FUNCTION__, idx+2, elem ));
+ }
+ }
+
+ return $self;
+ }
+
+}
+%enddef
+
+
+//
+// Common fragments
+//
+
+%fragment("StdSequenceTraits","header",
+ fragment="StdTraits",
+ fragment="RubySequence_Cont",
+ fragment="GC_VALUE_definition")
+{
+namespace swig {
+ template <class RubySeq, class Seq>
+ inline void
+ assign(const RubySeq& rubyseq, Seq* seq) {
+ // seq->assign(rubyseq.begin(), rubyseq.end()); // not used as not always implemented
+ typedef typename RubySeq::value_type value_type;
+ typename RubySeq::const_iterator it = rubyseq.begin();
+ for (;it != rubyseq.end(); ++it) {
+ seq->insert(seq->end(),(value_type)(*it));
+ }
+ }
+
+ template <class Seq, class T = typename Seq::value_type >
+ struct traits_asptr_stdseq {
+ typedef Seq sequence;
+ typedef T value_type;
+
+ static int asptr(VALUE obj, sequence **seq) {
+ if (rb_obj_is_kind_of(obj, rb_cArray) == Qtrue) {
+ try {
+ RubySequence_Cont<value_type> rubyseq(obj);
+ if (seq) {
+ sequence *pseq = new sequence();
+ assign(rubyseq, pseq);
+ *seq = pseq;
+ return SWIG_NEWOBJ;
+ } else {
+ return rubyseq.check() ? SWIG_OK : SWIG_ERROR;
+ }
+ } catch (std::exception& e) {
+ if (seq) {
+ VALUE lastErr = rb_gv_get("$!");
+ if (lastErr == Qnil) {
+ rb_raise(rb_eTypeError, "%s", e.what());
+ }
+ }
+ return SWIG_ERROR;
+ }
+ } else {
+ sequence *p;
+ if (SWIG_ConvertPtr(obj,(void**)&p,
+ swig::type_info<sequence>(),0) == SWIG_OK) {
+ if (seq) *seq = p;
+ return SWIG_OLDOBJ;
+ }
+ }
+ return SWIG_ERROR;
+ }
+ };
+
+ // Partial specialization for GC_VALUE's. No need to typecheck each
+ // element.
+ template< class Seq >
+ struct traits_asptr_stdseq< Seq, swig::GC_VALUE > {
+ typedef Seq sequence;
+ typedef swig::GC_VALUE value_type;
+
+ static int asptr(VALUE obj, sequence **seq) {
+ if (rb_obj_is_kind_of(obj, rb_cArray) == Qtrue) {
+ try {
+ if (seq) {
+ RubySequence_Cont<value_type> rubyseq(obj);
+ sequence *pseq = new sequence();
+ assign(rubyseq, pseq);
+ *seq = pseq;
+ return SWIG_NEWOBJ;
+ } else {
+ return true;
+ }
+ } catch (std::exception& e) {
+ if (seq) {
+ VALUE lastErr = rb_gv_get("$!");
+ if (lastErr == Qnil) {
+ rb_raise(rb_eTypeError, "%s", e.what());
+ }
+ }
+ return SWIG_ERROR;
+ }
+ } else {
+ sequence *p;
+ if (SWIG_ConvertPtr(obj,(void**)&p,
+ swig::type_info<sequence>(),0) == SWIG_OK) {
+ if (seq) *seq = p;
+ return SWIG_OLDOBJ;
+ }
+ }
+ return SWIG_ERROR;
+ }
+ };
+
+ template <class Seq, class T = typename Seq::value_type >
+ struct traits_from_stdseq {
+ typedef Seq sequence;
+ typedef T value_type;
+ typedef typename Seq::size_type size_type;
+ typedef typename sequence::const_iterator const_iterator;
+
+ static VALUE from(const sequence& seq) {
+#ifdef SWIG_RUBY_EXTRA_NATIVE_CONTAINERS
+ swig_type_info *desc = swig::type_info<sequence>();
+ if (desc && desc->clientdata) {
+ return SWIG_NewPointerObj(new sequence(seq), desc, SWIG_POINTER_OWN);
+ }
+#endif
+ size_type size = seq.size();
+ if (size <= (size_type)INT_MAX) {
+ VALUE obj = rb_ary_new2((int)size);
+ int i = 0;
+ for (const_iterator it = seq.begin();
+ it != seq.end(); ++it, ++i) {
+ rb_ary_push(obj, swig::from< value_type >(*it));
+ }
+ rb_obj_freeze(obj); // treat as immutable result
+ return obj;
+ } else {
+ rb_raise(rb_eRangeError,"sequence size not valid in ruby");
+ return Qnil;
+ }
+ }
+ };
+}
+}
+
+
+%include <rubycontainer_extended.swg>
diff --git a/share/swig/2.0.11/ruby/rubycontainer_extended.swg b/share/swig/2.0.11/ruby/rubycontainer_extended.swg
new file mode 100644
index 0000000..7514ba2
--- /dev/null
+++ b/share/swig/2.0.11/ruby/rubycontainer_extended.swg
@@ -0,0 +1,134 @@
+/* -----------------------------------------------------------------------------
+ * rubycontainer_extended.swg
+ *
+ * This file contains additional functions that make containers
+ * behave closer to ruby primitive types.
+ * However, some of these functions place some restrictions on
+ * the underlying object inside of the container and the iterator
+ * (that it has to have an == comparison function, that it has to have
+ * an = assignment operator, etc).
+ * ----------------------------------------------------------------------------- */
+
+/**
+ * Macro used to add extend functions that require operator== in object.
+ *
+ * @param Container STL container
+ * @param Type class inside container
+ *
+ */
+%define %swig_container_with_equal_operator( Container, Type )
+
+ VALUE __delete__( const Type& val ) {
+ VALUE r = Qnil;
+ Container<Type >::iterator e = $self->end();
+ Container<Type >::iterator i = std::remove( $self->begin(), e, val );
+ // remove dangling elements now
+ $self->erase( i, e );
+
+ if ( i != e )
+ r = swig::from< Type >( val );
+ else if ( rb_block_given_p() )
+ r = rb_yield(Qnil);
+ return r;
+ }
+
+%enddef // end of %swig_container_with_equal_operator
+
+
+
+
+/**
+ * Macro used to add extend functions that require the assignment
+ * operator (ie. = ) of contained class
+ *
+ * @param Container STL container
+ * @param Type class inside container
+ *
+ */
+
+%define %swig_container_with_assignment( Container, Type )
+
+
+ //
+ // map! -- the equivalent of std::transform
+ //
+ Container< Type >* map_bang() {
+
+ if ( !rb_block_given_p() )
+ rb_raise( rb_eArgError, "No block given" );
+
+ VALUE r = Qnil;
+ Container< Type >::iterator i = $self->begin();
+ Container< Type >::iterator e = $self->end();
+
+ try {
+ for ( ; i != e; ++i )
+ {
+ r = swig::from< Type >( *i );
+ r = rb_yield( r );
+ *i = swig::as< Type >( r );
+ }
+ }
+ catch ( const std::invalid_argument& )
+ {
+ rb_raise(rb_eTypeError,
+ "Yield block did not return a valid element for " "Container");
+ }
+
+ return $self;
+ }
+
+
+%enddef // end of %swig_container_with_assignment
+
+
+
+
+
+/**
+ * Macro used to add all extended functions to a container
+ *
+ * @param Container STL container
+ * @param Type class inside container
+ *
+ */
+%define %swig_container_extend( Container, Type )
+
+%extend Container< Type > {
+
+ %swig_container_with_assignment( %arg(Container), Type );
+ %swig_container_with_equal_operator( %arg(Container), Type );
+
+}
+
+%enddef
+
+
+/**
+ * Private macro used to add all extended functions to C/C++
+ * primitive types
+ *
+ * @param Container an STL container, like std::vector (with no class template)
+ *
+ */
+%define %__swig_container_extend_primtypes( Container )
+
+%swig_container_extend( %arg( Container ), bool );
+%swig_container_extend( %arg( Container ), char );
+%swig_container_extend( %arg( Container ), short );
+%swig_container_extend( %arg( Container ), int );
+%swig_container_extend( %arg( Container ), unsigned short );
+%swig_container_extend( %arg( Container ), unsigned int );
+%swig_container_extend( %arg( Container ), float );
+%swig_container_extend( %arg( Container ), double );
+%swig_container_extend( %arg( Container ), std::complex );
+%swig_container_extend( %arg( Container ), std::string );
+%swig_container_extend( %arg( Container ), swig::GC_VALUE );
+
+%enddef
+
+
+%__swig_container_extend_primtypes( std::vector );
+%__swig_container_extend_primtypes( std::deque );
+%__swig_container_extend_primtypes( std::list );
+
diff --git a/share/swig/2.0.11/ruby/rubydef.swg b/share/swig/2.0.11/ruby/rubydef.swg
new file mode 100644
index 0000000..956aaee
--- /dev/null
+++ b/share/swig/2.0.11/ruby/rubydef.swg
@@ -0,0 +1 @@
+/* empty file added for backward comp. */
diff --git a/share/swig/2.0.11/ruby/rubyerrors.swg b/share/swig/2.0.11/ruby/rubyerrors.swg
new file mode 100644
index 0000000..434544b
--- /dev/null
+++ b/share/swig/2.0.11/ruby/rubyerrors.swg
@@ -0,0 +1,154 @@
+/* -----------------------------------------------------------------------------
+ * error manipulation
+ * ----------------------------------------------------------------------------- */
+
+
+/* Define some additional error types */
+#define SWIG_ObjectPreviouslyDeletedError -100
+
+
+/* Define custom exceptions for errors that do not map to existing Ruby
+ exceptions. Note this only works for C++ since a global cannot be
+ initialized by a function in C. For C, fallback to rb_eRuntimeError.*/
+
+SWIGINTERN VALUE
+getNullReferenceError(void) {
+ static int init = 0;
+ static VALUE rb_eNullReferenceError ;
+ if (!init) {
+ init = 1;
+ rb_eNullReferenceError = rb_define_class("NullReferenceError", rb_eRuntimeError);
+ }
+ return rb_eNullReferenceError;
+}
+
+SWIGINTERN VALUE
+getObjectPreviouslyDeletedError(void) {
+ static int init = 0;
+ static VALUE rb_eObjectPreviouslyDeleted ;
+ if (!init) {
+ init = 1;
+ rb_eObjectPreviouslyDeleted = rb_define_class("ObjectPreviouslyDeleted", rb_eRuntimeError);
+ }
+ return rb_eObjectPreviouslyDeleted;
+}
+
+
+SWIGINTERN VALUE
+SWIG_Ruby_ErrorType(int SWIG_code) {
+ VALUE type;
+ switch (SWIG_code) {
+ case SWIG_MemoryError:
+ type = rb_eNoMemError;
+ break;
+ case SWIG_IOError:
+ type = rb_eIOError;
+ break;
+ case SWIG_RuntimeError:
+ type = rb_eRuntimeError;
+ break;
+ case SWIG_IndexError:
+ type = rb_eIndexError;
+ break;
+ case SWIG_TypeError:
+ type = rb_eTypeError;
+ break;
+ case SWIG_DivisionByZero:
+ type = rb_eZeroDivError;
+ break;
+ case SWIG_OverflowError:
+ type = rb_eRangeError;
+ break;
+ case SWIG_SyntaxError:
+ type = rb_eSyntaxError;
+ break;
+ case SWIG_ValueError:
+ type = rb_eArgError;
+ break;
+ case SWIG_SystemError:
+ type = rb_eFatal;
+ break;
+ case SWIG_AttributeError:
+ type = rb_eRuntimeError;
+ break;
+ case SWIG_NullReferenceError:
+ type = getNullReferenceError();
+ break;
+ case SWIG_ObjectPreviouslyDeletedError:
+ type = getObjectPreviouslyDeletedError();
+ break;
+ case SWIG_UnknownError:
+ type = rb_eRuntimeError;
+ break;
+ default:
+ type = rb_eRuntimeError;
+ }
+ return type;
+}
+
+
+/* This function is called when a user inputs a wrong argument to
+ a method.
+ */
+SWIGINTERN
+const char* Ruby_Format_TypeError( const char* msg,
+ const char* type,
+ const char* name,
+ const int argn,
+ VALUE input )
+{
+ char buf[128];
+ VALUE str;
+ VALUE asStr;
+ if ( msg && *msg )
+ {
+ str = rb_str_new2(msg);
+ }
+ else
+ {
+ str = rb_str_new(NULL, 0);
+ }
+
+ str = rb_str_cat2( str, "Expected argument " );
+ sprintf( buf, "%d of type ", argn-1 );
+ str = rb_str_cat2( str, buf );
+ str = rb_str_cat2( str, type );
+ str = rb_str_cat2( str, ", but got " );
+ str = rb_str_cat2( str, rb_obj_classname(input) );
+ str = rb_str_cat2( str, " " );
+ asStr = rb_inspect(input);
+ if ( RSTRING_LEN(asStr) > 30 )
+ {
+ str = rb_str_cat( str, StringValuePtr(asStr), 30 );
+ str = rb_str_cat2( str, "..." );
+ }
+ else
+ {
+ str = rb_str_append( str, asStr );
+ }
+
+ if ( name )
+ {
+ str = rb_str_cat2( str, "\n\tin SWIG method '" );
+ str = rb_str_cat2( str, name );
+ str = rb_str_cat2( str, "'" );
+ }
+
+ return StringValuePtr( str );
+}
+
+/* This function is called when an overloaded method fails */
+SWIGINTERN
+void Ruby_Format_OverloadedError(
+ const int argc,
+ const int maxargs,
+ const char* method,
+ const char* prototypes
+ )
+{
+ const char* msg = "Wrong # of arguments";
+ if ( argc <= maxargs ) msg = "Wrong arguments";
+ rb_raise(rb_eArgError,"%s for overloaded method '%s'.\n"
+ "Possible C/C++ prototypes are:\n%s",
+ msg, method, prototypes);
+}
diff --git a/share/swig/2.0.11/ruby/rubyfragments.swg b/share/swig/2.0.11/ruby/rubyfragments.swg
new file mode 100644
index 0000000..3c3b658
--- /dev/null
+++ b/share/swig/2.0.11/ruby/rubyfragments.swg
@@ -0,0 +1,23 @@
+/*
+
+ Create a file with this name, 'rubyfragments.swg', in your working
+ directory and add all the %fragments you want to take precedence
+ over the ones defined by default by swig.
+
+ For example, if you add:
+
+ %fragment(SWIG_AsVal_frag(int),"header") {
+ SWIGINTERNINLINE int
+ SWIG_AsVal(int)(VALUE obj, int *val)
+ {
+ <your code here>;
+ }
+ }
+
+ this will replace the code used to retrieve an integer value for all
+ the typemaps that need it, including:
+
+ int, std::vector<int>, std::list<std::pair<int,int> >, etc.
+
+
+*/
diff --git a/share/swig/2.0.11/ruby/rubyhead.swg b/share/swig/2.0.11/ruby/rubyhead.swg
new file mode 100644
index 0000000..9960087
--- /dev/null
+++ b/share/swig/2.0.11/ruby/rubyhead.swg
@@ -0,0 +1,157 @@
+#include <ruby.h>
+
+/* Ruby 1.9.1 has a "memoisation optimisation" when compiling with GCC which
+ * breaks using rb_intern as an lvalue, as SWIG does. We work around this
+ * issue for now by disabling this.
+ * https://sourceforge.net/tracker/?func=detail&aid=2859614&group_id=1645&atid=101645
+ */
+#ifdef rb_intern
+# undef rb_intern
+#endif
+
+/* Remove global macros defined in Ruby's win32.h */
+#ifdef write
+# undef write
+#endif
+#ifdef read
+# undef read
+#endif
+#ifdef bind
+# undef bind
+#endif
+#ifdef close
+# undef close
+#endif
+#ifdef connect
+# undef connect
+#endif
+
+
+/* Ruby 1.7 defines NUM2LL(), LL2NUM() and ULL2NUM() macros */
+#ifndef NUM2LL
+#define NUM2LL(x) NUM2LONG((x))
+#endif
+#ifndef LL2NUM
+#define LL2NUM(x) INT2NUM((long) (x))
+#endif
+#ifndef ULL2NUM
+#define ULL2NUM(x) UINT2NUM((unsigned long) (x))
+#endif
+
+/* Ruby 1.7 doesn't (yet) define NUM2ULL() */
+#ifndef NUM2ULL
+#ifdef HAVE_LONG_LONG
+#define NUM2ULL(x) rb_num2ull((x))
+#else
+#define NUM2ULL(x) NUM2ULONG(x)
+#endif
+#endif
+
+/* RSTRING_LEN, etc are new in Ruby 1.9, but ->ptr and ->len no longer work */
+/* Define these for older versions so we can just write code the new way */
+#ifndef RSTRING_LEN
+# define RSTRING_LEN(x) RSTRING(x)->len
+#endif
+#ifndef RSTRING_PTR
+# define RSTRING_PTR(x) RSTRING(x)->ptr
+#endif
+#ifndef RSTRING_END
+# define RSTRING_END(x) (RSTRING_PTR(x) + RSTRING_LEN(x))
+#endif
+#ifndef RARRAY_LEN
+# define RARRAY_LEN(x) RARRAY(x)->len
+#endif
+#ifndef RARRAY_PTR
+# define RARRAY_PTR(x) RARRAY(x)->ptr
+#endif
+#ifndef RFLOAT_VALUE
+# define RFLOAT_VALUE(x) RFLOAT(x)->value
+#endif
+#ifndef DOUBLE2NUM
+# define DOUBLE2NUM(x) rb_float_new(x)
+#endif
+#ifndef RHASH_TBL
+# define RHASH_TBL(x) (RHASH(x)->tbl)
+#endif
+#ifndef RHASH_ITER_LEV
+# define RHASH_ITER_LEV(x) (RHASH(x)->iter_lev)
+#endif
+#ifndef RHASH_IFNONE
+# define RHASH_IFNONE(x) (RHASH(x)->ifnone)
+#endif
+#ifndef RHASH_SIZE
+# define RHASH_SIZE(x) (RHASH(x)->tbl->num_entries)
+#endif
+#ifndef RHASH_EMPTY_P
+# define RHASH_EMPTY_P(x) (RHASH_SIZE(x) == 0)
+#endif
+#ifndef RSTRUCT_LEN
+# define RSTRUCT_LEN(x) RSTRUCT(x)->len
+#endif
+#ifndef RSTRUCT_PTR
+# define RSTRUCT_PTR(x) RSTRUCT(x)->ptr
+#endif
+
+
+
+/*
+ * Need to be very careful about how these macros are defined, especially
+ * when compiling C++ code or C code with an ANSI C compiler.
+ *
+ * VALUEFUNC(f) is a macro used to typecast a C function that implements
+ * a Ruby method so that it can be passed as an argument to API functions
+ * like rb_define_method() and rb_define_singleton_method().
+ *
+ * VOIDFUNC(f) is a macro used to typecast a C function that implements
+ * either the "mark" or "free" stuff for a Ruby Data object, so that it
+ * can be passed as an argument to API functions like Data_Wrap_Struct()
+ * and Data_Make_Struct().
+ */
+
+#ifdef __cplusplus
+# ifndef RUBY_METHOD_FUNC /* These definitions should work for Ruby 1.4.6 */
+# define PROTECTFUNC(f) ((VALUE (*)()) f)
+# define VALUEFUNC(f) ((VALUE (*)()) f)
+# define VOIDFUNC(f) ((void (*)()) f)
+# else
+# ifndef ANYARGS /* These definitions should work for Ruby 1.6 */
+# define PROTECTFUNC(f) ((VALUE (*)()) f)
+# define VALUEFUNC(f) ((VALUE (*)()) f)
+# define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
+# else /* These definitions should work for Ruby 1.7+ */
+# define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f)
+# define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f)
+# define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
+# endif
+# endif
+#else
+# define VALUEFUNC(f) (f)
+# define VOIDFUNC(f) (f)
+#endif
+
+/* Don't use for expressions have side effect */
+#ifndef RB_STRING_VALUE
+#define RB_STRING_VALUE(s) (TYPE(s) == T_STRING ? (s) : (*(volatile VALUE *)&(s) = rb_str_to_str(s)))
+#endif
+#ifndef StringValue
+#define StringValue(s) RB_STRING_VALUE(s)
+#endif
+#ifndef StringValuePtr
+#define StringValuePtr(s) RSTRING_PTR(RB_STRING_VALUE(s))
+#endif
+#ifndef StringValueLen
+#define StringValueLen(s) RSTRING_LEN(RB_STRING_VALUE(s))
+#endif
+#ifndef SafeStringValue
+#define SafeStringValue(v) do {\
+ StringValue(v);\
+ rb_check_safe_str(v);\
+} while (0)
+#endif
+
+#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
+#define rb_define_alloc_func(klass, func) rb_define_singleton_method((klass), "new", VALUEFUNC((func)), -1)
+#define rb_undef_alloc_func(klass) rb_undef_method(CLASS_OF((klass)), "new")
+#endif
+
+static VALUE _mSWIG = Qnil;
diff --git a/share/swig/2.0.11/ruby/rubyinit.swg b/share/swig/2.0.11/ruby/rubyinit.swg
new file mode 100644
index 0000000..fc6e039
--- /dev/null
+++ b/share/swig/2.0.11/ruby/rubyinit.swg
@@ -0,0 +1 @@
+%insert(initbeforefunc) "swiginit.swg"
diff --git a/share/swig/2.0.11/ruby/rubyiterators.swg b/share/swig/2.0.11/ruby/rubyiterators.swg
new file mode 100644
index 0000000..88f1e7c
--- /dev/null
+++ b/share/swig/2.0.11/ruby/rubyiterators.swg
@@ -0,0 +1,932 @@
+/* -----------------------------------------------------------------------------
+ * rubyiterators.swg
+ *
+ * Implement a C++ 'output' iterator for Ruby.
+ *
+ * Users can derive form the Iterator to implemet their
+ * own iterators. As an example (real one since we use it for STL/STD
+ * containers), the template Iterator_T does the
+ * implementation for generic C++ iterators.
+ * ----------------------------------------------------------------------------- */
+
+%include <std_common.i>
+
+
+%fragment("ConstIterator","header",fragment="<stddef.h>",fragment="GC_VALUE_definition") {
+namespace swig {
+ struct stop_iteration {
+ };
+
+ /**
+ * Abstract base class used to represent all iterators of STL containers.
+ */
+ struct ConstIterator {
+ public:
+ typedef ConstIterator self_type;
+
+ protected:
+ GC_VALUE _seq;
+
+ protected:
+ ConstIterator(VALUE seq) : _seq(seq)
+ {
+ }
+
+ // Random access iterator methods, but not required in Ruby
+ virtual ptrdiff_t distance(const ConstIterator &x) const
+ {
+ throw std::invalid_argument("distance not supported");
+ }
+
+ virtual bool equal (const ConstIterator &x) const
+ {
+ throw std::invalid_argument("equal not supported");
+ }
+
+ virtual self_type* advance(ptrdiff_t n)
+ {
+ throw std::invalid_argument("advance not supported");
+ }
+
+ public:
+ virtual ~ConstIterator() {}
+
+ // Access iterator method, required by Ruby
+ virtual VALUE value() const {
+ throw std::invalid_argument("value not supported");
+ return Qnil;
+ };
+
+ virtual VALUE setValue( const VALUE& v ) {
+ throw std::invalid_argument("value= not supported");
+ return Qnil;
+ }
+
+ virtual self_type* next( size_t n = 1 )
+ {
+ return this->advance( n );
+ }
+
+ virtual self_type* previous( size_t n = 1 )
+ {
+ ptrdiff_t nn = n;
+ return this->advance( -nn );
+ }
+
+ virtual VALUE to_s() const {
+ throw std::invalid_argument("to_s not supported");
+ return Qnil;
+ }
+
+ virtual VALUE inspect() const {
+ throw std::invalid_argument("inspect not supported");
+ return Qnil;
+ }
+
+ virtual ConstIterator *dup() const
+ {
+ throw std::invalid_argument("dup not supported");
+ return NULL;
+ }
+
+ //
+ // C++ common/needed methods. We emulate a bidirectional
+ // operator, to be compatible with all the STL.
+ // The iterator traits will then tell the STL what type of
+ // iterator we really are.
+ //
+ ConstIterator() : _seq( Qnil )
+ {
+ }
+
+ ConstIterator( const self_type& b ) : _seq( b._seq )
+ {
+ }
+
+ self_type& operator=( const self_type& b )
+ {
+ _seq = b._seq;
+ return *this;
+ }
+
+ bool operator == (const ConstIterator& x) const
+ {
+ return equal(x);
+ }
+
+ bool operator != (const ConstIterator& x) const
+ {
+ return ! operator==(x);
+ }
+
+ // Pre-decrement operator
+ self_type& operator--()
+ {
+ return *previous();
+ }
+
+ // Pre-increment operator
+ self_type& operator++()
+ {
+ return *next();
+ }
+
+ // Post-decrement operator
+ self_type operator--(int)
+ {
+ self_type r = *this;
+ previous();
+ return r;
+ }
+
+ // Post-increment operator
+ self_type operator++(int)
+ {
+ self_type r = *this;
+ next();
+ return r;
+ }
+
+ ConstIterator& operator += (ptrdiff_t n)
+ {
+ return *advance(n);
+ }
+
+ ConstIterator& operator -= (ptrdiff_t n)
+ {
+ return *advance(-n);
+ }
+
+ ConstIterator* operator + (ptrdiff_t n) const
+ {
+ return dup()->advance(n);
+ }
+
+ ConstIterator* operator - (ptrdiff_t n) const
+ {
+ return dup()->advance(-n);
+ }
+
+ ptrdiff_t operator - (const ConstIterator& x) const
+ {
+ return x.distance(*this);
+ }
+
+ static swig_type_info* descriptor() {
+ static int init = 0;
+ static swig_type_info* desc = 0;
+ if (!init) {
+ desc = SWIG_TypeQuery("swig::ConstIterator *");
+ init = 1;
+ }
+ return desc;
+ }
+ };
+
+
+ /**
+ * Abstract base class used to represent all non-const iterators of STL containers.
+ *
+ */
+ struct Iterator : public ConstIterator {
+ public:
+ typedef Iterator self_type;
+
+ protected:
+ Iterator(VALUE seq) : ConstIterator(seq)
+ {
+ }
+
+ virtual self_type* advance(ptrdiff_t n)
+ {
+ throw std::invalid_argument("operation not supported");
+ }
+
+ public:
+ static swig_type_info* descriptor() {
+ static int init = 0;
+ static swig_type_info* desc = 0;
+ if (!init) {
+ desc = SWIG_TypeQuery("swig::Iterator *");
+ init = 1;
+ }
+ return desc;
+ }
+
+ virtual Iterator *dup() const
+ {
+ throw std::invalid_argument("dup not supported");
+ return NULL;
+ }
+
+ virtual self_type* next( size_t n = 1 )
+ {
+ return this->advance( n );
+ }
+
+ virtual self_type* previous( size_t n = 1 )
+ {
+ ptrdiff_t nn = n;
+ return this->advance( -nn );
+ }
+
+ bool operator == (const ConstIterator& x) const
+ {
+ return equal(x);
+ }
+
+ bool operator != (const Iterator& x) const
+ {
+ return ! operator==(x);
+ }
+
+ Iterator& operator += (ptrdiff_t n)
+ {
+ return *advance(n);
+ }
+
+ Iterator& operator -= (ptrdiff_t n)
+ {
+ return *advance(-n);
+ }
+
+ Iterator* operator + (ptrdiff_t n) const
+ {
+ return dup()->advance(n);
+ }
+
+ Iterator* operator - (ptrdiff_t n) const
+ {
+ return dup()->advance(-n);
+ }
+
+ ptrdiff_t operator - (const Iterator& x) const
+ {
+ return x.distance(*this);
+ }
+ };
+
+}
+}
+
+
+%fragment("ConstIterator_T","header",fragment="<stddef.h>",fragment="ConstIterator",fragment="StdTraits",fragment="StdIteratorTraits") {
+namespace swig {
+
+ /**
+ * Templated base classes for all custom const_iterators.
+ *
+ */
+ template<typename OutConstIterator>
+ class ConstIterator_T : public ConstIterator
+ {
+ public:
+ typedef OutConstIterator const_iter;
+ typedef typename std::iterator_traits<const_iter>::value_type value_type;
+ typedef ConstIterator_T<const_iter> self_type;
+
+ protected:
+
+
+ virtual bool equal (const ConstIterator &iter) const
+ {
+ const self_type *iters = dynamic_cast<const self_type *>(&iter);
+ if (iters) {
+ return (current == iters->get_current());
+ } else {
+ throw std::invalid_argument("bad iterator type");
+ }
+ }
+
+ virtual ptrdiff_t distance(const ConstIterator &iter) const
+ {
+ const self_type *iters = dynamic_cast<const self_type *>(&iter);
+ if (iters) {
+ return std::distance(current, iters->get_current());
+ } else {
+ throw std::invalid_argument("bad iterator type");
+ }
+ }
+
+ virtual ConstIterator* advance(ptrdiff_t n)
+ {
+ std::advance( current, n );
+ return this;
+ }
+
+ public:
+ ConstIterator_T() : ConstIterator(Qnil)
+ {
+ }
+
+ ConstIterator_T(const_iter curr, VALUE seq = Qnil)
+ : ConstIterator(seq), current(curr)
+ {
+ }
+
+ const const_iter& get_current() const
+ {
+ return current;
+ }
+
+ const value_type& operator*() const
+ {
+ return *current;
+ }
+
+ virtual VALUE inspect() const
+ {
+ VALUE ret = rb_str_new2("#<");
+ ret = rb_str_cat2( ret, rb_obj_classname(_seq) );
+ ret = rb_str_cat2( ret, "::const_iterator " );
+ VALUE cur = value();
+ ret = rb_str_concat( ret, rb_inspect(cur) );
+ ret = rb_str_cat2( ret, ">" );
+ return ret;
+ }
+
+ virtual VALUE to_s() const
+ {
+ VALUE ret = rb_str_new2( rb_obj_classname(_seq) );
+ ret = rb_str_cat2( ret, "::const_iterator " );
+ VALUE cur = value();
+ ret = rb_str_concat( ret, rb_obj_as_string(cur) );
+ return ret;
+ }
+
+ protected:
+ const_iter current;
+ };
+
+
+ /**
+ * Templated base classes for all custom non-const iterators.
+ *
+ */
+ template<typename InOutIterator>
+ class Iterator_T : public Iterator
+ {
+ public:
+ typedef InOutIterator nonconst_iter;
+
+ // Make this class iterator STL compatible, by using iterator_traits
+ typedef typename std::iterator_traits<nonconst_iter >::iterator_category iterator_category;
+ typedef typename std::iterator_traits<nonconst_iter >::value_type value_type;
+ typedef typename std::iterator_traits<nonconst_iter >::difference_type difference_type;
+ typedef typename std::iterator_traits<nonconst_iter >::pointer pointer;
+ typedef typename std::iterator_traits<nonconst_iter >::reference reference;
+
+ typedef Iterator base;
+ typedef Iterator_T< nonconst_iter > self_type;
+
+ protected:
+
+ virtual bool equal (const ConstIterator &iter) const
+ {
+ const self_type *iters = dynamic_cast<const self_type *>(&iter);
+ if (iters) {
+ return (current == iters->get_current());
+ } else {
+ throw std::invalid_argument("bad iterator type");
+ }
+ }
+
+ virtual ptrdiff_t distance(const ConstIterator &iter) const
+ {
+ const self_type *iters = dynamic_cast<const self_type *>(&iter);
+ if (iters) {
+ return std::distance(current, iters->get_current());
+ } else {
+ throw std::invalid_argument("bad iterator type");
+ }
+ }
+
+ virtual Iterator* advance(ptrdiff_t n)
+ {
+ std::advance( current, n );
+ return this;
+ }
+
+ public:
+
+ Iterator_T(nonconst_iter curr, VALUE seq = Qnil)
+ : Iterator(seq), current(curr)
+ {
+ }
+
+ const nonconst_iter& get_current() const
+ {
+ return current;
+ }
+
+ self_type& operator=( const self_type& b )
+ {
+ base::operator=( b );
+ return *this;
+ }
+
+ self_type& operator=( const value_type& b )
+ {
+ *current = b;
+ return *this;
+ }
+
+ const value_type& operator*() const
+ {
+ return *current;
+ }
+
+ value_type& operator*()
+ {
+ return *current;
+ }
+
+ virtual VALUE inspect() const
+ {
+ VALUE ret = rb_str_new2("#<");
+ ret = rb_str_cat2( ret, rb_obj_classname(_seq) );
+ ret = rb_str_cat2( ret, "::iterator " );
+ VALUE cur = value();
+ ret = rb_str_concat( ret, rb_inspect(cur) );
+ ret = rb_str_cat2( ret, ">" );
+ return ret;
+ }
+
+ virtual VALUE to_s() const
+ {
+ VALUE ret = rb_str_new2( rb_obj_classname(_seq) );
+ ret = rb_str_cat2( ret, "::iterator " );
+ VALUE cur = value();
+ ret = rb_str_concat( ret, rb_obj_as_string(cur) );
+ return ret;
+ }
+
+ protected:
+ nonconst_iter current;
+ };
+
+
+ /**
+ * Auxiliary functor to store the value of a ruby object inside
+ * a reference of a compatible C++ type. ie: Ruby -> C++
+ *
+ */
+ template <class ValueType>
+ struct asval_oper
+ {
+ typedef ValueType value_type;
+ typedef bool result_type;
+ bool operator()(VALUE obj, value_type& v) const
+ {
+ return ( swig::asval< value_type >(obj, &v) == SWIG_OK );
+ }
+ };
+
+ /**
+ * Auxiliary functor to return a ruby object from a C++ type.
+ * ie: C++ -> Ruby
+ *
+ */
+ template <class ValueType>
+ struct from_oper
+ {
+ typedef const ValueType& argument_type;
+ typedef VALUE result_type;
+ result_type operator()(argument_type v) const
+ {
+ return swig::from(v);
+ }
+ };
+
+
+ /**
+ * ConstIterator class for a const_iterator with no end() boundaries.
+ *
+ */
+ template<typename OutConstIterator,
+ typename ValueType = typename std::iterator_traits<OutConstIterator>::value_type,
+ typename FromOper = from_oper<ValueType> >
+ class ConstIteratorOpen_T : public ConstIterator_T<OutConstIterator>
+ {
+ public:
+ FromOper from;
+ typedef OutConstIterator const_iter;
+ typedef ValueType value_type;
+ typedef ConstIterator_T<const_iter> base;
+ typedef ConstIteratorOpen_T<OutConstIterator, ValueType, FromOper> self_type;
+
+ ConstIteratorOpen_T(const_iter curr, VALUE seq = Qnil)
+ : ConstIterator_T<OutConstIterator>(curr, seq)
+ {
+ }
+
+ virtual VALUE value() const {
+ return from(static_cast<const value_type&>(*(base::current)));
+ }
+
+ ConstIterator *dup() const
+ {
+ return new self_type(*this);
+ }
+ };
+
+ /**
+ * Iterator class for an iterator with no end() boundaries.
+ *
+ */
+ template<typename InOutIterator,
+ typename ValueType = typename std::iterator_traits<InOutIterator>::value_type,
+ typename FromOper = from_oper<ValueType>,
+ typename AsvalOper = asval_oper<ValueType> >
+ class IteratorOpen_T : public Iterator_T<InOutIterator>
+ {
+ public:
+ FromOper from;
+ AsvalOper asval;
+ typedef InOutIterator nonconst_iter;
+ typedef ValueType value_type;
+ typedef Iterator_T<nonconst_iter> base;
+ typedef IteratorOpen_T<InOutIterator, ValueType, FromOper, AsvalOper> self_type;
+
+ public:
+ IteratorOpen_T(nonconst_iter curr, VALUE seq = Qnil)
+ : Iterator_T<InOutIterator>(curr, seq)
+ {
+ }
+
+ virtual VALUE value() const {
+ return from(static_cast<const value_type&>(*(base::current)));
+ }
+
+ virtual VALUE setValue( const VALUE& v )
+ {
+ value_type& dst = *base::current;
+ if ( asval(v, dst) ) return v;
+ return Qnil;
+ }
+
+ Iterator *dup() const
+ {
+ return new self_type(*this);
+ }
+ };
+
+ /**
+ * ConstIterator class for a const_iterator where begin() and end() boundaries are known.
+ *
+ */
+ template<typename OutConstIterator,
+ typename ValueType = typename std::iterator_traits<OutConstIterator>::value_type,
+ typename FromOper = from_oper<ValueType> >
+ class ConstIteratorClosed_T : public ConstIterator_T<OutConstIterator>
+ {
+ public:
+ FromOper from;
+ typedef OutConstIterator const_iter;
+ typedef ValueType value_type;
+ typedef ConstIterator_T<const_iter> base;
+ typedef ConstIteratorClosed_T<OutConstIterator, ValueType, FromOper> self_type;
+
+ protected:
+ virtual ConstIterator* advance(ptrdiff_t n)
+ {
+ std::advance( base::current, n );
+ if ( base::current == end )
+ throw stop_iteration();
+ return this;
+ }
+
+ public:
+ ConstIteratorClosed_T(const_iter curr, const_iter first,
+ const_iter last, VALUE seq = Qnil)
+ : ConstIterator_T<OutConstIterator>(curr, seq), begin(first), end(last)
+ {
+ }
+
+ virtual VALUE value() const {
+ if (base::current == end) {
+ throw stop_iteration();
+ } else {
+ return from(static_cast<const value_type&>(*(base::current)));
+ }
+ }
+
+ ConstIterator *dup() const
+ {
+ return new self_type(*this);
+ }
+
+
+ private:
+ const_iter begin;
+ const_iter end;
+ };
+
+ /**
+ * Iterator class for a iterator where begin() and end() boundaries are known.
+ *
+ */
+ template<typename InOutIterator,
+ typename ValueType = typename std::iterator_traits<InOutIterator>::value_type,
+ typename FromOper = from_oper<ValueType>,
+ typename AsvalOper = asval_oper<ValueType> >
+ class IteratorClosed_T : public Iterator_T<InOutIterator>
+ {
+ public:
+ FromOper from;
+ AsvalOper asval;
+ typedef InOutIterator nonconst_iter;
+ typedef ValueType value_type;
+ typedef Iterator_T<nonconst_iter> base;
+ typedef IteratorClosed_T<InOutIterator, ValueType, FromOper, AsvalOper> self_type;
+
+ protected:
+ virtual Iterator* advance(ptrdiff_t n)
+ {
+ std::advance( base::current, n );
+ if ( base::current == end )
+ throw stop_iteration();
+ return this;
+ }
+
+ public:
+ IteratorClosed_T(nonconst_iter curr, nonconst_iter first,
+ nonconst_iter last, VALUE seq = Qnil)
+ : Iterator_T<InOutIterator>(curr, seq), begin(first), end(last)
+ {
+ }
+
+ virtual VALUE value() const {
+ if (base::current == end) {
+ throw stop_iteration();
+ } else {
+ return from(static_cast<const value_type&>(*(base::current)));
+ }
+ }
+
+ // Iterator setter method, required by Ruby
+ virtual VALUE setValue( const VALUE& v )
+ {
+ if (base::current == end)
+ throw stop_iteration();
+
+ value_type& dst = *base::current;
+ if ( asval( v, dst ) ) return v;
+ return Qnil;
+ }
+
+ Iterator *dup() const
+ {
+ return new self_type(*this);
+ }
+
+ private:
+ nonconst_iter begin;
+ nonconst_iter end;
+ };
+
+ /* Partial specialization for bools which don't allow de-referencing */
+ template< typename InOutIterator, typename FromOper, typename AsvalOper >
+ class IteratorOpen_T< InOutIterator, bool, FromOper, AsvalOper > :
+ public Iterator_T<InOutIterator>
+ {
+ public:
+ FromOper from;
+ AsvalOper asval;
+ typedef InOutIterator nonconst_iter;
+ typedef bool value_type;
+ typedef Iterator_T<nonconst_iter> base;
+ typedef IteratorOpen_T<InOutIterator, bool, FromOper, AsvalOper> self_type;
+
+ IteratorOpen_T(nonconst_iter curr, VALUE seq = Qnil)
+ : Iterator_T<InOutIterator>(curr, seq)
+ {
+ }
+
+ virtual VALUE value() const {
+ return from(static_cast<const value_type&>(*(base::current)));
+ }
+
+ virtual VALUE setValue( const VALUE& v )
+ {
+ bool tmp = *base::current;
+ if ( asval( v, tmp ) )
+ {
+ *base::current = tmp;
+ return v;
+ }
+ return Qnil;
+ }
+
+ Iterator *dup() const
+ {
+ return new self_type(*this);
+ }
+
+ };
+
+ /* Partial specialization for bools which don't allow de-referencing */
+ template< typename InOutIterator, typename FromOper, typename AsvalOper >
+ class IteratorClosed_T< InOutIterator, bool, FromOper, AsvalOper > :
+ public Iterator_T<InOutIterator>
+ {
+ public:
+ FromOper from;
+ AsvalOper asval;
+ typedef InOutIterator nonconst_iter;
+ typedef bool value_type;
+ typedef Iterator_T<nonconst_iter> base;
+ typedef IteratorClosed_T<InOutIterator, bool, FromOper, AsvalOper> self_type;
+
+ protected:
+ virtual Iterator* advance(ptrdiff_t n)
+ {
+ std::advance( base::current, n );
+ if ( base::current == end )
+ throw stop_iteration();
+ return this;
+ }
+
+ public:
+ IteratorClosed_T(nonconst_iter curr, nonconst_iter first,
+ nonconst_iter last, VALUE seq = Qnil)
+ : Iterator_T<InOutIterator>(curr, seq), begin(first), end(last)
+ {
+ }
+
+ virtual VALUE value() const {
+ if (base::current == end) {
+ throw stop_iteration();
+ } else {
+ return from(static_cast<const value_type&>(*(base::current)));
+ }
+ }
+
+ virtual VALUE setValue( const VALUE& v )
+ {
+ if (base::current == end)
+ throw stop_iteration();
+
+ bool tmp = *base::current;
+ if ( asval( v, tmp ) )
+ {
+ *base::current = tmp;
+ return v;
+ }
+ return Qnil;
+ }
+
+ Iterator *dup() const
+ {
+ return new self_type(*this);
+ }
+
+ private:
+ nonconst_iter begin;
+ nonconst_iter end;
+ };
+
+
+ /**
+ * Helper function used to wrap a bounded const_iterator. This is to be used in
+ * a %typemap(out), for example.
+ *
+ */
+ template<typename InOutIter>
+ inline Iterator*
+ make_nonconst_iterator(const InOutIter& current, const InOutIter& begin,
+ const InOutIter& end, VALUE seq = Qnil)
+ {
+ return new IteratorClosed_T<InOutIter>(current, begin, end, seq);
+ }
+
+ /**
+ * Helper function used to wrap an unbounded const_iterator. This is to be used in
+ * a %typemap(out), for example.
+ *
+ */
+ template<typename InOutIter>
+ inline Iterator*
+ make_nonconst_iterator(const InOutIter& current, VALUE seq = Qnil)
+ {
+ return new IteratorOpen_T<InOutIter>(current, seq);
+ }
+
+ /**
+ * Helper function used to wrap a bounded const_iterator. This is to be used in
+ * a %typemap(out), for example.
+ *
+ */
+ template<typename OutIter>
+ inline ConstIterator*
+ make_const_iterator(const OutIter& current, const OutIter& begin,
+ const OutIter& end, VALUE seq = Qnil)
+ {
+ return new ConstIteratorClosed_T<OutIter>(current, begin, end, seq);
+ }
+
+ /**
+ * Helper function used to wrap an unbounded const_iterator. This is to be used in
+ * a %typemap(out), for example.
+ *
+ */
+ template<typename OutIter>
+ inline ConstIterator*
+ make_const_iterator(const OutIter& current, VALUE seq = Qnil)
+ {
+ return new ConstIteratorOpen_T<OutIter>(current, seq);
+ }
+}
+}
+
+
+%fragment("ConstIterator");
+
+
+//
+// This part is just so SWIG is aware of the base abstract iterator class.
+//
+namespace swig
+{
+ /*
+ Throw a StopIteration exception
+ */
+ %ignore stop_iteration;
+ struct stop_iteration {};
+
+ %typemap(throws) stop_iteration {
+ (void)$1;
+ SWIG_Ruby_ExceptionType(NULL, Qnil);
+ SWIG_fail;
+ }
+
+ /*
+ Mark methods that return new objects
+ */
+ %newobject ConstIterator::dup;
+ %newobject ConstIterator::operator + (ptrdiff_t n) const;
+ %newobject ConstIterator::operator - (ptrdiff_t n) const;
+
+ %nodirector ConstIterator;
+
+ %catches(swig::stop_iteration) ConstIterator::value() const;
+ %catches(swig::stop_iteration) ConstIterator::incr(size_t n = 1);
+ %catches(swig::stop_iteration) ConstIterator::decr(size_t n = 1);
+ %catches(std::invalid_argument) ConstIterator::distance(const ConstIterator &x) const;
+ %catches(std::invalid_argument) ConstIterator::equal (const ConstIterator &x) const;
+ %catches(swig::stop_iteration) ConstIterator::next();
+ %catches(swig::stop_iteration) ConstIterator::previous();
+ %catches(swig::stop_iteration) ConstIterator::advance(ptrdiff_t n);
+ %catches(swig::stop_iteration) ConstIterator::operator += (ptrdiff_t n);
+ %catches(swig::stop_iteration) ConstIterator::operator -= (ptrdiff_t n);
+ %catches(swig::stop_iteration) ConstIterator::operator + (ptrdiff_t n) const;
+ %catches(swig::stop_iteration) ConstIterator::operator - (ptrdiff_t n) const;
+
+
+ struct ConstIterator
+ {
+ protected:
+ ConstIterator(VALUE seq);
+
+ public:
+ virtual ~ConstIterator();
+
+ // Access iterator method, required by Ruby
+ virtual VALUE value() const;
+
+ // C++ common/needed methods
+ virtual ConstIterator *dup() const;
+
+ virtual VALUE inspect() const;
+ virtual VALUE to_s() const;
+
+ virtual ConstIterator* next(size_t n = 1);
+ virtual ConstIterator* previous(size_t n = 1);
+
+ bool operator == (const ConstIterator& x) const;
+ ConstIterator* operator + (ptrdiff_t n) const;
+ ConstIterator* operator - (ptrdiff_t n) const;
+ ptrdiff_t operator - (const ConstIterator& x) const;
+ };
+
+ struct Iterator : public ConstIterator
+ {
+ %rename("value=") setValue( const VALUE& v );
+ virtual VALUE setValue( const VALUE& v );
+
+ virtual Iterator *dup() const;
+
+ virtual Iterator* next(size_t n = 1);
+ virtual Iterator* previous(size_t n = 1);
+
+ virtual VALUE inspect() const;
+ virtual VALUE to_s() const;
+
+ bool operator == (const Iterator& x) const;
+ Iterator* operator + (ptrdiff_t n) const;
+ Iterator* operator - (ptrdiff_t n) const;
+ ptrdiff_t operator - (const Iterator& x) const;
+ };
+
+}
+
diff --git a/share/swig/2.0.11/ruby/rubykw.swg b/share/swig/2.0.11/ruby/rubykw.swg
new file mode 100644
index 0000000..194687b
--- /dev/null
+++ b/share/swig/2.0.11/ruby/rubykw.swg
@@ -0,0 +1,72 @@
+#ifndef RUBY_RUBYKW_SWG_
+#define RUBY_RUBYKW_SWG_
+
+/* Warnings for Ruby keywords */
+#define RUBYKW(x) %keywordwarn("'" `x` "' is a ruby keyword, renaming to 'C_" `x` "'",rename="C_%s",fullname=1) `x`
+
+/*
+
+ from http://www.rubycentral.com/book/language.html
+
+*/
+
+RUBYKW(BEGIN);
+RUBYKW(END);
+RUBYKW(alias);
+RUBYKW(and);
+RUBYKW(begin);
+RUBYKW(break);
+RUBYKW(case);
+RUBYKW(class);
+RUBYKW(def);
+RUBYKW("defined");
+RUBYKW(do);
+RUBYKW(else);
+RUBYKW(elsif);
+RUBYKW(end);
+RUBYKW(ensure);
+RUBYKW(false);
+RUBYKW(fatal);
+RUBYKW(for);
+RUBYKW(if);
+RUBYKW(in);
+RUBYKW(module);
+RUBYKW(next);
+RUBYKW(nil);
+RUBYKW(not);
+RUBYKW(or);
+RUBYKW(redo);
+RUBYKW(rescue);
+RUBYKW(retry);
+RUBYKW(return);
+RUBYKW(self);
+RUBYKW(super);
+RUBYKW(then);
+RUBYKW(true);
+RUBYKW(undef);
+RUBYKW(unless);
+RUBYKW(until);
+RUBYKW(when);
+RUBYKW(while);
+RUBYKW(yield);
+
+// RUBYKW(FalseClass);
+// RUBYKW(TrueClass);
+// RUBYKW(Numeric);
+// RUBYKW(Integer);
+// RUBYKW(Fixnum);
+// RUBYKW(Float);
+// RUBYKW(Range);
+// RUBYKW(Array);
+// RUBYKW(String);
+// RUBYKW(IO);
+// RUBYKW(File);
+// RUBYKW(FileUtils);
+// RUBYKW(Find);
+// RUBYKW(Struct);
+// RUBYKW(OpenStruct);
+// RUBYKW(Regexp);
+
+#undef RUBYKW
+
+#endif //RUBY_RUBYKW_SWG_
diff --git a/share/swig/2.0.11/ruby/rubymacros.swg b/share/swig/2.0.11/ruby/rubymacros.swg
new file mode 100644
index 0000000..de2a52b
--- /dev/null
+++ b/share/swig/2.0.11/ruby/rubymacros.swg
@@ -0,0 +1,13 @@
+
+// Redefine these macros so argument index for ruby is done properly,
+// ignoring self and we get some more info about the input.
+#define %argfail_fmt(_type,_name,_argn) Ruby_Format_TypeError( "", _type, #_name, _argn, $input )
+
+#define %argnullref_fmt(_type,_name,_argn) Ruby_Format_TypeError(%nullref_fmt(), _type, #_name, _argn, $input)
+
+%{
+#define SWIG_RUBY_THREAD_BEGIN_BLOCK
+#define SWIG_RUBY_THREAD_END_BLOCK
+%}
+
+%include <typemaps/swigmacros.swg>
diff --git a/share/swig/2.0.11/ruby/rubyopers.swg b/share/swig/2.0.11/ruby/rubyopers.swg
new file mode 100644
index 0000000..d1ac8bf
--- /dev/null
+++ b/share/swig/2.0.11/ruby/rubyopers.swg
@@ -0,0 +1,55 @@
+/* ------------------------------------------------------------
+ * Overloaded operator support
+ * ------------------------------------------------------------ */
+
+#ifdef __cplusplus
+
+%rename(__add__) *::operator+;
+%rename(__pos__) *::operator+();
+%rename(__pos__) *::operator+() const;
+%rename(__sub__) *::operator-;
+%rename(__neg__) *::operator-();
+%rename(__neg__) *::operator-() const;
+%rename(__mul__) *::operator*;
+%rename(__div__) *::operator/;
+%rename(__mod__) *::operator%;
+%rename(__lshift__) *::operator<<;
+%rename(__rshift__) *::operator>>;
+%rename(__and__) *::operator&;
+%rename(__or__) *::operator|;
+%rename(__xor__) *::operator^;
+%rename(__invert__) *::operator~;
+%rename(__lt__) *::operator<;
+%rename(__le__) *::operator<=;
+%rename(__gt__) *::operator>;
+%rename(__ge__) *::operator>=;
+%rename(__eq__) *::operator==;
+
+/* Special cases */
+%rename(__call__) *::operator();
+
+/* Ignored inplace operators */
+%ignoreoperator(NOTEQUAL) operator!=;
+%ignoreoperator(PLUSEQ) operator+=;
+%ignoreoperator(MINUSEQ) operator-=;
+%ignoreoperator(MULEQ) operator*=;
+%ignoreoperator(DIVEQ) operator/=;
+%ignoreoperator(MODEQ) operator%=;
+%ignoreoperator(LSHIFTEQ) operator<<=;
+%ignoreoperator(RSHIFTEQ) operator>>=;
+%ignoreoperator(ANDEQ) operator&=;
+%ignoreoperator(OREQ) operator|=;
+%ignoreoperator(XOREQ) operator^=;
+
+/* Ignored operators */
+%ignoreoperator(LNOT) operator!;
+%ignoreoperator(LAND) operator&&;
+%ignoreoperator(LOR) operator||;
+%ignoreoperator(EQ) operator=;
+%ignoreoperator(PLUSPLUS) operator++;
+%ignoreoperator(MINUSMINUS) operator--;
+%ignoreoperator(ARROWSTAR) operator->*;
+%ignoreoperator(INDEX) operator[];
+
+
+#endif /* __cplusplus */
diff --git a/share/swig/2.0.11/ruby/rubyprimtypes.swg b/share/swig/2.0.11/ruby/rubyprimtypes.swg
new file mode 100644
index 0000000..df72e97
--- /dev/null
+++ b/share/swig/2.0.11/ruby/rubyprimtypes.swg
@@ -0,0 +1,216 @@
+/* -----------------------------------------------------------------------------
+ * rubyprimtypes.swg
+ * ----------------------------------------------------------------------------- */
+/* ------------------------------------------------------------
+ * Primitive Types
+ * ------------------------------------------------------------ */
+
+/* auxiliary ruby fail method */
+
+%fragment("SWIG_ruby_failed","header")
+{
+SWIGINTERN VALUE
+SWIG_ruby_failed(void)
+{
+ return Qnil;
+}
+}
+
+%define %ruby_aux_method(Type, Method, Action)
+SWIGINTERN VALUE SWIG_AUX_##Method##(VALUE *args)
+{
+ VALUE obj = args[0];
+ VALUE type = TYPE(obj);
+ Type *res = (Type *)(args[1]);
+ *res = Action;
+ return obj;
+}
+%enddef
+
+
+/* boolean */
+
+%fragment(SWIG_From_frag(bool),"header") {
+SWIGINTERNINLINE VALUE
+SWIG_From_dec(bool)(bool value)
+{
+ return value ? Qtrue : Qfalse;
+}
+}
+
+%fragment(SWIG_AsVal_frag(bool),"header",
+ fragment=SWIG_AsVal_frag(int)) {
+SWIGINTERN int
+SWIG_AsVal_dec(bool)(VALUE obj, bool *val)
+{
+ if (obj == Qtrue) {
+ if (val) *val = true;
+ return SWIG_OK;
+ } else if (obj == Qfalse) {
+ if (val) *val = false;
+ return SWIG_OK;
+ } else {
+ int res = 0;
+ if (SWIG_AsVal(int)(obj, &res) == SWIG_OK) {
+ if (val) *val = res ? true : false;
+ return SWIG_OK;
+ }
+ }
+ return SWIG_TypeError;
+}
+}
+
+/* long */
+
+%fragment(SWIG_From_frag(long),"header",
+ fragment="<limits.h>") {
+ %define_as(SWIG_From_dec(long), LONG2NUM)
+}
+
+%fragment(SWIG_AsVal_frag(long),"header",fragment="SWIG_ruby_failed") {
+%ruby_aux_method(long, NUM2LONG, type == T_FIXNUM ? NUM2LONG(obj) : rb_big2long(obj))
+
+SWIGINTERN int
+SWIG_AsVal_dec(long)(VALUE obj, long* val)
+{
+ VALUE type = TYPE(obj);
+ if ((type == T_FIXNUM) || (type == T_BIGNUM)) {
+ long v;
+ VALUE a[2];
+ a[0] = obj;
+ a[1] = (VALUE)(&v);
+ if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2LONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
+ if (val) *val = v;
+ return SWIG_OK;
+ }
+ }
+ return SWIG_TypeError;
+}
+}
+
+/* unsigned long */
+
+%fragment(SWIG_From_frag(unsigned long),"header",
+ fragment=SWIG_From_frag(long)) {
+SWIGINTERNINLINE VALUE
+SWIG_From_dec(unsigned long)(unsigned long value)
+{
+ return ULONG2NUM(value);
+}
+}
+
+%fragment(SWIG_AsVal_frag(unsigned long),"header",fragment="SWIG_ruby_failed") {
+%ruby_aux_method(unsigned long, NUM2ULONG, type == T_FIXNUM ? NUM2ULONG(obj) : rb_big2ulong(obj))
+
+SWIGINTERN int
+SWIG_AsVal_dec(unsigned long)(VALUE obj, unsigned long *val)
+{
+ VALUE type = TYPE(obj);
+ if ((type == T_FIXNUM) || (type == T_BIGNUM)) {
+ unsigned long v;
+ VALUE a[2];
+ a[0] = obj;
+ a[1] = (VALUE)(&v);
+ if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2ULONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
+ if (val) *val = v;
+ return SWIG_OK;
+ }
+ }
+ return SWIG_TypeError;
+}
+}
+
+/* long long */
+
+%fragment(SWIG_From_frag(long long),"header",
+ fragment=SWIG_From_frag(long),
+ fragment="<limits.h>") {
+SWIGINTERNINLINE VALUE
+SWIG_From_dec(long long)(long long value)
+{
+ return LL2NUM(value);
+}
+}
+
+%fragment(SWIG_AsVal_frag(long long),"header",fragment="SWIG_ruby_failed") {
+%ruby_aux_method(long long, NUM2LL, type == T_FIXNUM ? NUM2LL(obj) : rb_big2ll(obj))
+
+SWIGINTERN int
+SWIG_AsVal_dec(long long)(VALUE obj, long long *val)
+{
+ VALUE type = TYPE(obj);
+ if ((type == T_FIXNUM) || (type == T_BIGNUM)) {
+ long long v;
+ VALUE a[2];
+ a[0] = obj;
+ a[1] = (VALUE)(&v);
+ if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2LL), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
+ if (val) *val = v;
+ return SWIG_OK;
+ }
+ }
+ return SWIG_TypeError;
+}
+}
+
+/* unsigned long long */
+
+%fragment(SWIG_From_frag(unsigned long long),"header",
+ fragment=SWIG_From_frag(long long),
+ fragment="<limits.h>") {
+SWIGINTERNINLINE VALUE
+SWIG_From_dec(unsigned long long)(unsigned long long value)
+{
+ return ULL2NUM(value);
+}
+}
+
+%fragment(SWIG_AsVal_frag(unsigned long long),"header",fragment="SWIG_ruby_failed") {
+%ruby_aux_method(long long, NUM2ULL, type == T_FIXNUM ? NUM2ULL(obj) : rb_big2ull(obj))
+
+SWIGINTERN int
+SWIG_AsVal_dec(unsigned long long)(VALUE obj, unsigned long long *val)
+{
+ VALUE type = TYPE(obj);
+ if ((type == T_FIXNUM) || (type == T_BIGNUM)) {
+ unsigned long long v;
+ VALUE a[2];
+ a[0] = obj;
+ a[1] = (VALUE)(&v);
+ if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2ULL), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
+ if (val) *val = v;
+ return SWIG_OK;
+ }
+ }
+ return SWIG_TypeError;
+}
+}
+
+/* double */
+
+%fragment(SWIG_From_frag(double),"header") {
+ %define_as(SWIG_From_dec(double), rb_float_new)
+}
+
+%fragment(SWIG_AsVal_frag(double),"header",fragment="SWIG_ruby_failed") {
+%ruby_aux_method(double, NUM2DBL, NUM2DBL(obj))
+
+SWIGINTERN int
+SWIG_AsVal_dec(double)(VALUE obj, double *val)
+{
+ VALUE type = TYPE(obj);
+ if ((type == T_FLOAT) || (type == T_FIXNUM) || (type == T_BIGNUM)) {
+ double v;
+ VALUE a[2];
+ a[0] = obj;
+ a[1] = (VALUE)(&v);
+ if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2DBL), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
+ if (val) *val = v;
+ return SWIG_OK;
+ }
+ }
+ return SWIG_TypeError;
+}
+}
+
+
diff --git a/share/swig/2.0.11/ruby/rubyrun.swg b/share/swig/2.0.11/ruby/rubyrun.swg
new file mode 100644
index 0000000..e851b18
--- /dev/null
+++ b/share/swig/2.0.11/ruby/rubyrun.swg
@@ -0,0 +1,441 @@
+/* -----------------------------------------------------------------------------
+ * rubyrun.swg
+ *
+ * This file contains the runtime support for Ruby modules
+ * and includes code for managing global variables and pointer
+ * type checking.
+ * ----------------------------------------------------------------------------- */
+
+/* For backward compatibility only */
+#define SWIG_POINTER_EXCEPTION 0
+
+/* for raw pointers */
+#define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
+#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, own)
+#define SWIG_NewPointerObj(ptr, type, flags) SWIG_Ruby_NewPointerObj(ptr, type, flags)
+#define SWIG_AcquirePtr(ptr, own) SWIG_Ruby_AcquirePtr(ptr, own)
+#define swig_owntype ruby_owntype
+
+/* for raw packed data */
+#define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty, flags)
+#define SWIG_NewPackedObj(ptr, sz, type) SWIG_Ruby_NewPackedObj(ptr, sz, type)
+
+/* for class or struct pointers */
+#define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags)
+#define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags)
+
+/* for C or C++ function pointers */
+#define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_ConvertPtr(obj, pptr, type, 0)
+#define SWIG_NewFunctionPtrObj(ptr, type) SWIG_NewPointerObj(ptr, type, 0)
+
+/* for C++ member pointers, ie, member methods */
+#define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty)
+#define SWIG_NewMemberObj(ptr, sz, type) SWIG_Ruby_NewPackedObj(ptr, sz, type)
+
+
+/* Runtime API */
+
+#define SWIG_GetModule(clientdata) SWIG_Ruby_GetModule(clientdata)
+#define SWIG_SetModule(clientdata, pointer) SWIG_Ruby_SetModule(pointer)
+
+
+/* Error manipulation */
+
+#define SWIG_ErrorType(code) SWIG_Ruby_ErrorType(code)
+#define SWIG_Error(code, msg) rb_raise(SWIG_Ruby_ErrorType(code), "%s", msg)
+#define SWIG_fail goto fail
+
+
+/* Ruby-specific SWIG API */
+
+#define SWIG_InitRuntime() SWIG_Ruby_InitRuntime()
+#define SWIG_define_class(ty) SWIG_Ruby_define_class(ty)
+#define SWIG_NewClassInstance(value, ty) SWIG_Ruby_NewClassInstance(value, ty)
+#define SWIG_MangleStr(value) SWIG_Ruby_MangleStr(value)
+#define SWIG_CheckConvert(value, ty) SWIG_Ruby_CheckConvert(value, ty)
+
+#include "assert.h"
+
+/* -----------------------------------------------------------------------------
+ * pointers/data manipulation
+ * ----------------------------------------------------------------------------- */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct {
+ VALUE klass;
+ VALUE mImpl;
+ void (*mark)(void *);
+ void (*destroy)(void *);
+ int trackObjects;
+} swig_class;
+
+
+/* Global pointer used to keep some internal SWIG stuff */
+static VALUE _cSWIG_Pointer = Qnil;
+static VALUE swig_runtime_data_type_pointer = Qnil;
+
+/* Global IDs used to keep some internal SWIG stuff */
+static ID swig_arity_id = 0;
+static ID swig_call_id = 0;
+
+/*
+ If your swig extension is to be run within an embedded ruby and has
+ director callbacks, you should set -DRUBY_EMBEDDED during compilation.
+ This will reset ruby's stack frame on each entry point from the main
+ program the first time a virtual director function is invoked (in a
+ non-recursive way).
+ If this is not done, you run the risk of Ruby trashing the stack.
+*/
+
+#ifdef RUBY_EMBEDDED
+
+# define SWIG_INIT_STACK \
+ if ( !swig_virtual_calls ) { RUBY_INIT_STACK } \
+ ++swig_virtual_calls;
+# define SWIG_RELEASE_STACK --swig_virtual_calls;
+# define Ruby_DirectorTypeMismatchException(x) \
+ rb_raise( rb_eTypeError, "%s", x ); return c_result;
+
+ static unsigned int swig_virtual_calls = 0;
+
+#else /* normal non-embedded extension */
+
+# define SWIG_INIT_STACK
+# define SWIG_RELEASE_STACK
+# define Ruby_DirectorTypeMismatchException(x) \
+ throw Swig::DirectorTypeMismatchException( x );
+
+#endif /* RUBY_EMBEDDED */
+
+
+SWIGRUNTIME VALUE
+getExceptionClass(void) {
+ static int init = 0;
+ static VALUE rubyExceptionClass ;
+ if (!init) {
+ init = 1;
+ rubyExceptionClass = rb_const_get(_mSWIG, rb_intern("Exception"));
+ }
+ return rubyExceptionClass;
+}
+
+/* This code checks to see if the Ruby object being raised as part
+ of an exception inherits from the Ruby class Exception. If so,
+ the object is simply returned. If not, then a new Ruby exception
+ object is created and that will be returned to Ruby.*/
+SWIGRUNTIME VALUE
+SWIG_Ruby_ExceptionType(swig_type_info *desc, VALUE obj) {
+ VALUE exceptionClass = getExceptionClass();
+ if (rb_obj_is_kind_of(obj, exceptionClass)) {
+ return obj;
+ } else {
+ return rb_exc_new3(rb_eRuntimeError, rb_obj_as_string(obj));
+ }
+}
+
+/* Initialize Ruby runtime support */
+SWIGRUNTIME void
+SWIG_Ruby_InitRuntime(void)
+{
+ if (_mSWIG == Qnil) {
+ _mSWIG = rb_define_module("SWIG");
+ swig_call_id = rb_intern("call");
+ swig_arity_id = rb_intern("arity");
+ }
+}
+
+/* Define Ruby class for C type */
+SWIGRUNTIME void
+SWIG_Ruby_define_class(swig_type_info *type)
+{
+ VALUE klass;
+ char *klass_name = (char *) malloc(4 + strlen(type->name) + 1);
+ sprintf(klass_name, "TYPE%s", type->name);
+ if (NIL_P(_cSWIG_Pointer)) {
+ _cSWIG_Pointer = rb_define_class_under(_mSWIG, "Pointer", rb_cObject);
+ rb_undef_method(CLASS_OF(_cSWIG_Pointer), "new");
+ }
+ klass = rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer);
+ free((void *) klass_name);
+}
+
+/* Create a new pointer object */
+SWIGRUNTIME VALUE
+SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags)
+{
+ int own = flags & SWIG_POINTER_OWN;
+ int track;
+ char *klass_name;
+ swig_class *sklass;
+ VALUE klass;
+ VALUE obj;
+
+ if (!ptr)
+ return Qnil;
+
+ if (type->clientdata) {
+ sklass = (swig_class *) type->clientdata;
+
+ /* Are we tracking this class and have we already returned this Ruby object? */
+ track = sklass->trackObjects;
+ if (track) {
+ obj = SWIG_RubyInstanceFor(ptr);
+
+ /* Check the object's type and make sure it has the correct type.
+ It might not in cases where methods do things like
+ downcast methods. */
+ if (obj != Qnil) {
+ VALUE value = rb_iv_get(obj, "@__swigtype__");
+ const char* type_name = RSTRING_PTR(value);
+
+ if (strcmp(type->name, type_name) == 0) {
+ return obj;
+ }
+ }
+ }
+
+ /* Create a new Ruby object */
+ obj = Data_Wrap_Struct(sklass->klass, VOIDFUNC(sklass->mark),
+ ( own ? VOIDFUNC(sklass->destroy) :
+ (track ? VOIDFUNC(SWIG_RubyRemoveTracking) : 0 )
+ ), ptr);
+
+ /* If tracking is on for this class then track this object. */
+ if (track) {
+ SWIG_RubyAddTracking(ptr, obj);
+ }
+ } else {
+ klass_name = (char *) malloc(4 + strlen(type->name) + 1);
+ sprintf(klass_name, "TYPE%s", type->name);
+ klass = rb_const_get(_mSWIG, rb_intern(klass_name));
+ free((void *) klass_name);
+ obj = Data_Wrap_Struct(klass, 0, 0, ptr);
+ }
+ rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name));
+
+ return obj;
+}
+
+/* Create a new class instance (always owned) */
+SWIGRUNTIME VALUE
+SWIG_Ruby_NewClassInstance(VALUE klass, swig_type_info *type)
+{
+ VALUE obj;
+ swig_class *sklass = (swig_class *) type->clientdata;
+ obj = Data_Wrap_Struct(klass, VOIDFUNC(sklass->mark), VOIDFUNC(sklass->destroy), 0);
+ rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name));
+ return obj;
+}
+
+/* Get type mangle from class name */
+SWIGRUNTIMEINLINE char *
+SWIG_Ruby_MangleStr(VALUE obj)
+{
+ VALUE stype = rb_iv_get(obj, "@__swigtype__");
+ return StringValuePtr(stype);
+}
+
+/* Acquire a pointer value */
+typedef void (*ruby_owntype)(void*);
+
+SWIGRUNTIME ruby_owntype
+SWIG_Ruby_AcquirePtr(VALUE obj, ruby_owntype own) {
+ if (obj) {
+ ruby_owntype oldown = RDATA(obj)->dfree;
+ RDATA(obj)->dfree = own;
+ return oldown;
+ } else {
+ return 0;
+ }
+}
+
+/* Convert a pointer value */
+SWIGRUNTIME int
+SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags, ruby_owntype *own)
+{
+ char *c;
+ swig_cast_info *tc;
+ void *vptr = 0;
+
+ /* Grab the pointer */
+ if (NIL_P(obj)) {
+ *ptr = 0;
+ return SWIG_OK;
+ } else {
+ if (TYPE(obj) != T_DATA) {
+ return SWIG_ERROR;
+ }
+ Data_Get_Struct(obj, void, vptr);
+ }
+
+ if (own) *own = RDATA(obj)->dfree;
+
+ /* Check to see if the input object is giving up ownership
+ of the underlying C struct or C++ object. If so then we
+ need to reset the destructor since the Ruby object no
+ longer owns the underlying C++ object.*/
+ if (flags & SWIG_POINTER_DISOWN) {
+ /* Is tracking on for this class? */
+ int track = 0;
+ if (ty && ty->clientdata) {
+ swig_class *sklass = (swig_class *) ty->clientdata;
+ track = sklass->trackObjects;
+ }
+
+ if (track) {
+ /* We are tracking objects for this class. Thus we change the destructor
+ * to SWIG_RubyRemoveTracking. This allows us to
+ * remove the mapping from the C++ to Ruby object
+ * when the Ruby object is garbage collected. If we don't
+ * do this, then it is possible we will return a reference
+ * to a Ruby object that no longer exists thereby crashing Ruby. */
+ RDATA(obj)->dfree = SWIG_RubyRemoveTracking;
+ } else {
+ RDATA(obj)->dfree = 0;
+ }
+ }
+
+ /* Do type-checking if type info was provided */
+ if (ty) {
+ if (ty->clientdata) {
+ if (rb_obj_is_kind_of(obj, ((swig_class *) (ty->clientdata))->klass)) {
+ if (vptr == 0) {
+ /* The object has already been deleted */
+ return SWIG_ObjectPreviouslyDeletedError;
+ }
+ *ptr = vptr;
+ return SWIG_OK;
+ }
+ }
+ if ((c = SWIG_MangleStr(obj)) == NULL) {
+ return SWIG_ERROR;
+ }
+ tc = SWIG_TypeCheck(c, ty);
+ if (!tc) {
+ return SWIG_ERROR;
+ } else {
+ int newmemory = 0;
+ *ptr = SWIG_TypeCast(tc, vptr, &newmemory);
+ assert(!newmemory); /* newmemory handling not yet implemented */
+ }
+ } else {
+ *ptr = vptr;
+ }
+
+ return SWIG_OK;
+}
+
+/* Check convert */
+SWIGRUNTIMEINLINE int
+SWIG_Ruby_CheckConvert(VALUE obj, swig_type_info *ty)
+{
+ char *c = SWIG_MangleStr(obj);
+ if (!c) return 0;
+ return SWIG_TypeCheck(c,ty) != 0;
+}
+
+SWIGRUNTIME VALUE
+SWIG_Ruby_NewPackedObj(void *ptr, int sz, swig_type_info *type) {
+ char result[1024];
+ char *r = result;
+ if ((2*sz + 1 + strlen(type->name)) > 1000) return 0;
+ *(r++) = '_';
+ r = SWIG_PackData(r, ptr, sz);
+ strcpy(r, type->name);
+ return rb_str_new2(result);
+}
+
+/* Convert a packed value value */
+SWIGRUNTIME int
+SWIG_Ruby_ConvertPacked(VALUE obj, void *ptr, int sz, swig_type_info *ty) {
+ swig_cast_info *tc;
+ const char *c;
+
+ if (TYPE(obj) != T_STRING) goto type_error;
+ c = StringValuePtr(obj);
+ /* Pointer values must start with leading underscore */
+ if (*c != '_') goto type_error;
+ c++;
+ c = SWIG_UnpackData(c, ptr, sz);
+ if (ty) {
+ tc = SWIG_TypeCheck(c, ty);
+ if (!tc) goto type_error;
+ }
+ return SWIG_OK;
+
+ type_error:
+ return SWIG_ERROR;
+}
+
+SWIGRUNTIME swig_module_info *
+SWIG_Ruby_GetModule(void *SWIGUNUSEDPARM(clientdata))
+{
+ VALUE pointer;
+ swig_module_info *ret = 0;
+ VALUE verbose = rb_gv_get("VERBOSE");
+
+ /* temporarily disable warnings, since the pointer check causes warnings with 'ruby -w' */
+ rb_gv_set("VERBOSE", Qfalse);
+
+ /* first check if pointer already created */
+ pointer = rb_gv_get("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
+ if (pointer != Qnil) {
+ Data_Get_Struct(pointer, swig_module_info, ret);
+ }
+
+ /* reinstate warnings */
+ rb_gv_set("VERBOSE", verbose);
+ return ret;
+}
+
+SWIGRUNTIME void
+SWIG_Ruby_SetModule(swig_module_info *pointer)
+{
+ /* register a new class */
+ VALUE cl = rb_define_class("swig_runtime_data", rb_cObject);
+ /* create and store the structure pointer to a global variable */
+ swig_runtime_data_type_pointer = Data_Wrap_Struct(cl, 0, 0, pointer);
+ rb_define_readonly_variable("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, &swig_runtime_data_type_pointer);
+}
+
+/* This function can be used to check whether a proc or method or similarly
+ callable function has been passed. Usually used in a %typecheck, like:
+
+ %typecheck(c_callback_t, precedence=SWIG_TYPECHECK_POINTER) {
+ $result = SWIG_Ruby_isCallable( $input );
+ }
+ */
+SWIGINTERN
+int SWIG_Ruby_isCallable( VALUE proc )
+{
+ if ( rb_respond_to( proc, swig_call_id ) )
+ return 1;
+ return 0;
+}
+
+/* This function can be used to check the arity (number of arguments)
+ a proc or method can take. Usually used in a %typecheck.
+ Valid arities will be that equal to minimal or those < 0
+ which indicate a variable number of parameters at the end.
+ */
+SWIGINTERN
+int SWIG_Ruby_arity( VALUE proc, int minimal )
+{
+ if ( rb_respond_to( proc, swig_arity_id ) )
+ {
+ VALUE num = rb_funcall( proc, swig_arity_id, 0 );
+ int arity = NUM2INT(num);
+ if ( arity < 0 && (arity+1) < -minimal ) return 1;
+ if ( arity == minimal ) return 1;
+ return 1;
+ }
+ return 0;
+}
+
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/share/swig/2.0.11/ruby/rubyruntime.swg b/share/swig/2.0.11/ruby/rubyruntime.swg
new file mode 100644
index 0000000..4121561
--- /dev/null
+++ b/share/swig/2.0.11/ruby/rubyruntime.swg
@@ -0,0 +1,9 @@
+
+%runtime "swiglabels.swg" /* Common C API type-checking code */
+%runtime "swigrun.swg" /* Common C API type-checking code */
+%runtime "swigerrors.swg" /* SWIG errors */
+%runtime "rubyhead.swg" /* Ruby includes and fixes */
+%runtime "rubyerrors.swg" /* Ruby errors */
+%runtime "rubytracking.swg" /* API for tracking C++ classes to Ruby objects */
+%runtime "rubyapi.swg"
+%runtime "rubyrun.swg"
diff --git a/share/swig/2.0.11/ruby/rubystdautodoc.swg b/share/swig/2.0.11/ruby/rubystdautodoc.swg
new file mode 100644
index 0000000..e14f659
--- /dev/null
+++ b/share/swig/2.0.11/ruby/rubystdautodoc.swg
@@ -0,0 +1,33 @@
+/* -----------------------------------------------------------------------------
+ * rubystdautodoc.swg
+ *
+ * This file contains autodocs for standard STL functions.
+ * ----------------------------------------------------------------------------- */
+
+//
+// For STL autodocumentation
+//
+AUTODOC(c_str, "Convert class to a String representation");
+AUTODOC(begin, "Return an iterator to the beginning of the $class");
+AUTODOC(end, "Return an iterator to past the end of the $class");
+AUTODOC(rbegin, "Return a reverse iterator to the beginning (the end) of the $class");
+AUTODOC(rend, "Return a reverse iterator to past the end (past the beginning) of the $class");
+AUTODOC(length, "Size or Length of the $class");
+AUTODOC(replace, "Replace all or a portion of the $class");
+AUTODOC(resize, "Resize the size of the $class");
+AUTODOC(capacity, "Reserved capacity of the $class");
+AUTODOC(reserve, "Reserve memory in the $class for a number of elements");
+AUTODOC(erase, "Delete a portion of the $class");
+AUTODOC(max_size, "Maximum size of elements allowed in the $class");
+AUTODOC(iterator, "Return an iterator to the $class");
+AUTODOC(empty, "Check if the $class is empty or not");
+AUTODOC(rfind, "Find an element in reverse usually starting from the end of the $class");
+AUTODOC(assign, "Assign a new $class or portion of it");
+AUTODOC(front, "Return the first element in $class");
+AUTODOC(back, "Return the last element in $class");
+AUTODOC(second, "Return the second element in $class");
+AUTODOC(push_front, "Add an element at the beginning of the $class");
+AUTODOC(push_back, "Add an element at the end of the $class");
+AUTODOC(pop_front, "Remove and return element at the beginning of the $class");
+AUTODOC(pop_back, "Remove and return an element at the end of the $class");
+AUTODOC(clear, "Clear $class contents");
diff --git a/share/swig/2.0.11/ruby/rubystdcommon.swg b/share/swig/2.0.11/ruby/rubystdcommon.swg
new file mode 100644
index 0000000..b4ae3a3
--- /dev/null
+++ b/share/swig/2.0.11/ruby/rubystdcommon.swg
@@ -0,0 +1,202 @@
+
+/* ------------------------------------------------------------
+ * The Ruby classes, for C++
+ * ------------------------------------------------------------ */
+%include <rubyclasses.swg>
+
+%fragment("StdTraits","header",fragment="StdTraitsCommon")
+{
+
+namespace swig {
+ /*
+ Traits that provides the from method
+ */
+ template <class Type> struct traits_from_ptr {
+ static VALUE from(Type *val, int owner = 0) {
+ return SWIG_NewPointerObj(val, type_info<Type>(), owner);
+ }
+ };
+
+ template <class Type> struct traits_from {
+ static VALUE from(const Type& val) {
+ return traits_from_ptr<Type>::from(new Type(val), 1);
+ }
+ };
+
+ template <class Type> struct traits_from<Type *> {
+ static VALUE from(Type* val) {
+ return traits_from_ptr<Type>::from(val, 0);
+ }
+ };
+
+ template <class Type> struct traits_from<const Type *> {
+ static VALUE from(const Type* val) {
+ return traits_from_ptr<Type>::from(const_cast<Type*>(val), 0);
+ }
+ };
+
+
+ template <class Type>
+ inline VALUE from(const Type& val) {
+ return traits_from<Type>::from(val);
+ }
+
+ template <class Type>
+ inline VALUE from_ptr(Type* val, int owner) {
+ return traits_from_ptr<Type>::from(val, owner);
+ }
+
+ /*
+ Traits that provides the asval/as/check method
+ */
+ template <class Type>
+ struct traits_asptr {
+ static int asptr(VALUE obj, Type **val) {
+ Type *p;
+ int res = SWIG_ConvertPtr(obj, (void**)&p, type_info<Type>(), 0);
+ if (SWIG_IsOK(res)) {
+ if (val) *val = p;
+ }
+ return res;
+ }
+ };
+
+ template <class Type>
+ inline int asptr(VALUE obj, Type **vptr) {
+ return traits_asptr<Type>::asptr(obj, vptr);
+ }
+
+ template <class Type>
+ struct traits_asval {
+ static int asval(VALUE obj, Type *val) {
+ if (val) {
+ Type *p = 0;
+ int res = traits_asptr<Type>::asptr(obj, &p);
+ if (!SWIG_IsOK(res)) return res;
+ if (p) {
+ typedef typename noconst_traits<Type>::noconst_type noconst_type;
+ *(const_cast<noconst_type*>(val)) = *p;
+ if (SWIG_IsNewObj(res)){
+ %delete(p);
+ res = SWIG_DelNewMask(res);
+ }
+ return res;
+ } else {
+ return SWIG_ERROR;
+ }
+ } else {
+ return traits_asptr<Type>::asptr(obj, (Type **)(0));
+ }
+ }
+ };
+
+ template <class Type> struct traits_asval<Type*> {
+ static int asval(VALUE obj, Type **val) {
+ if (val) {
+ typedef typename noconst_traits<Type>::noconst_type noconst_type;
+ noconst_type *p = 0;
+ int res = traits_asptr<noconst_type>::asptr(obj, &p);
+ if (SWIG_IsOK(res)) {
+ *(const_cast<noconst_type**>(val)) = p;
+ }
+ return res;
+ } else {
+ return traits_asptr<Type>::asptr(obj, (Type **)(0));
+ }
+ }
+ };
+
+ template <class Type>
+ inline int asval(VALUE obj, Type *val) {
+ return traits_asval<Type>::asval(obj, val);
+ }
+
+ template <class Type>
+ struct traits_as<Type, value_category> {
+ static Type as(VALUE obj, bool throw_error) {
+ Type v;
+ int res = asval(obj, &v);
+ if (!obj || !SWIG_IsOK(res)) {
+ if (throw_error) throw std::invalid_argument("bad type");
+ VALUE lastErr = rb_gv_get("$!");
+ if (lastErr == Qnil) {
+ %type_error(swig::type_name<Type>());
+ }
+ }
+ return v;
+ }
+ };
+
+ template <class Type>
+ struct traits_as<Type, pointer_category> {
+ static Type as(VALUE obj, bool throw_error) {
+ Type *v = 0;
+ int res = (obj ? traits_asptr<Type>::asptr(obj, &v) : SWIG_ERROR);
+ if (SWIG_IsOK(res) && v) {
+ if (SWIG_IsNewObj(res)) {
+ Type r(*v);
+ %delete(v);
+ return r;
+ } else {
+ return *v;
+ }
+ } else {
+ // Uninitialized return value, no Type() constructor required.
+ if (throw_error) throw std::invalid_argument("bad type");
+ VALUE lastErr = rb_gv_get("$!");
+ if (lastErr == Qnil) {
+ %type_error(swig::type_name<Type>());
+ }
+ static Type *v_def = (Type*) malloc(sizeof(Type));
+ memset(v_def,0,sizeof(Type));
+ return *v_def;
+ }
+ }
+ };
+
+ template <class Type>
+ struct traits_as<Type*, pointer_category> {
+ static Type* as(VALUE obj, bool throw_error) {
+ Type *v = 0;
+ int res = (obj ? traits_asptr<Type>::asptr(obj, &v) : SWIG_ERROR);
+ if (SWIG_IsOK(res)) {
+ return v;
+ } else {
+ if (throw_error) throw std::invalid_argument("bad type");
+ VALUE lastErr = rb_gv_get("$!");
+ if (lastErr == Qnil) {
+ %type_error(swig::type_name<Type>());
+ }
+ return 0;
+ }
+ }
+ };
+
+ template <class Type>
+ inline Type as(VALUE obj, bool te = false) {
+ return traits_as< Type, typename traits< Type >::category >::as(obj, te);
+ }
+
+ template <class Type>
+ struct traits_check<Type, value_category> {
+ static bool check(VALUE obj) {
+ int res = obj ? asval(obj, (Type *)(0)) : SWIG_ERROR;
+ return SWIG_IsOK(res) ? true : false;
+ }
+ };
+
+ template <class Type>
+ struct traits_check<Type, pointer_category> {
+ static bool check(VALUE obj) {
+ int res = obj ? asptr(obj, (Type **)(0)) : SWIG_ERROR;
+ return SWIG_IsOK(res) ? true : false;
+ }
+ };
+
+ template <class Type>
+ inline bool check(VALUE obj) {
+ return traits_check<Type, typename traits<Type>::category>::check(obj);
+ }
+}
+}
+
diff --git a/share/swig/2.0.11/ruby/rubystdfunctors.swg b/share/swig/2.0.11/ruby/rubystdfunctors.swg
new file mode 100644
index 0000000..f2050b6
--- /dev/null
+++ b/share/swig/2.0.11/ruby/rubystdfunctors.swg
@@ -0,0 +1,162 @@
+/**
+ * @file rubystdfunctors.swg
+ * @date Sun May 6 00:44:33 2007
+ *
+ * @brief This file provides unary and binary functors for STL
+ * containers, that will invoke a Ruby proc or method to do
+ * their operation.
+ *
+ * You can use them in a swig file like:
+ *
+ * %include <std_set.i>
+ * %include <std_functors.i>
+ *
+ * %template< IntSet > std::set< int, swig::BinaryPredicate<> >;
+ *
+ *
+ * which will then allow calling them from Ruby either like:
+ *
+ * # order of set is defined by C++ default
+ * a = IntSet.new
+ *
+ * # sort order defined by Ruby proc
+ * b = IntSet.new( proc { |a,b| a > b } )
+ *
+ */
+
+%include rubyclasses.swg
+
+
+namespace swig {
+
+ %apply GC_VALUE { UnaryPredicate, BinaryPredicate, UnaryFunction,
+ BinaryFunction };
+
+ %typecheck(SWIG_TYPECHECK_POINTER,noblock=1)
+ UnaryPredicate, UnaryPredicate&, UnaryFunction, UnaryFunction&
+ {
+ $1 = SWIG_Ruby_isCallable($input) && SWIG_Ruby_arity($input, 1);
+ }
+
+ %typecheck(SWIG_TYPECHECK_POINTER,noblock=1)
+ BinaryPredicate, BinaryPredicate&, BinaryFunction, BinaryFunction& {
+ $1 = SWIG_Ruby_isCallable($input) && SWIG_Ruby_arity($input, 2);
+ }
+
+ %typemap(in,noblock=1) BinaryFunction&, BinaryFunction {
+ $1 = new swig::BinaryFunction< >($input);
+ }
+ %typemap(in,noblock=1) UnaryFunction&, UnaryFunction {
+ $1 = new swig::UnaryFunction< >($input);
+ }
+
+ %typemap(in,noblock=1) BinaryPredicate&, BinaryPredicate {
+ $1 = new swig::BinaryPredicate<>($input);
+ }
+
+ %typemap(in,noblock=1) UnaryPredicate&, UnaryPredicate {
+ $1 = new swig::UnaryPredicate< >($input);
+ }
+
+
+ %ignore BinaryFunction;
+ template< class _T = GC_VALUE >
+ struct BinaryFunction {
+ };
+
+ %ignore UnaryFunction;
+ template< class _T = GC_VALUE >
+ struct UnaryFunction {
+ };
+
+ %ignore BinaryPredicate;
+ template< class _T = GC_VALUE >
+ struct BinaryPredicate {
+ };
+
+ %ignore UnaryPredicate;
+ template< class _T = GC_VALUE >
+ struct UnaryPredicate {
+
+ };
+
+}
+
+
+%fragment("StdFunctors","header",fragment="StdTraits",fragment="GC_VALUE_definition")
+{
+namespace swig {
+
+ static ID call_id = rb_intern("call");
+
+ template <class _T = GC_VALUE, class _DefaultFunc = std::less<GC_VALUE> >
+ struct BinaryPredicate : GC_VALUE, std::binary_function< _T, _T, bool >
+ {
+ BinaryPredicate(VALUE obj = Qnil) : GC_VALUE(obj) { }
+ bool operator()(_T a, _T b) const
+ {
+ if (_obj != Qnil) {
+ SWIG_RUBY_THREAD_BEGIN_BLOCK;
+ VALUE arg1 = swig::from(a);
+ VALUE arg2 = swig::from(b);
+ VALUE res = rb_funcall( _obj, swig::call_id, 2, arg1, arg2);
+ SWIG_RUBY_THREAD_END_BLOCK;
+ return RTEST(res);
+ } else {
+ return _DefaultFunc()(a, b);
+ }
+ }
+ };
+
+ template <class _T = GC_VALUE, class _DefaultFunc = std::less< _T > >
+ struct BinaryFunction : GC_VALUE, std::binary_function< _T, _T, _T >
+ {
+ BinaryFunction(VALUE obj = Qnil) : GC_VALUE(obj) { }
+ _T operator()(_T a, _T b) const
+ {
+ if (_obj != Qnil) {
+ SWIG_RUBY_THREAD_BEGIN_BLOCK;
+ VALUE arg1 = swig::from(a);
+ VALUE arg2 = swig::from(b);
+ VALUE res = rb_funcall( _obj, swig::call_id, 2, arg1, arg2);
+ SWIG_RUBY_THREAD_END_BLOCK;
+ return swig::as<_T >(res);
+ } else {
+ return _DefaultFunc()(a, b);
+ }
+ }
+ };
+
+ template< class _T = GC_VALUE >
+ struct UnaryPredicate : GC_VALUE, std::unary_function< _T, bool >
+ {
+ UnaryPredicate(VALUE obj = Qnil) : GC_VALUE(obj) { }
+ bool operator()(_T a) const
+ {
+ SWIG_RUBY_THREAD_BEGIN_BLOCK;
+ VALUE arg1 = swig::from<_T >(a);
+ VALUE res = rb_funcall( _obj, swig::call_id, 1, arg1);
+ SWIG_RUBY_THREAD_END_BLOCK;
+ return RTEST(res);
+ }
+ };
+
+ template< class _T = GC_VALUE >
+ struct UnaryFunction : GC_VALUE, std::unary_function< _T, _T >
+ {
+ UnaryFunction(VALUE obj = Qnil) : GC_VALUE(obj) { }
+ _T operator()(_T a) const
+ {
+ SWIG_RUBY_THREAD_BEGIN_BLOCK;
+ VALUE arg1 = swig::from(a);
+ VALUE res = rb_funcall( _obj, swig::call_id, 1, VALUE(arg1));
+ SWIG_RUBY_THREAD_END_BLOCK;
+ return swig::as< _T >(res);
+ }
+ };
+
+} // namespace swig
+
+}
+
+
diff --git a/share/swig/2.0.11/ruby/rubystrings.swg b/share/swig/2.0.11/ruby/rubystrings.swg
new file mode 100644
index 0000000..3adf000
--- /dev/null
+++ b/share/swig/2.0.11/ruby/rubystrings.swg
@@ -0,0 +1,57 @@
+/* ------------------------------------------------------------
+ * utility methods for char strings
+ * ------------------------------------------------------------ */
+
+%fragment("SWIG_AsCharPtrAndSize","header",fragment="SWIG_pchar_descriptor") {
+SWIGINTERN int
+SWIG_AsCharPtrAndSize(VALUE obj, char** cptr, size_t* psize, int *alloc)
+{
+ if (TYPE(obj) == T_STRING) {
+ char *cstr = StringValuePtr(obj);
+ size_t size = RSTRING_LEN(obj) + 1;
+ if (cptr) {
+ if (alloc) {
+ if (*alloc == SWIG_NEWOBJ) {
+ *cptr = %new_copy_array(cstr, size, char);
+ } else {
+ *cptr = cstr;
+ *alloc = SWIG_OLDOBJ;
+ }
+ }
+ }
+ if (psize) *psize = size;
+ return SWIG_OK;
+ } else {
+ swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
+ if (pchar_descriptor) {
+ void* vptr = 0;
+ if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
+ if (cptr) *cptr = (char *)vptr;
+ if (psize) *psize = vptr ? (strlen((char*)vptr) + 1) : 0;
+ if (alloc) *alloc = SWIG_OLDOBJ;
+ return SWIG_OK;
+ }
+ }
+ }
+ return SWIG_TypeError;
+}
+}
+
+%fragment("SWIG_FromCharPtrAndSize","header",fragment="SWIG_pchar_descriptor") {
+SWIGINTERNINLINE VALUE
+SWIG_FromCharPtrAndSize(const char* carray, size_t size)
+{
+ if (carray) {
+ if (size > LONG_MAX) {
+ swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
+ return pchar_descriptor ?
+ SWIG_NewPointerObj(%const_cast(carray,char *), pchar_descriptor, 0) : Qnil;
+ } else {
+ return rb_str_new(carray, %numeric_cast(size,long));
+ }
+ } else {
+ return Qnil;
+ }
+}
+}
+
diff --git a/share/swig/2.0.11/ruby/rubytracking.swg b/share/swig/2.0.11/ruby/rubytracking.swg
new file mode 100644
index 0000000..0a36f4a
--- /dev/null
+++ b/share/swig/2.0.11/ruby/rubytracking.swg
@@ -0,0 +1,157 @@
+/* -----------------------------------------------------------------------------
+ * rubytracking.swg
+ *
+ * This file contains support for tracking mappings from
+ * Ruby objects to C++ objects. This functionality is needed
+ * to implement mark functions for Ruby's mark and sweep
+ * garbage collector.
+ * ----------------------------------------------------------------------------- */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Ruby 1.8 actually assumes the first case. */
+#if SIZEOF_VOIDP == SIZEOF_LONG
+# define SWIG2NUM(v) LONG2NUM((unsigned long)v)
+# define NUM2SWIG(x) (unsigned long)NUM2LONG(x)
+#elif SIZEOF_VOIDP == SIZEOF_LONG_LONG
+# define SWIG2NUM(v) LL2NUM((unsigned long long)v)
+# define NUM2SWIG(x) (unsigned long long)NUM2LL(x)
+#else
+# error sizeof(void*) is not the same as long or long long
+#endif
+
+
+/* Global Ruby hash table to store Trackings from C/C++
+ structs to Ruby Objects.
+*/
+static VALUE swig_ruby_trackings = Qnil;
+
+/* Global variable that stores a reference to the ruby
+ hash table delete function. */
+static ID swig_ruby_hash_delete;
+
+/* Setup a Ruby hash table to store Trackings */
+SWIGRUNTIME void SWIG_RubyInitializeTrackings(void) {
+ /* Create a ruby hash table to store Trackings from C++
+ objects to Ruby objects. */
+
+ /* Try to see if some other .so has already created a
+ tracking hash table, which we keep hidden in an instance var
+ in the SWIG module.
+ This is done to allow multiple DSOs to share the same
+ tracking table.
+ */
+ ID trackings_id = rb_intern( "@__trackings__" );
+ VALUE verbose = rb_gv_get("VERBOSE");
+ rb_gv_set("VERBOSE", Qfalse);
+ swig_ruby_trackings = rb_ivar_get( _mSWIG, trackings_id );
+ rb_gv_set("VERBOSE", verbose);
+
+ /* No, it hasn't. Create one ourselves */
+ if ( swig_ruby_trackings == Qnil )
+ {
+ swig_ruby_trackings = rb_hash_new();
+ rb_ivar_set( _mSWIG, trackings_id, swig_ruby_trackings );
+ }
+
+ /* Now store a reference to the hash table delete function
+ so that we only have to look it up once.*/
+ swig_ruby_hash_delete = rb_intern("delete");
+}
+
+/* Get a Ruby number to reference a pointer */
+SWIGRUNTIME VALUE SWIG_RubyPtrToReference(void* ptr) {
+ /* We cast the pointer to an unsigned long
+ and then store a reference to it using
+ a Ruby number object. */
+
+ /* Convert the pointer to a Ruby number */
+ return SWIG2NUM(ptr);
+}
+
+/* Get a Ruby number to reference an object */
+SWIGRUNTIME VALUE SWIG_RubyObjectToReference(VALUE object) {
+ /* We cast the object to an unsigned long
+ and then store a reference to it using
+ a Ruby number object. */
+
+ /* Convert the Object to a Ruby number */
+ return SWIG2NUM(object);
+}
+
+/* Get a Ruby object from a previously stored reference */
+SWIGRUNTIME VALUE SWIG_RubyReferenceToObject(VALUE reference) {
+ /* The provided Ruby number object is a reference
+ to the Ruby object we want.*/
+
+ /* Convert the Ruby number to a Ruby object */
+ return NUM2SWIG(reference);
+}
+
+/* Add a Tracking from a C/C++ struct to a Ruby object */
+SWIGRUNTIME void SWIG_RubyAddTracking(void* ptr, VALUE object) {
+ /* In a Ruby hash table we store the pointer and
+ the associated Ruby object. The trick here is
+ that we cannot store the Ruby object directly - if
+ we do then it cannot be garbage collected. So
+ instead we typecast it as a unsigned long and
+ convert it to a Ruby number object.*/
+
+ /* Get a reference to the pointer as a Ruby number */
+ VALUE key = SWIG_RubyPtrToReference(ptr);
+
+ /* Get a reference to the Ruby object as a Ruby number */
+ VALUE value = SWIG_RubyObjectToReference(object);
+
+ /* Store the mapping to the global hash table. */
+ rb_hash_aset(swig_ruby_trackings, key, value);
+}
+
+/* Get the Ruby object that owns the specified C/C++ struct */
+SWIGRUNTIME VALUE SWIG_RubyInstanceFor(void* ptr) {
+ /* Get a reference to the pointer as a Ruby number */
+ VALUE key = SWIG_RubyPtrToReference(ptr);
+
+ /* Now lookup the value stored in the global hash table */
+ VALUE value = rb_hash_aref(swig_ruby_trackings, key);
+
+ if (value == Qnil) {
+ /* No object exists - return nil. */
+ return Qnil;
+ }
+ else {
+ /* Convert this value to Ruby object */
+ return SWIG_RubyReferenceToObject(value);
+ }
+}
+
+/* Remove a Tracking from a C/C++ struct to a Ruby object. It
+ is very important to remove objects once they are destroyed
+ since the same memory address may be reused later to create
+ a new object. */
+SWIGRUNTIME void SWIG_RubyRemoveTracking(void* ptr) {
+ /* Get a reference to the pointer as a Ruby number */
+ VALUE key = SWIG_RubyPtrToReference(ptr);
+
+ /* Delete the object from the hash table by calling Ruby's
+ do this we need to call the Hash.delete method.*/
+ rb_funcall(swig_ruby_trackings, swig_ruby_hash_delete, 1, key);
+}
+
+/* This is a helper method that unlinks a Ruby object from its
+ underlying C++ object. This is needed if the lifetime of the
+ Ruby object is longer than the C++ object */
+SWIGRUNTIME void SWIG_RubyUnlinkObjects(void* ptr) {
+ VALUE object = SWIG_RubyInstanceFor(ptr);
+
+ if (object != Qnil) {
+ DATA_PTR(object) = 0;
+ }
+}
+
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/share/swig/2.0.11/ruby/rubytypemaps.swg b/share/swig/2.0.11/ruby/rubytypemaps.swg
new file mode 100644
index 0000000..336ee97
--- /dev/null
+++ b/share/swig/2.0.11/ruby/rubytypemaps.swg
@@ -0,0 +1,62 @@
+/* ------------------------------------------------------------
+ * Typemap specializations for Ruby
+ * ------------------------------------------------------------ */
+/* ------------------------------------------------------------
+ * Fragment section
+ * ------------------------------------------------------------ */
+/* bool is dangerous in Ruby, change precedence */
+#undef SWIG_TYPECHECK_BOOL
+%define SWIG_TYPECHECK_BOOL 10000 %enddef
+
+/* Include fundamental fragemt definitions */
+%include <typemaps/fragments.swg>
+
+/* Look for user fragments file. */
+%include <rubyfragments.swg>
+
+/* Ruby fragments for primitive types */
+%include <rubyprimtypes.swg>
+
+/* Ruby fragments for char* strings */
+%include <rubystrings.swg>
+
+/* Backward compatibility output helper */
+%fragment("output_helper","header") %{
+#define output_helper SWIG_Ruby_AppendOutput
+%}
+
+/* ------------------------------------------------------------
+ * Unified typemap section
+ * ------------------------------------------------------------ */
+
+/* Directors are supported in Ruby */
+#ifndef SWIG_DIRECTOR_TYPEMAPS
+#define SWIG_DIRECTOR_TYPEMAPS
+#endif
+
+
+/* Ruby types */
+#define SWIG_Object VALUE
+#define VOID_Object Qnil
+
+/* Overload of the output/constant/exception handling */
+
+/* append output */
+#define SWIG_AppendOutput(result,obj) SWIG_Ruby_AppendOutput(result, obj)
+
+/* set constant */
+#define SWIG_SetConstant(name, obj) rb_define_const($module, name, obj)
+
+/* raise */
+#define SWIG_Raise(obj, type, desc) rb_exc_raise(SWIG_Ruby_ExceptionType(desc, obj))
+
+/* Get the address of the 'Ruby self' object */
+
+%typemap(in,numinputs=0,noblock=1) VALUE* RUBY_SELF {
+ $1 = &self;
+}
+
+/* Include the unified typemap library */
+%include <typemaps/swigtypemaps.swg>
+
+
diff --git a/share/swig/2.0.11/ruby/rubyuserdir.swg b/share/swig/2.0.11/ruby/rubyuserdir.swg
new file mode 100644
index 0000000..638433c
--- /dev/null
+++ b/share/swig/2.0.11/ruby/rubyuserdir.swg
@@ -0,0 +1,20 @@
+#define %alias %feature("alias")
+#define %freefunc %feature("freefunc")
+#define %markfunc %feature("markfunc")
+#define %mixin %feature("mixin")
+#define %predicate %feature("predicate", "1")
+#define %bang %feature("bang", "1")
+#define %trackobjects %feature("trackobjects")
+#define %nooutput %feature("outputs","0")
+#define %initstack %feature("initstack", "1")
+#define %ignorestack %feature("initstack", "0")
+
+/* ------------------------------------------------------------------------- */
+/*
+ Enable keywords paramaters
+*/
+
+#define %kwargs %feature("kwargs")
+#define %nokwargs %feature("kwargs", "0")
+#define %clearkwargs %feature("kwargs", "")
+
diff --git a/share/swig/2.0.11/ruby/rubywstrings.swg b/share/swig/2.0.11/ruby/rubywstrings.swg
new file mode 100644
index 0000000..bb44fbc
--- /dev/null
+++ b/share/swig/2.0.11/ruby/rubywstrings.swg
@@ -0,0 +1,72 @@
+/* -----------------------------------------------------------------------------
+ * rubywstrings.swg
+ *
+ * Currently, Ruby does not support Unicode or WChar properly, so these
+ * are still treated as char arrays for now.
+ * There are other libraries available that add support to this in
+ * ruby including WString, FXString, etc.
+ * ----------------------------------------------------------------------------- */
+
+/* ------------------------------------------------------------
+ * utility methods for wchar_t strings
+ * ------------------------------------------------------------ */
+
+%fragment("SWIG_AsWCharPtrAndSize","header",fragment="<wchar.h>",fragment="SWIG_pwchar_descriptor") {
+SWIGINTERN int
+SWIG_AsWCharPtrAndSize(VALUE obj, wchar_t **cptr, size_t *psize, int *alloc)
+{
+ return SWIG_AsCharPtrAndSize( obj, (char**)cptr, psize, alloc);
+// VALUE tmp = 0;
+// bool ok = false;
+// if ( TYPE(obj) == T_STRING ) {
+// if (cptr) {
+// obj = tmp = SWIG_Unicode_FromObject(obj);
+// ok = true;
+// }
+// }
+// if (ok) {
+// Py_ssize_t len = PyUnicode_GetSize(obj);
+// rb_notimplement();
+// if (cptr) {
+// *cptr = %new_array(len + 1, wchar_t);
+// SWIG_Unicode_AsWideChar((PyUnicodeObject *)obj, *cptr, len);
+// (*cptr)[len] = 0;
+// }
+// if (psize) *psize = (size_t) len + 1;
+// if (alloc) *alloc = cptr ? SWIG_NEWOBJ : 0;
+// return SWIG_OK;
+// } else {
+// swig_type_info* pwchar_descriptor = SWIG_pwchar_descriptor();
+// if (pwchar_descriptor) {
+// void * vptr = 0;
+// if (SWIG_ConvertPtr(obj, &vptr, pwchar_descriptor, 0) == SWIG_OK) {
+// if (cptr) *cptr = (wchar_t *)vptr;
+// if (psize) *psize = vptr ? (wcslen((wchar_t *)vptr) + 1) : 0;
+// return SWIG_OK;
+// }
+// }
+// }
+// return SWIG_TypeError;
+}
+}
+
+%fragment("SWIG_FromWCharPtrAndSize","header",fragment="<wchar.h>",fragment="SWIG_pwchar_descriptor") {
+SWIGINTERNINLINE VALUE
+SWIG_FromWCharPtrAndSize(const wchar_t * carray, size_t size)
+{
+ return SWIG_FromCharPtrAndSize( (const char*)carray, size);
+// if (carray) {
+// if (size > INT_MAX) {
+// swig_type_info* pwchar_descriptor = SWIG_pwchar_descriptor();
+// return pwchar_descriptor ?
+// SWIG_NewPointerObj(%const_cast(carray,wchar_t *), pwchar_descriptor, 0) : Qnil;
+// } else {
+// return SWIG_Unicode_FromWideChar(carray, %numeric_cast(size,int));
+// }
+// } else {
+// return Qnil;
+// }
+}
+}
+
+
diff --git a/share/swig/2.0.11/ruby/std_alloc.i b/share/swig/2.0.11/ruby/std_alloc.i
new file mode 100644
index 0000000..35dc051
--- /dev/null
+++ b/share/swig/2.0.11/ruby/std_alloc.i
@@ -0,0 +1 @@
+%include <std/std_alloc.i>
diff --git a/share/swig/2.0.11/ruby/std_basic_string.i b/share/swig/2.0.11/ruby/std_basic_string.i
new file mode 100644
index 0000000..1351177
--- /dev/null
+++ b/share/swig/2.0.11/ruby/std_basic_string.i
@@ -0,0 +1,97 @@
+#if !defined(SWIG_STD_STRING)
+#define SWIG_STD_BASIC_STRING
+
+%include <rubycontainer.swg>
+
+#define %swig_basic_string(Type...) %swig_sequence_methods_val(Type)
+
+
+%traits_swigtype(std::basic_string<char>);
+%fragment(SWIG_Traits_frag(std::basic_string<char>));
+
+
+%fragment(SWIG_AsPtr_frag(std::basic_string<char>),"header",
+ fragment="SWIG_AsCharPtrAndSize") {
+SWIGINTERN int
+SWIG_AsPtr(std::basic_string<char>)(VALUE obj, std::string **val)
+{
+ static swig_type_info* string_info =
+ SWIG_TypeQuery("std::basic_string<char> *");
+ std::string *vptr;
+ if (SWIG_ConvertPtr(obj, (void**)&vptr, string_info, 0) == SWIG_OK) {
+ if (val) *val = vptr;
+ return SWIG_OLDOBJ;
+ } else {
+ char* buf = 0 ; size_t size = 0; int alloc = 0;
+ if (SWIG_AsCharPtrAndSize(obj, &buf, &size, &alloc) == SWIG_OK) {
+ if (buf) {
+ if (val) *val = new std::string(buf, size - 1);
+ if (alloc == SWIG_NEWOBJ) %delete_array(buf);
+ return SWIG_NEWOBJ;
+ }
+ }
+ if (val) {
+ rb_raise( rb_eTypeError, "a string is expected");
+ }
+ return 0;
+ }
+}
+}
+
+%fragment(SWIG_From_frag(std::basic_string<char>),"header",
+ fragment="SWIG_FromCharPtrAndSize") {
+SWIGINTERNINLINE VALUE
+ SWIG_From(std::basic_string<char>)(const std::string& s)
+ {
+ return SWIG_FromCharPtrAndSize(s.data(), s.size());
+ }
+}
+
+%include <std/std_basic_string.i>
+%typemaps_asptrfromn(%checkcode(STRING), std::basic_string<char>);
+
+#endif
+
+
+#if !defined(SWIG_STD_WSTRING)
+
+%fragment(SWIG_AsPtr_frag(std::basic_string<wchar_t>),"header",
+ fragment="SWIG_AsWCharPtrAndSize") {
+SWIGINTERN int
+ SWIG_AsPtr(std::basic_string<wchar_t>)(VALUE obj, std::wstring **val)
+ {
+ static swig_type_info* string_info =
+ SWIG_TypeQuery("std::basic_string<wchar_t> *");
+ std::wstring *vptr;
+ if (SWIG_ConvertPtr(obj, (void**)&vptr, string_info, 0) == SWIG_OK) {
+ if (val) *val = vptr;
+ return SWIG_OLDOBJ;
+ } else {
+ wchar_t *buf = 0 ; size_t size = 0; int alloc = 0;
+ if (SWIG_AsWCharPtrAndSize(obj, &buf, &size, &alloc) == SWIG_OK) {
+ if (buf) {
+ if (val) *val = new std::wstring(buf, size - 1);
+ if (alloc == SWIG_NEWOBJ) %delete_array(buf);
+ return SWIG_NEWOBJ;
+ }
+ }
+ if (val) {
+ rb_raise( rb_eTypeError, "a string is expected");
+ }
+ return 0;
+ }
+ }
+}
+
+%fragment(SWIG_From_frag(std::basic_string<wchar_t>),"header",
+ fragment="SWIG_FromWCharPtrAndSize") {
+SWIGINTERNINLINE VALUE
+ SWIG_From(std::basic_string<wchar_t>)(const std::wstring& s)
+ {
+ return SWIG_FromWCharPtrAndSize(s.data(), s.size());
+ }
+}
+
+%typemaps_asptrfromn(%checkcode(UNISTRING), std::basic_string<wchar_t>);
+
+#endif
diff --git a/share/swig/2.0.11/ruby/std_char_traits.i b/share/swig/2.0.11/ruby/std_char_traits.i
new file mode 100644
index 0000000..bf4e6c4
--- /dev/null
+++ b/share/swig/2.0.11/ruby/std_char_traits.i
@@ -0,0 +1 @@
+%include <std/std_char_traits.i>
diff --git a/share/swig/2.0.11/ruby/std_common.i b/share/swig/2.0.11/ruby/std_common.i
new file mode 100644
index 0000000..14fba0d
--- /dev/null
+++ b/share/swig/2.0.11/ruby/std_common.i
@@ -0,0 +1,74 @@
+%include <std/std_except.i>
+%include <rubystdcommon.swg>
+%include <rubystdautodoc.swg>
+
+
+/*
+ Generate the traits for a 'primitive' type, such as 'double',
+ for which the SWIG_AsVal and SWIG_From methods are already defined.
+*/
+
+%define %traits_ptypen(Type...)
+ %fragment(SWIG_Traits_frag(Type),"header",
+ fragment=SWIG_AsVal_frag(Type),
+ fragment=SWIG_From_frag(Type),
+ fragment="StdTraits") {
+namespace swig {
+ template <> struct traits<Type > {
+ typedef value_category category;
+ static const char* type_name() { return #Type; }
+ };
+ template <> struct traits_asval<Type > {
+ typedef Type value_type;
+ static int asval(VALUE obj, value_type *val) {
+ return SWIG_AsVal(Type)(obj, val);
+ }
+ };
+ template <> struct traits_from<Type > {
+ typedef Type value_type;
+ static VALUE from(const value_type& val) {
+ return SWIG_From(Type)(val);
+ }
+ };
+}
+}
+%enddef
+
+/* Traits for enums. This is bit of a sneaky trick needed because a generic template specialization of enums
+ is not possible (unless using template meta-programming which SWIG doesn't support because of the explicit
+ instantiations required using %template). The STL containers define the 'front' method and the typemap
+ below is used whenever the front method is wrapped returning an enum. This typemap simply picks up the
+ standard enum typemap, but additionally drags in a fragment containing the traits_asval and traits_from
+ required in the generated code for enums. */
+
+%define %traits_enum(Type...)
+ %fragment("SWIG_Traits_enum_"{Type},"header",
+ fragment=SWIG_AsVal_frag(int),
+ fragment=SWIG_From_frag(int),
+ fragment="StdTraits") {
+namespace swig {
+ template <> struct traits_asval<Type > {
+ typedef Type value_type;
+ static int asval(VALUE obj, value_type *val) {
+ return SWIG_AsVal(int)(obj, (int *)val);
+ }
+ };
+ template <> struct traits_from<Type > {
+ typedef Type value_type;
+ static VALUE from(const value_type& val) {
+ return SWIG_From(int)((int)val);
+ }
+ };
+}
+}
+%typemap(out, fragment="SWIG_Traits_enum_"{Type}) const enum SWIGTYPE& front %{$typemap(out, const enum SWIGTYPE&)%}
+%enddef
+
+
+%include <std/std_common.i>
+
+//
+// Generates the traits for all the known primitive
+// C++ types (int, double, ...)
+//
+%apply_cpptypes(%traits_ptypen);
diff --git a/share/swig/2.0.11/ruby/std_complex.i b/share/swig/2.0.11/ruby/std_complex.i
new file mode 100644
index 0000000..dacbea2
--- /dev/null
+++ b/share/swig/2.0.11/ruby/std_complex.i
@@ -0,0 +1,22 @@
+/*
+ * STD C++ complex typemaps
+ */
+
+%include <rubycomplex.swg>
+
+%{
+#include <complex>
+%}
+
+/* defining the complex as/from converters */
+
+%swig_cplxdbl_convn(std::complex<double>, std::complex<double>, std::real, std::imag)
+%swig_cplxflt_convn(std::complex<float>, std::complex<float>, std::real, std::imag)
+
+/* defining the typemaps */
+
+%typemaps_primitive(%checkcode(CPLXDBL), std::complex<double>);
+%typemaps_primitive(%checkcode(CPLXFLT), std::complex<float>);
+
+
+
diff --git a/share/swig/2.0.11/ruby/std_container.i b/share/swig/2.0.11/ruby/std_container.i
new file mode 100644
index 0000000..8537950
--- /dev/null
+++ b/share/swig/2.0.11/ruby/std_container.i
@@ -0,0 +1,2 @@
+%include <rubycontainer.swg>
+%include <std/std_container.i>
diff --git a/share/swig/2.0.11/ruby/std_deque.i b/share/swig/2.0.11/ruby/std_deque.i
new file mode 100644
index 0000000..38048af
--- /dev/null
+++ b/share/swig/2.0.11/ruby/std_deque.i
@@ -0,0 +1,30 @@
+/*
+ Deques
+*/
+
+%fragment("StdDequeTraits","header",fragment="StdSequenceTraits")
+%{
+ namespace swig {
+ template <class T>
+ struct traits_asptr<std::deque<T> > {
+ static int asptr(VALUE obj, std::deque<T> **vec) {
+ return traits_asptr_stdseq<std::deque<T> >::asptr(obj, vec);
+ }
+ };
+
+ template <class T>
+ struct traits_from<std::deque<T> > {
+ static VALUE from(const std::deque<T> & vec) {
+ return traits_from_stdseq<std::deque<T> >::from(vec);
+ }
+ };
+ }
+%}
+
+%ignore std::deque::push_back;
+%ignore std::deque::pop_back;
+
+#define %swig_deque_methods(Type...) %swig_sequence_methods(Type)
+#define %swig_deque_methods_val(Type...) %swig_sequence_methods_val(Type);
+
+%include <std/std_deque.i>
diff --git a/share/swig/2.0.11/ruby/std_except.i b/share/swig/2.0.11/ruby/std_except.i
new file mode 100644
index 0000000..af98428
--- /dev/null
+++ b/share/swig/2.0.11/ruby/std_except.i
@@ -0,0 +1 @@
+%include <typemaps/std_except.swg>
diff --git a/share/swig/2.0.11/ruby/std_functors.i b/share/swig/2.0.11/ruby/std_functors.i
new file mode 100644
index 0000000..54ee97b
--- /dev/null
+++ b/share/swig/2.0.11/ruby/std_functors.i
@@ -0,0 +1,29 @@
+/**
+ * @file std_functors.i
+ * @date Sun May 6 00:44:33 2007
+ *
+ * @brief This file provides unary and binary functors for STL
+ * containers, that will invoke a Ruby proc or method to do
+ * their operation.
+ *
+ * You can use them in a swig file like:
+ *
+ * %include <std_set.i>
+ * %include <std_functors.i>
+ *
+ * %template< IntSet > std::set< int, swig::BinaryPredicate<int> >;
+ *
+ *
+ * which will then allow calling them from Ruby either like:
+ *
+ * # order of set is defined by C++ default
+ * a = IntSet.new
+ *
+ * # sort order defined by Ruby proc
+ * b = IntSet.new( proc { |a,b| a > b } )
+ *
+ */
+
+%include <rubystdfunctors.swg>
+
+%fragment("StdFunctors");
diff --git a/share/swig/2.0.11/ruby/std_ios.i b/share/swig/2.0.11/ruby/std_ios.i
new file mode 100644
index 0000000..7aafae2
--- /dev/null
+++ b/share/swig/2.0.11/ruby/std_ios.i
@@ -0,0 +1,14 @@
+
+#pragma SWIG nowarn=801
+
+%rename(ios_base_in) std::ios_base::in;
+
+AUTODOC(cerr, "Standard C++ error stream");
+AUTODOC(cout, "Standard C++ output stream");
+AUTODOC(cin, "Standard C++ input stream");
+AUTODOC(clog, "Standard C++ logging stream");
+AUTODOC(endl, "Add an end line to stream");
+AUTODOC(ends, "Ends stream");
+AUTODOC(flush, "Flush stream");
+
+%include <std/std_ios.i>
diff --git a/share/swig/2.0.11/ruby/std_iostream.i b/share/swig/2.0.11/ruby/std_iostream.i
new file mode 100644
index 0000000..ee36bec
--- /dev/null
+++ b/share/swig/2.0.11/ruby/std_iostream.i
@@ -0,0 +1,12 @@
+namespace std
+{
+%callback("%s") endl;
+%callback("%s") ends;
+%callback("%s") flush;
+}
+
+%warnfilter(365) operator+=;
+%warnfilter(802) std::basic_iostream; // turn off multiple inheritance warning
+
+%include <std/std_iostream.i>
+
diff --git a/share/swig/2.0.11/ruby/std_list.i b/share/swig/2.0.11/ruby/std_list.i
new file mode 100644
index 0000000..8d4284b
--- /dev/null
+++ b/share/swig/2.0.11/ruby/std_list.i
@@ -0,0 +1,41 @@
+/*
+ Lists
+*/
+
+%fragment("StdListTraits","header",fragment="StdSequenceTraits")
+%{
+ namespace swig {
+ template <class T >
+ struct traits_asptr<std::list<T> > {
+ static int asptr(VALUE obj, std::list<T> **lis) {
+ return traits_asptr_stdseq<std::list<T> >::asptr(obj, lis);
+ }
+ };
+
+ template <class T>
+ struct traits_from<std::list<T> > {
+ static VALUE from(const std::list<T> & vec) {
+ return traits_from_stdseq<std::list<T> >::from(vec);
+ }
+ };
+ }
+%}
+
+%ignore std::list::push_back;
+%ignore std::list::pop_back;
+
+#define %swig_list_methods(Type...) %swig_sequence_methods(Type)
+#define %swig_list_methods_val(Type...) %swig_sequence_methods_val(Type);
+
+
+%rename("delete") std::list::__delete__;
+%rename("reject!") std::list::reject_bang;
+%rename("map!") std::list::map_bang;
+%rename("empty?") std::list::empty;
+%rename("include?" ) std::list::__contains__ const;
+%rename("has_key?" ) std::list::has_key const;
+
+%alias std::list::push "<<";
+
+%include <std/std_list.i>
+
diff --git a/share/swig/2.0.11/ruby/std_map.i b/share/swig/2.0.11/ruby/std_map.i
new file mode 100644
index 0000000..f706ca8
--- /dev/null
+++ b/share/swig/2.0.11/ruby/std_map.i
@@ -0,0 +1,423 @@
+//
+// Maps
+//
+%fragment("StdMapCommonTraits","header",fragment="StdSequenceTraits")
+{
+ namespace swig {
+ template <class ValueType>
+ struct from_key_oper
+ {
+ typedef const ValueType& argument_type;
+ typedef VALUE result_type;
+ result_type operator()(argument_type v) const
+ {
+ return swig::from(v.first);
+ }
+ };
+
+ template <class ValueType>
+ struct from_value_oper
+ {
+ typedef const ValueType& argument_type;
+ typedef VALUE result_type;
+ result_type operator()(argument_type v) const
+ {
+ return swig::from(v.second);
+ }
+ };
+
+ template<class OutIterator, class FromOper,
+ class ValueType = typename OutIterator::value_type>
+ struct MapIterator_T : ConstIteratorClosed_T<OutIterator, ValueType, FromOper>
+ {
+ MapIterator_T(OutIterator curr, OutIterator first, OutIterator last, VALUE seq)
+ : ConstIteratorClosed_T<OutIterator,ValueType,FromOper>(curr, first, last, seq)
+ {
+ }
+ };
+
+
+ template<class OutIterator,
+ class FromOper = from_key_oper<typename OutIterator::value_type> >
+ struct MapKeyIterator_T : MapIterator_T<OutIterator, FromOper>
+ {
+ MapKeyIterator_T(OutIterator curr, OutIterator first, OutIterator last, VALUE seq)
+ : MapIterator_T<OutIterator, FromOper>(curr, first, last, seq)
+ {
+ }
+ };
+
+ template<typename OutIter>
+ inline ConstIterator*
+ make_output_key_iterator(const OutIter& current, const OutIter& begin,
+ const OutIter& end, VALUE seq = 0)
+ {
+ return new MapKeyIterator_T<OutIter>(current, begin, end, seq);
+ }
+
+ template<class OutIterator,
+ class FromOper = from_value_oper<typename OutIterator::value_type> >
+ struct MapValueIterator_T : MapIterator_T<OutIterator, FromOper>
+ {
+ MapValueIterator_T(OutIterator curr, OutIterator first, OutIterator last, VALUE seq)
+ : MapIterator_T<OutIterator, FromOper>(curr, first, last, seq)
+ {
+ }
+ };
+
+
+ template<typename OutIter>
+ inline ConstIterator*
+ make_output_value_iterator(const OutIter& current, const OutIter& begin,
+ const OutIter& end, VALUE seq = 0)
+ {
+ return new MapValueIterator_T<OutIter>(current, begin, end, seq);
+ }
+ }
+}
+
+%fragment("StdMapTraits","header",fragment="StdMapCommonTraits")
+{
+ namespace swig {
+ template <class RubySeq, class K, class T >
+ inline void
+ assign(const RubySeq& rubyseq, std::map<K,T > *map) {
+ typedef typename std::map<K,T>::value_type value_type;
+ typename RubySeq::const_iterator it = rubyseq.begin();
+ for (;it != rubyseq.end(); ++it) {
+ map->insert(value_type(it->first, it->second));
+ }
+ }
+
+ template <class K, class T>
+ struct traits_asptr<std::map<K,T> > {
+ typedef std::map<K,T> map_type;
+ static int asptr(VALUE obj, map_type **val) {
+ int res = SWIG_ERROR;
+ if ( TYPE(obj) == T_HASH ) {
+ static ID id_to_a = rb_intern("to_a");
+ VALUE items = rb_funcall(obj, id_to_a, 0);
+ res = traits_asptr_stdseq<std::map<K,T>, std::pair<K, T> >::asptr(items, val);
+ } else {
+ map_type *p;
+ res = SWIG_ConvertPtr(obj,(void**)&p,swig::type_info<map_type>(),0);
+ if (SWIG_IsOK(res) && val) *val = p;
+ }
+ return res;
+ }
+ };
+
+ template <class K, class T >
+ struct traits_from<std::map<K,T> > {
+ typedef std::map<K,T> map_type;
+ typedef typename map_type::const_iterator const_iterator;
+ typedef typename map_type::size_type size_type;
+
+ static VALUE from(const map_type& map) {
+ swig_type_info *desc = swig::type_info<map_type>();
+ if (desc && desc->clientdata) {
+ return SWIG_NewPointerObj(new map_type(map), desc, SWIG_POINTER_OWN);
+ } else {
+ size_type size = map.size();
+ int rubysize = (size <= (size_type) INT_MAX) ? (int) size : -1;
+ if (rubysize < 0) {
+ SWIG_RUBY_THREAD_BEGIN_BLOCK;
+ rb_raise( rb_eRuntimeError, "map size not valid in Ruby");
+ SWIG_RUBY_THREAD_END_BLOCK;
+ return Qnil;
+ }
+ VALUE obj = rb_hash_new();
+ for (const_iterator i= map.begin(); i!= map.end(); ++i) {
+ VALUE key = swig::from(i->first);
+ VALUE val = swig::from(i->second);
+ rb_hash_aset(obj, key, val);
+ }
+ return obj;
+ }
+ }
+ };
+ }
+}
+
+%define %swig_map_common(Map...)
+ %swig_container_methods(%arg(Map));
+ // %swig_sequence_iterator(%arg(Map));
+
+ %extend {
+
+ VALUE __delete__(const key_type& key) {
+ Map::iterator i = self->find(key);
+ if (i != self->end()) {
+ self->erase(i);
+ return swig::from( key );
+ }
+ else {
+ return Qnil;
+ }
+ }
+
+ bool has_key(const key_type& key) const {
+ Map::const_iterator i = self->find(key);
+ return i != self->end();
+ }
+
+ VALUE keys() {
+ Map::size_type size = self->size();
+ int rubysize = (size <= (Map::size_type) INT_MAX) ? (int) size : -1;
+ if (rubysize < 0) {
+ SWIG_RUBY_THREAD_BEGIN_BLOCK;
+ rb_raise(rb_eRuntimeError, "map size not valid in Ruby");
+ SWIG_RUBY_THREAD_END_BLOCK;
+ return Qnil;
+ }
+ VALUE ary = rb_ary_new2(rubysize);
+ Map::const_iterator i = self->begin();
+ Map::const_iterator e = self->end();
+ for ( ; i != e; ++i ) {
+ rb_ary_push( ary, swig::from(i->first) );
+ }
+ return ary;
+ }
+
+ Map* each()
+ {
+ if ( !rb_block_given_p() )
+ rb_raise( rb_eArgError, "no block given");
+
+ VALUE k, v;
+ Map::iterator i = self->begin();
+ Map::iterator e = self->end();
+ for ( ; i != e; ++i )
+ {
+ const Map::key_type& key = i->first;
+ const Map::mapped_type& val = i->second;
+
+ k = swig::from<Map::key_type>(key);
+ v = swig::from<Map::mapped_type>(val);
+ rb_yield_values(2, k, v);
+ }
+
+ return self;
+ }
+
+ %newobject select;
+ Map* select() {
+ if ( !rb_block_given_p() )
+ rb_raise( rb_eArgError, "no block given" );
+
+ Map* r = new Map;
+ Map::iterator i = $self->begin();
+ Map::iterator e = $self->end();
+ for ( ; i != e; ++i )
+ {
+ VALUE k = swig::from<Map::key_type>(i->first);
+ VALUE v = swig::from<Map::mapped_type>(i->second);
+ if ( RTEST( rb_yield_values(2, k, v) ) )
+ $self->insert(r->end(), *i);
+ }
+
+ return r;
+ }
+
+ %typemap(in) (int argc, VALUE* argv) {
+ $1 = argc;
+ $2 = argv;
+ }
+
+ VALUE values_at(int argc, VALUE* argv, ...) {
+
+ VALUE r = rb_ary_new();
+ ID id = rb_intern("[]");
+ swig_type_info* type = swig::type_info< Map >();
+ VALUE me = SWIG_NewPointerObj( $self, type, 0 );
+ for ( int i = 0; i < argc; ++i )
+ {
+ VALUE key = argv[i];
+ VALUE tmp = rb_funcall( me, id, 1, key );
+ rb_ary_push( r, tmp );
+ }
+
+ return r;
+ }
+
+
+ Map* each_key()
+ {
+ if ( !rb_block_given_p() )
+ rb_raise( rb_eArgError, "no block given");
+
+ VALUE r;
+ Map::iterator i = self->begin();
+ Map::iterator e = self->end();
+ for ( ; i != e; ++i )
+ {
+ r = swig::from( i->first );
+ rb_yield(r);
+ }
+
+ return self;
+ }
+
+ VALUE values() {
+ Map::size_type size = self->size();
+ int rubysize = (size <= (Map::size_type) INT_MAX) ? (int) size : -1;
+ if (rubysize < 0) {
+ SWIG_RUBY_THREAD_BEGIN_BLOCK;
+ rb_raise(rb_eRuntimeError, "map size not valid in Ruby");
+ SWIG_RUBY_THREAD_END_BLOCK;
+ return Qnil;
+ }
+ VALUE ary = rb_ary_new2(rubysize);
+ Map::const_iterator i = self->begin();
+ Map::const_iterator e = self->end();
+ for ( ; i != e; ++i ) {
+ rb_ary_push( ary, swig::from(i->second) );
+ }
+ return ary;
+ }
+
+ Map* each_value()
+ {
+ if ( !rb_block_given_p() )
+ rb_raise( rb_eArgError, "no block given");
+
+ VALUE r;
+ Map::iterator i = self->begin();
+ Map::iterator e = self->end();
+ for ( ; i != e; ++i )
+ {
+ r = swig::from( i->second );
+ rb_yield(r);
+ }
+
+ return self;
+ }
+
+ VALUE entries() {
+ Map::size_type size = self->size();
+ int rubysize = (size <= (Map::size_type) INT_MAX) ? (int) size : -1;
+ if (rubysize < 0) {
+ SWIG_RUBY_THREAD_BEGIN_BLOCK;
+ rb_raise(rb_eRuntimeError, "map size not valid in Ruby");
+ SWIG_RUBY_THREAD_END_BLOCK;
+ return Qnil;
+ }
+ VALUE ary = rb_ary_new2(rubysize);
+ Map::const_iterator i = self->begin();
+ Map::const_iterator e = self->end();
+ for ( ; i != e; ++i ) {
+ rb_ary_push( ary, swig::from<std::pair<Map::key_type,
+ Map::mapped_type> >(*i) );
+ }
+ return ary;
+ }
+
+ bool __contains__(const key_type& key) {
+ return self->find(key) != self->end();
+ }
+
+ %newobject key_iterator(VALUE *RUBY_SELF);
+ swig::ConstIterator* key_iterator(VALUE *RUBY_SELF) {
+ return swig::make_output_key_iterator($self->begin(), $self->begin(),
+ $self->end(), *RUBY_SELF);
+ }
+
+ %newobject value_iterator(VALUE *RUBY_SELF);
+ swig::ConstIterator* value_iterator(VALUE *RUBY_SELF) {
+ return swig::make_output_value_iterator($self->begin(), $self->begin(),
+ $self->end(), *RUBY_SELF);
+ }
+
+ }
+%enddef
+
+%define %swig_map_methods(Map...)
+ %swig_map_common(Map)
+ %extend {
+ VALUE __getitem__(const key_type& key) const {
+ Map::const_iterator i = self->find(key);
+ if ( i != self->end() )
+ return swig::from<Map::mapped_type>( i->second );
+ else
+ return Qnil;
+ }
+
+ void __setitem__(const key_type& key, const mapped_type& x) throw (std::out_of_range) {
+ (*self)[key] = x;
+ }
+
+ VALUE inspect()
+ {
+ Map::const_iterator i = $self->begin();
+ Map::const_iterator e = $self->end();
+ const char *type_name = swig::type_name< Map >();
+ VALUE str = rb_str_new2( type_name );
+ str = rb_str_cat2( str, " {" );
+ bool comma = false;
+ VALUE tmp;
+ for ( ; i != e; ++i, comma = true )
+ {
+ if (comma) str = rb_str_cat2( str, "," );
+ tmp = swig::from< Map::key_type >( i->first );
+ tmp = rb_inspect( tmp );
+ str = rb_str_buf_append( str, tmp );
+ str = rb_str_cat2( str, "=>" );
+ tmp = swig::from< Map::mapped_type >( i->second );
+ tmp = rb_inspect( tmp );
+ str = rb_str_buf_append( str, tmp );
+ }
+ str = rb_str_cat2( str, "}" );
+ return str;
+ }
+
+ VALUE to_a()
+ {
+ Map::const_iterator i = $self->begin();
+ Map::const_iterator e = $self->end();
+ VALUE ary = rb_ary_new2( std::distance( i, e ) );
+ VALUE tmp;
+ for ( ; i != e; ++i )
+ {
+ // @todo: improve -- this should just be swig::from(*i)
+ tmp = swig::from< std::pair<Map::key_type,
+ Map::mapped_type> >( *i );
+ rb_ary_push( ary, tmp );
+ }
+ return ary;
+ }
+
+ VALUE to_s()
+ {
+ Map::iterator i = $self->begin();
+ Map::iterator e = $self->end();
+ VALUE str = rb_str_new2( "" );
+ VALUE tmp;
+ for ( ; i != e; ++i )
+ {
+ // @todo: improve -- this should just be swig::from(*i)
+ tmp = swig::from< std::pair<Map::key_type,
+ Map::mapped_type> >( *i );
+ tmp = rb_obj_as_string( tmp );
+ str = rb_str_buf_append( str, tmp );
+ }
+ return str;
+ }
+
+ }
+%enddef
+
+
+%mixin std::map "Enumerable";
+
+
+%rename("delete") std::map::__delete__;
+%rename("reject!") std::map::reject_bang;
+%rename("map!") std::map::map_bang;
+%rename("empty?") std::map::empty;
+%rename("include?" ) std::map::__contains__ const;
+%rename("has_key?" ) std::map::has_key const;
+
+%alias std::map::push "<<";
+
+
+%include <std/std_map.i>
diff --git a/share/swig/2.0.11/ruby/std_multimap.i b/share/swig/2.0.11/ruby/std_multimap.i
new file mode 100644
index 0000000..3e06ee1
--- /dev/null
+++ b/share/swig/2.0.11/ruby/std_multimap.i
@@ -0,0 +1,227 @@
+/*
+ Multimaps
+*/
+%include <std_map.i>
+
+%fragment("StdMultimapTraits","header",fragment="StdMapCommonTraits")
+{
+ namespace swig {
+ template <class RubySeq, class K, class T >
+ inline void
+ assign(const RubySeq& rubyseq, std::multimap<K,T > *multimap) {
+ typedef typename std::multimap<K,T>::value_type value_type;
+ typename RubySeq::const_iterator it = rubyseq.begin();
+ for (;it != rubyseq.end(); ++it) {
+ multimap->insert(value_type(it->first, it->second));
+ }
+ }
+
+ template <class K, class T>
+ struct traits_asptr<std::multimap<K,T> > {
+ typedef std::multimap<K,T> multimap_type;
+ static int asptr(VALUE obj, std::multimap<K,T> **val) {
+ int res = SWIG_ERROR;
+ if ( TYPE(obj) == T_HASH ) {
+ static ID id_to_a = rb_intern("to_a");
+ VALUE items = rb_funcall(obj, id_to_a, 0);
+ return traits_asptr_stdseq<std::multimap<K,T>, std::pair<K, T> >::asptr(items, val);
+ } else {
+ multimap_type *p;
+ res = SWIG_ConvertPtr(obj,(void**)&p,swig::type_info<multimap_type>(),0);
+ if (SWIG_IsOK(res) && val) *val = p;
+ }
+ return res;
+ }
+ };
+
+ template <class K, class T >
+ struct traits_from<std::multimap<K,T> > {
+ typedef std::multimap<K,T> multimap_type;
+ typedef typename multimap_type::const_iterator const_iterator;
+ typedef typename multimap_type::size_type size_type;
+
+ static VALUE from(const multimap_type& multimap) {
+ swig_type_info *desc = swig::type_info<multimap_type>();
+ if (desc && desc->clientdata) {
+ return SWIG_NewPointerObj(new multimap_type(multimap), desc, SWIG_POINTER_OWN);
+ } else {
+ size_type size = multimap.size();
+ int rubysize = (size <= (size_type) INT_MAX) ? (int) size : -1;
+ if (rubysize < 0) {
+ SWIG_RUBY_THREAD_BEGIN_BLOCK;
+ rb_raise(rb_eRuntimeError,
+ "multimap size not valid in Ruby");
+ SWIG_RUBY_THREAD_END_BLOCK;
+ return Qnil;
+ }
+ VALUE obj = rb_hash_new();
+ for (const_iterator i= multimap.begin(); i!= multimap.end(); ++i) {
+ VALUE key = swig::from(i->first);
+ VALUE val = swig::from(i->second);
+
+ VALUE oldval = rb_hash_aref( obj, key );
+ if ( oldval == Qnil )
+ rb_hash_aset(obj, key, val);
+ else {
+ // Multiple values for this key, create array if needed
+ // and add a new element to it.
+ VALUE ary;
+ if ( TYPE(oldval) == T_ARRAY )
+ ary = oldval;
+ else
+ {
+ ary = rb_ary_new2(2);
+ rb_ary_push( ary, oldval );
+ rb_hash_aset( obj, key, ary );
+ }
+ rb_ary_push( ary, val );
+ }
+
+ }
+ return obj;
+ }
+ }
+ };
+ }
+}
+
+%define %swig_multimap_methods(MultiMap...)
+ %swig_map_common(%arg(MultiMap));
+
+ %extend {
+ VALUE __getitem__(const key_type& key) const {
+ MultiMap::const_iterator i = self->find(key);
+ if ( i != self->end() )
+ {
+ MultiMap::const_iterator e = $self->upper_bound(key);
+ VALUE ary = rb_ary_new();
+ for ( ; i != e; ++i )
+ {
+ rb_ary_push( ary, swig::from<MultiMap::mapped_type>( i->second ) );
+ }
+ if ( RARRAY_LEN(ary) == 1 )
+ return RARRAY_PTR(ary)[0];
+ return ary;
+ }
+ else
+ return Qnil;
+ }
+
+ void __setitem__(const key_type& key, const mapped_type& x) throw (std::out_of_range) {
+ self->insert(MultiMap::value_type(key,x));
+ }
+
+ VALUE inspect()
+ {
+ MultiMap::iterator i = $self->begin();
+ MultiMap::iterator e = $self->end();
+ const char *type_name = swig::type_name< MultiMap >();
+ VALUE str = rb_str_new2( type_name );
+ str = rb_str_cat2( str, " {" );
+ VALUE tmp;
+ while ( i != e )
+ {
+ const MultiMap::key_type& key = i->first;
+ const MultiMap::key_type& oldkey = key;
+ tmp = swig::from( key );
+ str = rb_str_buf_append( str, rb_inspect(tmp) );
+ str = rb_str_cat2( str, "=>" );
+
+ VALUE vals = rb_ary_new();
+ for ( ; i != e && key == oldkey; ++i )
+ {
+ const MultiMap::mapped_type& val = i->second;
+ tmp = swig::from( val );
+ rb_ary_push( vals, tmp );
+ }
+
+ if ( RARRAY_LEN(vals) == 1 )
+ {
+ str = rb_str_buf_append( str, rb_inspect(tmp) );
+ }
+ else
+ {
+ str = rb_str_buf_append( str, rb_inspect(vals) );
+ }
+ }
+ str = rb_str_cat2( str, "}" );
+ return str;
+ }
+
+ VALUE to_a()
+ {
+ MultiMap::const_iterator i = $self->begin();
+ MultiMap::const_iterator e = $self->end();
+ VALUE ary = rb_ary_new2( std::distance( i, e ) );
+ VALUE tmp;
+ while ( i != e )
+ {
+ const MultiMap::key_type& key = i->first;
+ const MultiMap::key_type& oldkey = key;
+ tmp = swig::from( key );
+ rb_ary_push( ary, tmp );
+
+ VALUE vals = rb_ary_new();
+ for ( ; i != e && key == oldkey; ++i )
+ {
+ const MultiMap::mapped_type& val = i->second;
+ tmp = swig::from( val );
+ rb_ary_push( vals, tmp );
+ }
+
+ if ( RARRAY_LEN(vals) == 1 )
+ {
+ rb_ary_push( ary, tmp );
+ }
+ else
+ {
+ rb_ary_push( ary, vals );
+ }
+ }
+ return ary;
+ }
+
+ VALUE to_s()
+ {
+ MultiMap::iterator i = $self->begin();
+ MultiMap::iterator e = $self->end();
+ VALUE str = rb_str_new2( "" );
+ VALUE tmp;
+ while ( i != e )
+ {
+ const MultiMap::key_type& key = i->first;
+ const MultiMap::key_type& oldkey = key;
+ tmp = swig::from( key );
+ tmp = rb_obj_as_string( tmp );
+ str = rb_str_buf_append( str, tmp );
+
+ VALUE vals = rb_ary_new();
+ for ( ; i != e && key == oldkey; ++i )
+ {
+ const MultiMap::mapped_type& val = i->second;
+ tmp = swig::from( val );
+ rb_ary_push( vals, tmp );
+ }
+
+ tmp = rb_obj_as_string( vals );
+ str = rb_str_buf_append( str, tmp );
+ }
+ return str;
+ }
+ }
+%enddef
+
+
+%mixin std::multimap "Enumerable";
+
+%rename("delete") std::multimap::__delete__;
+%rename("reject!") std::multimap::reject_bang;
+%rename("map!") std::multimap::map_bang;
+%rename("empty?") std::multimap::empty;
+%rename("include?" ) std::multimap::__contains__ const;
+%rename("has_key?" ) std::multimap::has_key const;
+
+%alias std::multimap::push "<<";
+
+%include <std/std_multimap.i>
+
diff --git a/share/swig/2.0.11/ruby/std_multiset.i b/share/swig/2.0.11/ruby/std_multiset.i
new file mode 100644
index 0000000..87a7b29
--- /dev/null
+++ b/share/swig/2.0.11/ruby/std_multiset.i
@@ -0,0 +1,50 @@
+/*
+ Multisets
+*/
+
+%include <std_set.i>
+
+%fragment("StdMultisetTraits","header",fragment="StdSequenceTraits")
+%{
+ namespace swig {
+ template <class RubySeq, class T>
+ inline void
+ assign(const RubySeq& rubyseq, std::multiset<T>* seq) {
+ // seq->insert(rubyseq.begin(), rubyseq.end()); // not used as not always implemented
+ typedef typename RubySeq::value_type value_type;
+ typename RubySeq::const_iterator it = rubyseq.begin();
+ for (;it != rubyseq.end(); ++it) {
+ seq->insert(seq->end(),(value_type)(*it));
+ }
+ }
+
+ template <class T>
+ struct traits_asptr<std::multiset<T> > {
+ static int asptr(VALUE obj, std::multiset<T> **m) {
+ return traits_asptr_stdseq<std::multiset<T> >::asptr(obj, m);
+ }
+ };
+
+ template <class T>
+ struct traits_from<std::multiset<T> > {
+ static VALUE from(const std::multiset<T>& vec) {
+ return traits_from_stdseq<std::multiset<T> >::from(vec);
+ }
+ };
+ }
+%}
+
+#define %swig_multiset_methods(Set...) %swig_set_methods(Set)
+
+
+
+%rename("delete") std::multiset::__delete__;
+%rename("reject!") std::multiset::reject_bang;
+%rename("map!") std::multiset::map_bang;
+%rename("empty?") std::multiset::empty;
+%rename("include?" ) std::multiset::__contains__ const;
+%rename("has_key?" ) std::multiset::has_key const;
+
+%alias std::multiset::push "<<";
+
+%include <std/std_multiset.i>
diff --git a/share/swig/2.0.11/ruby/std_pair.i b/share/swig/2.0.11/ruby/std_pair.i
new file mode 100644
index 0000000..5b4c8ba
--- /dev/null
+++ b/share/swig/2.0.11/ruby/std_pair.i
@@ -0,0 +1,206 @@
+/*
+ Pairs
+*/
+%include <rubystdcommon.swg>
+
+//#define SWIG_STD_PAIR_ASVAL
+
+%fragment("StdPairTraits","header",fragment="StdTraits") {
+ namespace swig {
+
+ template <class T, class U >
+ struct traits_asval<std::pair<T,U> > {
+ typedef std::pair<T,U> value_type;
+
+ static int get_pair(VALUE first, VALUE second,
+ std::pair<T,U> *val)
+ {
+ if (val) {
+ T *pfirst = &(val->first);
+ int res1 = swig::asval((VALUE)first, pfirst);
+ if (!SWIG_IsOK(res1)) return res1;
+ U *psecond = &(val->second);
+ int res2 = swig::asval((VALUE)second, psecond);
+ if (!SWIG_IsOK(res2)) return res2;
+ return res1 > res2 ? res1 : res2;
+ } else {
+ T *pfirst = 0;
+ int res1 = swig::asval((VALUE)first, pfirst);
+ if (!SWIG_IsOK(res1)) return res1;
+ U *psecond = 0;
+ int res2 = swig::asval((VALUE)second, psecond);
+ if (!SWIG_IsOK(res2)) return res2;
+ return res1 > res2 ? res1 : res2;
+ }
+ }
+
+ static int asval(VALUE obj, std::pair<T,U> *val) {
+ int res = SWIG_ERROR;
+ if ( TYPE(obj) == T_ARRAY ) {
+ if (RARRAY_LEN(obj) == 2) {
+ VALUE first = rb_ary_entry(obj,0);
+ VALUE second = rb_ary_entry(obj,1);
+ res = get_pair(first, second, val);
+ }
+ } else {
+ value_type *p;
+ res = SWIG_ConvertPtr(obj,(void**)&p,
+ swig::type_info<value_type>(),0);
+ if (SWIG_IsOK(res) && val) *val = *p;
+ }
+ return res;
+ }
+ };
+
+ template <class T, class U >
+ struct traits_asptr<std::pair<T,U> > {
+ typedef std::pair<T,U> value_type;
+
+ static int get_pair(VALUE first, VALUE second,
+ std::pair<T,U> **val)
+ {
+ if (val) {
+ value_type *vp = %new_instance(std::pair<T,U>);
+ T *pfirst = &(vp->first);
+ int res1 = swig::asval((VALUE)first, pfirst);
+ if (!SWIG_IsOK(res1)) return res1;
+ U *psecond = &(vp->second);
+ int res2 = swig::asval((VALUE)second, psecond);
+ if (!SWIG_IsOK(res2)) return res2;
+ *val = vp;
+ return SWIG_AddNewMask(res1 > res2 ? res1 : res2);
+ } else {
+ T *pfirst = 0;
+ int res1 = swig::asval((VALUE)first, pfirst);
+ if (!SWIG_IsOK(res1)) return res1;
+ U *psecond = 0;
+ int res2 = swig::asval((VALUE)second, psecond);
+ if (!SWIG_IsOK(res2)) return res2;
+ return res1 > res2 ? res1 : res2;
+ }
+ }
+
+ static int asptr(VALUE obj, std::pair<T,U> **val) {
+ int res = SWIG_ERROR;
+ if ( TYPE(obj) == T_ARRAY ) {
+ if ( RARRAY_LEN(obj) == 2) {
+ VALUE first = rb_ary_entry(obj,0);
+ VALUE second = rb_ary_entry(obj,1);
+ res = get_pair(first, second, val);
+ }
+ } else {
+ value_type *p;
+ res = SWIG_ConvertPtr(obj,(void**)&p,
+ swig::type_info<value_type>(),0);
+ if (SWIG_IsOK(res) && val) *val = p;
+ }
+ return res;
+ }
+ };
+
+
+
+ template <class T, class U >
+ struct traits_from<std::pair<T,U> > {
+ static VALUE _wrap_pair_second( VALUE self )
+ {
+ std::pair< typename swig::noconst_traits<T >::noconst_type,U>* p = NULL;
+ swig::asptr( self, &p );
+ return swig::from( p->second );
+ }
+
+ static VALUE _wrap_pair_second_eq( VALUE self, VALUE arg )
+ {
+ std::pair< typename swig::noconst_traits<T >::noconst_type,U>* p = NULL;
+ swig::asptr( self, &p );
+ return swig::from( p->second );
+ }
+
+ static VALUE from(const std::pair<T,U>& val) {
+ VALUE obj = rb_ary_new2(2);
+ rb_ary_push(obj, swig::from<typename swig::noconst_traits<T >::noconst_type>(val.first));
+ rb_ary_push(obj, swig::from(val.second));
+ rb_define_singleton_method(obj, "second",
+ VALUEFUNC(_wrap_pair_second), 0 );
+ rb_define_singleton_method(obj, "second=",
+ VALUEFUNC(_wrap_pair_second_eq), 1 );
+ rb_obj_freeze(obj); // treat as immutable tuple
+ return obj;
+ }
+ };
+
+ }
+}
+
+// Missing typemap
+%typemap(in) std::pair* (int res) {
+ res = swig::asptr( $input, &$1 );
+ if (!SWIG_IsOK(res))
+ %argument_fail(res, "$1_type", $symname, $argnum);
+}
+
+
+%define %swig_pair_methods(pair...)
+
+%extend {
+ VALUE inspect() const
+ {
+ VALUE tmp;
+ const char *type_name = swig::type_name< pair >();
+ VALUE str = rb_str_new2( type_name );
+ str = rb_str_cat2( str, " (" );
+ tmp = swig::from( $self->first );
+ tmp = rb_obj_as_string( tmp );
+ str = rb_str_buf_append( str, tmp );
+ str = rb_str_cat2( str, "," );
+ tmp = swig::from( $self->second );
+ tmp = rb_obj_as_string( tmp );
+ str = rb_str_buf_append( str, tmp );
+ str = rb_str_cat2( str, ")" );
+ return str;
+ }
+
+ VALUE to_s() const
+ {
+ VALUE tmp;
+ VALUE str = rb_str_new2( "(" );
+ tmp = swig::from( $self->first );
+ tmp = rb_obj_as_string( tmp );
+ str = rb_str_buf_append( str, tmp );
+ str = rb_str_cat2( str, "," );
+ tmp = swig::from( $self->second );
+ tmp = rb_obj_as_string( tmp );
+ str = rb_str_buf_append( str, tmp );
+ str = rb_str_cat2( str, ")" );
+ return str;
+ }
+
+ VALUE __getitem__( int index )
+ {
+ if (( index % 2 ) == 0 )
+ return swig::from( $self->first );
+ else
+ return swig::from( $self->second );
+ }
+
+ VALUE __setitem__( int index, VALUE obj )
+ {
+ int res;
+ if (( index % 2 ) == 0 )
+ {
+ res = swig::asval( obj, &($self->first) );
+ }
+ else
+ {
+ res = swig::asval(obj, &($self->second) );
+ }
+ if (!SWIG_IsOK(res))
+ rb_raise( rb_eArgError, "invalid item for " #pair );
+ return obj;
+ }
+
+ } // extend
+
+%enddef
+
+%include <std/std_pair.i>
diff --git a/share/swig/2.0.11/ruby/std_queue.i b/share/swig/2.0.11/ruby/std_queue.i
new file mode 100644
index 0000000..a129367
--- /dev/null
+++ b/share/swig/2.0.11/ruby/std_queue.i
@@ -0,0 +1,33 @@
+/*
+ Queues
+*/
+
+%fragment("StdQueueTraits","header",fragment="StdSequenceTraits")
+%{
+ namespace swig {
+ template <class T>
+ struct traits_asptr<std::queue<T> > {
+ static int asptr(VALUE obj, std::queue<T> **vec) {
+ return traits_asptr_stdseq<std::queue<T> >::asptr(obj, vec);
+ }
+ };
+
+ template <class T>
+ struct traits_from<std::queue<T> > {
+ static VALUE from(const std::queue<T> & vec) {
+ return traits_from_stdseq<std::queue<T> >::from(vec);
+ }
+ };
+ }
+%}
+
+%rename("delete") std::queue::__delete__;
+%rename("reject!") std::queue::reject_bang;
+%rename("map!") std::queue::map_bang;
+%rename("empty?") std::queue::empty;
+%rename("include?" ) std::queue::__contains__ const;
+%rename("has_key?" ) std::queue::has_key const;
+
+%alias std::queue::push "<<";
+
+%include <std/std_queue.i>
diff --git a/share/swig/2.0.11/ruby/std_set.i b/share/swig/2.0.11/ruby/std_set.i
new file mode 100644
index 0000000..e38702e
--- /dev/null
+++ b/share/swig/2.0.11/ruby/std_set.i
@@ -0,0 +1,231 @@
+/*
+ Sets
+*/
+
+%fragment("StdSetTraits","header",fragment="<stddef.h>",fragment="StdSequenceTraits")
+%{
+ namespace swig {
+ template <class RubySeq, class T>
+ inline void
+ assign(const RubySeq& rubyseq, std::set<T>* seq) {
+ // seq->insert(rubyseq.begin(), rubyseq.end()); // not used as not always implemented
+ typedef typename RubySeq::value_type value_type;
+ typename RubySeq::const_iterator it = rubyseq.begin();
+ for (;it != rubyseq.end(); ++it) {
+ seq->insert(seq->end(),(value_type)(*it));
+ }
+ }
+
+ template <class T>
+ struct traits_asptr<std::set<T> > {
+ static int asptr(VALUE obj, std::set<T> **s) {
+ return traits_asptr_stdseq<std::set<T> >::asptr(obj, s);
+ }
+ };
+
+ template <class T>
+ struct traits_from<std::set<T> > {
+ static VALUE from(const std::set<T>& vec) {
+ return traits_from_stdseq<std::set<T> >::from(vec);
+ }
+ };
+
+
+ /**
+ * Set Iterator class for an iterator with no end() boundaries.
+ *
+ */
+ template<typename InOutIterator,
+ typename ValueType = typename std::iterator_traits<InOutIterator>::value_type,
+ typename FromOper = from_oper<ValueType>,
+ typename AsvalOper = asval_oper<ValueType> >
+ class SetIteratorOpen_T : public Iterator_T<InOutIterator>
+ {
+ public:
+ FromOper from;
+ AsvalOper asval;
+ typedef InOutIterator nonconst_iter;
+ typedef ValueType value_type;
+ typedef Iterator_T<nonconst_iter> base;
+ typedef SetIteratorOpen_T<InOutIterator, ValueType, FromOper, AsvalOper> self_type;
+
+ public:
+ SetIteratorOpen_T(nonconst_iter curr, VALUE seq = Qnil)
+ : Iterator_T<InOutIterator>(curr, seq)
+ {
+ }
+
+ virtual VALUE value() const {
+ return from(static_cast<const value_type&>(*(base::current)));
+ }
+
+ // no setValue allowed
+
+ Iterator *dup() const
+ {
+ return new self_type(*this);
+ }
+ };
+
+
+ /**
+ * Set Iterator class for a iterator where begin() and end() boundaries
+ are known.
+ *
+ */
+ template<typename InOutIterator,
+ typename ValueType = typename std::iterator_traits<InOutIterator>::value_type,
+ typename FromOper = from_oper<ValueType>,
+ typename AsvalOper = asval_oper<ValueType> >
+ class SetIteratorClosed_T : public Iterator_T<InOutIterator>
+ {
+ public:
+ FromOper from;
+ AsvalOper asval;
+ typedef InOutIterator nonconst_iter;
+ typedef ValueType value_type;
+ typedef Iterator_T<nonconst_iter> base;
+ typedef SetIteratorClosed_T<InOutIterator, ValueType, FromOper, AsvalOper> self_type;
+
+ protected:
+ virtual Iterator* advance(ptrdiff_t n)
+ {
+ std::advance( base::current, n );
+ if ( base::current == end )
+ throw stop_iteration();
+ return this;
+ }
+
+ public:
+ SetIteratorClosed_T(nonconst_iter curr, nonconst_iter first,
+ nonconst_iter last, VALUE seq = Qnil)
+ : Iterator_T<InOutIterator>(curr, seq), begin(first), end(last)
+ {
+ }
+
+ virtual VALUE value() const {
+ if (base::current == end) {
+ throw stop_iteration();
+ } else {
+ return from(static_cast<const value_type&>(*(base::current)));
+ }
+ }
+
+ // no setValue allowed
+
+
+ Iterator *dup() const
+ {
+ return new self_type(*this);
+ }
+
+ private:
+ nonconst_iter begin;
+ nonconst_iter end;
+ };
+
+ // Template specialization to construct a closed iterator for sets
+ // this turns a nonconst iterator into a const one for ruby to avoid
+ // allowing the user to change the value
+ template< typename InOutIter >
+ inline Iterator*
+ make_set_nonconst_iterator(const InOutIter& current,
+ const InOutIter& begin,
+ const InOutIter& end,
+ VALUE seq = Qnil)
+ {
+ return new SetIteratorClosed_T< InOutIter >(current,
+ begin, end, seq);
+ }
+
+ // Template specialization to construct an open iterator for sets
+ // this turns a nonconst iterator into a const one for ruby to avoid
+ // allowing the user to change the value
+ template< typename InOutIter >
+ inline Iterator*
+ make_set_nonconst_iterator(const InOutIter& current,
+ VALUE seq = Qnil)
+ {
+ return new SetIteratorOpen_T< InOutIter >(current, seq);
+ }
+
+ }
+%}
+
+%define %swig_sequence_methods_extra_set(Sequence...)
+ %extend {
+ %alias reject_bang "delete_if";
+ Sequence* reject_bang() {
+ if ( !rb_block_given_p() )
+ rb_raise( rb_eArgError, "no block given" );
+
+ for ( Sequence::iterator i = $self->begin(); i != $self->end(); ) {
+ VALUE r = swig::from< Sequence::value_type >(*i);
+ Sequence::iterator current = i++;
+ if ( RTEST( rb_yield(r) ) )
+ $self->erase(current);
+ }
+
+ return self;
+ }
+ }
+%enddef
+
+%define %swig_set_methods(set...)
+
+ %swig_sequence_methods_common(%arg(set));
+ %swig_sequence_methods_extra_set(%arg(set));
+
+ %fragment("RubyPairBoolOutputIterator","header",fragment=SWIG_From_frag(bool),fragment="RubySequence_Cont") {}
+
+// Redefine std::set iterator/reverse_iterator typemap
+%typemap(out,noblock=1) iterator, reverse_iterator {
+ $result = SWIG_NewPointerObj(swig::make_set_nonconst_iterator(%static_cast($1,const $type &),
+ self),
+ swig::Iterator::descriptor(),SWIG_POINTER_OWN);
+ }
+
+// Redefine std::set std::pair<iterator, bool> typemap
+ %typemap(out,noblock=1,fragment="RubyPairBoolOutputIterator")
+ std::pair<iterator, bool> {
+ $result = rb_ary_new2(2);
+ rb_ary_push($result, SWIG_NewPointerObj(swig::make_set_nonconst_iterator(%static_cast($1,$type &).first),
+ swig::Iterator::descriptor(),SWIG_POINTER_OWN));
+ rb_ary_push($result, SWIG_From(bool)(%static_cast($1,const $type &).second));
+ }
+
+ %extend {
+ %alias push "<<";
+ value_type push(const value_type& x) {
+ self->insert(x);
+ return x;
+ }
+
+ bool __contains__(const value_type& x) {
+ return self->find(x) != self->end();
+ }
+
+ value_type __getitem__(difference_type i) const throw (std::out_of_range) {
+ return *(swig::cgetpos(self, i));
+ }
+
+ };
+%enddef
+
+
+%mixin std::set "Enumerable";
+
+
+
+%rename("delete") std::set::__delete__;
+%rename("reject!") std::set::reject_bang;
+%rename("map!") std::set::map_bang;
+%rename("empty?") std::set::empty;
+%rename("include?" ) std::set::__contains__ const;
+%rename("has_key?" ) std::set::has_key const;
+
+%alias std::set::push "<<";
+
+
+%include <std/std_set.i>
+
diff --git a/share/swig/2.0.11/ruby/std_sstream.i b/share/swig/2.0.11/ruby/std_sstream.i
new file mode 100644
index 0000000..537a3ae
--- /dev/null
+++ b/share/swig/2.0.11/ruby/std_sstream.i
@@ -0,0 +1,2 @@
+
+%include <std/std_sstream.i>
diff --git a/share/swig/2.0.11/ruby/std_stack.i b/share/swig/2.0.11/ruby/std_stack.i
new file mode 100644
index 0000000..600c81c
--- /dev/null
+++ b/share/swig/2.0.11/ruby/std_stack.i
@@ -0,0 +1,35 @@
+/*
+ Stacks
+*/
+
+%fragment("StdStackTraits","header",fragment="StdSequenceTraits")
+%{
+ namespace swig {
+ template <class T>
+ struct traits_asptr<std::stack<T> > {
+ static int asptr(VALUE obj, std::stack<T> **vec) {
+ return traits_asptr_stdseq<std::stack<T> >::asptr(obj, vec);
+ }
+ };
+
+ template <class T>
+ struct traits_from<std::stack<T> > {
+ static VALUE from(const std::stack<T> & vec) {
+ return traits_from_stdseq<std::stack<T> >::from(vec);
+ }
+ };
+ }
+%}
+
+
+%rename("delete") std::stack::__delete__;
+%rename("reject!") std::stack::reject_bang;
+%rename("map!") std::stack::map_bang;
+%rename("empty?") std::stack::empty;
+%rename("include?" ) std::stack::__contains__ const;
+%rename("has_key?" ) std::stack::has_key const;
+
+%alias std::stack::push "<<";
+
+
+%include <std/std_stack.i>
diff --git a/share/swig/2.0.11/ruby/std_streambuf.i b/share/swig/2.0.11/ruby/std_streambuf.i
new file mode 100644
index 0000000..44b9bb4
--- /dev/null
+++ b/share/swig/2.0.11/ruby/std_streambuf.i
@@ -0,0 +1 @@
+%include <std/std_streambuf.i>
diff --git a/share/swig/2.0.11/ruby/std_string.i b/share/swig/2.0.11/ruby/std_string.i
new file mode 100644
index 0000000..cac4324
--- /dev/null
+++ b/share/swig/2.0.11/ruby/std_string.i
@@ -0,0 +1,9 @@
+
+%warnfilter(801) std::string; // wrong class name
+%warnfilter(378) std::basic_string::operator!=;
+
+
+AUTODOC(substr, "Return a portion of the String");
+
+%include <typemaps/std_string.swg>
+
diff --git a/share/swig/2.0.11/ruby/std_vector.i b/share/swig/2.0.11/ruby/std_vector.i
new file mode 100644
index 0000000..67fdcd1
--- /dev/null
+++ b/share/swig/2.0.11/ruby/std_vector.i
@@ -0,0 +1,52 @@
+/*
+ Vectors
+*/
+
+%fragment("StdVectorTraits","header",fragment="StdSequenceTraits")
+%{
+ namespace swig {
+ template <class T>
+ struct traits_asptr<std::vector<T> > {
+ static int asptr(VALUE obj, std::vector<T> **vec) {
+ return traits_asptr_stdseq<std::vector<T> >::asptr(obj, vec);
+ }
+ };
+
+ template <class T>
+ struct traits_from<std::vector<T> > {
+ static VALUE from(const std::vector<T>& vec) {
+ return traits_from_stdseq<std::vector<T> >::from(vec);
+ }
+ };
+ }
+%}
+
+
+
+%define %swig_vector_methods(Type...)
+ %swig_sequence_methods(Type)
+ %swig_sequence_front_inserters(Type);
+%enddef
+
+%define %swig_vector_methods_val(Type...)
+ %swig_sequence_methods_val(Type);
+ %swig_sequence_front_inserters(Type);
+%enddef
+
+
+%mixin std::vector "Enumerable";
+%ignore std::vector::push_back;
+%ignore std::vector::pop_back;
+
+
+%rename("delete") std::vector::__delete__;
+%rename("reject!") std::vector::reject_bang;
+%rename("map!") std::vector::map_bang;
+%rename("empty?") std::vector::empty;
+%rename("include?" ) std::vector::__contains__ const;
+%rename("has_key?" ) std::vector::has_key const;
+
+%alias std::vector::push "<<";
+
+%include <std/std_vector.i>
+
diff --git a/share/swig/2.0.11/ruby/std_vectora.i b/share/swig/2.0.11/ruby/std_vectora.i
new file mode 100644
index 0000000..1708361
--- /dev/null
+++ b/share/swig/2.0.11/ruby/std_vectora.i
@@ -0,0 +1,36 @@
+/*
+ Vectors + allocators
+*/
+
+%fragment("StdVectorATraits","header",fragment="StdSequenceTraits")
+%{
+ namespace swig {
+ template <class T, class A>
+ struct traits_asptr<std::vector<T,A> > {
+ typedef std::vector<T,A> vector_type;
+ typedef T value_type;
+ static int asptr(VALUE obj, vector_type **vec) {
+ return traits_asptr_stdseq<vector_type>::asptr(obj, vec);
+ }
+ };
+
+ template <class T, class A>
+ struct traits_from<std::vector<T,A> > {
+ typedef std::vector<T,A> vector_type;
+ static VALUE from(const vector_type& vec) {
+ return traits_from_stdseq<vector_type>::from(vec);
+ }
+ };
+ }
+%}
+
+
+#define %swig_vector_methods(Type...) %swig_sequence_methods(Type)
+#define %swig_vector_methods_val(Type...) %swig_sequence_methods_val(Type);
+
+%mixin std::vector "Enumerable";
+%ignore std::vector::push_back;
+%ignore std::vector::pop_back;
+%alias std::vector::push "<<";
+
+%include <std/std_vectora.i>
diff --git a/share/swig/2.0.11/ruby/std_wstring.i b/share/swig/2.0.11/ruby/std_wstring.i
new file mode 100644
index 0000000..5ca77c0
--- /dev/null
+++ b/share/swig/2.0.11/ruby/std_wstring.i
@@ -0,0 +1,3 @@
+%include <rubywstrings.swg>
+%include <typemaps/std_wstring.swg>
+
diff --git a/share/swig/2.0.11/ruby/stl.i b/share/swig/2.0.11/ruby/stl.i
new file mode 100644
index 0000000..9d2e91e
--- /dev/null
+++ b/share/swig/2.0.11/ruby/stl.i
@@ -0,0 +1,12 @@
+/* -----------------------------------------------------------------------------
+ * stl.i
+ *
+ * Initial STL definition. extended as needed in each language
+ * ----------------------------------------------------------------------------- */
+
+%include <std_common.i>
+%include <std_string.i>
+%include <std_vector.i>
+%include <std_map.i>
+%include <std_pair.i>
+
diff --git a/share/swig/2.0.11/ruby/timeval.i b/share/swig/2.0.11/ruby/timeval.i
new file mode 100644
index 0000000..e7bc2d3
--- /dev/null
+++ b/share/swig/2.0.11/ruby/timeval.i
@@ -0,0 +1,69 @@
+/*
+ struct timeval *
+ time_t
+
+ Ruby has builtin class Time. INPUT/OUTPUT typemap for timeval and
+ time_t is provided.
+
+*/
+%{
+#ifdef __cplusplus
+extern "C" {
+#endif
+#ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+struct timeval rb_time_timeval(VALUE);
+#endif
+#ifdef __cplusplus
+}
+#endif
+%}
+
+%typemap(in) struct timeval *INPUT (struct timeval temp)
+{
+ if (NIL_P($input))
+ $1 = NULL;
+ else {
+ temp = rb_time_timeval($input);
+ $1 = &temp;
+ }
+}
+
+%typemap(in,numinputs=0) struct timeval *OUTPUT(struct timeval temp)
+{
+ $1 = &temp;
+}
+
+%typemap(argout) struct timeval *OUTPUT
+{
+ $result = rb_time_new($1->tv_sec, $1->tv_usec);
+}
+
+%typemap(out) struct timeval *
+{
+ $result = rb_time_new($1->tv_sec, $1->tv_usec);
+}
+
+%typemap(out) struct timespec *
+{
+ $result = rb_time_new($1->tv_sec, $1->tv_nsec / 1000);
+}
+
+// time_t
+%typemap(in) time_t
+{
+ if (NIL_P($input))
+ $1 = (time_t)-1;
+ else
+ $1 = NUM2LONG(rb_funcall($input, rb_intern("tv_sec"), 0));
+}
+
+%typemap(typecheck) time_t
+{
+ $1 = (NIL_P($input) || TYPE(rb_funcall($input, rb_intern("respond_to?"), 1, ID2SYM(rb_intern("tv_sec")))) == T_TRUE);
+}
+
+%typemap(out) time_t
+{
+ $result = rb_time_new($1, 0);
+}
diff --git a/share/swig/2.0.11/ruby/typemaps.i b/share/swig/2.0.11/ruby/typemaps.i
new file mode 100644
index 0000000..c4db821
--- /dev/null
+++ b/share/swig/2.0.11/ruby/typemaps.i
@@ -0,0 +1,314 @@
+/* -----------------------------------------------------------------------------
+ * typemaps.i
+ *
+ * Pointer handling
+ *
+ * These mappings provide support for input/output arguments and
+ * common uses for C/C++ pointers. INOUT mappings allow for C/C++
+ * pointer variables in addition to input/output arguments.
+ * ----------------------------------------------------------------------------- */
+
+#if !defined(SWIG_USE_OLD_TYPEMAPS)
+%include <typemaps/typemaps.swg>
+#else
+
+/*
+The SWIG typemap library provides a language independent mechanism for
+supporting output arguments, input values, and other C function
+calling mechanisms. The primary use of the library is to provide a
+better interface to certain C function--especially those involving
+pointers.
+*/
+
+// ------------------------------------------------------------------------
+// Pointer handling
+//
+// These mappings provide support for input/output arguments and common
+// uses for C/C++ pointers.
+// ------------------------------------------------------------------------
+
+// INPUT typemaps.
+// These remap a C pointer to be an "INPUT" value which is passed by value
+// instead of reference.
+
+/*
+The following methods can be applied to turn a pointer into a simple
+"input" value. That is, instead of passing a pointer to an object,
+you would use a real value instead.
+
+ int *INPUT
+ short *INPUT
+ long *INPUT
+ long long *INPUT
+ unsigned int *INPUT
+ unsigned short *INPUT
+ unsigned long *INPUT
+ unsigned long long *INPUT
+ unsigned char *INPUT
+ bool *INPUT
+ float *INPUT
+ double *INPUT
+
+To use these, suppose you had a C function like this :
+
+ double fadd(double *a, double *b) {
+ return *a+*b;
+ }
+
+You could wrap it with SWIG as follows :
+
+ %include typemaps.i
+ double fadd(double *INPUT, double *INPUT);
+
+or you can use the %apply directive :
+
+ %include typemaps.i
+ %apply double *INPUT { double *a, double *b };
+ double fadd(double *a, double *b);
+
+*/
+
+%define INPUT_TYPEMAP(type, converter)
+%typemap(in) type *INPUT($*1_ltype temp), type &INPUT($*1_ltype temp)
+{
+ temp = ($*1_ltype) converter($input);
+ $1 = &temp;
+}
+%typemap(typecheck) type *INPUT = type;
+%typemap(typecheck) type &INPUT = type;
+%enddef
+
+INPUT_TYPEMAP(float, NUM2DBL);
+INPUT_TYPEMAP(double, NUM2DBL);
+INPUT_TYPEMAP(int, NUM2INT);
+INPUT_TYPEMAP(short, NUM2SHRT);
+INPUT_TYPEMAP(long, NUM2LONG);
+INPUT_TYPEMAP(long long, NUM2LL);
+INPUT_TYPEMAP(unsigned int, NUM2UINT);
+INPUT_TYPEMAP(unsigned short, NUM2USHRT);
+INPUT_TYPEMAP(unsigned long, NUM2ULONG);
+INPUT_TYPEMAP(unsigned long long, NUM2ULL);
+INPUT_TYPEMAP(unsigned char, NUM2UINT);
+INPUT_TYPEMAP(signed char, NUM2INT);
+INPUT_TYPEMAP(bool, RTEST);
+
+#undef INPUT_TYPEMAP
+
+// OUTPUT typemaps. These typemaps are used for parameters that
+// are output only. The output value is appended to the result as
+// a array element.
+
+/*
+The following methods can be applied to turn a pointer into an "output"
+value. When calling a function, no input value would be given for
+a parameter, but an output value would be returned. In the case of
+multiple output values, they are returned in the form of a Ruby Array.
+
+ int *OUTPUT
+ short *OUTPUT
+ long *OUTPUT
+ long long *OUTPUT
+ unsigned int *OUTPUT
+ unsigned short *OUTPUT
+ unsigned long *OUTPUT
+ unsigned long long *OUTPUT
+ unsigned char *OUTPUT
+ bool *OUTPUT
+ float *OUTPUT
+ double *OUTPUT
+
+For example, suppose you were trying to wrap the modf() function in the
+C math library which splits x into integral and fractional parts (and
+returns the integer part in one of its parameters).K:
+
+ double modf(double x, double *ip);
+
+You could wrap it with SWIG as follows :
+
+ %include typemaps.i
+ double modf(double x, double *OUTPUT);
+
+or you can use the %apply directive :
+
+ %include typemaps.i
+ %apply double *OUTPUT { double *ip };
+ double modf(double x, double *ip);
+
+The Ruby output of the function would be a Array containing both
+output values.
+*/
+
+%define OUTPUT_TYPEMAP(type, converter, convtype)
+%typemap(in,numinputs=0) type *OUTPUT($*1_ltype temp), type &OUTPUT($*1_ltype temp) "$1 = &temp;";
+%typemap(argout, fragment="output_helper") type *OUTPUT, type &OUTPUT {
+ VALUE o = converter(convtype (*$1));
+ $result = output_helper($result, o);
+}
+%enddef
+
+OUTPUT_TYPEMAP(int, INT2NUM, (int));
+OUTPUT_TYPEMAP(short, INT2NUM, (int));
+OUTPUT_TYPEMAP(long, INT2NUM, (long));
+OUTPUT_TYPEMAP(long long, LL2NUM, (long long));
+OUTPUT_TYPEMAP(unsigned int, UINT2NUM, (unsigned int));
+OUTPUT_TYPEMAP(unsigned short, UINT2NUM, (unsigned int));
+OUTPUT_TYPEMAP(unsigned long, UINT2NUM, (unsigned long));
+OUTPUT_TYPEMAP(unsigned long long, ULL2NUM, (unsigned long long));
+OUTPUT_TYPEMAP(unsigned char, UINT2NUM, (unsigned int));
+OUTPUT_TYPEMAP(signed char, INT2NUM, (int));
+OUTPUT_TYPEMAP(float, rb_float_new, (double));
+OUTPUT_TYPEMAP(double, rb_float_new, (double));
+
+#undef OUTPUT_TYPEMAP
+
+%typemap(in,numinputs=0) bool *OUTPUT(bool temp), bool &OUTPUT(bool temp) "$1 = &temp;";
+%typemap(argout, fragment="output_helper") bool *OUTPUT, bool &OUTPUT {
+ VALUE o = (*$1) ? Qtrue : Qfalse;
+ $result = output_helper($result, o);
+}
+
+// INOUT
+// Mappings for an argument that is both an input and output
+// parameter
+
+/*
+The following methods can be applied to make a function parameter both
+an input and output value. This combines the behavior of both the
+"INPUT" and "OUTPUT" methods described earlier. Output values are
+returned in the form of a Ruby array.
+
+ int *INOUT
+ short *INOUT
+ long *INOUT
+ long long *INOUT
+ unsigned int *INOUT
+ unsigned short *INOUT
+ unsigned long *INOUT
+ unsigned long long *INOUT
+ unsigned char *INOUT
+ bool *INOUT
+ float *INOUT
+ double *INOUT
+
+For example, suppose you were trying to wrap the following function :
+
+ void neg(double *x) {
+ *x = -(*x);
+ }
+
+You could wrap it with SWIG as follows :
+
+ %include typemaps.i
+ void neg(double *INOUT);
+
+or you can use the %apply directive :
+
+ %include typemaps.i
+ %apply double *INOUT { double *x };
+ void neg(double *x);
+
+Unlike C, this mapping does not directly modify the input value (since
+this makes no sense in Ruby). Rather, the modified input value shows
+up as the return value of the function. Thus, to apply this function
+to a Ruby variable you might do this :
+
+ x = neg(x)
+
+Note : previous versions of SWIG used the symbol 'BOTH' to mark
+input/output arguments. This is still supported, but will be slowly
+phased out in future releases.
+
+*/
+
+%typemap(in) int *INOUT = int *INPUT;
+%typemap(in) short *INOUT = short *INPUT;
+%typemap(in) long *INOUT = long *INPUT;
+%typemap(in) long long *INOUT = long long *INPUT;
+%typemap(in) unsigned *INOUT = unsigned *INPUT;
+%typemap(in) unsigned short *INOUT = unsigned short *INPUT;
+%typemap(in) unsigned long *INOUT = unsigned long *INPUT;
+%typemap(in) unsigned long long *INOUT = unsigned long long *INPUT;
+%typemap(in) unsigned char *INOUT = unsigned char *INPUT;
+%typemap(in) signed char *INOUT = signed char *INPUT;
+%typemap(in) bool *INOUT = bool *INPUT;
+%typemap(in) float *INOUT = float *INPUT;
+%typemap(in) double *INOUT = double *INPUT;
+
+%typemap(in) int &INOUT = int &INPUT;
+%typemap(in) short &INOUT = short &INPUT;
+%typemap(in) long &INOUT = long &INPUT;
+%typemap(in) long long &INOUT = long long &INPUT;
+%typemap(in) unsigned &INOUT = unsigned &INPUT;
+%typemap(in) unsigned short &INOUT = unsigned short &INPUT;
+%typemap(in) unsigned long &INOUT = unsigned long &INPUT;
+%typemap(in) unsigned long long &INOUT = unsigned long long &INPUT;
+%typemap(in) unsigned char &INOUT = unsigned char &INPUT;
+%typemap(in) signed char &INOUT = signed char &INPUT;
+%typemap(in) bool &INOUT = bool &INPUT;
+%typemap(in) float &INOUT = float &INPUT;
+%typemap(in) double &INOUT = double &INPUT;
+
+%typemap(argout) int *INOUT = int *OUTPUT;
+%typemap(argout) short *INOUT = short *OUTPUT;
+%typemap(argout) long *INOUT = long *OUTPUT;
+%typemap(argout) long long *INOUT = long long *OUTPUT;
+%typemap(argout) unsigned *INOUT = unsigned *OUTPUT;
+%typemap(argout) unsigned short *INOUT = unsigned short *OUTPUT;
+%typemap(argout) unsigned long *INOUT = unsigned long *OUTPUT;
+%typemap(argout) unsigned long long *INOUT = unsigned long long *OUTPUT;
+%typemap(argout) unsigned char *INOUT = unsigned char *OUTPUT;
+%typemap(argout) signed char *INOUT = signed char *OUTPUT;
+%typemap(argout) bool *INOUT = bool *OUTPUT;
+%typemap(argout) float *INOUT = float *OUTPUT;
+%typemap(argout) double *INOUT = double *OUTPUT;
+
+%typemap(argout) int &INOUT = int &OUTPUT;
+%typemap(argout) short &INOUT = short &OUTPUT;
+%typemap(argout) long &INOUT = long &OUTPUT;
+%typemap(argout) long long &INOUT = long long &OUTPUT;
+%typemap(argout) unsigned &INOUT = unsigned &OUTPUT;
+%typemap(argout) unsigned short &INOUT = unsigned short &OUTPUT;
+%typemap(argout) unsigned long &INOUT = unsigned long &OUTPUT;
+%typemap(argout) unsigned long long &INOUT = unsigned long long &OUTPUT;
+%typemap(argout) unsigned char &INOUT = unsigned char &OUTPUT;
+%typemap(argout) signed char &INOUT = signed char &OUTPUT;
+%typemap(argout) bool &INOUT = bool &OUTPUT;
+%typemap(argout) float &INOUT = float &OUTPUT;
+%typemap(argout) double &INOUT = double &OUTPUT;
+
+/* Overloading information */
+
+%typemap(typecheck) double *INOUT = double;
+%typemap(typecheck) signed char *INOUT = signed char;
+%typemap(typecheck) unsigned char *INOUT = unsigned char;
+%typemap(typecheck) unsigned long *INOUT = unsigned long;
+%typemap(typecheck) unsigned long long *INOUT = unsigned long long;
+%typemap(typecheck) unsigned short *INOUT = unsigned short;
+%typemap(typecheck) unsigned int *INOUT = unsigned int;
+%typemap(typecheck) long *INOUT = long;
+%typemap(typecheck) long long *INOUT = long long;
+%typemap(typecheck) short *INOUT = short;
+%typemap(typecheck) int *INOUT = int;
+%typemap(typecheck) float *INOUT = float;
+
+%typemap(typecheck) double &INOUT = double;
+%typemap(typecheck) signed char &INOUT = signed char;
+%typemap(typecheck) unsigned char &INOUT = unsigned char;
+%typemap(typecheck) unsigned long &INOUT = unsigned long;
+%typemap(typecheck) unsigned long long &INOUT = unsigned long long;
+%typemap(typecheck) unsigned short &INOUT = unsigned short;
+%typemap(typecheck) unsigned int &INOUT = unsigned int;
+%typemap(typecheck) long &INOUT = long;
+%typemap(typecheck) long long &INOUT = long long;
+%typemap(typecheck) short &INOUT = short;
+%typemap(typecheck) int &INOUT = int;
+%typemap(typecheck) float &INOUT = float;
+
+#endif
+
+// --------------------------------------------------------------------
+// Special types
+// --------------------------------------------------------------------
+%include <progargcargv.i>
+%include <file.i>
+%include <timeval.i>