Compare commits

..

11 Commits

Author SHA1 Message Date
Bram Moolenaar
3ca71f1f1f updated for version 7.3.043
Problem:    Can't load Ruby dynamically on Unix.
Solution:   Adjust the configure script. (James Vega)
2010-10-27 16:49:47 +02:00
Bram Moolenaar
beca055b0c updated for version 7.3.042
Problem:    No spell highlighting when re-using an empty buffer.
Solution:   Clear the spell checking info only when clearing the options for a
            buffer. (James Vega)
2010-10-27 16:18:00 +02:00
Bram Moolenaar
22df3f90fc updated for version 7.3.041
Problem:    Compiler warning for accessing mediumVersion. (Tony Mechelynck)
Solution:   Use the pointer instead of the array itself. (Dominique Pelle)
2010-10-27 16:01:27 +02:00
Bram Moolenaar
c395a3aac2 updated for version 7.3.040
Problem:    Comparing strings while ignoring case goes beyond end of the
            string when there are illegal bytes. (Dominique Pelle)
Solution:   Explicitly check for illegal bytes.
2010-10-27 13:37:44 +02:00
Bram Moolenaar
fc3c83e47e updated for version 7.3.039
Problem:    Crash when using skk.vim plugin.
Solution:   Get length of expression evaluation result only after checking for
            NULL.  (Noriaki Yagi, Dominique Pelle)
2010-10-27 12:58:23 +02:00
Bram Moolenaar
264e9fd61b updated for version 7.3.038
Problem:    v:windowid isn't set on MS-Windows.
Solution:   Set it to the window handle. (Chris Sutcliffe)
2010-10-27 12:33:17 +02:00
Bram Moolenaar
6b5ef067a5 updated for version 7.3.037
Problem:    Compiler warnings for loss of data. (Mike Williams)
Solution:   Add type casts.
2010-10-27 12:18:00 +02:00
Bram Moolenaar
786989ba37 updated for version 7.3.036
Problem:    Win32 GUI: When building without menus, the font for dialogs and
            tab page headers also changes.
Solution:   Define USE_SYSMENU_FONT always. (Harig G.)
2010-10-27 12:15:33 +02:00
Bram Moolenaar
8bbe993c79 updated for version 7.3.035
Problem:    Stray semicolon after if statement. (Hari G)
Solution:   Remove the semicolon.
2010-10-24 14:33:43 +02:00
Bram Moolenaar
ebbcb824ba updated for version 7.3.034
Problem:    Win32: may be loading .dll from the wrong directory.
Solution:   Go to the Vim executable directory when opening a library.
2010-10-23 14:02:54 +02:00
Bram Moolenaar
b8e86705ca updated for version 7.3.033
Problem:    Can't build without FEAT_LOCALMAP.
Solution:   Add an #ifdef. (John Marriott)
2010-10-22 22:13:52 +02:00
21 changed files with 195 additions and 104 deletions

View File

@@ -1660,7 +1660,11 @@ v:warningmsg Last given warning message. It's allowed to set this variable.
*v:windowid* *windowid-variable*
v:windowid When any X11 based GUI is running or when running in a
terminal and Vim connects to the X server (|-X|) this will be
set to the window ID. Otherwise the value is zero.
set to the window ID.
When an MS-Windows GUI is running this will be set to the
window handle.
Otherwise the value is zero.
Note: for windows inside Vim use |winnr()|.
==============================================================================
4. Builtin Functions *functions*

View File

@@ -414,12 +414,16 @@ CClink = $(CC)
# However, this may still cause problems, such as "import termios" failing.
# Build two separate versions of Vim in that case.
#CONF_OPT_PYTHON = --enable-pythoninterp
#CONF_OPT_PYTHON = --enable-pythoninterp=dynamic
#CONF_OPT_PYTHON3 = --enable-python3interp
#CONF_OPT_PYTHON3 = --enable-python3interp=dynamic
# RUBY
# Uncomment this when you want to include the Ruby interface.
# First one for static linking, second one for loading when used.
# Note: you need the development package (e.g., ruby1.9.1-dev on Ubuntu).
#CONF_OPT_RUBY = --enable-rubyinterp
#CONF_OPT_RUBY = --enable-rubyinterp=dynamic
#CONF_OPT_RUBY = --enable-rubyinterp --with-ruby-command=ruby1.9.1
# TCL
@@ -1047,8 +1051,9 @@ INSTALL_PROG = cp
INSTALL_DATA = cp
INSTALL_DATA_R = cp -r
### Program to run on installed binary
### Program to run on installed binary. Use the second one to disable strip.
#STRIP = strip
#STRIP = /bin/true
### Permissions for binaries {{{1
BINMOD = 755
@@ -1321,7 +1326,7 @@ SHELL = /bin/sh
.SUFFIXES: .c .o .pro
PRE_DEFS = -Iproto $(DEFS) $(GUI_DEFS) $(GUI_IPATH) $(CPPFLAGS) $(EXTRA_IPATHS)
POST_DEFS = $(X_CFLAGS) $(MZSCHEME_CFLAGS) $(TCL_CFLAGS) $(RUBY_CFLAGS) $(EXTRA_DEFS)
POST_DEFS = $(X_CFLAGS) $(MZSCHEME_CFLAGS) $(TCL_CFLAGS) $(EXTRA_DEFS)
ALL_CFLAGS = $(PRE_DEFS) $(CFLAGS) $(PROFILE_CFLAGS) $(POST_DEFS)
@@ -1329,7 +1334,7 @@ ALL_CFLAGS = $(PRE_DEFS) $(CFLAGS) $(PROFILE_CFLAGS) $(POST_DEFS)
# with "-E".
OSDEF_CFLAGS = $(PRE_DEFS) $(POST_DEFS)
LINT_CFLAGS = -DLINT -I. $(PRE_DEFS) $(POST_DEFS) $(LUA_CFLAGS) $(PERL_CFLAGS) $(PYTHON_CFLAGS) -Dinline= -D__extension__= -Dalloca=alloca
LINT_CFLAGS = -DLINT -I. $(PRE_DEFS) $(POST_DEFS) $(RUBY_CFLAGS) $(LUA_CFLAGS) $(PERL_CFLAGS) $(PYTHON_CFLAGS) -Dinline= -D__extension__= -Dalloca=alloca
LINT_EXTRA = -DUSE_SNIFF -DHANGUL_INPUT -D"__attribute__(x)="
@@ -2532,7 +2537,7 @@ objects/if_python3.o: if_python3.c if_py_both.h
$(CCC) $(PYTHON3_CFLAGS) $(PYTHON3_CFLAGS_EXTRA) -o $@ if_python3.c
objects/if_ruby.o: if_ruby.c
$(CCC) -o $@ if_ruby.c
$(CCC) $(RUBY_CFLAGS) -o $@ if_ruby.c
objects/if_sniff.o: if_sniff.c
$(CCC) -o $@ if_sniff.c

11
src/auto/configure vendored
View File

@@ -1427,7 +1427,7 @@ Optional Features:
--enable-pythoninterp=OPTS Include Python interpreter. default=no OPTS=no/yes/dynamic
--enable-python3interp=OPTS Include Python3 interpreter. default=no OPTS=no/yes/dynamic
--enable-tclinterp Include Tcl interpreter.
--enable-rubyinterp Include Ruby interpreter.
--enable-rubyinterp=OPTS Include Ruby interpreter. default=no OPTS=no/yes/dynamic
--enable-cscope Include cscope interface.
--enable-workshop Include Sun Visual Workshop support.
--disable-netbeans Disable NetBeans integration support.
@@ -6103,7 +6103,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_rubyinterp" >&5
$as_echo "$enable_rubyinterp" >&6; }
if test "$enable_rubyinterp" = "yes"; then
if test "$enable_rubyinterp" = "yes" -o "$enable_rubyinterp" = "dynamic"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking --with-ruby-command argument" >&5
$as_echo_n "checking --with-ruby-command argument... " >&6; }
@@ -6209,6 +6209,13 @@ $as_echo "$rubyhdrdir" >&6; }
RUBY_PRO="if_ruby.pro"
$as_echo "#define FEAT_RUBY 1" >>confdefs.h
if test "$enable_rubyinterp" = "dynamic"; then
libruby=`$vi_cv_path_ruby -r rbconfig -e 'printf "lib%s.%s\n", Config::CONFIG["RUBY_SO_NAME"], Config::CONFIG["DLEXT"]'`
$as_echo "#define DYNAMIC_RUBY 1" >>confdefs.h
RUBY_CFLAGS="-DDYNAMIC_RUBY_DLL=\\\"$libruby\\\" -DDYNAMIC_RUBY_VER=$rubyversion $RUBY_CFLAGS"
RUBY_LIBS=
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found; disabling Ruby" >&5
$as_echo "not found; disabling Ruby" >&6; }

View File

@@ -639,6 +639,9 @@ free_buffer_stuff(buf, free_options)
{
clear_wininfo(buf); /* including window-local options */
free_buf_options(buf, TRUE);
#ifdef FEAT_SPELL
ga_clear(&buf->b_s.b_langp);
#endif
}
#ifdef FEAT_EVAL
vars_clear(&buf->b_vars.dv_hashtab); /* free all internal variables */
@@ -661,9 +664,6 @@ free_buffer_stuff(buf, free_options)
vim_free(buf->b_start_fenc);
buf->b_start_fenc = NULL;
#endif
#ifdef FEAT_SPELL
ga_clear(&buf->b_s.b_langp);
#endif
}
/*

View File

@@ -349,6 +349,9 @@
/* Define if you want to include the Ruby interpreter. */
#undef FEAT_RUBY
/* Define for linking via dlopen() or LoadLibrary() */
#undef DYNAMIC_RUBY
/* Define if you want to include the Tcl interpreter. */
#undef FEAT_TCL

View File

@@ -1299,10 +1299,10 @@ AC_SUBST(TCL_LIBS)
AC_MSG_CHECKING(--enable-rubyinterp argument)
AC_ARG_ENABLE(rubyinterp,
[ --enable-rubyinterp Include Ruby interpreter.], ,
[ --enable-rubyinterp[=OPTS] Include Ruby interpreter. [default=no] [OPTS=no/yes/dynamic]], ,
[enable_rubyinterp="no"])
AC_MSG_RESULT($enable_rubyinterp)
if test "$enable_rubyinterp" = "yes"; then
if test "$enable_rubyinterp" = "yes" -o "$enable_rubyinterp" = "dynamic"; then
AC_MSG_CHECKING(--with-ruby-command argument)
AC_ARG_WITH(ruby-command, [ --with-ruby-command=RUBY name of the Ruby command (default: ruby)],
RUBY_CMD="$withval"; AC_MSG_RESULT($RUBY_CMD),
@@ -1360,6 +1360,12 @@ if test "$enable_rubyinterp" = "yes"; then
RUBY_OBJ="objects/if_ruby.o"
RUBY_PRO="if_ruby.pro"
AC_DEFINE(FEAT_RUBY)
if test "$enable_rubyinterp" = "dynamic"; then
libruby=`$vi_cv_path_ruby -r rbconfig -e 'printf "lib%s.%s\n", Config::CONFIG[["RUBY_SO_NAME"]], Config::CONFIG[["DLEXT"]]'`
AC_DEFINE(DYNAMIC_RUBY)
RUBY_CFLAGS="-DDYNAMIC_RUBY_DLL=\\\"$libruby\\\" -DDYNAMIC_RUBY_VER=$rubyversion $RUBY_CFLAGS"
RUBY_LIBS=
fi
else
AC_MSG_RESULT(not found; disabling Ruby)
fi

View File

@@ -688,24 +688,27 @@ getcmdline(firstc, count, indent)
p = get_expr_line();
--textlock;
restore_cmdline(&save_ccline);
len = (int)STRLEN(p);
if (p != NULL && realloc_cmdbuff(len + 1) == OK)
if (p != NULL)
{
ccline.cmdlen = len;
STRCPY(ccline.cmdbuff, p);
vim_free(p);
len = (int)STRLEN(p);
if (realloc_cmdbuff(len + 1) == OK)
{
ccline.cmdlen = len;
STRCPY(ccline.cmdbuff, p);
vim_free(p);
/* Restore the cursor or use the position set with
* set_cmdline_pos(). */
if (new_cmdpos > ccline.cmdlen)
ccline.cmdpos = ccline.cmdlen;
else
ccline.cmdpos = new_cmdpos;
/* Restore the cursor or use the position set with
* set_cmdline_pos(). */
if (new_cmdpos > ccline.cmdlen)
ccline.cmdpos = ccline.cmdlen;
else
ccline.cmdpos = new_cmdpos;
KeyTyped = FALSE; /* Don't do p_wc completion. */
redrawcmd();
goto cmdline_changed;
KeyTyped = FALSE; /* Don't do p_wc completion. */
redrawcmd();
goto cmdline_changed;
}
}
}
beep_flush();

View File

@@ -3922,7 +3922,7 @@ showmap(mp, local)
if (mapchars != NULL)
{
msg_puts(mapchars);
len = STRLEN(mapchars);
len = (int)STRLEN(mapchars);
vim_free(mapchars);
}
@@ -5086,7 +5086,11 @@ check_map(keys, mode, exact, ign_mod, abbr, mp_ptr, local_ptr)
if (mp_ptr != NULL)
*mp_ptr = mp;
if (local_ptr != NULL)
#ifdef FEAT_LOCALMAP
*local_ptr = local;
#else
*local_ptr = 0;
#endif
return mp->m_str;
}
}

View File

@@ -289,13 +289,13 @@ typedef struct tagNMTTDISPINFOW {
#ifdef FEAT_MENU
static UINT s_menu_id = 100;
#endif
/*
* Use the system font for dialogs and tear-off menus. Remove this line to
* use DLG_FONT_NAME.
*/
# define USE_SYSMENU_FONT
#endif
#define USE_SYSMENU_FONT
#define VIM_NAME "vim"
#define VIM_CLASS "Vim"
@@ -1260,7 +1260,7 @@ gui_mch_prepare(int *argc, char **argv)
/* try and load the user32.dll library and get the entry points for
* multi-monitor-support. */
if ((user32_lib = LoadLibrary("User32.dll")) != NULL)
if ((user32_lib = vimLoadLib("User32.dll")) != NULL)
{
pMonitorFromWindow = (TMonitorFromWindow)GetProcAddress(user32_lib,
"MonitorFromWindow");
@@ -1573,6 +1573,11 @@ gui_mch_init(void)
# endif
#endif
#ifdef FEAT_EVAL
/* set the v:windowid variable */
set_vim_var_nr(VV_WINDOWID, (long)s_hwnd);
#endif
theend:
/* Display any pending error messages */
display_errors();
@@ -4188,7 +4193,7 @@ gui_mch_set_foreground(void)
static void
dyn_imm_load(void)
{
hLibImm = LoadLibrary("imm32.dll");
hLibImm = vimLoadLib("imm32.dll");
if (hLibImm == NULL)
return;

View File

@@ -49,7 +49,7 @@ static const char LUAVIM_FREE[] = "luaV_free";
# define symbol_from_dll dlsym
# define close_dll dlclose
#else
# define load_dll LoadLibrary
# define load_dll vimLoadLib
# define symbol_from_dll GetProcAddress
# define close_dll FreeLibrary
#endif

View File

@@ -556,8 +556,8 @@ mzscheme_runtime_link_init(char *sch_dll, char *gc_dll, int verbose)
if (hMzGC && hMzSch)
return OK;
hMzSch = LoadLibrary(sch_dll);
hMzGC = LoadLibrary(gc_dll);
hMzSch = vimLoadLib(sch_dll);
hMzGC = vimLoadLib(gc_dll);
if (!hMzSch)
{

View File

@@ -106,7 +106,7 @@ typedef int perl_key;
#define close_dll dlclose
#else
#define PERL_PROC FARPROC
#define load_dll LoadLibrary
#define load_dll vimLoadLib
#define symbol_from_dll GetProcAddress
#define close_dll FreeLibrary
#endif

View File

@@ -154,7 +154,7 @@ writer(writefn fn, char_u *str, PyInt n)
{
PyInt len = ptr - str;
if (ga_grow(&io_ga, len + 1) == FAIL)
if (ga_grow(&io_ga, (int)(len + 1)) == FAIL)
break;
mch_memmove(((char *)io_ga.ga_data) + io_ga.ga_len, str, (size_t)len);
@@ -166,10 +166,10 @@ writer(writefn fn, char_u *str, PyInt n)
}
/* Put the remaining text into io_ga for later printing. */
if (n > 0 && ga_grow(&io_ga, n + 1) == OK)
if (n > 0 && ga_grow(&io_ga, (int)(n + 1)) == OK)
{
mch_memmove(((char *)io_ga.ga_data) + io_ga.ga_len, str, (size_t)n);
io_ga.ga_len += n;
io_ga.ga_len += (int)n;
}
}

View File

@@ -110,7 +110,7 @@ struct PyMethodDef { Py_ssize_t a; };
# define close_dll dlclose
# define symbol_from_dll dlsym
# else
# define load_dll LoadLibrary
# define load_dll vimLoadLib
# define close_dll FreeLibrary
# define symbol_from_dll GetProcAddress
# endif

View File

@@ -88,7 +88,7 @@ static void init_structs(void);
# define close_dll dlclose
# define symbol_from_dll dlsym
# else
# define load_dll LoadLibrary
# define load_dll vimLoadLib
# define close_dll FreeLibrary
# define symbol_from_dll GetProcAddress
# endif

View File

@@ -14,6 +14,8 @@
#include <stdio.h>
#include <string.h>
#include "auto/config.h"
#ifdef _WIN32
# if !defined(DYNAMIC_RUBY_VER) || (DYNAMIC_RUBY_VER < 18)
# define NT
@@ -48,14 +50,16 @@
# define RUBY_EXPORT
# endif
#if !(defined(WIN32) || defined(_WIN64))
#ifndef WIN3264
# include <dlfcn.h>
# define HANDLE void*
# define HINSTANCE void*
# define RUBY_PROC void*
# define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL)
# define symbol_from_dll dlsym
# define close_dll dlclose
#else
# define load_dll LoadLibrary
# define RUBY_PROC FARPROC
# define load_dll vimLoadLib
# define symbol_from_dll GetProcAddress
# define close_dll FreeLibrary
#endif
@@ -174,7 +178,9 @@ static void ruby_vim_init(void);
#define rb_lastline_get dll_rb_lastline_get
#define rb_lastline_set dll_rb_lastline_set
#define rb_load_protect dll_rb_load_protect
#ifndef RUBY19_OR_LATER
#define rb_num2long dll_rb_num2long
#endif
#define rb_num2ulong dll_rb_num2ulong
#define rb_obj_alloc dll_rb_obj_alloc
#define rb_obj_as_string dll_rb_obj_as_string
@@ -186,6 +192,9 @@ static void ruby_vim_init(void);
#ifdef rb_str_new2
/* Ruby may #define rb_str_new2 to use rb_str_new_cstr. */
# define need_rb_str_new_cstr 1
/* Ruby's headers #define rb_str_new_cstr to make use of GCC's
* __builtin_constant_p extension. */
# undef rb_str_new_cstr
# define rb_str_new_cstr dll_rb_str_new_cstr
#else
# define rb_str_new2 dll_rb_str_new2
@@ -206,9 +215,11 @@ static void ruby_vim_init(void);
#endif
#define ruby_init dll_ruby_init
#define ruby_init_loadpath dll_ruby_init_loadpath
#define NtInitialize dll_NtInitialize
#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
# define rb_w32_snprintf dll_rb_w32_snprintf
#ifdef WIN3264
# define NtInitialize dll_NtInitialize
# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
# define rb_w32_snprintf dll_rb_w32_snprintf
# endif
#endif
#ifdef RUBY19_OR_LATER
@@ -283,7 +294,12 @@ static VALUE *dll_ruby_errinfo;
#endif
static void (*dll_ruby_init) (void);
static void (*dll_ruby_init_loadpath) (void);
#ifdef WIN3264
static void (*dll_NtInitialize) (int*, char***);
# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
static int (*dll_rb_w32_snprintf)(char*, size_t, const char*, ...);
# endif
#endif
#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
static char * (*dll_rb_string_value_ptr) (volatile VALUE*);
static VALUE (*dll_rb_float_new) (double);
@@ -293,9 +309,6 @@ static VALUE (*dll_rb_ary_push) (VALUE, VALUE);
#ifdef RUBY19_OR_LATER
static VALUE (*dll_rb_int2big)(SIGNED_VALUE);
#endif
#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
static int (*dll_rb_w32_snprintf)(char*, size_t, const char*, ...);
#endif
#ifdef RUBY19_OR_LATER
static void (*dll_ruby_script) (const char*);
@@ -317,12 +330,11 @@ VALUE rb_int2big_stub(SIGNED_VALUE x)
}
#endif
static HINSTANCE hinstRuby = 0; /* Instance of ruby.dll */
static HINSTANCE hinstRuby = NULL; /* Instance of ruby.dll */
/*
* Table of name to function pointer of ruby.
*/
#define RUBY_PROC FARPROC
static struct
{
char *name;
@@ -387,15 +399,17 @@ static struct
#endif
{"ruby_init", (RUBY_PROC*)&dll_ruby_init},
{"ruby_init_loadpath", (RUBY_PROC*)&dll_ruby_init_loadpath},
#ifdef WIN3264
{
#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER < 19
# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER < 19
"NtInitialize",
#else
# else
"ruby_sysinit",
#endif
# endif
(RUBY_PROC*)&dll_NtInitialize},
#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
{"rb_w32_snprintf", (RUBY_PROC*)&dll_rb_w32_snprintf},
# endif
#endif
#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
{"rb_string_value_ptr", (RUBY_PROC*)&dll_rb_string_value_ptr},
@@ -424,7 +438,7 @@ end_dynamic_ruby()
if (hinstRuby)
{
close_dll(hinstRuby);
hinstRuby = 0;
hinstRuby = NULL;
}
}
@@ -454,7 +468,7 @@ ruby_runtime_link_init(char *libname, int verbose)
ruby_funcname_table[i].name)))
{
close_dll(hinstRuby);
hinstRuby = 0;
hinstRuby = NULL;
if (verbose)
EMSG2(_(e_loadfunc), ruby_funcname_table[i].name);
return FAIL;
@@ -936,9 +950,7 @@ static VALUE get_buffer_line(buf_T *buf, linenr_T n)
return line ? vim_str2rb_enc_str(line) : Qnil;
}
rb_raise(rb_eIndexError, "line number %ld out of range", (long)n);
#ifndef __GNUC__
return Qnil; /* For stop warning */
#endif
}
static VALUE buffer_aref(VALUE self, VALUE num)

View File

@@ -3124,6 +3124,9 @@ mb_strnicmp(s1, s2, nn)
/* If one of the two characters is incomplete return -1. */
if (incomplete || i + utf_byte2len(s2[i]) > n)
return -1;
/* Don't case-fold illegal bytes or truncated characters. */
if (utf_ptr2len(s1 + i) < l || utf_ptr2len(s2 + i) < l)
return -1;
cdiff = utf_fold(utf_ptr2char(s1 + i))
- utf_fold(utf_ptr2char(s2 + i));
if (cdiff != 0)
@@ -4159,11 +4162,11 @@ iconv_enabled(verbose)
{
if (hIconvDLL != 0 && hMsvcrtDLL != 0)
return TRUE;
hIconvDLL = LoadLibrary(DYNAMIC_ICONV_DLL);
hIconvDLL = vimLoadLib(DYNAMIC_ICONV_DLL);
if (hIconvDLL == 0) /* sometimes it's called libiconv.dll */
hIconvDLL = LoadLibrary(DYNAMIC_ICONV_DLL_ALT);
hIconvDLL = vimLoadLib(DYNAMIC_ICONV_DLL_ALT);
if (hIconvDLL != 0)
hMsvcrtDLL = LoadLibrary(DYNAMIC_MSVCRT_DLL);
hMsvcrtDLL = vimLoadLib(DYNAMIC_MSVCRT_DLL);
if (hIconvDLL == 0 || hMsvcrtDLL == 0)
{
/* Only give the message when 'verbose' is set, otherwise it might be

View File

@@ -817,7 +817,11 @@ mch_libcall(
BOOL fRunTimeLinkSuccess = FALSE;
// Get a handle to the DLL module.
# ifdef WIN16
hinstLib = LoadLibrary(libname);
# else
hinstLib = vimLoadLib(libname);
# endif
// If the handle is valid, try to get the function address.
if (hinstLib != NULL)

View File

@@ -206,44 +206,66 @@ static char *vimrun_path = "vimrun ";
static int suppress_winsize = 1; /* don't fiddle with console */
#endif
static char_u *exe_path = NULL;
static void
get_exe_name(void)
{
char temp[256];
static int did_set_PATH = FALSE;
char temp[MAXPATHL];
char_u *p;
if (exe_name == NULL)
{
/* store the name of the executable, may be used for $VIM */
GetModuleFileName(NULL, temp, 255);
GetModuleFileName(NULL, temp, MAXPATHL - 1);
if (*temp != NUL)
exe_name = FullName_save((char_u *)temp, FALSE);
}
if (!did_set_PATH && exe_name != NULL)
if (exe_path == NULL && exe_name != NULL)
{
char_u *p;
char_u *newpath;
/* Append our starting directory to $PATH, so that when doing "!xxd"
* it's found in our starting directory. Needed because SearchPath()
* also looks there. */
p = mch_getenv("PATH");
newpath = alloc((unsigned)(STRLEN(p) + STRLEN(exe_name) + 2));
if (newpath != NULL)
exe_path = vim_strnsave(exe_name,
(int)(gettail_sep(exe_name) - exe_name));
if (exe_path != NULL)
{
STRCPY(newpath, p);
STRCAT(newpath, ";");
vim_strncpy(newpath + STRLEN(newpath), exe_name,
gettail_sep(exe_name) - exe_name);
vim_setenv((char_u *)"PATH", newpath);
vim_free(newpath);
/* Append our starting directory to $PATH, so that when doing
* "!xxd" it's found in our starting directory. Needed because
* SearchPath() also looks there. */
p = mch_getenv("PATH");
if (STRLEN(p) + STRLEN(exe_path) + 2 < MAXPATHL)
{
STRCPY(temp, p);
STRCAT(temp, ";");
STRCAT(temp, exe_path);
vim_setenv((char_u *)"PATH", temp);
}
}
did_set_PATH = TRUE;
}
}
/*
* Load library "name".
*/
HINSTANCE
vimLoadLib(char *name)
{
HINSTANCE dll = NULL;
char old_dir[MAXPATHL];
if (exe_path == NULL)
get_exe_name();
if (exe_path != NULL && mch_dirname(old_dir, MAXPATHL) == OK)
{
/* Change directory to where the executable is, both to make sure we
* find a .dll there and to avoid looking for a .dll in the current
* directory. */
mch_chdir(exe_path);
dll = LoadLibrary(name);
mch_chdir(old_dir);
}
return dll;
}
#if defined(DYNAMIC_GETTEXT) || defined(PROTO)
# ifndef GETTEXT_DLL
# define GETTEXT_DLL "libintl.dll"
@@ -254,7 +276,7 @@ static char *null_libintl_textdomain(const char *);
static char *null_libintl_bindtextdomain(const char *, const char *);
static char *null_libintl_bind_textdomain_codeset(const char *, const char *);
static HINSTANCE hLibintlDLL = 0;
static HINSTANCE hLibintlDLL = NULL;
char *(*dyn_libintl_gettext)(const char *) = null_libintl_gettext;
char *(*dyn_libintl_textdomain)(const char *) = null_libintl_textdomain;
char *(*dyn_libintl_bindtextdomain)(const char *, const char *)
@@ -282,26 +304,16 @@ dyn_libintl_init(char *libname)
if (hLibintlDLL)
return 1;
/* Load gettext library (libintl.dll) */
hLibintlDLL = LoadLibrary(libname != NULL ? libname : GETTEXT_DLL);
hLibintlDLL = vimLoadLib(libname != NULL ? libname : GETTEXT_DLL);
if (!hLibintlDLL)
{
char_u dirname[_MAX_PATH];
/* Try using the path from gvim.exe to find the .dll there. */
get_exe_name();
STRCPY(dirname, exe_name);
STRCPY(gettail(dirname), GETTEXT_DLL);
hLibintlDLL = LoadLibrary((char *)dirname);
if (!hLibintlDLL)
if (p_verbose > 0)
{
if (p_verbose > 0)
{
verbose_enter();
EMSG2(_(e_loadlib), GETTEXT_DLL);
verbose_leave();
}
return 0;
verbose_enter();
EMSG2(_(e_loadlib), GETTEXT_DLL);
verbose_leave();
}
return 0;
}
for (i = 0; libintl_entry[i].name != NULL
&& libintl_entry[i].ptr != NULL; ++i)
@@ -430,7 +442,7 @@ PlatformId(void)
* Seems like a lot of overhead to load/unload ADVAPI32.DLL each
* time we verify security...
*/
advapi_lib = LoadLibrary("ADVAPI32.DLL");
advapi_lib = vimLoadLib("ADVAPI32.DLL");
if (advapi_lib != NULL)
{
pSetNamedSecurityInfo = (PSNSECINFO)GetProcAddress(advapi_lib,
@@ -2363,7 +2375,7 @@ fname_case(
/* To avoid a slow failure append "\*" when searching a directory,
* server or network share. */
STRCPY(szTrueNameTemp, szTrueName);
slen = strlen(szTrueNameTemp);
slen = (int)strlen(szTrueNameTemp);
if (*porig == psepc && slen + 2 < _MAX_PATH)
STRCPY(szTrueNameTemp + slen, "\\*");

View File

@@ -1,4 +1,5 @@
/* os_win32.c */
HINSTANCE vimLoadLib __ARGS((char *name));
int dyn_libintl_init __ARGS((char *libname));
void dyn_libintl_end __ARGS((void));
void PlatformId __ARGS((void));

View File

@@ -714,6 +714,28 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
43,
/**/
42,
/**/
41,
/**/
40,
/**/
39,
/**/
38,
/**/
37,
/**/
36,
/**/
35,
/**/
34,
/**/
33,
/**/
32,
/**/
@@ -1326,9 +1348,9 @@ do_intro_line(row, mesg, add_version, attr)
if (highest_patch())
{
/* Check for 9.9x or 9.9xx, alpha/beta version */
if (isalpha((int)mediumVersion[3]))
if (isalpha((int)vers[3]))
{
if (isalpha((int)mediumVersion[4]))
if (isalpha((int)vers[4]))
sprintf((char *)vers + 5, ".%d%s", highest_patch(),
mediumVersion + 5);
else