comparison src/if_ruby.c @ 2077:d8983769c9dd v7.2.361

updated for version 7.2.361 Problem: Ruby 1.9 is not supported. Solution: Add Ruby 1.9 support. (Msaki Suketa)
author Bram Moolenaar <bram@zimbu.org>
date Wed, 17 Feb 2010 16:23:09 +0100
parents 1c7a66d820e4
children 4bac7ed34007
comparison
equal deleted inserted replaced
2076:1c7a66d820e4 2077:d8983769c9dd
52 #if (_MSC_VER == 1200) 52 #if (_MSC_VER == 1200)
53 # undef _WIN32_WINNT 53 # undef _WIN32_WINNT
54 #endif 54 #endif
55 55
56 #include <ruby.h> 56 #include <ruby.h>
57 #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
58 # include <ruby/encoding.h>
59 #endif
57 60
58 #undef EXTERN 61 #undef EXTERN
59 #undef _ 62 #undef _
60 63
61 /* T_DATA defined both by Ruby and Mac header files, hack around it... */ 64 /* T_DATA defined both by Ruby and Mac header files, hack around it... */
62 #if defined(MACOS_X_UNIX) || defined(macintosh) 65 #if defined(MACOS_X_UNIX) || defined(macintosh)
63 # define __OPENTRANSPORT__ 66 # define __OPENTRANSPORT__
64 # define __OPENTRANSPORTPROTOCOL__ 67 # define __OPENTRANSPORTPROTOCOL__
65 # define __OPENTRANSPORTPROVIDERS__ 68 # define __OPENTRANSPORTPROVIDERS__
69 #endif
70
71 /*
72 * Backward compatiblity for Ruby 1.8 and earlier.
73 * Ruby 1.9 does not provide STR2CSTR, instead StringValuePtr is provided.
74 * Ruby 1.9 does not provide RXXX(s)->len and RXXX(s)->ptr, instead
75 * RXXX_LEN(s) and RXXX_PTR(s) are provided.
76 */
77 #ifndef StringValuePtr
78 # define StringValuePtr(s) STR2CSTR(s)
79 #endif
80 #ifndef RARRAY_LEN
81 # define RARRAY_LEN(s) RARRAY(s)->len
82 #endif
83 #ifndef RARRAY_PTR
84 # define RARRAY_PTR(s) RARRAY(s)->ptr
85 #endif
86 #ifndef RSTRING_LEN
87 # define RSTRING_LEN(s) RSTRING(s)->len
88 #endif
89 #ifndef RSTRING_PTR
90 # define RSTRING_PTR(s) RSTRING(s)->ptr
66 #endif 91 #endif
67 92
68 #include "vim.h" 93 #include "vim.h"
69 #include "version.h" 94 #include "version.h"
70 95
132 #define rb_str2cstr dll_rb_str2cstr 157 #define rb_str2cstr dll_rb_str2cstr
133 #define rb_str_cat dll_rb_str_cat 158 #define rb_str_cat dll_rb_str_cat
134 #define rb_str_concat dll_rb_str_concat 159 #define rb_str_concat dll_rb_str_concat
135 #define rb_str_new dll_rb_str_new 160 #define rb_str_new dll_rb_str_new
136 #define rb_str_new2 dll_rb_str_new2 161 #define rb_str_new2 dll_rb_str_new2
137 #define ruby_errinfo (*dll_ruby_errinfo) 162 #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
163 # define rb_errinfo dll_rb_errinfo
164 #else
165 # define ruby_errinfo (*dll_ruby_errinfo)
166 #endif
138 #define ruby_init dll_ruby_init 167 #define ruby_init dll_ruby_init
139 #define ruby_init_loadpath dll_ruby_init_loadpath 168 #define ruby_init_loadpath dll_ruby_init_loadpath
140 #define NtInitialize dll_NtInitialize 169 #define NtInitialize dll_NtInitialize
141 #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18 170 #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
142 # define rb_w32_snprintf dll_rb_w32_snprintf 171 # define rb_w32_snprintf dll_rb_w32_snprintf
172 #endif
173
174 #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
175 # define ruby_script dll_ruby_script
176 # define rb_enc_find_index dll_rb_enc_find_index
177 # define rb_enc_find dll_rb_enc_find
178 # define rb_enc_str_new dll_rb_enc_str_new
179 # define rb_sprintf dll_rb_sprintf
143 #endif 180 #endif
144 181
145 /* 182 /*
146 * Pointers for dynamic link 183 * Pointers for dynamic link
147 */ 184 */
187 static char *(*dll_rb_str2cstr) (VALUE,int*); 224 static char *(*dll_rb_str2cstr) (VALUE,int*);
188 static VALUE (*dll_rb_str_cat) (VALUE, const char*, long); 225 static VALUE (*dll_rb_str_cat) (VALUE, const char*, long);
189 static VALUE (*dll_rb_str_concat) (VALUE, VALUE); 226 static VALUE (*dll_rb_str_concat) (VALUE, VALUE);
190 static VALUE (*dll_rb_str_new) (const char*, long); 227 static VALUE (*dll_rb_str_new) (const char*, long);
191 static VALUE (*dll_rb_str_new2) (const char*); 228 static VALUE (*dll_rb_str_new2) (const char*);
229 #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
230 static VALUE (*dll_rb_errinfo) (void);
231 #else
192 static VALUE *dll_ruby_errinfo; 232 static VALUE *dll_ruby_errinfo;
233 #endif
193 static void (*dll_ruby_init) (void); 234 static void (*dll_ruby_init) (void);
194 static void (*dll_ruby_init_loadpath) (void); 235 static void (*dll_ruby_init_loadpath) (void);
195 static void (*dll_NtInitialize) (int*, char***); 236 static void (*dll_NtInitialize) (int*, char***);
196 #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18 237 #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
197 static int (*dll_rb_w32_snprintf)(char*, size_t, const char*, ...); 238 static int (*dll_rb_w32_snprintf)(char*, size_t, const char*, ...);
239 #endif
240
241 #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
242 static void (*dll_ruby_script) (const char*);
243 static int (*dll_rb_enc_find_index) (const char*);
244 static rb_encoding* (*dll_rb_enc_find) (const char*);
245 static VALUE (*dll_rb_enc_str_new) (const char*, long, rb_encoding*);
246 static VALUE (*dll_rb_sprintf) (const char*, ...);
198 #endif 247 #endif
199 248
200 static HINSTANCE hinstRuby = 0; /* Instance of ruby.dll */ 249 static HINSTANCE hinstRuby = 0; /* Instance of ruby.dll */
201 250
202 /* 251 /*
250 {"rb_str2cstr", (RUBY_PROC*)&dll_rb_str2cstr}, 299 {"rb_str2cstr", (RUBY_PROC*)&dll_rb_str2cstr},
251 {"rb_str_cat", (RUBY_PROC*)&dll_rb_str_cat}, 300 {"rb_str_cat", (RUBY_PROC*)&dll_rb_str_cat},
252 {"rb_str_concat", (RUBY_PROC*)&dll_rb_str_concat}, 301 {"rb_str_concat", (RUBY_PROC*)&dll_rb_str_concat},
253 {"rb_str_new", (RUBY_PROC*)&dll_rb_str_new}, 302 {"rb_str_new", (RUBY_PROC*)&dll_rb_str_new},
254 {"rb_str_new2", (RUBY_PROC*)&dll_rb_str_new2}, 303 {"rb_str_new2", (RUBY_PROC*)&dll_rb_str_new2},
304 #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
305 {"rb_errinfo", (RUBY_PROC*)&dll_rb_errinfo},
306 #else
255 {"ruby_errinfo", (RUBY_PROC*)&dll_ruby_errinfo}, 307 {"ruby_errinfo", (RUBY_PROC*)&dll_ruby_errinfo},
308 #endif
256 {"ruby_init", (RUBY_PROC*)&dll_ruby_init}, 309 {"ruby_init", (RUBY_PROC*)&dll_ruby_init},
257 {"ruby_init_loadpath", (RUBY_PROC*)&dll_ruby_init_loadpath}, 310 {"ruby_init_loadpath", (RUBY_PROC*)&dll_ruby_init_loadpath},
258 {"NtInitialize", (RUBY_PROC*)&dll_NtInitialize}, 311 {"NtInitialize", (RUBY_PROC*)&dll_NtInitialize},
259 #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18 312 #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
260 {"rb_w32_snprintf", (RUBY_PROC*)&dll_rb_w32_snprintf}, 313 {"rb_w32_snprintf", (RUBY_PROC*)&dll_rb_w32_snprintf},
314 #endif
315 #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
316 {"ruby_script", (RUBY_PROC*)&dll_ruby_script},
317 {"rb_enc_find_index", (RUBY_PROC*)&dll_rb_enc_find_index},
318 {"rb_enc_find", (RUBY_PROC*)&dll_rb_enc_find},
319 {"rb_enc_str_new", (RUBY_PROC*)&dll_rb_enc_str_new},
320 {"rb_sprintf", (RUBY_PROC*)&dll_rb_sprintf},
261 #endif 321 #endif
262 {"", NULL}, 322 {"", NULL},
263 }; 323 };
264 324
265 /* 325 /*
346 error_print(state); 406 error_print(state);
347 } 407 }
348 vim_free(script); 408 vim_free(script);
349 } 409 }
350 410
411 /*
412 * In Ruby 1.9 or later, ruby String object has encoding.
413 * conversion buffer string of vim to ruby String object using
414 * VIM encoding option.
415 */
416 static VALUE
417 vim_str2rb_enc_str(const char *s)
418 {
419 #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
420 int isnum;
421 long lval;
422 char_u *sval;
423 rb_encoding *enc;
424
425 isnum = get_option_value((char_u *)"enc", &lval, &sval, 0);
426 if (isnum == 0)
427 {
428 enc = rb_enc_find((char *)sval);
429 vim_free(sval);
430 if (enc) {
431 return rb_enc_str_new(s, strlen(s), enc);
432 }
433 }
434 #endif
435 return rb_str_new2(s);
436 }
437
438 static VALUE
439 eval_enc_string_protect(const char *str, int *state)
440 {
441 #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
442 int isnum;
443 long lval;
444 char_u *sval;
445 rb_encoding *enc;
446 VALUE v;
447
448 isnum = get_option_value((char_u *)"enc", &lval, &sval, 0);
449 if (isnum == 0)
450 {
451 enc = rb_enc_find((char *)sval);
452 vim_free(sval);
453 if (enc)
454 {
455 v = rb_sprintf("#-*- coding:%s -*-\n%s", rb_enc_name(enc), str);
456 return rb_eval_string_protect(StringValuePtr(v), state);
457 }
458 }
459 #endif
460 return rb_eval_string_protect(str, state);
461 }
462
351 void ex_rubydo(exarg_T *eap) 463 void ex_rubydo(exarg_T *eap)
352 { 464 {
353 int state; 465 int state;
354 linenr_T i; 466 linenr_T i;
355 467
358 if (u_save(eap->line1 - 1, eap->line2 + 1) != OK) 470 if (u_save(eap->line1 - 1, eap->line2 + 1) != OK)
359 return; 471 return;
360 for (i = eap->line1; i <= eap->line2; i++) { 472 for (i = eap->line1; i <= eap->line2; i++) {
361 VALUE line, oldline; 473 VALUE line, oldline;
362 474
363 line = oldline = rb_str_new2((char *)ml_get(i)); 475 line = oldline = vim_str2rb_enc_str((char *)ml_get(i));
364 rb_lastline_set(line); 476 rb_lastline_set(line);
365 rb_eval_string_protect((char *) eap->arg, &state); 477 eval_enc_string_protect((char *) eap->arg, &state);
366 if (state) { 478 if (state) {
367 error_print(state); 479 error_print(state);
368 break; 480 break;
369 } 481 }
370 line = rb_lastline_get(); 482 line = rb_lastline_get();
371 if (!NIL_P(line)) { 483 if (!NIL_P(line)) {
372 if (TYPE(line) != T_STRING) { 484 if (TYPE(line) != T_STRING) {
373 EMSG(_("E265: $_ must be an instance of String")); 485 EMSG(_("E265: $_ must be an instance of String"));
374 return; 486 return;
375 } 487 }
376 ml_replace(i, (char_u *) STR2CSTR(line), 1); 488 ml_replace(i, (char_u *) StringValuePtr(line), 1);
377 changed(); 489 changed();
378 #ifdef SYNTAX_HL 490 #ifdef SYNTAX_HL
379 syn_changed(i); /* recompute syntax hl. for this line */ 491 syn_changed(i); /* recompute syntax hl. for this line */
380 #endif 492 #endif
381 } 493 }
426 /* suggested by Ariya Mizutani */ 538 /* suggested by Ariya Mizutani */
427 int argc = 1; 539 int argc = 1;
428 char *argv[] = {"gvim.exe"}; 540 char *argv[] = {"gvim.exe"};
429 NtInitialize(&argc, &argv); 541 NtInitialize(&argc, &argv);
430 #endif 542 #endif
543 #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
544 RUBY_INIT_STACK;
545 #endif
431 ruby_init(); 546 ruby_init();
547 #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
548 ruby_script("vim-ruby");
549 #endif
432 ruby_init_loadpath(); 550 ruby_init_loadpath();
433 ruby_io_init(); 551 ruby_io_init();
552 #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
553 rb_enc_find_index("encdb");
554 #endif
434 ruby_vim_init(); 555 ruby_vim_init();
435 ruby_initialized = 1; 556 ruby_initialized = 1;
436 #ifdef DYNAMIC_RUBY 557 #ifdef DYNAMIC_RUBY
437 } 558 }
438 else 559 else
446 } 567 }
447 568
448 static void error_print(int state) 569 static void error_print(int state)
449 { 570 {
450 #ifndef DYNAMIC_RUBY 571 #ifndef DYNAMIC_RUBY
572 #if !(defined(RUBY_VERSION) && RUBY_VERSION >= 19)
451 RUBYEXTERN VALUE ruby_errinfo; 573 RUBYEXTERN VALUE ruby_errinfo;
574 #endif
452 #endif 575 #endif
453 VALUE eclass; 576 VALUE eclass;
454 VALUE einfo; 577 VALUE einfo;
455 char buff[BUFSIZ]; 578 char buff[BUFSIZ];
456 579
480 case TAG_RETRY: 603 case TAG_RETRY:
481 EMSG(_("E271: retry outside of rescue clause")); 604 EMSG(_("E271: retry outside of rescue clause"));
482 break; 605 break;
483 case TAG_RAISE: 606 case TAG_RAISE:
484 case TAG_FATAL: 607 case TAG_FATAL:
608 #if defined(RUBY_VERSION) && RUBY_VERSION >= 19
609 eclass = CLASS_OF(rb_errinfo());
610 einfo = rb_obj_as_string(rb_errinfo());
611 #else
485 eclass = CLASS_OF(ruby_errinfo); 612 eclass = CLASS_OF(ruby_errinfo);
486 einfo = rb_obj_as_string(ruby_errinfo); 613 einfo = rb_obj_as_string(ruby_errinfo);
487 if (eclass == rb_eRuntimeError && RSTRING(einfo)->len == 0) { 614 #endif
615 if (eclass == rb_eRuntimeError && RSTRING_LEN(einfo) == 0) {
488 EMSG(_("E272: unhandled exception")); 616 EMSG(_("E272: unhandled exception"));
489 } 617 }
490 else { 618 else {
491 VALUE epath; 619 VALUE epath;
492 char *p; 620 char *p;
493 621
494 epath = rb_class_path(eclass); 622 epath = rb_class_path(eclass);
495 vim_snprintf(buff, BUFSIZ, "%s: %s", 623 vim_snprintf(buff, BUFSIZ, "%s: %s",
496 RSTRING(epath)->ptr, RSTRING(einfo)->ptr); 624 RSTRING_PTR(epath), RSTRING_PTR(einfo));
497 p = strchr(buff, '\n'); 625 p = strchr(buff, '\n');
498 if (p) *p = '\0'; 626 if (p) *p = '\0';
499 EMSG(buff); 627 EMSG(buff);
500 } 628 }
501 break; 629 break;
509 static VALUE vim_message(VALUE self UNUSED, VALUE str) 637 static VALUE vim_message(VALUE self UNUSED, VALUE str)
510 { 638 {
511 char *buff, *p; 639 char *buff, *p;
512 640
513 str = rb_obj_as_string(str); 641 str = rb_obj_as_string(str);
514 buff = ALLOCA_N(char, RSTRING(str)->len); 642 buff = ALLOCA_N(char, RSTRING_LEN(str));
515 strcpy(buff, RSTRING(str)->ptr); 643 strcpy(buff, RSTRING_PTR(str));
516 p = strchr(buff, '\n'); 644 p = strchr(buff, '\n');
517 if (p) *p = '\0'; 645 if (p) *p = '\0';
518 MSG(buff); 646 MSG(buff);
519 return Qnil; 647 return Qnil;
520 } 648 }
521 649
522 static VALUE vim_set_option(VALUE self UNUSED, VALUE str) 650 static VALUE vim_set_option(VALUE self UNUSED, VALUE str)
523 { 651 {
524 do_set((char_u *)STR2CSTR(str), 0); 652 do_set((char_u *)StringValuePtr(str), 0);
525 update_screen(NOT_VALID); 653 update_screen(NOT_VALID);
526 return Qnil; 654 return Qnil;
527 } 655 }
528 656
529 static VALUE vim_command(VALUE self UNUSED, VALUE str) 657 static VALUE vim_command(VALUE self UNUSED, VALUE str)
530 { 658 {
531 do_cmdline_cmd((char_u *)STR2CSTR(str)); 659 do_cmdline_cmd((char_u *)StringValuePtr(str));
532 return Qnil; 660 return Qnil;
533 } 661 }
534 662
535 static VALUE vim_evaluate(VALUE self UNUSED, VALUE str) 663 static VALUE vim_evaluate(VALUE self UNUSED, VALUE str)
536 { 664 {
537 #ifdef FEAT_EVAL 665 #ifdef FEAT_EVAL
538 char_u *value = eval_to_string((char_u *)STR2CSTR(str), NULL, TRUE); 666 char_u *value = eval_to_string((char_u *)StringValuePtr(str), NULL, TRUE);
539 667
540 if (value != NULL) 668 if (value != NULL)
541 { 669 {
542 VALUE val = rb_str_new2((char *)value); 670 VALUE val = rb_str_new2((char *)value);
543 vim_free(value); 671 vim_free(value);
638 static VALUE get_buffer_line(buf_T *buf, linenr_T n) 766 static VALUE get_buffer_line(buf_T *buf, linenr_T n)
639 { 767 {
640 if (n > 0 && n <= buf->b_ml.ml_line_count) 768 if (n > 0 && n <= buf->b_ml.ml_line_count)
641 { 769 {
642 char *line = (char *)ml_get_buf(buf, n, FALSE); 770 char *line = (char *)ml_get_buf(buf, n, FALSE);
643 return line ? rb_str_new2(line) : Qnil; 771 return line ? vim_str2rb_enc_str(line) : Qnil;
644 } 772 }
645 rb_raise(rb_eIndexError, "index %d out of buffer", n); 773 rb_raise(rb_eIndexError, "line number %ld out of range", (long)n);
646 #ifndef __GNUC__ 774 #ifndef __GNUC__
647 return Qnil; /* For stop warning */ 775 return Qnil; /* For stop warning */
648 #endif 776 #endif
649 } 777 }
650 778
657 return Qnil; /* For stop warning */ 785 return Qnil; /* For stop warning */
658 } 786 }
659 787
660 static VALUE set_buffer_line(buf_T *buf, linenr_T n, VALUE str) 788 static VALUE set_buffer_line(buf_T *buf, linenr_T n, VALUE str)
661 { 789 {
662 char *line = STR2CSTR(str); 790 char *line = StringValuePtr(str);
663 aco_save_T aco; 791 aco_save_T aco;
664 792
665 if (n > 0 && n <= buf->b_ml.ml_line_count && line != NULL) 793 if (n > 0 && n <= buf->b_ml.ml_line_count && line != NULL)
666 { 794 {
667 /* set curwin/curbuf for "buf" and save some things */ 795 /* set curwin/curbuf for "buf" and save some things */
681 809
682 update_curbuf(NOT_VALID); 810 update_curbuf(NOT_VALID);
683 } 811 }
684 else 812 else
685 { 813 {
686 rb_raise(rb_eIndexError, "index %d out of buffer", n); 814 rb_raise(rb_eIndexError, "line number %ld out of range", (long)n);
687 #ifndef __GNUC__ 815 #ifndef __GNUC__
688 return Qnil; /* For stop warning */ 816 return Qnil; /* For stop warning */
689 #endif 817 #endif
690 } 818 }
691 return str; 819 return str;
727 855
728 update_curbuf(NOT_VALID); 856 update_curbuf(NOT_VALID);
729 } 857 }
730 else 858 else
731 { 859 {
732 rb_raise(rb_eIndexError, "index %d out of buffer", n); 860 rb_raise(rb_eIndexError, "line number %ld out of range", n);
733 } 861 }
734 return Qnil; 862 return Qnil;
735 } 863 }
736 864
737 static VALUE buffer_append(VALUE self, VALUE num, VALUE str) 865 static VALUE buffer_append(VALUE self, VALUE num, VALUE str)
738 { 866 {
739 buf_T *buf = get_buf(self); 867 buf_T *buf = get_buf(self);
740 char *line = STR2CSTR(str); 868 char *line = StringValuePtr(str);
741 long n = NUM2LONG(num); 869 long n = NUM2LONG(num);
742 aco_save_T aco; 870 aco_save_T aco;
743 871
744 if (n >= 0 && n <= buf->b_ml.ml_line_count && line != NULL) 872 if (line != NULL) {
873 rb_raise(rb_eIndexError, "NULL line");
874 }
875 else if (n >= 0 && n <= buf->b_ml.ml_line_count)
745 { 876 {
746 /* set curwin/curbuf for "buf" and save some things */ 877 /* set curwin/curbuf for "buf" and save some things */
747 aucmd_prepbuf(&aco, buf); 878 aucmd_prepbuf(&aco, buf);
748 879
749 if (u_inssub(n + 1) == OK) { 880 if (u_inssub(n + 1) == OK) {
761 /* Careful: autocommands may have made "buf" invalid! */ 892 /* Careful: autocommands may have made "buf" invalid! */
762 893
763 update_curbuf(NOT_VALID); 894 update_curbuf(NOT_VALID);
764 } 895 }
765 else { 896 else {
766 rb_raise(rb_eIndexError, "index %d out of buffer", n); 897 rb_raise(rb_eIndexError, "line number %ld out of range", n);
767 } 898 }
768 return str; 899 return str;
769 } 900 }
770 901
771 static VALUE window_new(win_T *win) 902 static VALUE window_new(win_T *win)
902 { 1033 {
903 VALUE lnum, col; 1034 VALUE lnum, col;
904 win_T *win = get_win(self); 1035 win_T *win = get_win(self);
905 1036
906 Check_Type(pos, T_ARRAY); 1037 Check_Type(pos, T_ARRAY);
907 if (RARRAY(pos)->len != 2) 1038 if (RARRAY_LEN(pos) != 2)
908 rb_raise(rb_eArgError, "array length must be 2"); 1039 rb_raise(rb_eArgError, "array length must be 2");
909 lnum = RARRAY(pos)->ptr[0]; 1040 lnum = RARRAY_PTR(pos)[0];
910 col = RARRAY(pos)->ptr[1]; 1041 col = RARRAY_PTR(pos)[1];
911 win->w_cursor.lnum = NUM2LONG(lnum); 1042 win->w_cursor.lnum = NUM2LONG(lnum);
912 win->w_cursor.col = NUM2UINT(col); 1043 win->w_cursor.col = NUM2UINT(col);
913 check_cursor(); /* put cursor on an existing line */ 1044 check_cursor(); /* put cursor on an existing line */
914 update_screen(NOT_VALID); 1045 update_screen(NOT_VALID);
915 return Qnil; 1046 return Qnil;
922 1053
923 for (i = 0; i < argc; i++) { 1054 for (i = 0; i < argc; i++) {
924 if (i > 0) rb_str_cat(str, ", ", 2); 1055 if (i > 0) rb_str_cat(str, ", ", 2);
925 rb_str_concat(str, rb_inspect(argv[i])); 1056 rb_str_concat(str, rb_inspect(argv[i]));
926 } 1057 }
927 MSG(RSTRING(str)->ptr); 1058 MSG(RSTRING_PTR(str));
928 return Qnil; 1059 return Qnil;
929 } 1060 }
930 1061
931 static void ruby_io_init(void) 1062 static void ruby_io_init(void)
932 { 1063 {