To: vim-dev@vim.org Subject: Patch 6.2.066 (extra) Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.2.066 (extra) Problem: Ruby interface doesn't work with Ruby 1.8.0. Solution: Change "defout" to "stdout". (Aron Grifis) Change dynamic loading. (Taro Muraoka) Files: src/if_ruby.c, src/Make_mvc.mak *** ../vim-6.2.065/src/if_ruby.c Sat Apr 19 15:21:16 2003 --- src/if_ruby.c Fri Aug 8 20:43:45 2003 *************** *** 12,18 **** #include #ifdef _WIN32 ! # define NT # ifndef DYNAMIC_RUBY # define IMPORT /* For static dll usage __declspec(dllimport) */ # define RUBYEXTERN __declspec(dllimport) --- 12,20 ---- #include #ifdef _WIN32 ! # if !defined(DYNAMIC_RUBY_VER) || (DYNAMIC_RUBY_VER < 18) ! # define NT ! # endif # ifndef DYNAMIC_RUBY # define IMPORT /* For static dll usage __declspec(dllimport) */ # define RUBYEXTERN __declspec(dllimport) *************** *** 33,38 **** --- 35,49 ---- # define rb_cNilClass (*dll_rb_cNilClass) # define rb_cSymbol (*dll_rb_cSymbol) # define rb_cTrueClass (*dll_rb_cTrueClass) + # if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18 + /* + * On ver 1.8, all Ruby functions are exported with "__declspce(dllimport)" + * in ruby.h. But it cause trouble for these variables, because it is + * defined in this file. When defined this RUBY_EXPORT it modified to + * "extern" and be able to avoid this problem. + */ + # define RUBY_EXPORT + # endif #endif #include *************** *** 83,89 **** #define rb_define_module_function dll_rb_define_module_function #define rb_define_singleton_method dll_rb_define_singleton_method #define rb_define_virtual_variable dll_rb_define_virtual_variable ! #define rb_defout (*dll_rb_defout) #define rb_eArgError (*dll_rb_eArgError) #define rb_eIndexError (*dll_rb_eIndexError) #define rb_eRuntimeError (*dll_rb_eRuntimeError) --- 94,100 ---- #define rb_define_module_function dll_rb_define_module_function #define rb_define_singleton_method dll_rb_define_singleton_method #define rb_define_virtual_variable dll_rb_define_virtual_variable ! #define rb_stdout (*dll_rb_stdout) #define rb_eArgError (*dll_rb_eArgError) #define rb_eIndexError (*dll_rb_eIndexError) #define rb_eRuntimeError (*dll_rb_eRuntimeError) *************** *** 111,116 **** --- 122,130 ---- #define ruby_errinfo (*dll_ruby_errinfo) #define ruby_init dll_ruby_init #define ruby_init_loadpath dll_ruby_init_loadpath + #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18 + # define rb_w32_snprintf dll_rb_w32_snprintf + #endif /* * Pointers for dynamic link *************** *** 133,139 **** static void (*dll_rb_define_module_function) (VALUE,const char*,VALUE(*)(),int); static void (*dll_rb_define_singleton_method) (VALUE,const char*,VALUE(*)(),int); static void (*dll_rb_define_virtual_variable) (const char*,VALUE(*)(),void(*)()); ! static VALUE *dll_rb_defout; static VALUE *dll_rb_eArgError; static VALUE *dll_rb_eIndexError; static VALUE *dll_rb_eRuntimeError; --- 147,153 ---- static void (*dll_rb_define_module_function) (VALUE,const char*,VALUE(*)(),int); static void (*dll_rb_define_singleton_method) (VALUE,const char*,VALUE(*)(),int); static void (*dll_rb_define_virtual_variable) (const char*,VALUE(*)(),void(*)()); ! static VALUE *dll_rb_stdout; static VALUE *dll_rb_eArgError; static VALUE *dll_rb_eIndexError; static VALUE *dll_rb_eRuntimeError; *************** *** 162,167 **** --- 176,182 ---- static VALUE *dll_ruby_errinfo; static void (*dll_ruby_init) (void); static void (*dll_ruby_init_loadpath) (void); + static int (*dll_rb_w32_snprintf)(char*, size_t, const char*, ...); static HINSTANCE hinstRuby = 0; /* Instance of ruby.dll */ *************** *** 193,199 **** {"rb_define_module_function", (RUBY_PROC*)&dll_rb_define_module_function}, {"rb_define_singleton_method", (RUBY_PROC*)&dll_rb_define_singleton_method}, {"rb_define_virtual_variable", (RUBY_PROC*)&dll_rb_define_virtual_variable}, ! {"rb_defout", (RUBY_PROC*)&dll_rb_defout}, {"rb_eArgError", (RUBY_PROC*)&dll_rb_eArgError}, {"rb_eIndexError", (RUBY_PROC*)&dll_rb_eIndexError}, {"rb_eRuntimeError", (RUBY_PROC*)&dll_rb_eRuntimeError}, --- 208,214 ---- {"rb_define_module_function", (RUBY_PROC*)&dll_rb_define_module_function}, {"rb_define_singleton_method", (RUBY_PROC*)&dll_rb_define_singleton_method}, {"rb_define_virtual_variable", (RUBY_PROC*)&dll_rb_define_virtual_variable}, ! {"rb_stdout", (RUBY_PROC*)&dll_rb_stdout}, {"rb_eArgError", (RUBY_PROC*)&dll_rb_eArgError}, {"rb_eIndexError", (RUBY_PROC*)&dll_rb_eIndexError}, {"rb_eRuntimeError", (RUBY_PROC*)&dll_rb_eRuntimeError}, *************** *** 221,226 **** --- 236,242 ---- {"ruby_errinfo", (RUBY_PROC*)&dll_ruby_errinfo}, {"ruby_init", (RUBY_PROC*)&dll_ruby_init}, {"ruby_init_loadpath", (RUBY_PROC*)&dll_ruby_init_loadpath}, + {"rb_w32_snprintf", (RUBY_PROC*)&dll_rb_w32_snprintf}, {"", NULL}, }; *************** *** 782,792 **** static void ruby_io_init(void) { #ifndef DYNAMIC_RUBY ! RUBYEXTERN VALUE rb_defout; #endif ! rb_defout = rb_obj_alloc(rb_cObject); ! rb_define_singleton_method(rb_defout, "write", vim_message, 1); rb_define_global_function("p", f_p, -1); } --- 798,808 ---- static void ruby_io_init(void) { #ifndef DYNAMIC_RUBY ! RUBYEXTERN VALUE rb_stdout; #endif ! rb_stdout = rb_obj_alloc(rb_cObject); ! rb_define_singleton_method(rb_stdout, "write", vim_message, 1); rb_define_global_function("p", f_p, -1); } *** ../vim-6.2.065/src/Make_mvc.mak Sun Jul 27 15:09:30 2003 --- src/Make_mvc.mak Fri Aug 8 20:43:46 2003 *************** *** 506,515 **** --- 506,527 ---- !ifndef RUBY_VER_LONG RUBY_VER_LONG = 1.6 !endif + + !if $(RUBY_VER) >= 18 + !ifndef RUBY_PLATFORM + RUBY_PLATFORM = i386-mswin32 + !endif + !ifndef RUBY_INSTALL_NAME + RUBY_INSTALL_NAME = msvcrt-ruby$(RUBY_VER) + !endif + !else !ifndef RUBY_PLATFORM RUBY_PLATFORM = i586-mswin32 !endif + !ifndef RUBY_INSTALL_NAME RUBY_INSTALL_NAME = mswin32-ruby$(RUBY_VER) + !endif + !endif # $(RUBY_VER) >= 18 !message Ruby requested (version $(RUBY_VER)) - root dir is "$(RUBY)" CFLAGS = $(CFLAGS) -DFEAT_RUBY *************** *** 519,525 **** # Do we want to load Ruby dynamically? !if "$(DYNAMIC_RUBY)" == "yes" !message Ruby DLL will be loaded dynamically ! CFLAGS = $(CFLAGS) -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\" !undef RUBY_LIB !endif !endif # RUBY --- 531,537 ---- # Do we want to load Ruby dynamically? !if "$(DYNAMIC_RUBY)" == "yes" !message Ruby DLL will be loaded dynamically ! CFLAGS = $(CFLAGS) -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\" -DDYNAMIC_RUBY_VER=$(RUBY_VER) !undef RUBY_LIB !endif !endif # RUBY *** ../vim-6.2.065/src/version.c Sun Aug 10 22:34:58 2003 --- src/version.c Sun Aug 10 22:36:36 2003 *************** *** 632,633 **** --- 632,635 ---- { /* Add new patch number below this line */ + /**/ + 66, /**/ -- From "know your smileys": <<<:-{ Worf (Never smiles anyways, so he's a bad smiley) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\ \\\ Project leader for A-A-P -- http://www.A-A-P.org /// \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///