2 Subject: Patch 6.2.066 (extra)
4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
11 Problem: Ruby interface doesn't work with Ruby 1.8.0.
12 Solution: Change "defout" to "stdout". (Aron Grifis)
13 Change dynamic loading. (Taro Muraoka)
14 Files: src/if_ruby.c, src/Make_mvc.mak
17 *** ../vim-6.2.065/src/if_ruby.c Sat Apr 19 15:21:16 2003
18 --- src/if_ruby.c Fri Aug 8 20:43:45 2003
26 # define IMPORT /* For static dll usage __declspec(dllimport) */
27 # define RUBYEXTERN __declspec(dllimport)
32 ! # if !defined(DYNAMIC_RUBY_VER) || (DYNAMIC_RUBY_VER < 18)
36 # define IMPORT /* For static dll usage __declspec(dllimport) */
37 # define RUBYEXTERN __declspec(dllimport)
41 # define rb_cNilClass (*dll_rb_cNilClass)
42 # define rb_cSymbol (*dll_rb_cSymbol)
43 # define rb_cTrueClass (*dll_rb_cTrueClass)
44 + # if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
46 + * On ver 1.8, all Ruby functions are exported with "__declspce(dllimport)"
47 + * in ruby.h. But it cause trouble for these variables, because it is
48 + * defined in this file. When defined this RUBY_EXPORT it modified to
49 + * "extern" and be able to avoid this problem.
51 + # define RUBY_EXPORT
58 #define rb_define_module_function dll_rb_define_module_function
59 #define rb_define_singleton_method dll_rb_define_singleton_method
60 #define rb_define_virtual_variable dll_rb_define_virtual_variable
61 ! #define rb_defout (*dll_rb_defout)
62 #define rb_eArgError (*dll_rb_eArgError)
63 #define rb_eIndexError (*dll_rb_eIndexError)
64 #define rb_eRuntimeError (*dll_rb_eRuntimeError)
66 #define rb_define_module_function dll_rb_define_module_function
67 #define rb_define_singleton_method dll_rb_define_singleton_method
68 #define rb_define_virtual_variable dll_rb_define_virtual_variable
69 ! #define rb_stdout (*dll_rb_stdout)
70 #define rb_eArgError (*dll_rb_eArgError)
71 #define rb_eIndexError (*dll_rb_eIndexError)
72 #define rb_eRuntimeError (*dll_rb_eRuntimeError)
76 #define ruby_errinfo (*dll_ruby_errinfo)
77 #define ruby_init dll_ruby_init
78 #define ruby_init_loadpath dll_ruby_init_loadpath
79 + #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
80 + # define rb_w32_snprintf dll_rb_w32_snprintf
84 * Pointers for dynamic link
87 static void (*dll_rb_define_module_function) (VALUE,const char*,VALUE(*)(),int);
88 static void (*dll_rb_define_singleton_method) (VALUE,const char*,VALUE(*)(),int);
89 static void (*dll_rb_define_virtual_variable) (const char*,VALUE(*)(),void(*)());
90 ! static VALUE *dll_rb_defout;
91 static VALUE *dll_rb_eArgError;
92 static VALUE *dll_rb_eIndexError;
93 static VALUE *dll_rb_eRuntimeError;
95 static void (*dll_rb_define_module_function) (VALUE,const char*,VALUE(*)(),int);
96 static void (*dll_rb_define_singleton_method) (VALUE,const char*,VALUE(*)(),int);
97 static void (*dll_rb_define_virtual_variable) (const char*,VALUE(*)(),void(*)());
98 ! static VALUE *dll_rb_stdout;
99 static VALUE *dll_rb_eArgError;
100 static VALUE *dll_rb_eIndexError;
101 static VALUE *dll_rb_eRuntimeError;
105 static VALUE *dll_ruby_errinfo;
106 static void (*dll_ruby_init) (void);
107 static void (*dll_ruby_init_loadpath) (void);
108 + static int (*dll_rb_w32_snprintf)(char*, size_t, const char*, ...);
110 static HINSTANCE hinstRuby = 0; /* Instance of ruby.dll */
114 {"rb_define_module_function", (RUBY_PROC*)&dll_rb_define_module_function},
115 {"rb_define_singleton_method", (RUBY_PROC*)&dll_rb_define_singleton_method},
116 {"rb_define_virtual_variable", (RUBY_PROC*)&dll_rb_define_virtual_variable},
117 ! {"rb_defout", (RUBY_PROC*)&dll_rb_defout},
118 {"rb_eArgError", (RUBY_PROC*)&dll_rb_eArgError},
119 {"rb_eIndexError", (RUBY_PROC*)&dll_rb_eIndexError},
120 {"rb_eRuntimeError", (RUBY_PROC*)&dll_rb_eRuntimeError},
122 {"rb_define_module_function", (RUBY_PROC*)&dll_rb_define_module_function},
123 {"rb_define_singleton_method", (RUBY_PROC*)&dll_rb_define_singleton_method},
124 {"rb_define_virtual_variable", (RUBY_PROC*)&dll_rb_define_virtual_variable},
125 ! {"rb_stdout", (RUBY_PROC*)&dll_rb_stdout},
126 {"rb_eArgError", (RUBY_PROC*)&dll_rb_eArgError},
127 {"rb_eIndexError", (RUBY_PROC*)&dll_rb_eIndexError},
128 {"rb_eRuntimeError", (RUBY_PROC*)&dll_rb_eRuntimeError},
132 {"ruby_errinfo", (RUBY_PROC*)&dll_ruby_errinfo},
133 {"ruby_init", (RUBY_PROC*)&dll_ruby_init},
134 {"ruby_init_loadpath", (RUBY_PROC*)&dll_ruby_init_loadpath},
135 + {"rb_w32_snprintf", (RUBY_PROC*)&dll_rb_w32_snprintf},
141 static void ruby_io_init(void)
144 ! RUBYEXTERN VALUE rb_defout;
147 ! rb_defout = rb_obj_alloc(rb_cObject);
148 ! rb_define_singleton_method(rb_defout, "write", vim_message, 1);
149 rb_define_global_function("p", f_p, -1);
153 static void ruby_io_init(void)
156 ! RUBYEXTERN VALUE rb_stdout;
159 ! rb_stdout = rb_obj_alloc(rb_cObject);
160 ! rb_define_singleton_method(rb_stdout, "write", vim_message, 1);
161 rb_define_global_function("p", f_p, -1);
164 *** ../vim-6.2.065/src/Make_mvc.mak Sun Jul 27 15:09:30 2003
165 --- src/Make_mvc.mak Fri Aug 8 20:43:46 2003
169 !ifndef RUBY_VER_LONG
173 + !if $(RUBY_VER) >= 18
174 + !ifndef RUBY_PLATFORM
175 + RUBY_PLATFORM = i386-mswin32
177 + !ifndef RUBY_INSTALL_NAME
178 + RUBY_INSTALL_NAME = msvcrt-ruby$(RUBY_VER)
181 !ifndef RUBY_PLATFORM
182 RUBY_PLATFORM = i586-mswin32
184 + !ifndef RUBY_INSTALL_NAME
185 RUBY_INSTALL_NAME = mswin32-ruby$(RUBY_VER)
187 + !endif # $(RUBY_VER) >= 18
189 !message Ruby requested (version $(RUBY_VER)) - root dir is "$(RUBY)"
190 CFLAGS = $(CFLAGS) -DFEAT_RUBY
193 # Do we want to load Ruby dynamically?
194 !if "$(DYNAMIC_RUBY)" == "yes"
195 !message Ruby DLL will be loaded dynamically
196 ! CFLAGS = $(CFLAGS) -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\"
201 # Do we want to load Ruby dynamically?
202 !if "$(DYNAMIC_RUBY)" == "yes"
203 !message Ruby DLL will be loaded dynamically
204 ! CFLAGS = $(CFLAGS) -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\" -DDYNAMIC_RUBY_VER=$(RUBY_VER)
208 *** ../vim-6.2.065/src/version.c Sun Aug 10 22:34:58 2003
209 --- src/version.c Sun Aug 10 22:36:36 2003
213 { /* Add new patch number below this line */
219 From "know your smileys":
220 <<<:-{ Worf (Never smiles anyways, so he's a bad smiley)
222 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
223 /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
224 \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
225 \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///