]> git.pld-linux.org Git - packages/vim.git/blame - 7.2.361
- new
[packages/vim.git] / 7.2.361
CommitLineData
8587d00a
AM
1To: vim-dev@vim.org
2Subject: Patch 7.2.361
3Fcc: outbox
4From: Bram Moolenaar <Bram@moolenaar.net>
5Mime-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8------------
9
10Patch 7.2.361
11Problem: Ruby 1.9 is not supported.
12Solution: Add Ruby 1.9 support. (Msaki Suketa)
13Files: src/Makefile, src/auto/configure, src/configure.in, src/if_ruby.c
14
15
16*** ../vim-7.2.360/src/Makefile 2010-02-17 15:12:22.000000000 +0100
17--- src/Makefile 2010-02-17 16:21:01.000000000 +0100
18***************
19*** 395,401 ****
20
21 # RUBY
22 # Uncomment this when you want to include the Ruby interface.
23! #CONF_OPT_RUBY = --enable-rubyinterp
24
25 # MZSCHEME
26 # Uncomment this when you want to include the MzScheme interface.
27--- 395,403 ----
28
29 # RUBY
30 # Uncomment this when you want to include the Ruby interface.
31! # Note: you need the development package (e.g., ruby1.9.1-dev on Ubuntu).
32! # CONF_OPT_RUBY = --enable-rubyinterp
33! # CONF_OPT_RUBY = --enable-rubyinterp --with-ruby-command=ruby1.9.1
34
35 # MZSCHEME
36 # Uncomment this when you want to include the MzScheme interface.
37*** ../vim-7.2.360/src/auto/configure 2009-12-16 17:14:08.000000000 +0100
38--- src/auto/configure 2010-02-17 16:08:59.000000000 +0100
39***************
40*** 793,798 ****
41--- 793,799 ----
42 enable_tclinterp
43 with_tclsh
44 enable_rubyinterp
45+ with_ruby_command
46 enable_cscope
47 enable_workshop
48 enable_netbeans
49***************
50*** 1503,1508 ****
51--- 1504,1510 ----
52 --with-plthome=PLTHOME Use PLTHOME.
53 --with-python-config-dir=PATH Python's config directory
54 --with-tclsh=PATH which tclsh to use (default: tclsh8.0)
55+ --with-ruby-command=RUBY name of the Ruby command (default: ruby)
56 --with-x use the X Window System
57 --with-gtk-prefix=PFX Prefix where GTK is installed (optional)
58 --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)
59***************
60*** 5703,5711 ****
61 { $as_echo "$as_me:$LINENO: result: $enable_rubyinterp" >&5
62 $as_echo "$enable_rubyinterp" >&6; }
63 if test "$enable_rubyinterp" = "yes"; then
64
65! # Extract the first word of "ruby", so it can be a program name with args.
66! set dummy ruby; ac_word=$2
67 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
68 $as_echo_n "checking for $ac_word... " >&6; }
69 if test "${ac_cv_path_vi_cv_path_ruby+set}" = set; then
70--- 5705,5725 ----
71 { $as_echo "$as_me:$LINENO: result: $enable_rubyinterp" >&5
72 $as_echo "$enable_rubyinterp" >&6; }
73 if test "$enable_rubyinterp" = "yes"; then
74+ { $as_echo "$as_me:$LINENO: checking --with-ruby-command argument" >&5
75+ $as_echo_n "checking --with-ruby-command argument... " >&6; }
76
77! # Check whether --with-ruby-command was given.
78! if test "${with_ruby_command+set}" = set; then
79! withval=$with_ruby_command; RUBY_CMD="$withval"; { $as_echo "$as_me:$LINENO: result: $RUBY_CMD" >&5
80! $as_echo "$RUBY_CMD" >&6; }
81! else
82! RUBY_CMD="ruby"; { $as_echo "$as_me:$LINENO: result: defaulting to $RUBY_CMD" >&5
83! $as_echo "defaulting to $RUBY_CMD" >&6; }
84! fi
85!
86!
87! # Extract the first word of "$RUBY_CMD", so it can be a program name with args.
88! set dummy $RUBY_CMD; ac_word=$2
89 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
90 $as_echo_n "checking for $ac_word... " >&6; }
91 if test "${ac_cv_path_vi_cv_path_ruby+set}" = set; then
92***************
93*** 5752,5762 ****
94 $as_echo "OK" >&6; }
95 { $as_echo "$as_me:$LINENO: checking Ruby header files" >&5
96 $as_echo_n "checking Ruby header files... " >&6; }
97! rubyhdrdir=`$vi_cv_path_ruby -r mkmf -e 'print Config::CONFIG["archdir"] || $hdrdir' 2>/dev/null`
98 if test "X$rubyhdrdir" != "X"; then
99 { $as_echo "$as_me:$LINENO: result: $rubyhdrdir" >&5
100 $as_echo "$rubyhdrdir" >&6; }
101 RUBY_CFLAGS="-I$rubyhdrdir"
102 rubylibs=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG["LIBS"]'`
103 if test "X$rubylibs" != "X"; then
104 RUBY_LIBS="$rubylibs"
105--- 5766,5782 ----
106 $as_echo "OK" >&6; }
107 { $as_echo "$as_me:$LINENO: checking Ruby header files" >&5
108 $as_echo_n "checking Ruby header files... " >&6; }
109! rubyhdrdir=`$vi_cv_path_ruby -r mkmf -e 'print Config::CONFIG["rubyhdrdir"] || Config::CONFIG["archdir"] || $hdrdir' 2>/dev/null`
110 if test "X$rubyhdrdir" != "X"; then
111 { $as_echo "$as_me:$LINENO: result: $rubyhdrdir" >&5
112 $as_echo "$rubyhdrdir" >&6; }
113 RUBY_CFLAGS="-I$rubyhdrdir"
114+ rubyarch=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG["arch"]'`
115+ if test -d "$rubyhdrdir/$rubyarch"; then
116+ RUBY_CFLAGS="$RUBY_CFLAGS -I$rubyhdrdir/$rubyarch"
117+ fi
118+ rubyversion=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG["ruby_version"].gsub(/\./, "")[0,2]'`
119+ RUBY_CFLAGS="$RUBY_CFLAGS -DRUBY_VERSION=$rubyversion"
120 rubylibs=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG["LIBS"]'`
121 if test "X$rubylibs" != "X"; then
122 RUBY_LIBS="$rubylibs"
123***************
124*** 5793,5800 ****
125 _ACEOF
126
127 else
128! { $as_echo "$as_me:$LINENO: result: not found" >&5
129! $as_echo "not found" >&6; }
130 fi
131 else
132 { $as_echo "$as_me:$LINENO: result: too old; need Ruby version 1.6.0 or later" >&5
133--- 5813,5820 ----
134 _ACEOF
135
136 else
137! { $as_echo "$as_me:$LINENO: result: not found; disabling Ruby" >&5
138! $as_echo "not found; disabling Ruby" >&6; }
139 fi
140 else
141 { $as_echo "$as_me:$LINENO: result: too old; need Ruby version 1.6.0 or later" >&5
142*** ../vim-7.2.360/src/configure.in 2009-12-16 17:14:08.000000000 +0100
143--- src/configure.in 2010-02-17 16:00:58.000000000 +0100
144***************
145*** 949,965 ****
146 [enable_rubyinterp="no"])
147 AC_MSG_RESULT($enable_rubyinterp)
148 if test "$enable_rubyinterp" = "yes"; then
149 AC_SUBST(vi_cv_path_ruby)
150! AC_PATH_PROG(vi_cv_path_ruby, ruby)
151 if test "X$vi_cv_path_ruby" != "X"; then
152 AC_MSG_CHECKING(Ruby version)
153 if $vi_cv_path_ruby -e '(VERSION rescue RUBY_VERSION) >= "1.6.0" or exit 1' >/dev/null 2>/dev/null; then
154 AC_MSG_RESULT(OK)
155 AC_MSG_CHECKING(Ruby header files)
156! rubyhdrdir=`$vi_cv_path_ruby -r mkmf -e 'print Config::CONFIG[["archdir"]] || $hdrdir' 2>/dev/null`
157 if test "X$rubyhdrdir" != "X"; then
158 AC_MSG_RESULT($rubyhdrdir)
159 RUBY_CFLAGS="-I$rubyhdrdir"
160 rubylibs=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["LIBS"]]'`
161 if test "X$rubylibs" != "X"; then
162 RUBY_LIBS="$rubylibs"
163--- 949,975 ----
164 [enable_rubyinterp="no"])
165 AC_MSG_RESULT($enable_rubyinterp)
166 if test "$enable_rubyinterp" = "yes"; then
167+ AC_MSG_CHECKING(--with-ruby-command argument)
168+ AC_ARG_WITH(ruby-command, [ --with-ruby-command=RUBY name of the Ruby command (default: ruby)],
169+ RUBY_CMD="$withval"; AC_MSG_RESULT($RUBY_CMD),
170+ RUBY_CMD="ruby"; AC_MSG_RESULT(defaulting to $RUBY_CMD))
171 AC_SUBST(vi_cv_path_ruby)
172! AC_PATH_PROG(vi_cv_path_ruby, $RUBY_CMD)
173 if test "X$vi_cv_path_ruby" != "X"; then
174 AC_MSG_CHECKING(Ruby version)
175 if $vi_cv_path_ruby -e '(VERSION rescue RUBY_VERSION) >= "1.6.0" or exit 1' >/dev/null 2>/dev/null; then
176 AC_MSG_RESULT(OK)
177 AC_MSG_CHECKING(Ruby header files)
178! rubyhdrdir=`$vi_cv_path_ruby -r mkmf -e 'print Config::CONFIG[["rubyhdrdir"]] || Config::CONFIG[["archdir"]] || $hdrdir' 2>/dev/null`
179 if test "X$rubyhdrdir" != "X"; then
180 AC_MSG_RESULT($rubyhdrdir)
181 RUBY_CFLAGS="-I$rubyhdrdir"
182+ rubyarch=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["arch"]]'`
183+ if test -d "$rubyhdrdir/$rubyarch"; then
184+ RUBY_CFLAGS="$RUBY_CFLAGS -I$rubyhdrdir/$rubyarch"
185+ fi
186+ rubyversion=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["ruby_version"]].gsub(/\./, "")[[0,2]]'`
187+ RUBY_CFLAGS="$RUBY_CFLAGS -DRUBY_VERSION=$rubyversion"
188 rubylibs=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["LIBS"]]'`
189 if test "X$rubylibs" != "X"; then
190 RUBY_LIBS="$rubylibs"
191***************
192*** 997,1003 ****
193 RUBY_PRO="if_ruby.pro"
194 AC_DEFINE(FEAT_RUBY)
195 else
196! AC_MSG_RESULT(not found, disabling Ruby)
197 fi
198 else
199 AC_MSG_RESULT(too old; need Ruby version 1.6.0 or later)
200--- 1007,1013 ----
201 RUBY_PRO="if_ruby.pro"
202 AC_DEFINE(FEAT_RUBY)
203 else
204! AC_MSG_RESULT(not found; disabling Ruby)
205 fi
206 else
207 AC_MSG_RESULT(too old; need Ruby version 1.6.0 or later)
208*** ../vim-7.2.360/src/if_ruby.c 2010-02-17 15:11:35.000000000 +0100
209--- src/if_ruby.c 2010-02-17 16:08:47.000000000 +0100
210***************
211*** 54,59 ****
212--- 54,62 ----
213 #endif
214
215 #include <ruby.h>
216+ #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
217+ # include <ruby/encoding.h>
218+ #endif
219
220 #undef EXTERN
221 #undef _
222***************
223*** 65,70 ****
224--- 68,95 ----
225 # define __OPENTRANSPORTPROVIDERS__
226 #endif
227
228+ /*
229+ * Backward compatiblity for Ruby 1.8 and earlier.
230+ * Ruby 1.9 does not provide STR2CSTR, instead StringValuePtr is provided.
231+ * Ruby 1.9 does not provide RXXX(s)->len and RXXX(s)->ptr, instead
232+ * RXXX_LEN(s) and RXXX_PTR(s) are provided.
233+ */
234+ #ifndef StringValuePtr
235+ # define StringValuePtr(s) STR2CSTR(s)
236+ #endif
237+ #ifndef RARRAY_LEN
238+ # define RARRAY_LEN(s) RARRAY(s)->len
239+ #endif
240+ #ifndef RARRAY_PTR
241+ # define RARRAY_PTR(s) RARRAY(s)->ptr
242+ #endif
243+ #ifndef RSTRING_LEN
244+ # define RSTRING_LEN(s) RSTRING(s)->len
245+ #endif
246+ #ifndef RSTRING_PTR
247+ # define RSTRING_PTR(s) RSTRING(s)->ptr
248+ #endif
249+
250 #include "vim.h"
251 #include "version.h"
252
253***************
254*** 134,140 ****
255 #define rb_str_concat dll_rb_str_concat
256 #define rb_str_new dll_rb_str_new
257 #define rb_str_new2 dll_rb_str_new2
258! #define ruby_errinfo (*dll_ruby_errinfo)
259 #define ruby_init dll_ruby_init
260 #define ruby_init_loadpath dll_ruby_init_loadpath
261 #define NtInitialize dll_NtInitialize
262--- 159,169 ----
263 #define rb_str_concat dll_rb_str_concat
264 #define rb_str_new dll_rb_str_new
265 #define rb_str_new2 dll_rb_str_new2
266! #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
267! # define rb_errinfo dll_rb_errinfo
268! #else
269! # define ruby_errinfo (*dll_ruby_errinfo)
270! #endif
271 #define ruby_init dll_ruby_init
272 #define ruby_init_loadpath dll_ruby_init_loadpath
273 #define NtInitialize dll_NtInitialize
274***************
275*** 142,147 ****
276--- 171,184 ----
277 # define rb_w32_snprintf dll_rb_w32_snprintf
278 #endif
279
280+ #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
281+ # define ruby_script dll_ruby_script
282+ # define rb_enc_find_index dll_rb_enc_find_index
283+ # define rb_enc_find dll_rb_enc_find
284+ # define rb_enc_str_new dll_rb_enc_str_new
285+ # define rb_sprintf dll_rb_sprintf
286+ #endif
287+
288 /*
289 * Pointers for dynamic link
290 */
291***************
292*** 189,195 ****
293--- 226,236 ----
294 static VALUE (*dll_rb_str_concat) (VALUE, VALUE);
295 static VALUE (*dll_rb_str_new) (const char*, long);
296 static VALUE (*dll_rb_str_new2) (const char*);
297+ #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
298+ static VALUE (*dll_rb_errinfo) (void);
299+ #else
300 static VALUE *dll_ruby_errinfo;
301+ #endif
302 static void (*dll_ruby_init) (void);
303 static void (*dll_ruby_init_loadpath) (void);
304 static void (*dll_NtInitialize) (int*, char***);
305***************
306*** 197,202 ****
307--- 238,251 ----
308 static int (*dll_rb_w32_snprintf)(char*, size_t, const char*, ...);
309 #endif
310
311+ #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
312+ static void (*dll_ruby_script) (const char*);
313+ static int (*dll_rb_enc_find_index) (const char*);
314+ static rb_encoding* (*dll_rb_enc_find) (const char*);
315+ static VALUE (*dll_rb_enc_str_new) (const char*, long, rb_encoding*);
316+ static VALUE (*dll_rb_sprintf) (const char*, ...);
317+ #endif
318+
319 static HINSTANCE hinstRuby = 0; /* Instance of ruby.dll */
320
321 /*
322***************
323*** 252,264 ****
324--- 301,324 ----
325 {"rb_str_concat", (RUBY_PROC*)&dll_rb_str_concat},
326 {"rb_str_new", (RUBY_PROC*)&dll_rb_str_new},
327 {"rb_str_new2", (RUBY_PROC*)&dll_rb_str_new2},
328+ #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
329+ {"rb_errinfo", (RUBY_PROC*)&dll_rb_errinfo},
330+ #else
331 {"ruby_errinfo", (RUBY_PROC*)&dll_ruby_errinfo},
332+ #endif
333 {"ruby_init", (RUBY_PROC*)&dll_ruby_init},
334 {"ruby_init_loadpath", (RUBY_PROC*)&dll_ruby_init_loadpath},
335 {"NtInitialize", (RUBY_PROC*)&dll_NtInitialize},
336 #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
337 {"rb_w32_snprintf", (RUBY_PROC*)&dll_rb_w32_snprintf},
338 #endif
339+ #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
340+ {"ruby_script", (RUBY_PROC*)&dll_ruby_script},
341+ {"rb_enc_find_index", (RUBY_PROC*)&dll_rb_enc_find_index},
342+ {"rb_enc_find", (RUBY_PROC*)&dll_rb_enc_find},
343+ {"rb_enc_str_new", (RUBY_PROC*)&dll_rb_enc_str_new},
344+ {"rb_sprintf", (RUBY_PROC*)&dll_rb_sprintf},
345+ #endif
346 {"", NULL},
347 };
348
349***************
350*** 348,353 ****
351--- 408,465 ----
352 vim_free(script);
353 }
354
355+ /*
356+ * In Ruby 1.9 or later, ruby String object has encoding.
357+ * conversion buffer string of vim to ruby String object using
358+ * VIM encoding option.
359+ */
360+ static VALUE
361+ vim_str2rb_enc_str(const char *s)
362+ {
363+ #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
364+ int isnum;
365+ long lval;
366+ char_u *sval;
367+ rb_encoding *enc;
368+
369+ isnum = get_option_value((char_u *)"enc", &lval, &sval, 0);
370+ if (isnum == 0)
371+ {
372+ enc = rb_enc_find((char *)sval);
373+ vim_free(sval);
374+ if (enc) {
375+ return rb_enc_str_new(s, strlen(s), enc);
376+ }
377+ }
378+ #endif
379+ return rb_str_new2(s);
380+ }
381+
382+ static VALUE
383+ eval_enc_string_protect(const char *str, int *state)
384+ {
385+ #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
386+ int isnum;
387+ long lval;
388+ char_u *sval;
389+ rb_encoding *enc;
390+ VALUE v;
391+
392+ isnum = get_option_value((char_u *)"enc", &lval, &sval, 0);
393+ if (isnum == 0)
394+ {
395+ enc = rb_enc_find((char *)sval);
396+ vim_free(sval);
397+ if (enc)
398+ {
399+ v = rb_sprintf("#-*- coding:%s -*-\n%s", rb_enc_name(enc), str);
400+ return rb_eval_string_protect(StringValuePtr(v), state);
401+ }
402+ }
403+ #endif
404+ return rb_eval_string_protect(str, state);
405+ }
406+
407 void ex_rubydo(exarg_T *eap)
408 {
409 int state;
410***************
411*** 360,368 ****
412 for (i = eap->line1; i <= eap->line2; i++) {
413 VALUE line, oldline;
414
415! line = oldline = rb_str_new2((char *)ml_get(i));
416 rb_lastline_set(line);
417! rb_eval_string_protect((char *) eap->arg, &state);
418 if (state) {
419 error_print(state);
420 break;
421--- 472,480 ----
422 for (i = eap->line1; i <= eap->line2; i++) {
423 VALUE line, oldline;
424
425! line = oldline = vim_str2rb_enc_str((char *)ml_get(i));
426 rb_lastline_set(line);
427! eval_enc_string_protect((char *) eap->arg, &state);
428 if (state) {
429 error_print(state);
430 break;
431***************
432*** 373,379 ****
433 EMSG(_("E265: $_ must be an instance of String"));
434 return;
435 }
436! ml_replace(i, (char_u *) STR2CSTR(line), 1);
437 changed();
438 #ifdef SYNTAX_HL
439 syn_changed(i); /* recompute syntax hl. for this line */
440--- 485,491 ----
441 EMSG(_("E265: $_ must be an instance of String"));
442 return;
443 }
444! ml_replace(i, (char_u *) StringValuePtr(line), 1);
445 changed();
446 #ifdef SYNTAX_HL
447 syn_changed(i); /* recompute syntax hl. for this line */
448***************
449*** 428,436 ****
450--- 540,557 ----
451 char *argv[] = {"gvim.exe"};
452 NtInitialize(&argc, &argv);
453 #endif
454+ #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
455+ RUBY_INIT_STACK;
456+ #endif
457 ruby_init();
458+ #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
459+ ruby_script("vim-ruby");
460+ #endif
461 ruby_init_loadpath();
462 ruby_io_init();
463+ #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
464+ rb_enc_find_index("encdb");
465+ #endif
466 ruby_vim_init();
467 ruby_initialized = 1;
468 #ifdef DYNAMIC_RUBY
469***************
470*** 448,455 ****
471--- 569,578 ----
472 static void error_print(int state)
473 {
474 #ifndef DYNAMIC_RUBY
475+ #if !(defined(RUBY_VERSION) && RUBY_VERSION >= 19)
476 RUBYEXTERN VALUE ruby_errinfo;
477 #endif
478+ #endif
479 VALUE eclass;
480 VALUE einfo;
481 char buff[BUFSIZ];
482***************
483*** 482,490 ****
484 break;
485 case TAG_RAISE:
486 case TAG_FATAL:
487 eclass = CLASS_OF(ruby_errinfo);
488 einfo = rb_obj_as_string(ruby_errinfo);
489! if (eclass == rb_eRuntimeError && RSTRING(einfo)->len == 0) {
490 EMSG(_("E272: unhandled exception"));
491 }
492 else {
493--- 605,618 ----
494 break;
495 case TAG_RAISE:
496 case TAG_FATAL:
497+ #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
498+ eclass = CLASS_OF(rb_errinfo());
499+ einfo = rb_obj_as_string(rb_errinfo());
500+ #else
501 eclass = CLASS_OF(ruby_errinfo);
502 einfo = rb_obj_as_string(ruby_errinfo);
503! #endif
504! if (eclass == rb_eRuntimeError && RSTRING_LEN(einfo) == 0) {
505 EMSG(_("E272: unhandled exception"));
506 }
507 else {
508***************
509*** 493,499 ****
510
511 epath = rb_class_path(eclass);
512 vim_snprintf(buff, BUFSIZ, "%s: %s",
513! RSTRING(epath)->ptr, RSTRING(einfo)->ptr);
514 p = strchr(buff, '\n');
515 if (p) *p = '\0';
516 EMSG(buff);
517--- 621,627 ----
518
519 epath = rb_class_path(eclass);
520 vim_snprintf(buff, BUFSIZ, "%s: %s",
521! RSTRING_PTR(epath), RSTRING_PTR(einfo));
522 p = strchr(buff, '\n');
523 if (p) *p = '\0';
524 EMSG(buff);
525***************
526*** 511,518 ****
527 char *buff, *p;
528
529 str = rb_obj_as_string(str);
530! buff = ALLOCA_N(char, RSTRING(str)->len);
531! strcpy(buff, RSTRING(str)->ptr);
532 p = strchr(buff, '\n');
533 if (p) *p = '\0';
534 MSG(buff);
535--- 639,646 ----
536 char *buff, *p;
537
538 str = rb_obj_as_string(str);
539! buff = ALLOCA_N(char, RSTRING_LEN(str));
540! strcpy(buff, RSTRING_PTR(str));
541 p = strchr(buff, '\n');
542 if (p) *p = '\0';
543 MSG(buff);
544***************
545*** 521,541 ****
546
547 static VALUE vim_set_option(VALUE self UNUSED, VALUE str)
548 {
549! do_set((char_u *)STR2CSTR(str), 0);
550 update_screen(NOT_VALID);
551 return Qnil;
552 }
553
554 static VALUE vim_command(VALUE self UNUSED, VALUE str)
555 {
556! do_cmdline_cmd((char_u *)STR2CSTR(str));
557 return Qnil;
558 }
559
560 static VALUE vim_evaluate(VALUE self UNUSED, VALUE str)
561 {
562 #ifdef FEAT_EVAL
563! char_u *value = eval_to_string((char_u *)STR2CSTR(str), NULL, TRUE);
564
565 if (value != NULL)
566 {
567--- 649,669 ----
568
569 static VALUE vim_set_option(VALUE self UNUSED, VALUE str)
570 {
571! do_set((char_u *)StringValuePtr(str), 0);
572 update_screen(NOT_VALID);
573 return Qnil;
574 }
575
576 static VALUE vim_command(VALUE self UNUSED, VALUE str)
577 {
578! do_cmdline_cmd((char_u *)StringValuePtr(str));
579 return Qnil;
580 }
581
582 static VALUE vim_evaluate(VALUE self UNUSED, VALUE str)
583 {
584 #ifdef FEAT_EVAL
585! char_u *value = eval_to_string((char_u *)StringValuePtr(str), NULL, TRUE);
586
587 if (value != NULL)
588 {
589***************
590*** 640,648 ****
591 if (n > 0 && n <= buf->b_ml.ml_line_count)
592 {
593 char *line = (char *)ml_get_buf(buf, n, FALSE);
594! return line ? rb_str_new2(line) : Qnil;
595 }
596! rb_raise(rb_eIndexError, "index %d out of buffer", n);
597 #ifndef __GNUC__
598 return Qnil; /* For stop warning */
599 #endif
600--- 768,776 ----
601 if (n > 0 && n <= buf->b_ml.ml_line_count)
602 {
603 char *line = (char *)ml_get_buf(buf, n, FALSE);
604! return line ? vim_str2rb_enc_str(line) : Qnil;
605 }
606! rb_raise(rb_eIndexError, "line number %ld out of range", (long)n);
607 #ifndef __GNUC__
608 return Qnil; /* For stop warning */
609 #endif
610***************
611*** 659,665 ****
612
613 static VALUE set_buffer_line(buf_T *buf, linenr_T n, VALUE str)
614 {
615! char *line = STR2CSTR(str);
616 aco_save_T aco;
617
618 if (n > 0 && n <= buf->b_ml.ml_line_count && line != NULL)
619--- 787,793 ----
620
621 static VALUE set_buffer_line(buf_T *buf, linenr_T n, VALUE str)
622 {
623! char *line = StringValuePtr(str);
624 aco_save_T aco;
625
626 if (n > 0 && n <= buf->b_ml.ml_line_count && line != NULL)
627***************
628*** 683,689 ****
629 }
630 else
631 {
632! rb_raise(rb_eIndexError, "index %d out of buffer", n);
633 #ifndef __GNUC__
634 return Qnil; /* For stop warning */
635 #endif
636--- 811,817 ----
637 }
638 else
639 {
640! rb_raise(rb_eIndexError, "line number %ld out of range", (long)n);
641 #ifndef __GNUC__
642 return Qnil; /* For stop warning */
643 #endif
644***************
645*** 729,735 ****
646 }
647 else
648 {
649! rb_raise(rb_eIndexError, "index %d out of buffer", n);
650 }
651 return Qnil;
652 }
653--- 857,863 ----
654 }
655 else
656 {
657! rb_raise(rb_eIndexError, "line number %ld out of range", n);
658 }
659 return Qnil;
660 }
661***************
662*** 737,747 ****
663 static VALUE buffer_append(VALUE self, VALUE num, VALUE str)
664 {
665 buf_T *buf = get_buf(self);
666! char *line = STR2CSTR(str);
667 long n = NUM2LONG(num);
668 aco_save_T aco;
669
670! if (n >= 0 && n <= buf->b_ml.ml_line_count && line != NULL)
671 {
672 /* set curwin/curbuf for "buf" and save some things */
673 aucmd_prepbuf(&aco, buf);
674--- 865,878 ----
675 static VALUE buffer_append(VALUE self, VALUE num, VALUE str)
676 {
677 buf_T *buf = get_buf(self);
678! char *line = StringValuePtr(str);
679 long n = NUM2LONG(num);
680 aco_save_T aco;
681
682! if (line != NULL) {
683! rb_raise(rb_eIndexError, "NULL line");
684! }
685! else if (n >= 0 && n <= buf->b_ml.ml_line_count)
686 {
687 /* set curwin/curbuf for "buf" and save some things */
688 aucmd_prepbuf(&aco, buf);
689***************
690*** 763,769 ****
691 update_curbuf(NOT_VALID);
692 }
693 else {
694! rb_raise(rb_eIndexError, "index %d out of buffer", n);
695 }
696 return str;
697 }
698--- 894,900 ----
699 update_curbuf(NOT_VALID);
700 }
701 else {
702! rb_raise(rb_eIndexError, "line number %ld out of range", n);
703 }
704 return str;
705 }
706***************
707*** 904,913 ****
708 win_T *win = get_win(self);
709
710 Check_Type(pos, T_ARRAY);
711! if (RARRAY(pos)->len != 2)
712 rb_raise(rb_eArgError, "array length must be 2");
713! lnum = RARRAY(pos)->ptr[0];
714! col = RARRAY(pos)->ptr[1];
715 win->w_cursor.lnum = NUM2LONG(lnum);
716 win->w_cursor.col = NUM2UINT(col);
717 check_cursor(); /* put cursor on an existing line */
718--- 1035,1044 ----
719 win_T *win = get_win(self);
720
721 Check_Type(pos, T_ARRAY);
722! if (RARRAY_LEN(pos) != 2)
723 rb_raise(rb_eArgError, "array length must be 2");
724! lnum = RARRAY_PTR(pos)[0];
725! col = RARRAY_PTR(pos)[1];
726 win->w_cursor.lnum = NUM2LONG(lnum);
727 win->w_cursor.col = NUM2UINT(col);
728 check_cursor(); /* put cursor on an existing line */
729***************
730*** 924,930 ****
731 if (i > 0) rb_str_cat(str, ", ", 2);
732 rb_str_concat(str, rb_inspect(argv[i]));
733 }
734! MSG(RSTRING(str)->ptr);
735 return Qnil;
736 }
737
738--- 1055,1061 ----
739 if (i > 0) rb_str_cat(str, ", ", 2);
740 rb_str_concat(str, rb_inspect(argv[i]));
741 }
742! MSG(RSTRING_PTR(str));
743 return Qnil;
744 }
745
746*** ../vim-7.2.360/src/version.c 2010-02-17 15:11:35.000000000 +0100
747--- src/version.c 2010-02-17 15:59:12.000000000 +0100
748***************
749*** 683,684 ****
750--- 683,686 ----
751 { /* Add new patch number below this line */
752+ /**/
753+ 361,
754 /**/
755
756--
757"Marriage is when a man and woman become as one; the trouble starts
758when they try to decide which one"
759
760 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
761/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
762\\\ download, build and distribute -- http://www.A-A-P.org ///
763 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
This page took 0.139609 seconds and 4 git commands to generate.