1 To: vim_dev@googlegroups.com
4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
11 Problem: Ruby can't load Gems sometimes, may cause a crash.
12 Solution: Undefine off_t. Use ruby_process_options(). (Yasuhiro Matsumoto)
16 *** ../vim-7.3.087/src/if_ruby.c 2010-12-08 13:11:15.000000000 +0100
17 --- src/if_ruby.c 2010-12-24 12:18:31.000000000 +0100
21 # include <ruby/encoding.h>
24 + #undef off_t /* ruby defines off_t as _int64, Mingw uses long */
30 # define rb_enc_find_index dll_rb_enc_find_index
31 # define rb_enc_find dll_rb_enc_find
32 # define rb_enc_str_new dll_rb_enc_str_new
33 - # define rb_intern2 dll_rb_intern2
34 - # define rb_const_remove dll_rb_const_remove
35 # define rb_sprintf dll_rb_sprintf
36 # define ruby_init_stack dll_ruby_init_stack
41 # define rb_enc_find_index dll_rb_enc_find_index
42 # define rb_enc_find dll_rb_enc_find
43 # define rb_enc_str_new dll_rb_enc_str_new
44 # define rb_sprintf dll_rb_sprintf
45 + # define rb_require dll_rb_require
46 # define ruby_init_stack dll_ruby_init_stack
47 + # define ruby_process_options dll_ruby_process_options
53 static int (*dll_rb_enc_find_index) (const char*);
54 static rb_encoding* (*dll_rb_enc_find) (const char*);
55 static VALUE (*dll_rb_enc_str_new) (const char*, long, rb_encoding*);
56 - static ID (*dll_rb_intern2) (const char*, long);
57 - static void (*dll_Init_prelude) (void);
58 - static VALUE (*dll_rb_const_remove) (VALUE, ID);
59 static VALUE (*dll_rb_sprintf) (const char*, ...);
60 static void (*ruby_init_stack)(VALUE*);
63 #ifdef RUBY19_OR_LATER
65 static int (*dll_rb_enc_find_index) (const char*);
66 static rb_encoding* (*dll_rb_enc_find) (const char*);
67 static VALUE (*dll_rb_enc_str_new) (const char*, long, rb_encoding*);
68 static VALUE (*dll_rb_sprintf) (const char*, ...);
69 + static VALUE (*dll_rb_require) (const char*);
70 static void (*ruby_init_stack)(VALUE*);
71 + static void* (*ruby_process_options)(int, char**);
74 #ifdef RUBY19_OR_LATER
77 {"rb_enc_find_index", (RUBY_PROC*)&dll_rb_enc_find_index},
78 {"rb_enc_find", (RUBY_PROC*)&dll_rb_enc_find},
79 {"rb_enc_str_new", (RUBY_PROC*)&dll_rb_enc_str_new},
80 - {"rb_intern2", (RUBY_PROC*)&dll_rb_intern2},
81 - {"rb_const_remove", (RUBY_PROC*)&dll_rb_const_remove},
82 {"rb_sprintf", (RUBY_PROC*)&dll_rb_sprintf},
83 {"ruby_init_stack", (RUBY_PROC*)&dll_ruby_init_stack},
88 {"rb_enc_find_index", (RUBY_PROC*)&dll_rb_enc_find_index},
89 {"rb_enc_find", (RUBY_PROC*)&dll_rb_enc_find},
90 {"rb_enc_str_new", (RUBY_PROC*)&dll_rb_enc_str_new},
91 {"rb_sprintf", (RUBY_PROC*)&dll_rb_sprintf},
92 + {"rb_require", (RUBY_PROC*)&dll_rb_require},
93 {"ruby_init_stack", (RUBY_PROC*)&dll_ruby_init_stack},
94 + {"ruby_process_options", (RUBY_PROC*)&dll_ruby_process_options},
102 #ifdef RUBY19_OR_LATER
103 ruby_script("vim-ruby");
105 ruby_init_loadpath();
107 - #ifdef RUBY19_OR_LATER
108 - rb_enc_find_index("encdb");
110 - /* This avoids the error "Encoding::ConverterNotFoundError: code
111 - * converter not found (UTF-16LE to ASCII-8BIT)". */
112 - rb_define_module("Gem");
113 - rb_const_remove(rb_cObject, rb_intern2("TMP_RUBY_PREFIX", 15));
116 ruby_initialized = 1;
121 #ifdef RUBY19_OR_LATER
123 + int dummy_argc = 2;
124 + char *dummy_argv[] = {"vim-ruby", "-e0"};
125 + ruby_process_options(dummy_argc, dummy_argv);
127 ruby_script("vim-ruby");
129 ruby_init_loadpath();
133 ruby_initialized = 1;
135 *** ../vim-7.3.087/src/version.c 2010-12-17 20:23:56.000000000 +0100
136 --- src/version.c 2010-12-24 13:38:51.000000000 +0100
140 { /* Add new patch number below this line */
146 It is hard to understand how a cemetery raised its burial
147 cost and blamed it on the cost of living.
149 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
150 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
151 \\\ an exciting new programming language -- http://www.Zimbu.org ///
152 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///