--- src/if_ruby.c 2007-09-10 05:40:38.000000000 -0300 +++ src/if_ruby.new 2009-02-18 12:46:25.371757534 -0300 @@ -26,6 +26,7 @@ # define RUBYEXTERN extern #endif +#define HAVE_STRUCT_TIMESPEC /* * This is tricky. In ruby.h there is (inline) function rb_class_of() * definition. This function use these variables. But we want function to @@ -129,7 +130,8 @@ #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 rb_errinfo dll_rb_errinfo +#define ruby_init_stack dll_ruby_init_stack #define ruby_init dll_ruby_init #define ruby_init_loadpath dll_ruby_init_loadpath #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18 @@ -183,7 +185,8 @@ 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*); -static VALUE *dll_ruby_errinfo; +static VALUE (*dll_rb_errinfo) (void); +static void (*dll_ruby_init_stack) (void); static void (*dll_ruby_init) (void); static void (*dll_ruby_init_loadpath) (void); #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18 @@ -245,7 +248,8 @@ {"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}, - {"ruby_errinfo", (RUBY_PROC*)&dll_ruby_errinfo}, + {"rb_errinfo", (RUBY_PROC*)&dll_rb_errinfo}, + {"ruby_init_stack", (RUBY_PROC*)&dll_ruby_init_stack}, {"ruby_init", (RUBY_PROC*)&dll_ruby_init}, {"ruby_init_loadpath", (RUBY_PROC*)&dll_ruby_init_loadpath}, #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18 @@ -413,7 +417,8 @@ #ifdef DYNAMIC_RUBY if (ruby_enabled(TRUE)) { -#endif +#endif + RUBY_INIT_STACK ruby_init(); ruby_init_loadpath(); ruby_io_init(); @@ -433,9 +438,6 @@ static void error_print(int state) { -#ifndef DYNAMIC_RUBY - RUBYEXTERN VALUE ruby_errinfo; -#endif VALUE eclass; VALUE einfo; char buff[BUFSIZ]; @@ -468,9 +470,9 @@ 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) { + eclass = CLASS_OF(rb_errinfo()); + einfo = rb_obj_as_string(rb_errinfo()); + if (eclass == rb_eRuntimeError && RSTRING_LEN(einfo) == 0) { EMSG(_("E272: unhandled exception")); } else { @@ -479,7 +481,7 @@ epath = rb_class_path(eclass); vim_snprintf(buff, BUFSIZ, "%s: %s", - RSTRING(epath)->ptr, RSTRING(einfo)->ptr); + RSTRING_PTR(epath), RSTRING_PTR(einfo)); p = strchr(buff, '\n'); if (p) *p = '\0'; EMSG(buff); @@ -497,8 +499,8 @@ char *buff, *p; str = rb_obj_as_string(str); - buff = ALLOCA_N(char, RSTRING(str)->len); - strcpy(buff, RSTRING(str)->ptr); + buff = ALLOCA_N(char, RSTRING_LEN(str)); + strcpy(buff, RSTRING_PTR(str)); p = strchr(buff, '\n'); if (p) *p = '\0'; MSG(buff); @@ -886,10 +888,10 @@ win_T *win = get_win(self); Check_Type(pos, T_ARRAY); - if (RARRAY(pos)->len != 2) + if (RARRAY_LEN(pos) != 2) rb_raise(rb_eArgError, "array length must be 2"); - lnum = RARRAY(pos)->ptr[0]; - col = RARRAY(pos)->ptr[1]; + 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 */ @@ -906,7 +908,7 @@ if (i > 0) rb_str_cat(str, ", ", 2); rb_str_concat(str, rb_inspect(argv[i])); } - MSG(RSTRING(str)->ptr); + MSG(RSTRING_PTR(str)); return Qnil; }