]>
Commit | Line | Data |
---|---|---|
5634d1d6 ER |
1 | To: vim_dev@googlegroups.com |
2 | Subject: Patch 7.3.058 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=UTF-8 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 7.3.058 | |
11 | Problem: Error "code converter not found" when loading Ruby script. | |
12 | Solution: Load Gem module. (Yasuhiro Matsumoto) | |
13 | Files: src/if_ruby.c | |
14 | ||
15 | ||
16 | *** ../vim-7.3.057/src/if_ruby.c 2010-10-27 17:40:53.000000000 +0200 | |
17 | --- src/if_ruby.c 2010-11-16 14:37:48.000000000 +0100 | |
18 | *************** | |
19 | *** 229,234 **** | |
20 | --- 229,237 ---- | |
21 | # define rb_enc_find_index dll_rb_enc_find_index | |
22 | # define rb_enc_find dll_rb_enc_find | |
23 | # define rb_enc_str_new dll_rb_enc_str_new | |
24 | + # define rb_intern2 dll_rb_intern2 | |
25 | + # define rb_const_remove dll_rb_const_remove | |
26 | + # define Init_prelude dll_Init_prelude | |
27 | # define rb_sprintf dll_rb_sprintf | |
28 | # define ruby_init_stack dll_ruby_init_stack | |
29 | #endif | |
30 | *************** | |
31 | *** 317,322 **** | |
32 | --- 320,328 ---- | |
33 | static int (*dll_rb_enc_find_index) (const char*); | |
34 | static rb_encoding* (*dll_rb_enc_find) (const char*); | |
35 | static VALUE (*dll_rb_enc_str_new) (const char*, long, rb_encoding*); | |
36 | + static ID (*dll_rb_intern2) (const char*, long); | |
37 | + static void (*dll_Init_prelude) (void); | |
38 | + static VALUE (*dll_rb_const_remove) (VALUE, ID); | |
39 | static VALUE (*dll_rb_sprintf) (const char*, ...); | |
40 | static void (*ruby_init_stack)(VALUE*); | |
41 | #endif | |
42 | *************** | |
43 | *** 425,430 **** | |
44 | --- 431,439 ---- | |
45 | {"rb_enc_find_index", (RUBY_PROC*)&dll_rb_enc_find_index}, | |
46 | {"rb_enc_find", (RUBY_PROC*)&dll_rb_enc_find}, | |
47 | {"rb_enc_str_new", (RUBY_PROC*)&dll_rb_enc_str_new}, | |
48 | + {"rb_intern2", (RUBY_PROC*)&dll_rb_intern2}, | |
49 | + {"rb_const_remove", (RUBY_PROC*)&dll_rb_const_remove}, | |
50 | + {"Init_prelude", (RUBY_PROC*)&dll_Init_prelude}, | |
51 | {"rb_sprintf", (RUBY_PROC*)&dll_rb_sprintf}, | |
52 | {"ruby_init_stack", (RUBY_PROC*)&dll_ruby_init_stack}, | |
53 | #endif | |
54 | *************** | |
55 | *** 662,667 **** | |
56 | --- 671,682 ---- | |
57 | ruby_io_init(); | |
58 | #ifdef RUBY19_OR_LATER | |
59 | rb_enc_find_index("encdb"); | |
60 | + | |
61 | + /* This avoids the error "Encoding::ConverterNotFoundError: code | |
62 | + * converter not found (UTF-16LE to ASCII-8BIT)". */ | |
63 | + rb_define_module("Gem"); | |
64 | + Init_prelude(); | |
65 | + rb_const_remove(rb_cObject, rb_intern2("TMP_RUBY_PREFIX", 15)); | |
66 | #endif | |
67 | ruby_vim_init(); | |
68 | ruby_initialized = 1; | |
69 | *************** | |
70 | *** 946,958 **** | |
71 | ||
72 | static VALUE get_buffer_line(buf_T *buf, linenr_T n) | |
73 | { | |
74 | ! if (n > 0 && n <= buf->b_ml.ml_line_count) | |
75 | ! { | |
76 | ! char *line = (char *)ml_get_buf(buf, n, FALSE); | |
77 | ! return line ? vim_str2rb_enc_str(line) : Qnil; | |
78 | ! } | |
79 | ! rb_raise(rb_eIndexError, "line number %ld out of range", (long)n); | |
80 | ! return Qnil; /* For stop warning */ | |
81 | } | |
82 | ||
83 | static VALUE buffer_aref(VALUE self, VALUE num) | |
84 | --- 961,969 ---- | |
85 | ||
86 | static VALUE get_buffer_line(buf_T *buf, linenr_T n) | |
87 | { | |
88 | ! if (n <= 0 || n > buf->b_ml.ml_line_count) | |
89 | ! rb_raise(rb_eIndexError, "line number %ld out of range", (long)n); | |
90 | ! return vim_str2rb_enc_str((char *)ml_get_buf(buf, n, FALSE)); | |
91 | } | |
92 | ||
93 | static VALUE buffer_aref(VALUE self, VALUE num) | |
94 | *************** | |
95 | *** 991,999 **** | |
96 | else | |
97 | { | |
98 | rb_raise(rb_eIndexError, "line number %ld out of range", (long)n); | |
99 | - #ifndef __GNUC__ | |
100 | - return Qnil; /* For stop warning */ | |
101 | - #endif | |
102 | } | |
103 | return str; | |
104 | } | |
105 | --- 1002,1007 ---- | |
106 | *************** | |
107 | *** 1048,1054 **** | |
108 | long n = NUM2LONG(num); | |
109 | aco_save_T aco; | |
110 | ||
111 | ! if (line == NULL) { | |
112 | rb_raise(rb_eIndexError, "NULL line"); | |
113 | } | |
114 | else if (n >= 0 && n <= buf->b_ml.ml_line_count) | |
115 | --- 1056,1063 ---- | |
116 | long n = NUM2LONG(num); | |
117 | aco_save_T aco; | |
118 | ||
119 | ! if (line == NULL) | |
120 | ! { | |
121 | rb_raise(rb_eIndexError, "NULL line"); | |
122 | } | |
123 | else if (n >= 0 && n <= buf->b_ml.ml_line_count) | |
124 | *************** | |
125 | *** 1072,1078 **** | |
126 | ||
127 | update_curbuf(NOT_VALID); | |
128 | } | |
129 | ! else { | |
130 | rb_raise(rb_eIndexError, "line number %ld out of range", n); | |
131 | } | |
132 | return str; | |
133 | --- 1081,1088 ---- | |
134 | ||
135 | update_curbuf(NOT_VALID); | |
136 | } | |
137 | ! else | |
138 | ! { | |
139 | rb_raise(rb_eIndexError, "line number %ld out of range", n); | |
140 | } | |
141 | return str; | |
142 | *** ../vim-7.3.057/src/version.c 2010-11-16 14:05:48.000000000 +0100 | |
143 | --- src/version.c 2010-11-16 14:44:42.000000000 +0100 | |
144 | *************** | |
145 | *** 716,717 **** | |
146 | --- 716,719 ---- | |
147 | { /* Add new patch number below this line */ | |
148 | + /**/ | |
149 | + 58, | |
150 | /**/ | |
151 | ||
152 | -- | |
153 | SIGIRO -- irony detected (iron core dumped) | |
154 | ||
155 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
156 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
157 | \\\ an exciting new programming language -- http://www.Zimbu.org /// | |
158 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |