Karsten Hopp 07c82b
To: vim-dev@vim.org
Karsten Hopp 07c82b
Subject: Patch 7.2.387
Karsten Hopp 07c82b
Fcc: outbox
Karsten Hopp 07c82b
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 07c82b
Mime-Version: 1.0
Karsten Hopp 07c82b
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 07c82b
Content-Transfer-Encoding: 8bit
Karsten Hopp 07c82b
------------
Karsten Hopp 07c82b
Karsten Hopp 07c82b
Patch 7.2.387
Karsten Hopp 07c82b
Problem:    Ruby with MingW still doesn't build all versions.
Karsten Hopp 07c82b
Solution:   More #ifdefs for the  Ruby code. (Sergey Khorev)
Karsten Hopp 07c82b
Files:	    src/if_ruby.c
Karsten Hopp 07c82b
Karsten Hopp 07c82b
Karsten Hopp 07c82b
*** ../vim-7.2.386/src/if_ruby.c	2010-02-24 15:47:58.000000000 +0100
Karsten Hopp 07c82b
--- src/if_ruby.c	2010-03-10 12:40:30.000000000 +0100
Karsten Hopp 07c82b
***************
Karsten Hopp 07c82b
*** 39,46 ****
Karsten Hopp 07c82b
  # define rb_cTrueClass		(*dll_rb_cTrueClass)
Karsten Hopp 07c82b
  # if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
Karsten Hopp 07c82b
  /*
Karsten Hopp 07c82b
!  * On ver 1.8, all Ruby functions are exported with "__declspce(dllimport)"
Karsten Hopp 07c82b
!  * in ruby.h.  But it cause trouble for these variables, because it is
Karsten Hopp 07c82b
   * defined in this file.  When defined this RUBY_EXPORT it modified to
Karsten Hopp 07c82b
   * "extern" and be able to avoid this problem.
Karsten Hopp 07c82b
   */
Karsten Hopp 07c82b
--- 39,46 ----
Karsten Hopp 07c82b
  # define rb_cTrueClass		(*dll_rb_cTrueClass)
Karsten Hopp 07c82b
  # if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
Karsten Hopp 07c82b
  /*
Karsten Hopp 07c82b
!  * On ver 1.8, all Ruby functions are exported with "__declspec(dllimport)"
Karsten Hopp 07c82b
!  * in ruby.h.  But it causes trouble for these variables, because it is
Karsten Hopp 07c82b
   * defined in this file.  When defined this RUBY_EXPORT it modified to
Karsten Hopp 07c82b
   * "extern" and be able to avoid this problem.
Karsten Hopp 07c82b
   */
Karsten Hopp 07c82b
***************
Karsten Hopp 07c82b
*** 53,58 ****
Karsten Hopp 07c82b
--- 53,65 ----
Karsten Hopp 07c82b
  # undef _WIN32_WINNT
Karsten Hopp 07c82b
  #endif
Karsten Hopp 07c82b
  
Karsten Hopp 07c82b
+ #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 19
Karsten Hopp 07c82b
+ /* Ruby 1.9 defines a number of static functions which use rb_num2long and
Karsten Hopp 07c82b
+  * rb_int2big */
Karsten Hopp 07c82b
+ # define rb_num2long rb_num2long_stub
Karsten Hopp 07c82b
+ # define rb_int2big rb_int2big_stub
Karsten Hopp 07c82b
+ #endif
Karsten Hopp 07c82b
+ 
Karsten Hopp 07c82b
  #include <ruby.h>
Karsten Hopp 07c82b
  #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
Karsten Hopp 07c82b
  # include <ruby/encoding.h>
Karsten Hopp 07c82b
***************
Karsten Hopp 07c82b
*** 159,165 ****
Karsten Hopp 07c82b
  #define rb_str_concat			dll_rb_str_concat
Karsten Hopp 07c82b
  #define rb_str_new			dll_rb_str_new
Karsten Hopp 07c82b
  #define rb_str_new2			dll_rb_str_new2
Karsten Hopp 07c82b
! #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
Karsten Hopp 07c82b
  # define rb_errinfo			dll_rb_errinfo
Karsten Hopp 07c82b
  #else
Karsten Hopp 07c82b
  # define ruby_errinfo			(*dll_ruby_errinfo)
Karsten Hopp 07c82b
--- 166,179 ----
Karsten Hopp 07c82b
  #define rb_str_concat			dll_rb_str_concat
Karsten Hopp 07c82b
  #define rb_str_new			dll_rb_str_new
Karsten Hopp 07c82b
  #define rb_str_new2			dll_rb_str_new2
Karsten Hopp 07c82b
! #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
Karsten Hopp 07c82b
! # define rb_string_value_ptr		dll_rb_string_value_ptr
Karsten Hopp 07c82b
! # define rb_float_new			dll_rb_float_new
Karsten Hopp 07c82b
! # define rb_ary_new			dll_rb_ary_new
Karsten Hopp 07c82b
! # define rb_ary_push			dll_rb_ary_push
Karsten Hopp 07c82b
! #endif
Karsten Hopp 07c82b
! #if defined(RUBY_VERSION) && RUBY_VERSION >= 19 \
Karsten Hopp 07c82b
!     || defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 19
Karsten Hopp 07c82b
  # define rb_errinfo			dll_rb_errinfo
Karsten Hopp 07c82b
  #else
Karsten Hopp 07c82b
  # define ruby_errinfo			(*dll_ruby_errinfo)
Karsten Hopp 07c82b
***************
Karsten Hopp 07c82b
*** 226,232 ****
Karsten Hopp 07c82b
  static VALUE (*dll_rb_str_concat) (VALUE, VALUE);
Karsten Hopp 07c82b
  static VALUE (*dll_rb_str_new) (const char*, long);
Karsten Hopp 07c82b
  static VALUE (*dll_rb_str_new2) (const char*);
Karsten Hopp 07c82b
! #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
Karsten Hopp 07c82b
  static VALUE (*dll_rb_errinfo) (void);
Karsten Hopp 07c82b
  #else
Karsten Hopp 07c82b
  static VALUE *dll_ruby_errinfo;
Karsten Hopp 07c82b
--- 240,247 ----
Karsten Hopp 07c82b
  static VALUE (*dll_rb_str_concat) (VALUE, VALUE);
Karsten Hopp 07c82b
  static VALUE (*dll_rb_str_new) (const char*, long);
Karsten Hopp 07c82b
  static VALUE (*dll_rb_str_new2) (const char*);
Karsten Hopp 07c82b
! #if defined(RUBY_VERSION) && RUBY_VERSION >= 19 \
Karsten Hopp 07c82b
!     || defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 19
Karsten Hopp 07c82b
  static VALUE (*dll_rb_errinfo) (void);
Karsten Hopp 07c82b
  #else
Karsten Hopp 07c82b
  static VALUE *dll_ruby_errinfo;
Karsten Hopp 07c82b
***************
Karsten Hopp 07c82b
*** 235,240 ****
Karsten Hopp 07c82b
--- 250,264 ----
Karsten Hopp 07c82b
  static void (*dll_ruby_init_loadpath) (void);
Karsten Hopp 07c82b
  static void (*dll_NtInitialize) (int*, char***);
Karsten Hopp 07c82b
  #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
Karsten Hopp 07c82b
+ static char * (*dll_rb_string_value_ptr) (volatile VALUE*);
Karsten Hopp 07c82b
+ static VALUE (*dll_rb_float_new) (double);
Karsten Hopp 07c82b
+ static VALUE (*dll_rb_ary_new) (void);
Karsten Hopp 07c82b
+ static VALUE (*dll_rb_ary_push) (VALUE, VALUE);
Karsten Hopp 07c82b
+ #endif
Karsten Hopp 07c82b
+ #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 19
Karsten Hopp 07c82b
+ static VALUE (*dll_rb_int2big)(SIGNED_VALUE);
Karsten Hopp 07c82b
+ #endif
Karsten Hopp 07c82b
+ #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
Karsten Hopp 07c82b
  static int (*dll_rb_w32_snprintf)(char*, size_t, const char*, ...);
Karsten Hopp 07c82b
  #endif
Karsten Hopp 07c82b
  
Karsten Hopp 07c82b
***************
Karsten Hopp 07c82b
*** 246,251 ****
Karsten Hopp 07c82b
--- 270,286 ----
Karsten Hopp 07c82b
  static VALUE (*dll_rb_sprintf) (const char*, ...);
Karsten Hopp 07c82b
  #endif
Karsten Hopp 07c82b
  
Karsten Hopp 07c82b
+ #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 19
Karsten Hopp 07c82b
+ static SIGNED_VALUE rb_num2long_stub(VALUE x)
Karsten Hopp 07c82b
+ {
Karsten Hopp 07c82b
+     return dll_rb_num2long(x);
Karsten Hopp 07c82b
+ }
Karsten Hopp 07c82b
+ static VALUE rb_int2big_stub(SIGNED_VALUE x)
Karsten Hopp 07c82b
+ {
Karsten Hopp 07c82b
+     return dll_rb_int2big(x);
Karsten Hopp 07c82b
+ }
Karsten Hopp 07c82b
+ #endif
Karsten Hopp 07c82b
+ 
Karsten Hopp 07c82b
  static HINSTANCE hinstRuby = 0; /* Instance of ruby.dll */
Karsten Hopp 07c82b
  
Karsten Hopp 07c82b
  /*
Karsten Hopp 07c82b
***************
Karsten Hopp 07c82b
*** 301,317 ****
Karsten Hopp 07c82b
      {"rb_str_concat", (RUBY_PROC*)&dll_rb_str_concat},
Karsten Hopp 07c82b
      {"rb_str_new", (RUBY_PROC*)&dll_rb_str_new},
Karsten Hopp 07c82b
      {"rb_str_new2", (RUBY_PROC*)&dll_rb_str_new2},
Karsten Hopp 07c82b
! #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
Karsten Hopp 07c82b
      {"rb_errinfo", (RUBY_PROC*)&dll_rb_errinfo},
Karsten Hopp 07c82b
  #else
Karsten Hopp 07c82b
      {"ruby_errinfo", (RUBY_PROC*)&dll_ruby_errinfo},
Karsten Hopp 07c82b
  #endif
Karsten Hopp 07c82b
      {"ruby_init", (RUBY_PROC*)&dll_ruby_init},
Karsten Hopp 07c82b
      {"ruby_init_loadpath", (RUBY_PROC*)&dll_ruby_init_loadpath},
Karsten Hopp 07c82b
!     {"NtInitialize", (RUBY_PROC*)&dll_NtInitialize},
Karsten Hopp 07c82b
  #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
Karsten Hopp 07c82b
      {"rb_w32_snprintf", (RUBY_PROC*)&dll_rb_w32_snprintf},
Karsten Hopp 07c82b
  #endif
Karsten Hopp 07c82b
  #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
Karsten Hopp 07c82b
      {"ruby_script", (RUBY_PROC*)&dll_ruby_script},
Karsten Hopp 07c82b
      {"rb_enc_find_index", (RUBY_PROC*)&dll_rb_enc_find_index},
Karsten Hopp 07c82b
--- 336,368 ----
Karsten Hopp 07c82b
      {"rb_str_concat", (RUBY_PROC*)&dll_rb_str_concat},
Karsten Hopp 07c82b
      {"rb_str_new", (RUBY_PROC*)&dll_rb_str_new},
Karsten Hopp 07c82b
      {"rb_str_new2", (RUBY_PROC*)&dll_rb_str_new2},
Karsten Hopp 07c82b
! #if defined(RUBY_VERSION) && RUBY_VERSION >= 19 \
Karsten Hopp 07c82b
!     || defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 19
Karsten Hopp 07c82b
      {"rb_errinfo", (RUBY_PROC*)&dll_rb_errinfo},
Karsten Hopp 07c82b
  #else
Karsten Hopp 07c82b
      {"ruby_errinfo", (RUBY_PROC*)&dll_ruby_errinfo},
Karsten Hopp 07c82b
  #endif
Karsten Hopp 07c82b
      {"ruby_init", (RUBY_PROC*)&dll_ruby_init},
Karsten Hopp 07c82b
      {"ruby_init_loadpath", (RUBY_PROC*)&dll_ruby_init_loadpath},
Karsten Hopp 07c82b
!     {
Karsten Hopp 07c82b
! #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER < 19
Karsten Hopp 07c82b
!     "NtInitialize",
Karsten Hopp 07c82b
! #else
Karsten Hopp 07c82b
!     "ruby_sysinit",
Karsten Hopp 07c82b
! #endif
Karsten Hopp 07c82b
! 			(RUBY_PROC*)&dll_NtInitialize},
Karsten Hopp 07c82b
  #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
Karsten Hopp 07c82b
      {"rb_w32_snprintf", (RUBY_PROC*)&dll_rb_w32_snprintf},
Karsten Hopp 07c82b
  #endif
Karsten Hopp 07c82b
+ #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
Karsten Hopp 07c82b
+     {"rb_string_value_ptr", (RUBY_PROC*)&dll_rb_string_value_ptr},
Karsten Hopp 07c82b
+     {"rb_float_new", (RUBY_PROC*)&dll_rb_float_new},
Karsten Hopp 07c82b
+     {"rb_ary_new", (RUBY_PROC*)&dll_rb_ary_new},
Karsten Hopp 07c82b
+     {"rb_ary_push", (RUBY_PROC*)&dll_rb_ary_push},
Karsten Hopp 07c82b
+ #endif
Karsten Hopp 07c82b
+ #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 19
Karsten Hopp 07c82b
+     {"rb_int2big", (RUBY_PROC*)&dll_rb_int2big},
Karsten Hopp 07c82b
+ #endif
Karsten Hopp 07c82b
  #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
Karsten Hopp 07c82b
      {"ruby_script", (RUBY_PROC*)&dll_ruby_script},
Karsten Hopp 07c82b
      {"rb_enc_find_index", (RUBY_PROC*)&dll_rb_enc_find_index},
Karsten Hopp 07c82b
***************
Karsten Hopp 07c82b
*** 569,575 ****
Karsten Hopp 07c82b
  static void error_print(int state)
Karsten Hopp 07c82b
  {
Karsten Hopp 07c82b
  #ifndef DYNAMIC_RUBY
Karsten Hopp 07c82b
! #if !(defined(RUBY_VERSION) &&  RUBY_VERSION >= 19)
Karsten Hopp 07c82b
      RUBYEXTERN VALUE ruby_errinfo;
Karsten Hopp 07c82b
  #endif
Karsten Hopp 07c82b
  #endif
Karsten Hopp 07c82b
--- 620,627 ----
Karsten Hopp 07c82b
  static void error_print(int state)
Karsten Hopp 07c82b
  {
Karsten Hopp 07c82b
  #ifndef DYNAMIC_RUBY
Karsten Hopp 07c82b
! #if !(defined(RUBY_VERSION) && RUBY_VERSION >= 19) \
Karsten Hopp 07c82b
!     && !(defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 19)
Karsten Hopp 07c82b
      RUBYEXTERN VALUE ruby_errinfo;
Karsten Hopp 07c82b
  #endif
Karsten Hopp 07c82b
  #endif
Karsten Hopp 07c82b
***************
Karsten Hopp 07c82b
*** 605,611 ****
Karsten Hopp 07c82b
  	break;
Karsten Hopp 07c82b
      case TAG_RAISE:
Karsten Hopp 07c82b
      case TAG_FATAL:
Karsten Hopp 07c82b
! #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
Karsten Hopp 07c82b
  	eclass = CLASS_OF(rb_errinfo());
Karsten Hopp 07c82b
  	einfo = rb_obj_as_string(rb_errinfo());
Karsten Hopp 07c82b
  #else
Karsten Hopp 07c82b
--- 657,664 ----
Karsten Hopp 07c82b
  	break;
Karsten Hopp 07c82b
      case TAG_RAISE:
Karsten Hopp 07c82b
      case TAG_FATAL:
Karsten Hopp 07c82b
! #if defined(RUBY_VERSION) && RUBY_VERSION >= 19 \
Karsten Hopp 07c82b
!     || defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 19
Karsten Hopp 07c82b
  	eclass = CLASS_OF(rb_errinfo());
Karsten Hopp 07c82b
  	einfo = rb_obj_as_string(rb_errinfo());
Karsten Hopp 07c82b
  #else
Karsten Hopp 07c82b
*** ../vim-7.2.386/src/version.c	2010-03-10 12:24:44.000000000 +0100
Karsten Hopp 07c82b
--- src/version.c	2010-03-10 12:45:55.000000000 +0100
Karsten Hopp 07c82b
***************
Karsten Hopp 07c82b
*** 683,684 ****
Karsten Hopp 07c82b
--- 683,686 ----
Karsten Hopp 07c82b
  {   /* Add new patch number below this line */
Karsten Hopp 07c82b
+ /**/
Karsten Hopp 07c82b
+     387,
Karsten Hopp 07c82b
  /**/
Karsten Hopp 07c82b
Karsten Hopp 07c82b
-- 
Karsten Hopp 07c82b
Vim is like Emacs without all the typing.  (John "Johann" Spetz)
Karsten Hopp 07c82b
Karsten Hopp 07c82b
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 07c82b
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 07c82b
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 07c82b
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///