Patch 9.0.0546

5 views
Skip to first unread message

Bram Moolenaar

unread,
Sep 22, 2022, 11:12:49 AM9/22/22
to vim...@googlegroups.com

Patch 9.0.0546
Problem: Supporting Ruby 1.8 makes code complicated.
Solution: Drop Ruby 1.8 support, it is ancient. (Ken Takata, closes #11195)
Files: src/Make_cyg_ming.mak, src/Make_mvc.mak, src/auto/configure,
src/configure.ac, src/if_ruby.c


*** ../vim-9.0.0545/src/Make_cyg_ming.mak 2022-09-18 12:24:30.542430902 +0100
--- src/Make_cyg_ming.mak 2022-09-22 16:07:28.473952757 +0100
***************
*** 441,447 ****
# RUBY=[Path to Ruby directory] (Set inside Make_cyg.mak or Make_ming.mak)
# DYNAMIC_RUBY=yes (to load the Ruby DLL dynamically, "no" for static)
# RUBY_VER=[Ruby version, eg 19, 22] (default is 22)
! # RUBY_API_VER_LONG=[Ruby API version, eg 1.8, 1.9.1, 2.2.0]
# (default is 2.2.0)
# You must set RUBY_API_VER_LONG when changing RUBY_VER.
# Note: If you use Ruby 1.9.3, set as follows:
--- 441,447 ----
# RUBY=[Path to Ruby directory] (Set inside Make_cyg.mak or Make_ming.mak)
# DYNAMIC_RUBY=yes (to load the Ruby DLL dynamically, "no" for static)
# RUBY_VER=[Ruby version, eg 19, 22] (default is 22)
! # RUBY_API_VER_LONG=[Ruby API version, eg 1.9.1, 2.2.0]
# (default is 2.2.0)
# You must set RUBY_API_VER_LONG when changing RUBY_VER.
# Note: If you use Ruby 1.9.3, set as follows:
***************
*** 466,474 ****
endif

ifndef RUBY_PLATFORM
! ifeq ($(RUBY_VER), 16)
! RUBY_PLATFORM = i586-mswin32
! else ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_API_VER_LONG)/i386-mingw32),)
RUBY_PLATFORM = i386-mingw32
else ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_API_VER_LONG)/x64-mingw32),)
RUBY_PLATFORM = x64-mingw32
--- 466,472 ----
endif

ifndef RUBY_PLATFORM
! ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_API_VER_LONG)/i386-mingw32),)
RUBY_PLATFORM = i386-mingw32
else ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_API_VER_LONG)/x64-mingw32),)
RUBY_PLATFORM = x64-mingw32
***************
*** 480,511 ****
endif

ifndef RUBY_INSTALL_NAME
! ifeq ($(RUBY_VER), 16)
! RUBY_INSTALL_NAME = mswin32-ruby$(RUBY_API_VER)
! else
! ifndef RUBY_MSVCRT_NAME
# Base name of msvcrXX.dll which is used by ruby's dll.
RUBY_MSVCRT_NAME = msvcrt
! endif
! ifeq ($(RUBY_PLATFORM),x64-mingw-ucrt)
RUBY_INSTALL_NAME = x64-ucrt-ruby$(RUBY_API_VER)
! else ifeq ($(ARCH),x86-64)
RUBY_INSTALL_NAME = x64-$(RUBY_MSVCRT_NAME)-ruby$(RUBY_API_VER)
! else
RUBY_INSTALL_NAME = $(RUBY_MSVCRT_NAME)-ruby$(RUBY_API_VER)
- endif
endif
endif

- ifeq (19, $(word 1,$(sort 19 $(RUBY_VER))))
- RUBY_19_OR_LATER = 1
- endif
-
- ifdef RUBY_19_OR_LATER
RUBYINC = -I $(RUBY)/include/ruby-$(RUBY_API_VER_LONG) -I $(RUBY)/include/ruby-$(RUBY_API_VER_LONG)/$(RUBY_PLATFORM)
- else
- RUBYINC = -I $(RUBY)/lib/ruby/$(RUBY_API_VER_LONG)/$(RUBY_PLATFORM)
- endif
ifeq (no, $(DYNAMIC_RUBY))
RUBYLIB = -L$(RUBY)/lib -l$(RUBY_INSTALL_NAME)
endif
--- 478,497 ----
endif

ifndef RUBY_INSTALL_NAME
! ifndef RUBY_MSVCRT_NAME
# Base name of msvcrXX.dll which is used by ruby's dll.
RUBY_MSVCRT_NAME = msvcrt
! endif
! ifeq ($(RUBY_PLATFORM),x64-mingw-ucrt)
RUBY_INSTALL_NAME = x64-ucrt-ruby$(RUBY_API_VER)
! else ifeq ($(ARCH),x86-64)
RUBY_INSTALL_NAME = x64-$(RUBY_MSVCRT_NAME)-ruby$(RUBY_API_VER)
! else
RUBY_INSTALL_NAME = $(RUBY_MSVCRT_NAME)-ruby$(RUBY_API_VER)
endif
endif

RUBYINC = -I $(RUBY)/include/ruby-$(RUBY_API_VER_LONG) -I $(RUBY)/include/ruby-$(RUBY_API_VER_LONG)/$(RUBY_PLATFORM)
ifeq (no, $(DYNAMIC_RUBY))
RUBYLIB = -L$(RUBY)/lib -l$(RUBY_INSTALL_NAME)
endif
*** ../vim-9.0.0545/src/Make_mvc.mak 2022-09-22 13:17:13.622518653 +0100
--- src/Make_mvc.mak 2022-09-22 16:07:28.473952757 +0100
***************
*** 86,92 ****
# RUBY=[Path to Ruby directory]
# DYNAMIC_RUBY=yes (to load the Ruby DLL dynamically)
# RUBY_VER=[Ruby version, eg 19, 22] (default is 22)
! # RUBY_API_VER_LONG=[Ruby API version, eg 1.8, 1.9.1, 2.2.0]
# (default is 2.2.0)
# You must set RUBY_API_VER_LONG when change RUBY_VER.
# Note: If you use Ruby 1.9.3, set as follows:
--- 86,92 ----
# RUBY=[Path to Ruby directory]
# DYNAMIC_RUBY=yes (to load the Ruby DLL dynamically)
# RUBY_VER=[Ruby version, eg 19, 22] (default is 22)
! # RUBY_API_VER_LONG=[Ruby API version, eg 1.9.1, 2.2.0]
# (default is 2.2.0)
# You must set RUBY_API_VER_LONG when change RUBY_VER.
# Note: If you use Ruby 1.9.3, set as follows:
***************
*** 1076,1129 ****
RUBY_API_VER = $(RUBY_API_VER_LONG:.=)
! endif

! ! if $(RUBY_VER) >= 18
!
! ! ifndef RUBY_PLATFORM
! ! if "$(CPU)" == "i386"
RUBY_PLATFORM = i386-mswin32
! ! else # CPU
RUBY_PLATFORM = x64-mswin64
! ! endif # CPU
! ! if $(RUBY_VER) > 19
RUBY_PLATFORM = $(RUBY_PLATFORM)_$(MSVCRT_VER)
! ! endif # RUBY_VER
! ! endif # RUBY_PLATFORM

! ! ifndef RUBY_INSTALL_NAME
! ! ifndef RUBY_MSVCRT_NAME
# Base name of msvcrXX.dll which is used by ruby's dll.
RUBY_MSVCRT_NAME = $(MSVCRT_NAME)
! ! endif # RUBY_MSVCRT_NAME
! ! if "$(CPU)" == "i386"
RUBY_INSTALL_NAME = $(RUBY_MSVCRT_NAME)-ruby$(RUBY_API_VER)
! ! else # CPU
! ! if EXIST($(RUBY)/lib/ruby/$(RUBY_API_VER_LONG)/x64-mingw-ucrt)
RUBY_INSTALL_NAME = x64-ucrt-ruby$(RUBY_API_VER)
! ! else
RUBY_INSTALL_NAME = x64-$(RUBY_MSVCRT_NAME)-ruby$(RUBY_API_VER)
! ! endif
! ! endif # CPU
! ! endif # RUBY_INSTALL_NAME
!
! ! else # $(RUBY_VER) >= 18
!
! ! ifndef RUBY_PLATFORM
! RUBY_PLATFORM = i586-mswin32
! ! endif
! ! ifndef RUBY_INSTALL_NAME
! RUBY_INSTALL_NAME = mswin32-ruby$(RUBY_API_VER)
! ! endif
!
! ! endif # $(RUBY_VER) >= 18

! message Ruby requested (version $(RUBY_VER)) - root dir is "$(RUBY)"
CFLAGS = $(CFLAGS) -DFEAT_RUBY
RUBY_OBJ = $(OUTDIR)\if_ruby.obj
- ! if $(RUBY_VER) >= 19
RUBY_INC = /I "$(RUBY)\include\ruby-$(RUBY_API_VER_LONG)" /I "$(RUBY)\include\ruby-$(RUBY_API_VER_LONG)\$(RUBY_PLATFORM)"
- ! else
- RUBY_INC = /I "$(RUBY)\lib\ruby\$(RUBY_API_VER_LONG)\$(RUBY_PLATFORM)"
- ! endif
RUBY_LIB = $(RUBY)\lib\$(RUBY_INSTALL_NAME).lib
# Do we want to load Ruby dynamically?
! if "$(DYNAMIC_RUBY)" == "yes"
--- 1076,1110 ----
RUBY_API_VER = $(RUBY_API_VER_LONG:.=)
! endif

! ! ifndef RUBY_PLATFORM
! ! if "$(CPU)" == "i386"
RUBY_PLATFORM = i386-mswin32
! ! else # CPU
RUBY_PLATFORM = x64-mswin64
! ! endif # CPU
RUBY_PLATFORM = $(RUBY_PLATFORM)_$(MSVCRT_VER)
! ! endif # RUBY_PLATFORM

! ! ifndef RUBY_INSTALL_NAME
! ! ifndef RUBY_MSVCRT_NAME
# Base name of msvcrXX.dll which is used by ruby's dll.
RUBY_MSVCRT_NAME = $(MSVCRT_NAME)
! ! endif # RUBY_MSVCRT_NAME
! ! if "$(CPU)" == "i386"
RUBY_INSTALL_NAME = $(RUBY_MSVCRT_NAME)-ruby$(RUBY_API_VER)
! ! else # CPU
! ! if EXIST($(RUBY)/lib/ruby/$(RUBY_API_VER_LONG)/x64-mingw-ucrt)
RUBY_INSTALL_NAME = x64-ucrt-ruby$(RUBY_API_VER)
! ! else
RUBY_INSTALL_NAME = x64-$(RUBY_MSVCRT_NAME)-ruby$(RUBY_API_VER)
! ! endif
! ! endif # CPU
! ! endif # RUBY_INSTALL_NAME

! message Ruby requested (version $(RUBY_VER)) - root dir is "$(RUBY)"
CFLAGS = $(CFLAGS) -DFEAT_RUBY
RUBY_OBJ = $(OUTDIR)\if_ruby.obj
RUBY_INC = /I "$(RUBY)\include\ruby-$(RUBY_API_VER_LONG)" /I "$(RUBY)\include\ruby-$(RUBY_API_VER_LONG)\$(RUBY_PLATFORM)"
RUBY_LIB = $(RUBY)\lib\$(RUBY_INSTALL_NAME).lib
# Do we want to load Ruby dynamically?
! if "$(DYNAMIC_RUBY)" == "yes"
*** ../vim-9.0.0545/src/auto/configure 2022-09-17 21:07:52.091993174 +0100
--- src/auto/configure 2022-09-22 16:08:56.689664652 +0100
***************
*** 7639,7645 ****
if test "X$vi_cv_path_ruby" != "X"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking Ruby version" >&5
$as_echo_n "checking Ruby version... " >&6; }
! if $vi_cv_path_ruby -e '(VERSION rescue RUBY_VERSION) >= "1.6.0" or exit 1' >/dev/null 2>/dev/null; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: OK" >&5
$as_echo "OK" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking Ruby rbconfig" >&5
--- 7639,7645 ----
if test "X$vi_cv_path_ruby" != "X"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking Ruby version" >&5
$as_echo_n "checking Ruby version... " >&6; }
! if $vi_cv_path_ruby -e 'RUBY_VERSION >= "1.9.1" or exit 1' >/dev/null 2>/dev/null; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: OK" >&5
$as_echo "OK" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking Ruby rbconfig" >&5
***************
*** 7663,7669 ****
fi
rubyversion=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig::CONFIG['ruby_version'].gsub(/\./, '')[0,2]"`
if test "X$rubyversion" = "X"; then
! rubyversion=`$vi_cv_path_ruby -e "print ((VERSION rescue RUBY_VERSION)).gsub(/\./, '')[0,2]"`
fi
RUBY_CFLAGS="$RUBY_CFLAGS -DRUBY_VERSION=$rubyversion"
rubylibs=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig::CONFIG['LIBS']"`
--- 7663,7669 ----
fi
rubyversion=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig::CONFIG['ruby_version'].gsub(/\./, '')[0,2]"`
if test "X$rubyversion" = "X"; then
! rubyversion=`$vi_cv_path_ruby -e "print RUBY_VERSION.gsub(/\./, '')[0,2]"`
fi
RUBY_CFLAGS="$RUBY_CFLAGS -DRUBY_VERSION=$rubyversion"
rubylibs=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig::CONFIG['LIBS']"`
***************
*** 7715,7722 ****
$as_echo "not found; disabling Ruby" >&6; }
fi
else
! { $as_echo "$as_me:${as_lineno-$LINENO}: result: too old; need Ruby version 1.6.0 or later" >&5
! $as_echo "too old; need Ruby version 1.6.0 or later" >&6; }
fi
fi

--- 7715,7722 ----
$as_echo "not found; disabling Ruby" >&6; }
fi
else
! { $as_echo "$as_me:${as_lineno-$LINENO}: result: too old; need Ruby version 1.9.1 or later" >&5
! $as_echo "too old; need Ruby version 1.9.1 or later" >&6; }
fi
fi

*** ../vim-9.0.0545/src/configure.ac 2022-09-17 21:07:52.091993174 +0100
--- src/configure.ac 2022-09-22 16:07:28.477952746 +0100
***************
*** 1990,1996 ****
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 rbconfig)
ruby_rbconfig="RbConfig"
--- 1990,1996 ----
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 'RUBY_VERSION >= "1.9.1" or exit 1' >/dev/null 2>/dev/null; then
AC_MSG_RESULT(OK)
AC_MSG_CHECKING(Ruby rbconfig)
ruby_rbconfig="RbConfig"
***************
*** 2009,2015 ****
fi
rubyversion=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig::CONFIG[['ruby_version']].gsub(/\./, '')[[0,2]]"`
if test "X$rubyversion" = "X"; then
! rubyversion=`$vi_cv_path_ruby -e "print ((VERSION rescue RUBY_VERSION)).gsub(/\./, '')[[0,2]]"`
fi
RUBY_CFLAGS="$RUBY_CFLAGS -DRUBY_VERSION=$rubyversion"
rubylibs=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig::CONFIG[['LIBS']]"`
--- 2009,2015 ----
fi
rubyversion=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig::CONFIG[['ruby_version']].gsub(/\./, '')[[0,2]]"`
if test "X$rubyversion" = "X"; then
! rubyversion=`$vi_cv_path_ruby -e "print RUBY_VERSION.gsub(/\./, '')[[0,2]]"`
fi
RUBY_CFLAGS="$RUBY_CFLAGS -DRUBY_VERSION=$rubyversion"
rubylibs=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig::CONFIG[['LIBS']]"`
***************
*** 2062,2068 ****
AC_MSG_RESULT(not found; disabling Ruby)
fi
else
! AC_MSG_RESULT(too old; need Ruby version 1.6.0 or later)
fi
fi

--- 2062,2068 ----
AC_MSG_RESULT(not found; disabling Ruby)
fi
else
! AC_MSG_RESULT(too old; need Ruby version 1.9.1 or later)
fi
fi

*** ../vim-9.0.0545/src/if_ruby.c 2022-09-17 21:07:52.099993159 +0100
--- src/if_ruby.c 2022-09-22 16:07:28.477952746 +0100
***************
*** 20,29 ****
#include <string.h>

#ifdef _WIN32
- # if !defined(DYNAMIC_RUBY) || (RUBY_VERSION < 18)
- # define NT
- # endif
# ifndef DYNAMIC_RUBY
# define IMPORT // For static dll usage __declspec(dllimport)
# define RUBYEXTERN __declspec(dllimport)
# endif
--- 20,27 ----
#include <string.h>

#ifdef _WIN32
# ifndef DYNAMIC_RUBY
+ # define NT
# define IMPORT // For static dll usage __declspec(dllimport)
# define RUBYEXTERN __declspec(dllimport)
# endif
***************
*** 55,82 ****
# define rb_cSymbol (*dll_rb_cSymbol)
# define rb_cTrueClass (*dll_rb_cTrueClass)

- # if RUBY_VERSION >= 18
/*
! * On ver 1.8, all Ruby functions are exported with "__declspec(dllimport)"
! * in ruby.h. But it causes trouble for these variables, because it is
! * defined in this file. When defined this RUBY_EXPORT it modified to
! * "extern" and be able to avoid this problem.
*/
! # define RUBY_EXPORT
! # endif

- # if RUBY_VERSION >= 19
// Ruby 1.9 defines a number of static functions which use rb_num2long and
// rb_int2big
! # define rb_num2long rb_num2long_stub
! # define rb_int2big rb_int2big_stub

! # if RUBY_VERSION >= 30 || VIM_SIZEOF_INT < VIM_SIZEOF_LONG
// Ruby 1.9 defines a number of static functions which use rb_fix2int and
// rb_num2int if VIM_SIZEOF_INT < VIM_SIZEOF_LONG (64bit)
! # define rb_fix2int rb_fix2int_stub
! # define rb_num2int rb_num2int_stub
! # endif
# endif

# if RUBY_VERSION == 21
--- 53,76 ----
# define rb_cSymbol (*dll_rb_cSymbol)
# define rb_cTrueClass (*dll_rb_cTrueClass)

/*
! * All Ruby functions are exported with "__declspec(dllimport)" in ruby.h.
! * But it causes trouble for these variables, because it is defined in this
! * file. When defined this RUBY_EXPORT it modified to "extern" and be able
! * to avoid this problem.
*/
! # define RUBY_EXPORT

// Ruby 1.9 defines a number of static functions which use rb_num2long and
// rb_int2big
! # define rb_num2long rb_num2long_stub
! # define rb_int2big rb_int2big_stub

! # if RUBY_VERSION >= 30 || VIM_SIZEOF_INT < VIM_SIZEOF_LONG
// Ruby 1.9 defines a number of static functions which use rb_fix2int and
// rb_num2int if VIM_SIZEOF_INT < VIM_SIZEOF_LONG (64bit)
! # define rb_fix2int rb_fix2int_stub
! # define rb_num2int rb_num2int_stub
# endif

# if RUBY_VERSION == 21
***************
*** 114,125 ****
#endif

#include <ruby.h>
! #if RUBY_VERSION >= 19
! # include <ruby/encoding.h>
! #endif
! #if RUBY_VERSION <= 18
! # include <st.h> // for ST_STOP and ST_CONTINUE
! #endif

// See above.
#ifdef SIZEOF_TIME_T
--- 108,114 ----
#endif

#include <ruby.h>
! #include <ruby/encoding.h>

// See above.
#ifdef SIZEOF_TIME_T
***************
*** 224,233 ****
static void ruby_vim_init(void);
static int ruby_convert_to_vim_value(VALUE val, typval_T *rettv);

! #if (RUBY_VERSION >= 19) || defined(RUBY_INIT_STACK)
! # if defined(__ia64) && !defined(ruby_init_stack)
! # define ruby_init_stack(addr) ruby_init_stack((addr), rb_ia64_bsp())
! # endif
#endif

#if defined(DYNAMIC_RUBY) || defined(PROTO)
--- 213,220 ----
static void ruby_vim_init(void);
static int ruby_convert_to_vim_value(VALUE val, typval_T *rettv);

! #if defined(__ia64) && !defined(ruby_init_stack)
! # define ruby_init_stack(addr) ruby_init_stack((addr), rb_ia64_bsp())
#endif

#if defined(DYNAMIC_RUBY) || defined(PROTO)
***************
*** 298,307 ****
# define rb_intern dll_rb_intern

# if VIM_SIZEOF_INT < VIM_SIZEOF_LONG // 64 bits only
- # if RUBY_VERSION <= 18
- # define rb_fix2int dll_rb_fix2int
- # define rb_num2int dll_rb_num2int
- # endif
# if RUBY_VERSION < 30
# define rb_num2uint dll_rb_num2uint
# endif
--- 285,290 ----
***************
*** 311,320 ****
# define rb_lastline_set dll_rb_lastline_set
# define rb_protect dll_rb_protect
# define rb_load dll_rb_load
! # if RUBY_VERSION <= 18
! # define rb_num2long dll_rb_num2long
! # endif
! # if RUBY_VERSION <= 19
# define rb_num2ulong dll_rb_num2ulong
# endif
# define rb_obj_alloc dll_rb_obj_alloc
--- 294,300 ----
# define rb_lastline_set dll_rb_lastline_set
# define rb_protect dll_rb_protect
# define rb_load dll_rb_load
! # if RUBY_VERSION < 20
# define rb_num2ulong dll_rb_num2ulong
# endif
# define rb_obj_alloc dll_rb_obj_alloc
***************
*** 335,391 ****
# else
# define rb_str_new2 dll_rb_str_new2
# endif
! # if RUBY_VERSION >= 18
! # define rb_string_value dll_rb_string_value
! # define rb_string_value_ptr dll_rb_string_value_ptr
! # define rb_float_new dll_rb_float_new
! # define rb_ary_new dll_rb_ary_new
! # ifdef rb_ary_new4
! # define RB_ARY_NEW4_MACRO 1
! # undef rb_ary_new4
! # endif
! # define rb_ary_new4 dll_rb_ary_new4
! # define rb_ary_push dll_rb_ary_push
! # if (RUBY_VERSION >= 19) || defined(RUBY_INIT_STACK)
! # ifdef __ia64
! # define rb_ia64_bsp dll_rb_ia64_bsp
! # undef ruby_init_stack
! # define ruby_init_stack(addr) dll_ruby_init_stack((addr), rb_ia64_bsp())
! # else
! # define ruby_init_stack dll_ruby_init_stack
! # endif
! # endif
! # else
! # define rb_str2cstr dll_rb_str2cstr
! # endif
! # if 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
# ifdef MSWIN
! # if RUBY_VERSION >= 19
! # define ruby_sysinit dll_ruby_sysinit
! # else
! # define NtInitialize dll_NtInitialize
! # endif
! # if RUBY_VERSION >= 18
! # define rb_w32_snprintf dll_rb_w32_snprintf
! # endif
# endif

! # if 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
! # undef rb_enc_str_new
! # define rb_enc_str_new dll_rb_enc_str_new
! # define rb_sprintf dll_rb_sprintf
! # define rb_require dll_rb_require
! # define ruby_options dll_ruby_options
! # endif

/*
* Pointers for dynamic link
--- 315,353 ----
# else
# define rb_str_new2 dll_rb_str_new2
# endif
! # define rb_string_value dll_rb_string_value
! # define rb_string_value_ptr dll_rb_string_value_ptr
! # define rb_float_new dll_rb_float_new
! # define rb_ary_new dll_rb_ary_new
! # ifdef rb_ary_new4
! # define RB_ARY_NEW4_MACRO 1
! # undef rb_ary_new4
! # endif
! # define rb_ary_new4 dll_rb_ary_new4
! # define rb_ary_push dll_rb_ary_push
! # ifdef __ia64
! # define rb_ia64_bsp dll_rb_ia64_bsp
! # undef ruby_init_stack
! # define ruby_init_stack(addr) dll_ruby_init_stack((addr), rb_ia64_bsp())
# else
! # define ruby_init_stack dll_ruby_init_stack
# endif
+ # define rb_errinfo dll_rb_errinfo
# define ruby_init dll_ruby_init
# define ruby_init_loadpath dll_ruby_init_loadpath
# ifdef MSWIN
! # define ruby_sysinit dll_ruby_sysinit
! # define rb_w32_snprintf dll_rb_w32_snprintf
# endif

! # define ruby_script dll_ruby_script
! # define rb_enc_find_index dll_rb_enc_find_index
! # define rb_enc_find dll_rb_enc_find
! # undef rb_enc_str_new
! # define rb_enc_str_new dll_rb_enc_str_new
! # define rb_sprintf dll_rb_sprintf
! # define rb_require dll_rb_require
! # define ruby_options dll_ruby_options

/*
* Pointers for dynamic link
***************
*** 465,475 ****
static VALUE (*dll_rb_obj_as_string) (VALUE);
static VALUE (*dll_rb_obj_id) (VALUE);
static void (*dll_rb_raise) (VALUE, const char*, ...);
- # if RUBY_VERSION >= 18
static VALUE (*dll_rb_string_value) (volatile VALUE*);
- # else
- static char *(*dll_rb_str2cstr) (VALUE,int*);
- # endif
static VALUE (*dll_rb_str_cat) (VALUE, const char*, long);
static VALUE (*dll_rb_str_concat) (VALUE, VALUE);
static VALUE (*dll_rb_str_new) (const char*, long);
--- 427,433 ----
***************
*** 479,500 ****
# else
static VALUE (*dll_rb_str_new2) (const char*);
# endif
- # if 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);
# ifdef MSWIN
- # if RUBY_VERSION >= 19
static void (*dll_ruby_sysinit) (int*, char***);
- # else
- static void (*dll_NtInitialize) (int*, char***);
- # endif
- # if RUBY_VERSION >= 18
static int (*dll_rb_w32_snprintf)(char*, size_t, const char*, ...);
- # endif
# endif
# if RUBY_VERSION >= 31
# ifdef _MSC_VER
--- 437,448 ----
***************
*** 503,531 ****
NORETURN(static void (*dll_rb_unexpected_type) (VALUE, int));
# endif
# endif
- # if RUBY_VERSION >= 18
static char * (*dll_rb_string_value_ptr) (volatile VALUE*);
static VALUE (*dll_rb_float_new) (double);
static VALUE (*dll_rb_ary_new) (void);
static VALUE (*dll_rb_ary_new4) (long n, const VALUE *elts);
static VALUE (*dll_rb_ary_push) (VALUE, VALUE);
! # if RUBY_VERSION >= 26
static void (*dll_rb_ary_detransient) (VALUE);
! # endif
! # if (RUBY_VERSION >= 19) || defined(RUBY_INIT_STACK)
! # ifdef __ia64
static void * (*dll_rb_ia64_bsp) (void);
static void (*dll_ruby_init_stack)(VALUE*, void*);
! # else
static void (*dll_ruby_init_stack)(VALUE*);
- # endif
- # endif
# endif
- # if RUBY_VERSION >= 19
static VALUE (*dll_rb_int2big)(SIGNED_VALUE);
- # endif

- # if 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*);
--- 451,472 ----
NORETURN(static void (*dll_rb_unexpected_type) (VALUE, int));
# endif
# endif
static char * (*dll_rb_string_value_ptr) (volatile VALUE*);
static VALUE (*dll_rb_float_new) (double);
static VALUE (*dll_rb_ary_new) (void);
static VALUE (*dll_rb_ary_new4) (long n, const VALUE *elts);
static VALUE (*dll_rb_ary_push) (VALUE, VALUE);
! # if RUBY_VERSION >= 26
static void (*dll_rb_ary_detransient) (VALUE);
! # endif
! # ifdef __ia64
static void * (*dll_rb_ia64_bsp) (void);
static void (*dll_ruby_init_stack)(VALUE*, void*);
! # else
static void (*dll_ruby_init_stack)(VALUE*);
# endif
static VALUE (*dll_rb_int2big)(SIGNED_VALUE);

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*);
***************
*** 533,539 ****
static VALUE (*dll_rb_sprintf) (const char*, ...);
static VALUE (*dll_rb_require) (const char*);
static void* (*dll_ruby_options)(int, char**);
- # endif

# if defined(USE_RGENGC) && USE_RGENGC
# if RUBY_VERSION == 21
--- 474,479 ----
***************
*** 557,584 ****

// Do not generate a prototype here, VALUE isn't always defined.
# ifndef PROTO
! # if RUBY_VERSION >= 19
! # if RUBY_VERSION >= 22
long
rb_num2long_stub(VALUE x)
! # else
SIGNED_VALUE
rb_num2long_stub(VALUE x)
! # endif
{
return dll_rb_num2long(x);
}
! # if RUBY_VERSION >= 26
VALUE
rb_int2big_stub(intptr_t x)
! # else
VALUE
rb_int2big_stub(SIGNED_VALUE x)
! # endif
{
return dll_rb_int2big(x);
}
! # if RUBY_VERSION >= 30 || VIM_SIZEOF_INT < VIM_SIZEOF_LONG
long
rb_fix2int_stub(VALUE x)
{
--- 497,523 ----

// Do not generate a prototype here, VALUE isn't always defined.
# ifndef PROTO
! # if RUBY_VERSION >= 22
long
rb_num2long_stub(VALUE x)
! # else
SIGNED_VALUE
rb_num2long_stub(VALUE x)
! # endif
{
return dll_rb_num2long(x);
}
! # if RUBY_VERSION >= 26
VALUE
rb_int2big_stub(intptr_t x)
! # else
VALUE
rb_int2big_stub(SIGNED_VALUE x)
! # endif
{
return dll_rb_int2big(x);
}
! # if RUBY_VERSION >= 30 || VIM_SIZEOF_INT < VIM_SIZEOF_LONG
long
rb_fix2int_stub(VALUE x)
{
***************
*** 589,612 ****
{
return dll_rb_num2int(x);
}
! # endif
! # if RUBY_VERSION >= 20
VALUE
rb_float_new_in_heap(double d)
{
return dll_rb_float_new(d);
}
! # if RUBY_VERSION >= 22
unsigned long
rb_num2ulong(VALUE x)
! # else
VALUE
rb_num2ulong(VALUE x)
! # endif
{
return (long)RSHIFT((SIGNED_VALUE)(x),1);
}
- # endif
# endif
# if defined(USE_RGENGC) && USE_RGENGC
# if RUBY_VERSION == 21
--- 528,550 ----
{
return dll_rb_num2int(x);
}
! # endif
! # if RUBY_VERSION >= 20
VALUE
rb_float_new_in_heap(double d)
{
return dll_rb_float_new(d);
}
! # if RUBY_VERSION >= 22
unsigned long
rb_num2ulong(VALUE x)
! # else
VALUE
rb_num2ulong(VALUE x)
! # endif
{
return (long)RSHIFT((SIGNED_VALUE)(x),1);
}
# endif
# if defined(USE_RGENGC) && USE_RGENGC
# if RUBY_VERSION == 21
***************
*** 748,758 ****
{"rb_obj_as_string", (RUBY_PROC*)&dll_rb_obj_as_string},
{"rb_obj_id", (RUBY_PROC*)&dll_rb_obj_id},
{"rb_raise", (RUBY_PROC*)&dll_rb_raise},
- # if RUBY_VERSION >= 18
{"rb_string_value", (RUBY_PROC*)&dll_rb_string_value},
- # else
- {"rb_str2cstr", (RUBY_PROC*)&dll_rb_str2cstr},
- # endif
{"rb_str_cat", (RUBY_PROC*)&dll_rb_str_cat},
{"rb_str_concat", (RUBY_PROC*)&dll_rb_str_concat},
{"rb_str_new", (RUBY_PROC*)&dll_rb_str_new},
--- 686,692 ----
***************
*** 761,805 ****
# else
{"rb_str_new2", (RUBY_PROC*)&dll_rb_str_new2},
# endif
- # if 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},
# ifdef MSWIN
- # if RUBY_VERSION >= 19
{"ruby_sysinit", (RUBY_PROC*)&dll_ruby_sysinit},
- # else
- {"NtInitialize", (RUBY_PROC*)&dll_NtInitialize},
- # endif
- # if RUBY_VERSION >= 18
{"rb_w32_snprintf", (RUBY_PROC*)&dll_rb_w32_snprintf},
- # endif
# endif
# if RUBY_VERSION >= 31
{"rb_unexpected_type", (RUBY_PROC*)&dll_rb_unexpected_type},
# endif
- # if RUBY_VERSION >= 18
{"rb_string_value_ptr", (RUBY_PROC*)&dll_rb_string_value_ptr},
! # if RUBY_VERSION <= 19
! {"rb_float_new", (RUBY_PROC*)&dll_rb_float_new},
! # else
{"rb_float_new_in_heap", (RUBY_PROC*)&dll_rb_float_new},
! # endif
{"rb_ary_new", (RUBY_PROC*)&dll_rb_ary_new},
! # ifdef RB_ARY_NEW4_MACRO
{"rb_ary_new_from_values", (RUBY_PROC*)&dll_rb_ary_new4},
! # else
{"rb_ary_new4", (RUBY_PROC*)&dll_rb_ary_new4},
! # endif
{"rb_ary_push", (RUBY_PROC*)&dll_rb_ary_push},
! # if RUBY_VERSION >= 26
{"rb_ary_detransient", (RUBY_PROC*)&dll_rb_ary_detransient},
- # endif
# endif
- # if RUBY_VERSION >= 19
{"rb_int2big", (RUBY_PROC*)&dll_rb_int2big},
{"ruby_script", (RUBY_PROC*)&dll_ruby_script},
{"rb_enc_find_index", (RUBY_PROC*)&dll_rb_enc_find_index},
--- 695,726 ----
# else
{"rb_str_new2", (RUBY_PROC*)&dll_rb_str_new2},
# endif
{"rb_errinfo", (RUBY_PROC*)&dll_rb_errinfo},
{"ruby_init", (RUBY_PROC*)&dll_ruby_init},
{"ruby_init_loadpath", (RUBY_PROC*)&dll_ruby_init_loadpath},
# ifdef MSWIN
{"ruby_sysinit", (RUBY_PROC*)&dll_ruby_sysinit},
{"rb_w32_snprintf", (RUBY_PROC*)&dll_rb_w32_snprintf},
# endif
# if RUBY_VERSION >= 31
{"rb_unexpected_type", (RUBY_PROC*)&dll_rb_unexpected_type},
# endif
{"rb_string_value_ptr", (RUBY_PROC*)&dll_rb_string_value_ptr},
! # if RUBY_VERSION >= 20
{"rb_float_new_in_heap", (RUBY_PROC*)&dll_rb_float_new},
! # else
! {"rb_float_new", (RUBY_PROC*)&dll_rb_float_new},
! # endif
{"rb_ary_new", (RUBY_PROC*)&dll_rb_ary_new},
! # ifdef RB_ARY_NEW4_MACRO
{"rb_ary_new_from_values", (RUBY_PROC*)&dll_rb_ary_new4},
! # else
{"rb_ary_new4", (RUBY_PROC*)&dll_rb_ary_new4},
! # endif
{"rb_ary_push", (RUBY_PROC*)&dll_rb_ary_push},
! # if RUBY_VERSION >= 26
{"rb_ary_detransient", (RUBY_PROC*)&dll_rb_ary_detransient},
# endif
{"rb_int2big", (RUBY_PROC*)&dll_rb_int2big},
{"ruby_script", (RUBY_PROC*)&dll_ruby_script},
{"rb_enc_find_index", (RUBY_PROC*)&dll_rb_enc_find_index},
***************
*** 808,820 ****
{"rb_sprintf", (RUBY_PROC*)&dll_rb_sprintf},
{"rb_require", (RUBY_PROC*)&dll_rb_require},
{"ruby_options", (RUBY_PROC*)&dll_ruby_options},
! # endif
! # if (RUBY_VERSION >= 19) || defined(RUBY_INIT_STACK)
! # ifdef __ia64
{"rb_ia64_bsp", (RUBY_PROC*)&dll_rb_ia64_bsp},
- # endif
- {"ruby_init_stack", (RUBY_PROC*)&dll_ruby_init_stack},
# endif
# if defined(USE_RGENGC) && USE_RGENGC
# if RUBY_VERSION == 21
{"rb_gc_writebarrier_unprotect_promoted", (RUBY_PROC*)&dll_rb_gc_writebarrier_unprotect_promoted},
--- 729,738 ----
{"rb_sprintf", (RUBY_PROC*)&dll_rb_sprintf},
{"rb_require", (RUBY_PROC*)&dll_rb_require},
{"ruby_options", (RUBY_PROC*)&dll_ruby_options},
! # ifdef __ia64
{"rb_ia64_bsp", (RUBY_PROC*)&dll_rb_ia64_bsp},
# endif
+ {"ruby_init_stack", (RUBY_PROC*)&dll_ruby_init_stack},
# if defined(USE_RGENGC) && USE_RGENGC
# if RUBY_VERSION == 21
{"rb_gc_writebarrier_unprotect_promoted", (RUBY_PROC*)&dll_rb_gc_writebarrier_unprotect_promoted},
***************
*** 906,912 ****
static VALUE
vim_str2rb_enc_str(const char *s)
{
- #if RUBY_VERSION >= 19
long lval;
char_u *sval;
rb_encoding *enc;
--- 824,829 ----
***************
*** 918,931 ****
if (enc)
return rb_enc_str_new(s, (long)strlen(s), enc);
}
- #endif
return rb_str_new2(s);
}

static VALUE
eval_enc_string_protect(const char *str, int *state)
{
- #if RUBY_VERSION >= 19
long lval;
char_u *sval;
rb_encoding *enc;
--- 835,846 ----
***************
*** 941,947 ****
return rb_eval_string_protect(StringValuePtr(v), state);
}
}
- #endif
return rb_eval_string_protect(str, state);
}

--- 856,861 ----
***************
*** 1040,1079 ****
{
#ifdef DYNAMIC_RUBY
if (ruby_enabled(TRUE))
- {
#endif
#ifdef MSWIN
// suggested by Ariya Mizutani
int argc = 1;
char *argv[] = {"gvim.exe"};
char **argvp = argv;
- # if RUBY_VERSION >= 19
ruby_sysinit(&argc, &argvp);
- # else
- NtInitialize(&argc, &argvp);
- # endif
#endif
{
- #if (RUBY_VERSION >= 19) || defined(RUBY_INIT_STACK)
ruby_init_stack(ruby_stack_start);
- #endif
ruby_init();
}
- #if RUBY_VERSION >= 19
{
int dummy_argc = 2;
char *dummy_argv[] = {"vim-ruby", "-e_=0"};
ruby_options(dummy_argc, dummy_argv);
}
ruby_script("vim-ruby");
- #else
- ruby_init_loadpath();
- #endif
ruby_io_init();
ruby_vim_init();
ruby_initialized = 1;
- #ifdef DYNAMIC_RUBY
}
else
{
emsg(_(e_sorry_this_command_is_disabled_the_ruby_library_could_not_be_loaded));
--- 954,983 ----
{
#ifdef DYNAMIC_RUBY
if (ruby_enabled(TRUE))
#endif
+ {
#ifdef MSWIN
// suggested by Ariya Mizutani
int argc = 1;
char *argv[] = {"gvim.exe"};
char **argvp = argv;
ruby_sysinit(&argc, &argvp);
#endif
{
ruby_init_stack(ruby_stack_start);
ruby_init();
}
{
int dummy_argc = 2;
char *dummy_argv[] = {"vim-ruby", "-e_=0"};
ruby_options(dummy_argc, dummy_argv);
}
ruby_script("vim-ruby");
ruby_io_init();
ruby_vim_init();
ruby_initialized = 1;
}
+ #ifdef DYNAMIC_RUBY
else
{
emsg(_(e_sorry_this_command_is_disabled_the_ruby_library_could_not_be_loaded));
***************
*** 1087,1095 ****
static void
error_print(int state)
{
- #if !defined(DYNAMIC_RUBY) && (RUBY_VERSION <= 18)
- RUBYEXTERN VALUE ruby_errinfo;
- #endif
VALUE error;
VALUE eclass;
VALUE einfo;
--- 991,996 ----
***************
*** 1127,1137 ****
break;
case TAG_RAISE:
case TAG_FATAL:
- #if RUBY_VERSION >= 19
error = rb_errinfo();
- #else
- error = ruby_errinfo;
- #endif
eclass = CLASS_OF(error);
einfo = rb_obj_as_string(error);
if (eclass == rb_eRuntimeError && RSTRING_LEN(einfo) == 0)
--- 1028,1034 ----
*** ../vim-9.0.0545/src/version.c 2022-09-22 15:12:53.932791017 +0100
--- src/version.c 2022-09-22 16:09:57.673469887 +0100
***************
*** 701,702 ****
--- 701,704 ----
{ /* Add new patch number below this line */
+ /**/
+ 546,
/**/

--
hundred-and-one symptoms of being an internet addict:
133. You communicate with people on other continents more than you
do with your own neighbors.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages