summaryrefslogtreecommitdiffstats
path: root/source/ap/vim/patches/7.2.361
blob: ddc5857957ed8815ce4f3d1bf67e12fcf6aadc45 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
To: vim-dev@vim.org
Subject: Patch 7.2.361
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.2.361
Problem:    Ruby 1.9 is not supported.
Solution:   Add Ruby 1.9 support. (Msaki Suketa)
Files:	    src/Makefile, src/auto/configure, src/configure.in, src/if_ruby.c


*** ../vim-7.2.360/src/Makefile	2010-02-17 15:12:22.000000000 +0100
--- src/Makefile	2010-02-17 16:21:01.000000000 +0100
***************
*** 395,401 ****
  
  # RUBY
  # Uncomment this when you want to include the Ruby interface.
! #CONF_OPT_RUBY = --enable-rubyinterp
  
  # MZSCHEME
  # Uncomment this when you want to include the MzScheme interface.
--- 395,403 ----
  
  # RUBY
  # Uncomment this when you want to include the Ruby interface.
! # Note: you need the development package (e.g., ruby1.9.1-dev on Ubuntu).
! # CONF_OPT_RUBY = --enable-rubyinterp
! # CONF_OPT_RUBY = --enable-rubyinterp --with-ruby-command=ruby1.9.1
  
  # MZSCHEME
  # Uncomment this when you want to include the MzScheme interface.
*** ../vim-7.2.360/src/auto/configure	2009-12-16 17:14:08.000000000 +0100
--- src/auto/configure	2010-02-17 16:08:59.000000000 +0100
***************
*** 793,798 ****
--- 793,799 ----
  enable_tclinterp
  with_tclsh
  enable_rubyinterp
+ with_ruby_command
  enable_cscope
  enable_workshop
  enable_netbeans
***************
*** 1503,1508 ****
--- 1504,1510 ----
    --with-plthome=PLTHOME   Use PLTHOME.
    --with-python-config-dir=PATH  Python's config directory
    --with-tclsh=PATH       which tclsh to use (default: tclsh8.0)
+   --with-ruby-command=RUBY  name of the Ruby command (default: ruby)
    --with-x                use the X Window System
    --with-gtk-prefix=PFX   Prefix where GTK is installed (optional)
    --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)
***************
*** 5703,5711 ****
  { $as_echo "$as_me:$LINENO: result: $enable_rubyinterp" >&5
  $as_echo "$enable_rubyinterp" >&6; }
  if test "$enable_rubyinterp" = "yes"; then
  
!   # Extract the first word of "ruby", so it can be a program name with args.
! set dummy ruby; ac_word=$2
  { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
  $as_echo_n "checking for $ac_word... " >&6; }
  if test "${ac_cv_path_vi_cv_path_ruby+set}" = set; then
--- 5705,5725 ----
  { $as_echo "$as_me:$LINENO: result: $enable_rubyinterp" >&5
  $as_echo "$enable_rubyinterp" >&6; }
  if test "$enable_rubyinterp" = "yes"; then
+   { $as_echo "$as_me:$LINENO: checking --with-ruby-command argument" >&5
+ $as_echo_n "checking --with-ruby-command argument... " >&6; }
  
! # Check whether --with-ruby-command was given.
! if test "${with_ruby_command+set}" = set; then
!   withval=$with_ruby_command; RUBY_CMD="$withval"; { $as_echo "$as_me:$LINENO: result: $RUBY_CMD" >&5
! $as_echo "$RUBY_CMD" >&6; }
! else
!   RUBY_CMD="ruby"; { $as_echo "$as_me:$LINENO: result: defaulting to $RUBY_CMD" >&5
! $as_echo "defaulting to $RUBY_CMD" >&6; }
! fi
! 
! 
!   # Extract the first word of "$RUBY_CMD", so it can be a program name with args.
! set dummy $RUBY_CMD; ac_word=$2
  { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
  $as_echo_n "checking for $ac_word... " >&6; }
  if test "${ac_cv_path_vi_cv_path_ruby+set}" = set; then
***************
*** 5752,5762 ****
  $as_echo "OK" >&6; }
        { $as_echo "$as_me:$LINENO: checking Ruby header files" >&5
  $as_echo_n "checking Ruby header files... " >&6; }
!       rubyhdrdir=`$vi_cv_path_ruby -r mkmf -e 'print Config::CONFIG["archdir"] || $hdrdir' 2>/dev/null`
        if test "X$rubyhdrdir" != "X"; then
  	{ $as_echo "$as_me:$LINENO: result: $rubyhdrdir" >&5
  $as_echo "$rubyhdrdir" >&6; }
  	RUBY_CFLAGS="-I$rubyhdrdir"
  	rubylibs=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG["LIBS"]'`
  	if test "X$rubylibs" != "X"; then
  	  RUBY_LIBS="$rubylibs"
--- 5766,5782 ----
  $as_echo "OK" >&6; }
        { $as_echo "$as_me:$LINENO: checking Ruby header files" >&5
  $as_echo_n "checking Ruby header files... " >&6; }
!       rubyhdrdir=`$vi_cv_path_ruby -r mkmf -e 'print Config::CONFIG["rubyhdrdir"] || Config::CONFIG["archdir"] || $hdrdir' 2>/dev/null`
        if test "X$rubyhdrdir" != "X"; then
  	{ $as_echo "$as_me:$LINENO: result: $rubyhdrdir" >&5
  $as_echo "$rubyhdrdir" >&6; }
  	RUBY_CFLAGS="-I$rubyhdrdir"
+         rubyarch=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG["arch"]'`
+         if test -d "$rubyhdrdir/$rubyarch"; then
+           RUBY_CFLAGS="$RUBY_CFLAGS -I$rubyhdrdir/$rubyarch"
+         fi
+         rubyversion=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG["ruby_version"].gsub(/\./, "")[0,2]'`
+         RUBY_CFLAGS="$RUBY_CFLAGS -DRUBY_VERSION=$rubyversion"
  	rubylibs=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG["LIBS"]'`
  	if test "X$rubylibs" != "X"; then
  	  RUBY_LIBS="$rubylibs"
***************
*** 5793,5800 ****
  _ACEOF
  
        else
! 	{ $as_echo "$as_me:$LINENO: result: not found" >&5
! $as_echo "not found" >&6; }
        fi
      else
        { $as_echo "$as_me:$LINENO: result: too old; need Ruby version 1.6.0 or later" >&5
--- 5813,5820 ----
  _ACEOF
  
        else
! 	{ $as_echo "$as_me:$LINENO: result: not found; disabling Ruby" >&5
! $as_echo "not found; disabling Ruby" >&6; }
        fi
      else
        { $as_echo "$as_me:$LINENO: result: too old; need Ruby version 1.6.0 or later" >&5
*** ../vim-7.2.360/src/configure.in	2009-12-16 17:14:08.000000000 +0100
--- src/configure.in	2010-02-17 16:00:58.000000000 +0100
***************
*** 949,965 ****
  	[enable_rubyinterp="no"])
  AC_MSG_RESULT($enable_rubyinterp)
  if test "$enable_rubyinterp" = "yes"; then
    AC_SUBST(vi_cv_path_ruby)
!   AC_PATH_PROG(vi_cv_path_ruby, ruby)
    if test "X$vi_cv_path_ruby" != "X"; then
      AC_MSG_CHECKING(Ruby version)
      if $vi_cv_path_ruby -e '(VERSION rescue RUBY_VERSION) >= "1.6.0" or exit 1' >/dev/null 2>/dev/null; then
        AC_MSG_RESULT(OK)
        AC_MSG_CHECKING(Ruby header files)
!       rubyhdrdir=`$vi_cv_path_ruby -r mkmf -e 'print Config::CONFIG[["archdir"]] || $hdrdir' 2>/dev/null`
        if test "X$rubyhdrdir" != "X"; then
  	AC_MSG_RESULT($rubyhdrdir)
  	RUBY_CFLAGS="-I$rubyhdrdir"
  	rubylibs=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["LIBS"]]'`
  	if test "X$rubylibs" != "X"; then
  	  RUBY_LIBS="$rubylibs"
--- 949,975 ----
  	[enable_rubyinterp="no"])
  AC_MSG_RESULT($enable_rubyinterp)
  if test "$enable_rubyinterp" = "yes"; then
+   AC_MSG_CHECKING(--with-ruby-command argument)
+   AC_ARG_WITH(ruby-command, [  --with-ruby-command=RUBY  name of the Ruby command (default: ruby)],
+ 	RUBY_CMD="$withval"; AC_MSG_RESULT($RUBY_CMD),
+ 	RUBY_CMD="ruby"; AC_MSG_RESULT(defaulting to $RUBY_CMD))
    AC_SUBST(vi_cv_path_ruby)
!   AC_PATH_PROG(vi_cv_path_ruby, $RUBY_CMD)
    if test "X$vi_cv_path_ruby" != "X"; then
      AC_MSG_CHECKING(Ruby version)
      if $vi_cv_path_ruby -e '(VERSION rescue RUBY_VERSION) >= "1.6.0" or exit 1' >/dev/null 2>/dev/null; then
        AC_MSG_RESULT(OK)
        AC_MSG_CHECKING(Ruby header files)
!       rubyhdrdir=`$vi_cv_path_ruby -r mkmf -e 'print Config::CONFIG[["rubyhdrdir"]] || Config::CONFIG[["archdir"]] || $hdrdir' 2>/dev/null`
        if test "X$rubyhdrdir" != "X"; then
  	AC_MSG_RESULT($rubyhdrdir)
  	RUBY_CFLAGS="-I$rubyhdrdir"
+         rubyarch=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["arch"]]'`
+         if test -d "$rubyhdrdir/$rubyarch"; then
+           RUBY_CFLAGS="$RUBY_CFLAGS -I$rubyhdrdir/$rubyarch"
+         fi
+         rubyversion=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["ruby_version"]].gsub(/\./, "")[[0,2]]'`
+         RUBY_CFLAGS="$RUBY_CFLAGS -DRUBY_VERSION=$rubyversion"
  	rubylibs=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["LIBS"]]'`
  	if test "X$rubylibs" != "X"; then
  	  RUBY_LIBS="$rubylibs"
***************
*** 997,1003 ****
  	RUBY_PRO="if_ruby.pro"
  	AC_DEFINE(FEAT_RUBY)
        else
! 	AC_MSG_RESULT(not found, disabling Ruby)
        fi
      else
        AC_MSG_RESULT(too old; need Ruby version 1.6.0 or later)
--- 1007,1013 ----
  	RUBY_PRO="if_ruby.pro"
  	AC_DEFINE(FEAT_RUBY)
        else
! 	AC_MSG_RESULT(not found; disabling Ruby)
        fi
      else
        AC_MSG_RESULT(too old; need Ruby version 1.6.0 or later)
*** ../vim-7.2.360/src/if_ruby.c	2010-02-17 15:11:35.000000000 +0100
--- src/if_ruby.c	2010-02-17 16:08:47.000000000 +0100
***************
*** 54,59 ****
--- 54,62 ----
  #endif
  
  #include <ruby.h>
+ #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
+ # include <ruby/encoding.h>
+ #endif
  
  #undef EXTERN
  #undef _
***************
*** 65,70 ****
--- 68,95 ----
  # define __OPENTRANSPORTPROVIDERS__
  #endif
  
+ /*
+  * Backward compatiblity for Ruby 1.8 and earlier.
+  * Ruby 1.9 does not provide STR2CSTR, instead StringValuePtr is provided.
+  * Ruby 1.9 does not provide RXXX(s)->len and RXXX(s)->ptr, instead
+  * RXXX_LEN(s) and RXXX_PTR(s) are provided.
+  */
+ #ifndef StringValuePtr
+ # define StringValuePtr(s) STR2CSTR(s)
+ #endif
+ #ifndef RARRAY_LEN
+ # define RARRAY_LEN(s) RARRAY(s)->len
+ #endif
+ #ifndef RARRAY_PTR
+ # define RARRAY_PTR(s) RARRAY(s)->ptr
+ #endif
+ #ifndef RSTRING_LEN
+ # define RSTRING_LEN(s) RSTRING(s)->len
+ #endif
+ #ifndef RSTRING_PTR
+ # define RSTRING_PTR(s) RSTRING(s)->ptr
+ #endif
+ 
  #include "vim.h"
  #include "version.h"
  
***************
*** 134,140 ****
  #define rb_str_concat			dll_rb_str_concat
  #define rb_str_new			dll_rb_str_new
  #define rb_str_new2			dll_rb_str_new2
! #define ruby_errinfo			(*dll_ruby_errinfo)
  #define ruby_init			dll_ruby_init
  #define ruby_init_loadpath		dll_ruby_init_loadpath
  #define NtInitialize			dll_NtInitialize
--- 159,169 ----
  #define rb_str_concat			dll_rb_str_concat
  #define rb_str_new			dll_rb_str_new
  #define rb_str_new2			dll_rb_str_new2
! #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
! # define rb_errinfo			dll_rb_errinfo
! #else
! # define ruby_errinfo			(*dll_ruby_errinfo)
! #endif
  #define ruby_init			dll_ruby_init
  #define ruby_init_loadpath		dll_ruby_init_loadpath
  #define NtInitialize			dll_NtInitialize
***************
*** 142,147 ****
--- 171,184 ----
  # define rb_w32_snprintf		dll_rb_w32_snprintf
  #endif
  
+ #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
+ # define ruby_script			dll_ruby_script
+ # define rb_enc_find_index		dll_rb_enc_find_index
+ # define rb_enc_find			dll_rb_enc_find
+ # define rb_enc_str_new			dll_rb_enc_str_new
+ # define rb_sprintf			dll_rb_sprintf
+ #endif
+ 
  /*
   * Pointers for dynamic link
   */
***************
*** 189,195 ****
--- 226,236 ----
  static VALUE (*dll_rb_str_concat) (VALUE, VALUE);
  static VALUE (*dll_rb_str_new) (const char*, long);
  static VALUE (*dll_rb_str_new2) (const char*);
+ #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
+ static VALUE (*dll_rb_errinfo) (void);
+ #else
  static VALUE *dll_ruby_errinfo;
+ #endif
  static void (*dll_ruby_init) (void);
  static void (*dll_ruby_init_loadpath) (void);
  static void (*dll_NtInitialize) (int*, char***);
***************
*** 197,202 ****
--- 238,251 ----
  static int (*dll_rb_w32_snprintf)(char*, size_t, const char*, ...);
  #endif
  
+ #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
+ static void (*dll_ruby_script) (const char*);
+ static int (*dll_rb_enc_find_index) (const char*);
+ static rb_encoding* (*dll_rb_enc_find) (const char*);
+ static VALUE (*dll_rb_enc_str_new) (const char*, long, rb_encoding*);
+ static VALUE (*dll_rb_sprintf) (const char*, ...);
+ #endif
+ 
  static HINSTANCE hinstRuby = 0; /* Instance of ruby.dll */
  
  /*
***************
*** 252,264 ****
--- 301,324 ----
      {"rb_str_concat", (RUBY_PROC*)&dll_rb_str_concat},
      {"rb_str_new", (RUBY_PROC*)&dll_rb_str_new},
      {"rb_str_new2", (RUBY_PROC*)&dll_rb_str_new2},
+ #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
+     {"rb_errinfo", (RUBY_PROC*)&dll_rb_errinfo},
+ #else
      {"ruby_errinfo", (RUBY_PROC*)&dll_ruby_errinfo},
+ #endif
      {"ruby_init", (RUBY_PROC*)&dll_ruby_init},
      {"ruby_init_loadpath", (RUBY_PROC*)&dll_ruby_init_loadpath},
      {"NtInitialize", (RUBY_PROC*)&dll_NtInitialize},
  #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
      {"rb_w32_snprintf", (RUBY_PROC*)&dll_rb_w32_snprintf},
  #endif
+ #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
+     {"ruby_script", (RUBY_PROC*)&dll_ruby_script},
+     {"rb_enc_find_index", (RUBY_PROC*)&dll_rb_enc_find_index},
+     {"rb_enc_find", (RUBY_PROC*)&dll_rb_enc_find},
+     {"rb_enc_str_new", (RUBY_PROC*)&dll_rb_enc_str_new},
+     {"rb_sprintf", (RUBY_PROC*)&dll_rb_sprintf},
+ #endif
      {"", NULL},
  };
  
***************
*** 348,353 ****
--- 408,465 ----
      vim_free(script);
  }
  
+ /*
+  *  In Ruby 1.9 or later, ruby String object has encoding.
+  *  conversion buffer string of vim to ruby String object using
+  *  VIM encoding option.
+  */
+     static VALUE
+ vim_str2rb_enc_str(const char *s)
+ {
+ #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
+     int isnum;
+     long lval;
+     char_u *sval;
+     rb_encoding *enc;
+ 
+     isnum = get_option_value((char_u *)"enc", &lval, &sval, 0);
+     if (isnum == 0)
+     {
+ 	enc = rb_enc_find((char *)sval);
+ 	vim_free(sval);
+ 	if (enc) {
+ 	    return rb_enc_str_new(s, strlen(s), enc);
+ 	}
+     }
+ #endif
+     return rb_str_new2(s);
+ }
+ 
+     static VALUE
+ eval_enc_string_protect(const char *str, int *state)
+ {
+ #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
+     int isnum;
+     long lval;
+     char_u *sval;
+     rb_encoding *enc;
+     VALUE v;
+ 
+     isnum = get_option_value((char_u *)"enc", &lval, &sval, 0);
+     if (isnum == 0)
+     {
+ 	enc = rb_enc_find((char *)sval);
+ 	vim_free(sval);
+ 	if (enc)
+ 	{
+ 	    v = rb_sprintf("#-*- coding:%s -*-\n%s", rb_enc_name(enc), str);
+ 	    return rb_eval_string_protect(StringValuePtr(v), state);
+ 	}
+     }
+ #endif
+     return rb_eval_string_protect(str, state);
+ }
+ 
  void ex_rubydo(exarg_T *eap)
  {
      int state;
***************
*** 360,368 ****
  	for (i = eap->line1; i <= eap->line2; i++) {
  	    VALUE line, oldline;
  
! 	    line = oldline = rb_str_new2((char *)ml_get(i));
  	    rb_lastline_set(line);
! 	    rb_eval_string_protect((char *) eap->arg, &state);
  	    if (state) {
  		error_print(state);
  		break;
--- 472,480 ----
  	for (i = eap->line1; i <= eap->line2; i++) {
  	    VALUE line, oldline;
  
! 	    line = oldline = vim_str2rb_enc_str((char *)ml_get(i));
  	    rb_lastline_set(line);
! 	    eval_enc_string_protect((char *) eap->arg, &state);
  	    if (state) {
  		error_print(state);
  		break;
***************
*** 373,379 ****
  		    EMSG(_("E265: $_ must be an instance of String"));
  		    return;
  		}
! 		ml_replace(i, (char_u *) STR2CSTR(line), 1);
  		changed();
  #ifdef SYNTAX_HL
  		syn_changed(i); /* recompute syntax hl. for this line */
--- 485,491 ----
  		    EMSG(_("E265: $_ must be an instance of String"));
  		    return;
  		}
! 		ml_replace(i, (char_u *) StringValuePtr(line), 1);
  		changed();
  #ifdef SYNTAX_HL
  		syn_changed(i); /* recompute syntax hl. for this line */
***************
*** 428,436 ****
--- 540,557 ----
  	    char *argv[] = {"gvim.exe"};
  	    NtInitialize(&argc, &argv);
  #endif
+ #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
+ 	    RUBY_INIT_STACK;
+ #endif
  	    ruby_init();
+ #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
+ 	    ruby_script("vim-ruby");
+ #endif
  	    ruby_init_loadpath();
  	    ruby_io_init();
+ #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
+ 	    rb_enc_find_index("encdb");
+ #endif
  	    ruby_vim_init();
  	    ruby_initialized = 1;
  #ifdef DYNAMIC_RUBY
***************
*** 448,455 ****
--- 569,578 ----
  static void error_print(int state)
  {
  #ifndef DYNAMIC_RUBY
+ #if !(defined(RUBY_VERSION) &&  RUBY_VERSION >= 19)
      RUBYEXTERN VALUE ruby_errinfo;
  #endif
+ #endif
      VALUE eclass;
      VALUE einfo;
      char buff[BUFSIZ];
***************
*** 482,490 ****
  	break;
      case TAG_RAISE:
      case TAG_FATAL:
  	eclass = CLASS_OF(ruby_errinfo);
  	einfo = rb_obj_as_string(ruby_errinfo);
! 	if (eclass == rb_eRuntimeError && RSTRING(einfo)->len == 0) {
  	    EMSG(_("E272: unhandled exception"));
  	}
  	else {
--- 605,618 ----
  	break;
      case TAG_RAISE:
      case TAG_FATAL:
+ #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
+ 	eclass = CLASS_OF(rb_errinfo());
+ 	einfo = rb_obj_as_string(rb_errinfo());
+ #else
  	eclass = CLASS_OF(ruby_errinfo);
  	einfo = rb_obj_as_string(ruby_errinfo);
! #endif
! 	if (eclass == rb_eRuntimeError && RSTRING_LEN(einfo) == 0) {
  	    EMSG(_("E272: unhandled exception"));
  	}
  	else {
***************
*** 493,499 ****
  
  	    epath = rb_class_path(eclass);
  	    vim_snprintf(buff, BUFSIZ, "%s: %s",
! 		     RSTRING(epath)->ptr, RSTRING(einfo)->ptr);
  	    p = strchr(buff, '\n');
  	    if (p) *p = '\0';
  	    EMSG(buff);
--- 621,627 ----
  
  	    epath = rb_class_path(eclass);
  	    vim_snprintf(buff, BUFSIZ, "%s: %s",
! 		     RSTRING_PTR(epath), RSTRING_PTR(einfo));
  	    p = strchr(buff, '\n');
  	    if (p) *p = '\0';
  	    EMSG(buff);
***************
*** 511,518 ****
      char *buff, *p;
  
      str = rb_obj_as_string(str);
!     buff = ALLOCA_N(char, RSTRING(str)->len);
!     strcpy(buff, RSTRING(str)->ptr);
      p = strchr(buff, '\n');
      if (p) *p = '\0';
      MSG(buff);
--- 639,646 ----
      char *buff, *p;
  
      str = rb_obj_as_string(str);
!     buff = ALLOCA_N(char, RSTRING_LEN(str));
!     strcpy(buff, RSTRING_PTR(str));
      p = strchr(buff, '\n');
      if (p) *p = '\0';
      MSG(buff);
***************
*** 521,541 ****
  
  static VALUE vim_set_option(VALUE self UNUSED, VALUE str)
  {
!     do_set((char_u *)STR2CSTR(str), 0);
      update_screen(NOT_VALID);
      return Qnil;
  }
  
  static VALUE vim_command(VALUE self UNUSED, VALUE str)
  {
!     do_cmdline_cmd((char_u *)STR2CSTR(str));
      return Qnil;
  }
  
  static VALUE vim_evaluate(VALUE self UNUSED, VALUE str)
  {
  #ifdef FEAT_EVAL
!     char_u *value = eval_to_string((char_u *)STR2CSTR(str), NULL, TRUE);
  
      if (value != NULL)
      {
--- 649,669 ----
  
  static VALUE vim_set_option(VALUE self UNUSED, VALUE str)
  {
!     do_set((char_u *)StringValuePtr(str), 0);
      update_screen(NOT_VALID);
      return Qnil;
  }
  
  static VALUE vim_command(VALUE self UNUSED, VALUE str)
  {
!     do_cmdline_cmd((char_u *)StringValuePtr(str));
      return Qnil;
  }
  
  static VALUE vim_evaluate(VALUE self UNUSED, VALUE str)
  {
  #ifdef FEAT_EVAL
!     char_u *value = eval_to_string((char_u *)StringValuePtr(str), NULL, TRUE);
  
      if (value != NULL)
      {
***************
*** 640,648 ****
      if (n > 0 && n <= buf->b_ml.ml_line_count)
      {
  	char *line = (char *)ml_get_buf(buf, n, FALSE);
! 	return line ? rb_str_new2(line) : Qnil;
      }
!     rb_raise(rb_eIndexError, "index %d out of buffer", n);
  #ifndef __GNUC__
      return Qnil; /* For stop warning */
  #endif
--- 768,776 ----
      if (n > 0 && n <= buf->b_ml.ml_line_count)
      {
  	char *line = (char *)ml_get_buf(buf, n, FALSE);
! 	return line ? vim_str2rb_enc_str(line) : Qnil;
      }
!     rb_raise(rb_eIndexError, "line number %ld out of range", (long)n);
  #ifndef __GNUC__
      return Qnil; /* For stop warning */
  #endif
***************
*** 659,665 ****
  
  static VALUE set_buffer_line(buf_T *buf, linenr_T n, VALUE str)
  {
!     char	*line = STR2CSTR(str);
      aco_save_T	aco;
  
      if (n > 0 && n <= buf->b_ml.ml_line_count && line != NULL)
--- 787,793 ----
  
  static VALUE set_buffer_line(buf_T *buf, linenr_T n, VALUE str)
  {
!     char	*line = StringValuePtr(str);
      aco_save_T	aco;
  
      if (n > 0 && n <= buf->b_ml.ml_line_count && line != NULL)
***************
*** 683,689 ****
      }
      else
      {
! 	rb_raise(rb_eIndexError, "index %d out of buffer", n);
  #ifndef __GNUC__
  	return Qnil; /* For stop warning */
  #endif
--- 811,817 ----
      }
      else
      {
! 	rb_raise(rb_eIndexError, "line number %ld out of range", (long)n);
  #ifndef __GNUC__
  	return Qnil; /* For stop warning */
  #endif
***************
*** 729,735 ****
      }
      else
      {
! 	rb_raise(rb_eIndexError, "index %d out of buffer", n);
      }
      return Qnil;
  }
--- 857,863 ----
      }
      else
      {
! 	rb_raise(rb_eIndexError, "line number %ld out of range", n);
      }
      return Qnil;
  }
***************
*** 737,747 ****
  static VALUE buffer_append(VALUE self, VALUE num, VALUE str)
  {
      buf_T	*buf = get_buf(self);
!     char	*line = STR2CSTR(str);
      long	n = NUM2LONG(num);
      aco_save_T	aco;
  
!     if (n >= 0 && n <= buf->b_ml.ml_line_count && line != NULL)
      {
  	/* set curwin/curbuf for "buf" and save some things */
  	aucmd_prepbuf(&aco, buf);
--- 865,878 ----
  static VALUE buffer_append(VALUE self, VALUE num, VALUE str)
  {
      buf_T	*buf = get_buf(self);
!     char	*line = StringValuePtr(str);
      long	n = NUM2LONG(num);
      aco_save_T	aco;
  
!     if (line != NULL) {
! 	rb_raise(rb_eIndexError, "NULL line");
!     }
!     else if (n >= 0 && n <= buf->b_ml.ml_line_count)
      {
  	/* set curwin/curbuf for "buf" and save some things */
  	aucmd_prepbuf(&aco, buf);
***************
*** 763,769 ****
  	update_curbuf(NOT_VALID);
      }
      else {
! 	rb_raise(rb_eIndexError, "index %d out of buffer", n);
      }
      return str;
  }
--- 894,900 ----
  	update_curbuf(NOT_VALID);
      }
      else {
! 	rb_raise(rb_eIndexError, "line number %ld out of range", n);
      }
      return str;
  }
***************
*** 904,913 ****
      win_T *win = get_win(self);
  
      Check_Type(pos, T_ARRAY);
!     if (RARRAY(pos)->len != 2)
  	rb_raise(rb_eArgError, "array length must be 2");
!     lnum = RARRAY(pos)->ptr[0];
!     col = RARRAY(pos)->ptr[1];
      win->w_cursor.lnum = NUM2LONG(lnum);
      win->w_cursor.col = NUM2UINT(col);
      check_cursor();		    /* put cursor on an existing line */
--- 1035,1044 ----
      win_T *win = get_win(self);
  
      Check_Type(pos, T_ARRAY);
!     if (RARRAY_LEN(pos) != 2)
  	rb_raise(rb_eArgError, "array length must be 2");
!     lnum = RARRAY_PTR(pos)[0];
!     col = RARRAY_PTR(pos)[1];
      win->w_cursor.lnum = NUM2LONG(lnum);
      win->w_cursor.col = NUM2UINT(col);
      check_cursor();		    /* put cursor on an existing line */
***************
*** 924,930 ****
  	if (i > 0) rb_str_cat(str, ", ", 2);
  	rb_str_concat(str, rb_inspect(argv[i]));
      }
!     MSG(RSTRING(str)->ptr);
      return Qnil;
  }
  
--- 1055,1061 ----
  	if (i > 0) rb_str_cat(str, ", ", 2);
  	rb_str_concat(str, rb_inspect(argv[i]));
      }
!     MSG(RSTRING_PTR(str));
      return Qnil;
  }
  
*** ../vim-7.2.360/src/version.c	2010-02-17 15:11:35.000000000 +0100
--- src/version.c	2010-02-17 15:59:12.000000000 +0100
***************
*** 683,684 ****
--- 683,686 ----
  {   /* Add new patch number below this line */
+ /**/
+     361,
  /**/

-- 
"Marriage is when a man and woman become as one; the trouble starts
when they try to decide which one"

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///