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