Blob Blame History Raw
To: vim_dev@googlegroups.com
Subject: Patch 7.4.570
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.4.570
Problem:    Building with dynamic library does not work for Ruby 2.2.0
Solution:   Change #ifdefs and #defines. (Ken Takata)
Files:	    src/if_ruby.c


*** ../vim-7.4.569/src/if_ruby.c	2014-11-27 17:44:05.376820913 +0100
--- src/if_ruby.c	2015-01-14 14:02:59.680115042 +0100
***************
*** 96,106 ****
  # define rb_num2int rb_num2int_stub
  #endif
  
! #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 21
  /* Ruby 2.1 adds new GC called RGenGC and RARRAY_PTR uses
   * rb_gc_writebarrier_unprotect_promoted if USE_RGENGC  */
  # define rb_gc_writebarrier_unprotect_promoted rb_gc_writebarrier_unprotect_promoted_stub
  #endif
  
  #include <ruby.h>
  #ifdef RUBY19_OR_LATER
--- 96,110 ----
  # define rb_num2int rb_num2int_stub
  #endif
  
! #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER == 21
  /* Ruby 2.1 adds new GC called RGenGC and RARRAY_PTR uses
   * rb_gc_writebarrier_unprotect_promoted if USE_RGENGC  */
  # define rb_gc_writebarrier_unprotect_promoted rb_gc_writebarrier_unprotect_promoted_stub
  #endif
+ #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 22
+ # define rb_gc_writebarrier_unprotect rb_gc_writebarrier_unprotect_stub
+ # define rb_check_type rb_check_type_stub
+ #endif
  
  #include <ruby.h>
  #ifdef RUBY19_OR_LATER
***************
*** 180,186 ****
   */
  # define rb_assoc_new			dll_rb_assoc_new
  # define rb_cObject			(*dll_rb_cObject)
! # define rb_check_type			dll_rb_check_type
  # define rb_class_path			dll_rb_class_path
  # define rb_data_object_alloc		dll_rb_data_object_alloc
  # define rb_define_class_under		dll_rb_define_class_under
--- 184,192 ----
   */
  # define rb_assoc_new			dll_rb_assoc_new
  # define rb_cObject			(*dll_rb_cObject)
! # if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER < 22
! #  define rb_check_type			dll_rb_check_type
! # endif
  # define rb_class_path			dll_rb_class_path
  # define rb_data_object_alloc		dll_rb_data_object_alloc
  # define rb_define_class_under		dll_rb_define_class_under
***************
*** 382,388 ****
--- 388,398 ----
  # endif
  
  # if defined(USE_RGENGC) && USE_RGENGC
+ #  if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER == 21
  static void (*dll_rb_gc_writebarrier_unprotect_promoted)(VALUE);
+ #  else
+ static void (*dll_rb_gc_writebarrier_unprotect)(VALUE obj);
+ #  endif
  # endif
  
  # if defined(RUBY19_OR_LATER) && !defined(PROTO)
***************
*** 420,429 ****
--- 430,453 ----
  
     /* Do not generate a prototype here, VALUE isn't always defined. */
  # if defined(USE_RGENGC) && USE_RGENGC && !defined(PROTO)
+ #  if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER == 21
  void rb_gc_writebarrier_unprotect_promoted_stub(VALUE obj)
  {
      dll_rb_gc_writebarrier_unprotect_promoted(obj);
  }
+ #  else
+ void rb_gc_writebarrier_unprotect_stub(VALUE obj)
+ {
+     dll_rb_gc_writebarrier_unprotect(obj);
+ }
+ #  endif
+ # endif
+ 
+ # if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 22
+ void rb_check_type_stub(VALUE v, int i)
+ {
+     dll_rb_check_type(v, i);
+ }
  # endif
  
  static HINSTANCE hinstRuby = NULL; /* Instance of ruby.dll */
***************
*** 542,548 ****
--- 566,576 ----
      {"ruby_init_stack", (RUBY_PROC*)&dll_ruby_init_stack},
  # endif
  # if defined(USE_RGENGC) && USE_RGENGC
+ #  if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER == 21
      {"rb_gc_writebarrier_unprotect_promoted", (RUBY_PROC*)&dll_rb_gc_writebarrier_unprotect_promoted},
+ #  else
+     {"rb_gc_writebarrier_unprotect", (RUBY_PROC*)&dll_rb_gc_writebarrier_unprotect},
+ #  endif
  # endif
      {"", NULL},
  };
*** ../vim-7.4.569/src/version.c	2015-01-14 12:44:38.407422077 +0100
--- src/version.c	2015-01-14 14:02:53.868178396 +0100
***************
*** 743,744 ****
--- 743,746 ----
  {   /* Add new patch number below this line */
+ /**/
+     570,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
89. In addition to your e-mail address being on your business
    cards you even have your own domain.

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///