4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
11 Problem: Ruby with MingW still doesn't build all versions.
12 Solution: More #ifdefs for the Ruby code. (Sergey Khorev)
16 *** ../vim-7.2.386/src/if_ruby.c 2010-02-24 15:47:58.000000000 +0100
17 --- src/if_ruby.c 2010-03-10 12:40:30.000000000 +0100
20 # define rb_cTrueClass (*dll_rb_cTrueClass)
21 # if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
23 ! * On ver 1.8, all Ruby functions are exported with "__declspce(dllimport)"
24 ! * in ruby.h. But it cause trouble for these variables, because it is
25 * defined in this file. When defined this RUBY_EXPORT it modified to
26 * "extern" and be able to avoid this problem.
29 # define rb_cTrueClass (*dll_rb_cTrueClass)
30 # if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
32 ! * On ver 1.8, all Ruby functions are exported with "__declspec(dllimport)"
33 ! * in ruby.h. But it causes trouble for these variables, because it is
34 * defined in this file. When defined this RUBY_EXPORT it modified to
35 * "extern" and be able to avoid this problem.
43 + #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 19
44 + /* Ruby 1.9 defines a number of static functions which use rb_num2long and
46 + # define rb_num2long rb_num2long_stub
47 + # define rb_int2big rb_int2big_stub
51 #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
52 # include <ruby/encoding.h>
55 #define rb_str_concat dll_rb_str_concat
56 #define rb_str_new dll_rb_str_new
57 #define rb_str_new2 dll_rb_str_new2
58 ! #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
59 # define rb_errinfo dll_rb_errinfo
61 # define ruby_errinfo (*dll_ruby_errinfo)
63 #define rb_str_concat dll_rb_str_concat
64 #define rb_str_new dll_rb_str_new
65 #define rb_str_new2 dll_rb_str_new2
66 ! #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
67 ! # define rb_string_value_ptr dll_rb_string_value_ptr
68 ! # define rb_float_new dll_rb_float_new
69 ! # define rb_ary_new dll_rb_ary_new
70 ! # define rb_ary_push dll_rb_ary_push
72 ! #if defined(RUBY_VERSION) && RUBY_VERSION >= 19 \
73 ! || defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 19
74 # define rb_errinfo dll_rb_errinfo
76 # define ruby_errinfo (*dll_ruby_errinfo)
79 static VALUE (*dll_rb_str_concat) (VALUE, VALUE);
80 static VALUE (*dll_rb_str_new) (const char*, long);
81 static VALUE (*dll_rb_str_new2) (const char*);
82 ! #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
83 static VALUE (*dll_rb_errinfo) (void);
85 static VALUE *dll_ruby_errinfo;
87 static VALUE (*dll_rb_str_concat) (VALUE, VALUE);
88 static VALUE (*dll_rb_str_new) (const char*, long);
89 static VALUE (*dll_rb_str_new2) (const char*);
90 ! #if defined(RUBY_VERSION) && RUBY_VERSION >= 19 \
91 ! || defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 19
92 static VALUE (*dll_rb_errinfo) (void);
94 static VALUE *dll_ruby_errinfo;
98 static void (*dll_ruby_init_loadpath) (void);
99 static void (*dll_NtInitialize) (int*, char***);
100 #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
101 + static char * (*dll_rb_string_value_ptr) (volatile VALUE*);
102 + static VALUE (*dll_rb_float_new) (double);
103 + static VALUE (*dll_rb_ary_new) (void);
104 + static VALUE (*dll_rb_ary_push) (VALUE, VALUE);
106 + #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 19
107 + static VALUE (*dll_rb_int2big)(SIGNED_VALUE);
109 + #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
110 static int (*dll_rb_w32_snprintf)(char*, size_t, const char*, ...);
116 static VALUE (*dll_rb_sprintf) (const char*, ...);
119 + #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 19
120 + static SIGNED_VALUE rb_num2long_stub(VALUE x)
122 + return dll_rb_num2long(x);
124 + static VALUE rb_int2big_stub(SIGNED_VALUE x)
126 + return dll_rb_int2big(x);
130 static HINSTANCE hinstRuby = 0; /* Instance of ruby.dll */
135 {"rb_str_concat", (RUBY_PROC*)&dll_rb_str_concat},
136 {"rb_str_new", (RUBY_PROC*)&dll_rb_str_new},
137 {"rb_str_new2", (RUBY_PROC*)&dll_rb_str_new2},
138 ! #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
139 {"rb_errinfo", (RUBY_PROC*)&dll_rb_errinfo},
141 {"ruby_errinfo", (RUBY_PROC*)&dll_ruby_errinfo},
143 {"ruby_init", (RUBY_PROC*)&dll_ruby_init},
144 {"ruby_init_loadpath", (RUBY_PROC*)&dll_ruby_init_loadpath},
145 ! {"NtInitialize", (RUBY_PROC*)&dll_NtInitialize},
146 #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
147 {"rb_w32_snprintf", (RUBY_PROC*)&dll_rb_w32_snprintf},
149 #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
150 {"ruby_script", (RUBY_PROC*)&dll_ruby_script},
151 {"rb_enc_find_index", (RUBY_PROC*)&dll_rb_enc_find_index},
153 {"rb_str_concat", (RUBY_PROC*)&dll_rb_str_concat},
154 {"rb_str_new", (RUBY_PROC*)&dll_rb_str_new},
155 {"rb_str_new2", (RUBY_PROC*)&dll_rb_str_new2},
156 ! #if defined(RUBY_VERSION) && RUBY_VERSION >= 19 \
157 ! || defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 19
158 {"rb_errinfo", (RUBY_PROC*)&dll_rb_errinfo},
160 {"ruby_errinfo", (RUBY_PROC*)&dll_ruby_errinfo},
162 {"ruby_init", (RUBY_PROC*)&dll_ruby_init},
163 {"ruby_init_loadpath", (RUBY_PROC*)&dll_ruby_init_loadpath},
165 ! #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER < 19
170 ! (RUBY_PROC*)&dll_NtInitialize},
171 #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
172 {"rb_w32_snprintf", (RUBY_PROC*)&dll_rb_w32_snprintf},
174 + #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
175 + {"rb_string_value_ptr", (RUBY_PROC*)&dll_rb_string_value_ptr},
176 + {"rb_float_new", (RUBY_PROC*)&dll_rb_float_new},
177 + {"rb_ary_new", (RUBY_PROC*)&dll_rb_ary_new},
178 + {"rb_ary_push", (RUBY_PROC*)&dll_rb_ary_push},
180 + #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 19
181 + {"rb_int2big", (RUBY_PROC*)&dll_rb_int2big},
183 #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
184 {"ruby_script", (RUBY_PROC*)&dll_ruby_script},
185 {"rb_enc_find_index", (RUBY_PROC*)&dll_rb_enc_find_index},
188 static void error_print(int state)
191 ! #if !(defined(RUBY_VERSION) && RUBY_VERSION >= 19)
192 RUBYEXTERN VALUE ruby_errinfo;
196 static void error_print(int state)
199 ! #if !(defined(RUBY_VERSION) && RUBY_VERSION >= 19) \
200 ! && !(defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 19)
201 RUBYEXTERN VALUE ruby_errinfo;
209 ! #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
210 eclass = CLASS_OF(rb_errinfo());
211 einfo = rb_obj_as_string(rb_errinfo());
217 ! #if defined(RUBY_VERSION) && RUBY_VERSION >= 19 \
218 ! || defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 19
219 eclass = CLASS_OF(rb_errinfo());
220 einfo = rb_obj_as_string(rb_errinfo());
222 *** ../vim-7.2.386/src/version.c 2010-03-10 12:24:44.000000000 +0100
223 --- src/version.c 2010-03-10 12:45:55.000000000 +0100
227 { /* Add new patch number below this line */
233 Vim is like Emacs without all the typing. (John "Johann" Spetz)
235 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
236 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
237 \\\ download, build and distribute -- http://www.A-A-P.org ///
238 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///