components/vim/patches/if_ruby_c.patch
branchs11-update
changeset 3857 5e5034b03491
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/vim/patches/if_ruby_c.patch	Wed Feb 25 16:04:16 2015 -0800
@@ -0,0 +1,80 @@
+# Apply ruby 2.0 fix to ruby 1.9 as well.  Needed to allow
+# vim to build with ruby 1.9.
+# Includes changes from vim v7.4 plus a patch
+# applied upstream to vim 7.4.224.  See
+# https://groups.google.com/forum/#!msg/vim_dev/r8wzUVNYIfQ/m0DM8Wt97vkJ
+
+--- src/if_ruby.c	Tue Jul 10 13:28:45 2012
++++ src/if_ruby.c	Fri Feb 20 19:55:21 2015
+@@ -85,6 +85,14 @@
+ # define rb_int2big rb_int2big_stub
+ #endif
+ 
++#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 19 \
++    && SIZEOF_INT < SIZEOF_LONG
++/* Ruby 1.9 defines a number of static functions which use rb_fix2int and
++ * rb_num2int if SIZEOF_INT < SIZEOF_LONG (64bit) */
++# define rb_fix2int rb_fix2int_stub
++# define rb_num2int rb_num2int_stub
++#endif
++
+ #include <ruby.h>
+ #ifdef RUBY19_OR_LATER
+ # include <ruby/encoding.h>
+@@ -178,6 +186,13 @@
+ #define rb_hash_new			dll_rb_hash_new
+ #define rb_inspect			dll_rb_inspect
+ #define rb_int2inum			dll_rb_int2inum
++# if SIZEOF_INT < SIZEOF_LONG /* 64 bits only */
++# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER <= 18
++#  define rb_fix2int		dll_rb_fix2int
++#  define rb_num2int		dll_rb_num2int
++# endif
++#  define rb_num2uint		dll_rb_num2uint
++# endif
+ #define rb_lastline_get			dll_rb_lastline_get
+ #define rb_lastline_set			dll_rb_lastline_set
+ #define rb_load_protect			dll_rb_load_protect
+@@ -269,6 +284,11 @@
+ static VALUE (*dll_rb_inspect) (VALUE);
+ static VALUE (*dll_rb_int2inum) (long);
+ static VALUE (*dll_rb_int2inum) (long);
++# if SIZEOF_INT < SIZEOF_LONG /* 64 bits only */
++static long (*dll_rb_fix2int) (VALUE);
++static long (*dll_rb_num2int) (VALUE);
++static unsigned long (*dll_rb_num2uint) (VALUE);
++# endif
+ static VALUE (*dll_rb_lastline_get) (void);
+ static void (*dll_rb_lastline_set) (VALUE);
+ static void (*dll_rb_load_protect) (VALUE, int, int*);
+@@ -336,7 +356,17 @@
+     return dll_rb_int2big(x);
+ }
+ #endif
+-
++#  if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 19 \
++    && SIZEOF_INT < SIZEOF_LONG
++long rb_fix2int_stub(VALUE x)
++{
++    return dll_rb_fix2int(x);
++}
++long rb_num2int_stub(VALUE x)
++{
++    return dll_rb_num2int(x);
++}
++#  endif
+ static HINSTANCE hinstRuby = NULL; /* Instance of ruby.dll */
+ 
+ /*
+@@ -377,6 +407,11 @@
+     {"rb_hash_new", (RUBY_PROC*)&dll_rb_hash_new},
+     {"rb_inspect", (RUBY_PROC*)&dll_rb_inspect},
+     {"rb_int2inum", (RUBY_PROC*)&dll_rb_int2inum},
++# if SIZEOF_INT < SIZEOF_LONG /* 64 bits only */
++    {"rb_fix2int", (RUBY_PROC*)&dll_rb_fix2int},
++    {"rb_num2int", (RUBY_PROC*)&dll_rb_num2int},
++    {"rb_num2uint", (RUBY_PROC*)&dll_rb_num2uint},
++# endif
+     {"rb_lastline_get", (RUBY_PROC*)&dll_rb_lastline_get},
+     {"rb_lastline_set", (RUBY_PROC*)&dll_rb_lastline_set},
+     {"rb_load_protect", (RUBY_PROC*)&dll_rb_load_protect},