To: vim-dev@vim.org Subject: Patch 6.0.070 Fcc: outbox From: Bram Moolenaar MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.0.070 Problem: Win32: The error message for a failed dynamic linking of a Perl, Ruby, Tcl and Python library is unclear about what went wrong. Solution: Give the name of the library or function that could not be loaded. Also for the iconv and gettext libraries when 'verbose' is set. Files: src/eval.c, src/if_perl.xs, src/if_python.c, src/if_ruby.c, src/if_tcl.c, src/mbyte.c, src/os_win32.c, src/proto/if_perl.pro, src/proto/if_python.pro, src/proto/if_ruby.pro, src/proto/if_tcl.pro, src/proto/mbyte.pro *** ../vim60.69/src/eval.c Mon Oct 29 15:15:20 2001 --- src/eval.c Sun Nov 4 13:57:39 2001 *************** *** 4337,4359 **** n = (starting != 0); #ifdef DYNAMIC_TCL else if (STRICMP(name, "tcl") == 0) ! n = tcl_enabled() ? TRUE : FALSE; #endif #if defined(USE_ICONV) && defined(DYNAMIC_ICONV) else if (STRICMP(name, "iconv") == 0) ! n = iconv_enabled(); #endif #ifdef DYNAMIC_RUBY else if (STRICMP(name, "ruby") == 0) ! n = ruby_enabled() ? TRUE : FALSE; #endif #ifdef DYNAMIC_PYTHON else if (STRICMP(name, "python") == 0) ! n = python_enabled() ? TRUE : FALSE; #endif #ifdef DYNAMIC_PERL else if (STRICMP(name, "perl") == 0) ! n = perl_enabled() ? TRUE : FALSE; #endif #ifdef FEAT_GUI else if (STRICMP(name, "gui_running") == 0) --- 4337,4359 ---- n = (starting != 0); #ifdef DYNAMIC_TCL else if (STRICMP(name, "tcl") == 0) ! n = tcl_enabled(FALSE); #endif #if defined(USE_ICONV) && defined(DYNAMIC_ICONV) else if (STRICMP(name, "iconv") == 0) ! n = iconv_enabled(FALSE); #endif #ifdef DYNAMIC_RUBY else if (STRICMP(name, "ruby") == 0) ! n = ruby_enabled(FALSE); #endif #ifdef DYNAMIC_PYTHON else if (STRICMP(name, "python") == 0) ! n = python_enabled(FALSE); #endif #ifdef DYNAMIC_PERL else if (STRICMP(name, "perl") == 0) ! n = perl_enabled(FALSE); #endif #ifdef FEAT_GUI else if (STRICMP(name, "gui_running") == 0) *** ../vim60.69/src/if_perl.xs Sun Jul 29 14:47:04 2001 --- src/if_perl.xs Sun Nov 4 13:40:40 2001 *************** *** 307,323 **** * 3. Repeat 2, until get all functions will be used. * * Parameter 'libname' provides name of DLL. ! * Succeeded in load, return 1. Failed, return zero. */ static int ! perl_runtime_link_init(char *libname) { int i; ! if (hPerlLib) ! return 1; if (!(hPerlLib = LoadLibraryEx(libname, NULL, 0))) ! return 0; for (i = 0; perl_funcname_table[i].ptr; ++i) { if (!(*perl_funcname_table[i].ptr = GetProcAddress(hPerlLib, --- 307,327 ---- * 3. Repeat 2, until get all functions will be used. * * Parameter 'libname' provides name of DLL. ! * Return OK or FAIL. */ static int ! perl_runtime_link_init(char *libname, int verbose) { int i; ! if (hPerlLib != NULL) ! return OK; if (!(hPerlLib = LoadLibraryEx(libname, NULL, 0))) ! { ! if (verbose) ! EMSG2(_("E370: Could not load library %s"), libname); ! return FAIL; ! } for (i = 0; perl_funcname_table[i].ptr; ++i) { if (!(*perl_funcname_table[i].ptr = GetProcAddress(hPerlLib, *************** *** 325,344 **** { FreeLibrary(hPerlLib); hPerlLib = NULL; ! return 0; } } ! return 1; } /* ! * If runtime-link-perl(DLL) was loaded successfully, return 1. ! * There were no DLL loaded, return 0. */ int ! perl_enabled() { ! return perl_runtime_link_init(DYNAMIC_PERL_DLL); } #endif /* DYNAMIC_PERL */ --- 329,352 ---- { FreeLibrary(hPerlLib); hPerlLib = NULL; ! if (verbose) ! EMSG2(_("E448: Could not load library function %s"), ! perl_funcname_table[i].name); ! return FAIL; } } ! return OK; } /* ! * If runtime-link-perl(DLL) was loaded successfully, return TRUE. ! * There were no DLL loaded, return FALSE. */ int ! perl_enabled(verbose) ! int verbose; { ! return perl_runtime_link_init(DYNAMIC_PERL_DLL, verbose) == OK; } #endif /* DYNAMIC_PERL */ *************** *** 548,557 **** SV *sv; SV *safe; ! if (!perl_interp) { #ifdef DYNAMIC_PERL ! if (!perl_enabled()) { EMSG(_(e_noperl)); return; --- 556,565 ---- SV *sv; SV *safe; ! if (perl_interp == NULL) { #ifdef DYNAMIC_PERL ! if (!perl_enabled(TRUE)) { EMSG(_(e_noperl)); return; *************** *** 644,653 **** if (bufempty()) return; ! if (!perl_interp) { #ifdef DYNAMIC_PERL ! if (!perl_enabled()) { EMSG(_(e_noperl)); return; --- 652,661 ---- if (bufempty()) return; ! if (perl_interp == NULL) { #ifdef DYNAMIC_PERL ! if (!perl_enabled(TRUE)) { EMSG(_(e_noperl)); return; *** ../vim60.69/src/if_python.c Thu Oct 18 13:28:47 2001 --- src/if_python.c Sun Nov 4 13:41:47 2001 *************** *** 228,248 **** } /* ! * Load library and get all pointers. If failed, function returns 0. ! * Succeeded 1. ! * * Parameter 'libname' provides name of DLL. */ static int ! python_runtime_link_init(char* libname) { int i; if (hinstPython) ! return 1; hinstPython = LoadLibrary(libname); if (!hinstPython) ! return 0; for (i = 0; python_funcname_table[i].ptr; ++i) { --- 228,251 ---- } /* ! * Load library and get all pointers. * Parameter 'libname' provides name of DLL. + * Return OK or FAIL. */ static int ! python_runtime_link_init(char *libname, int verbose) { int i; if (hinstPython) ! return OK; hinstPython = LoadLibrary(libname); if (!hinstPython) ! { ! if (verbose) ! EMSG2(_("E370: Could not load library %s"), libname); ! return FAIL; ! } for (i = 0; python_funcname_table[i].ptr; ++i) { *************** *** 251,270 **** { FreeLibrary(hinstPython); hinstPython = 0; ! return 0; } } ! return 1; } /* * If python is enabled (there is installed python on Windows system) return ! * 1, else 0. */ int ! python_enabled() { ! return python_runtime_link_init(DYNAMIC_PYTHON_DLL); } /* Load the standard Python exceptions - don't import the symbols from the --- 254,277 ---- { FreeLibrary(hinstPython); hinstPython = 0; ! if (verbose) ! EMSG2(_("E448: Could not load library function %s"), ! python_funcname_table[i].name); ! return FAIL; } } ! return OK; } /* * If python is enabled (there is installed python on Windows system) return ! * TRUE, else FALSE. */ int ! python_enabled(verbose) ! int verbose; { ! return python_runtime_link_init(DYNAMIC_PYTHON_DLL, verbose) == OK; } /* Load the standard Python exceptions - don't import the symbols from the *************** *** 371,377 **** if (!initialised) { #ifdef DYNAMIC_PYTHON ! if (!python_enabled()) { EMSG(_("E263: Sorry, this command is disabled, the Python library could not be loaded.")); goto fail; --- 378,384 ---- if (!initialised) { #ifdef DYNAMIC_PYTHON ! if (!python_enabled(TRUE)) { EMSG(_("E263: Sorry, this command is disabled, the Python library could not be loaded.")); goto fail; *** ../vim60.69/src/if_ruby.c Thu Aug 16 18:45:32 2001 --- src/if_ruby.c Sun Nov 4 13:44:01 2001 *************** *** 242,262 **** } /* ! * Load library and get all pointers. If failed, function returns 0. ! * Succeeded 1. ! * * Parameter 'libname' provides name of DLL. */ static int ! ruby_runtime_link_init(char* libname) { int i; if (hinstRuby) ! return 1; hinstRuby = LoadLibrary(libname); if (!hinstRuby) ! return 0; for (i = 0; ruby_funcname_table[i].ptr; ++i) { --- 242,265 ---- } /* ! * Load library and get all pointers. * Parameter 'libname' provides name of DLL. + * Return OK or FAIL. */ static int ! ruby_runtime_link_init(char *libname, int verbose) { int i; if (hinstRuby) ! return OK; hinstRuby = LoadLibrary(libname); if (!hinstRuby) ! { ! if (verbose) ! EMSG2(_("E370: Could not load library %s"), libname); ! return FAIL; ! } for (i = 0; ruby_funcname_table[i].ptr; ++i) { *************** *** 265,284 **** { FreeLibrary(hinstRuby); hinstRuby = 0; ! return 0; } } ! return 1; } /* ! * If ruby is enabled (there is installed ruby on Windows system) return 1, ! * else 0. */ int ! ruby_enabled() { ! return ruby_runtime_link_init(DYNAMIC_RUBY_DLL); } #endif /* defined(DYNAMIC_RUBY) || defined(PROTO) */ --- 268,291 ---- { FreeLibrary(hinstRuby); hinstRuby = 0; ! if (verbose) ! EMSG2(_("E448: Could not load library function %s"), ! ruby_funcname_table[i].name); ! return FAIL; } } ! return OK; } /* ! * If ruby is enabled (there is installed ruby on Windows system) return TRUE, ! * else FALSE. */ int ! ruby_enabled(verbose) ! int verbose; { ! return ruby_runtime_link_init(DYNAMIC_RUBY_DLL, verbose) == OK; } #endif /* defined(DYNAMIC_RUBY) || defined(PROTO) */ *************** *** 379,385 **** if (!ruby_initialized) { #ifdef DYNAMIC_RUBY ! if (ruby_enabled()) { #endif ruby_init(); --- 386,392 ---- if (!ruby_initialized) { #ifdef DYNAMIC_RUBY ! if (ruby_enabled(TRUE)) { #endif ruby_init(); *** ../vim60.69/src/if_tcl.c Thu Aug 16 18:46:10 2001 --- src/if_tcl.c Sun Nov 4 13:55:02 2001 *************** *** 180,196 **** * 3. Repeat 2, until get all functions will be used. * * Parameter 'libname' provides name of DLL. ! * Succeeded in load, return 1. Failed, return zero. */ static int ! tcl_runtime_link_init(char *libname) { int i; if (hTclLib) ! return 1; if (!(hTclLib = LoadLibraryEx(libname, NULL, 0))) ! return 0; for (i = 0; tcl_funcname_table[i].ptr; ++i) { if (!(*tcl_funcname_table[i].ptr = GetProcAddress(hTclLib, --- 180,200 ---- * 3. Repeat 2, until get all functions will be used. * * Parameter 'libname' provides name of DLL. ! * Return OK or FAIL. */ static int ! tcl_runtime_link_init(char *libname, int verbose) { int i; if (hTclLib) ! return OK; if (!(hTclLib = LoadLibraryEx(libname, NULL, 0))) ! { ! if (verbose) ! EMSG2(_("E370: Could not load library %s"), libname); ! return FAIL; ! } for (i = 0; tcl_funcname_table[i].ptr; ++i) { if (!(*tcl_funcname_table[i].ptr = GetProcAddress(hTclLib, *************** *** 198,207 **** { FreeLibrary(hTclLib); hTclLib = NULL; ! return 0; } } ! return 1; } #endif /* defined(DYNAMIC_TCL) || defined(PROTO) */ --- 202,214 ---- { FreeLibrary(hTclLib); hTclLib = NULL; ! if (verbose) ! EMSG2(_("E448: Could not load library function %s"), ! tcl_funcname_table[i].name); ! return FAIL; } } ! return OK; } #endif /* defined(DYNAMIC_TCL) || defined(PROTO) */ *************** *** 221,233 **** } #if defined(DYNAMIC_TCL) || defined(PROTO) int ! tcl_enabled() { ! static int stubs_initialized = 0; ! if (!stubs_initialized && find_executable_arg ! && tcl_runtime_link_init(DYNAMIC_TCL_DLL)) { Tcl_Interp *interp; --- 228,244 ---- } #if defined(DYNAMIC_TCL) || defined(PROTO) + /* + * Return TRUE if the TCL interface can be used. + */ int ! tcl_enabled(verbose) ! int verbose; { ! static int stubs_initialized = FALSE; ! if (!stubs_initialized && find_executable_arg != NULL ! && tcl_runtime_link_init(DYNAMIC_TCL_DLL, verbose) == OK) { Tcl_Interp *interp; *************** *** 237,243 **** { Tcl_FindExecutable(find_executable_arg); Tcl_DeleteInterp(interp); ! stubs_initialized = 1; } /* FIXME: When Tcl_InitStubs() was failed, how delete interp? */ } --- 248,254 ---- { Tcl_FindExecutable(find_executable_arg); Tcl_DeleteInterp(interp); ! stubs_initialized = TRUE; } /* FIXME: When Tcl_InitStubs() was failed, how delete interp? */ } *************** *** 1708,1714 **** char *name; #ifdef DYNAMIC_TCL ! if (!tcl_enabled()) { EMSG(_("Sorry, this command is disabled: the Tcl library could not be loaded.")); return FAIL; --- 1719,1725 ---- char *name; #ifdef DYNAMIC_TCL ! if (!tcl_enabled(TRUE)) { EMSG(_("Sorry, this command is disabled: the Tcl library could not be loaded.")); return FAIL; *************** *** 2068,2074 **** struct ref *reflist; #ifdef DYNAMIC_TCL ! if (!tcl_enabled()) return; #endif --- 2079,2085 ---- struct ref *reflist; #ifdef DYNAMIC_TCL ! if (!tcl_enabled(TRUE)) return; #endif *************** *** 2089,2095 **** struct ref *reflist; #ifdef DYNAMIC_TCL ! if (!tcl_enabled()) return; #endif --- 2100,2106 ---- struct ref *reflist; #ifdef DYNAMIC_TCL ! if (!tcl_enabled(TRUE)) return; #endif *** ../vim60.69/src/mbyte.c Mon Oct 22 12:47:09 2001 --- src/mbyte.c Sun Nov 4 14:07:01 2001 *************** *** 2429,2435 **** #ifdef DYNAMIC_ICONV /* Check if the iconv.dll can be found. */ ! if (!iconv_enabled()) return (void *)-1; #endif --- 2429,2435 ---- #ifdef DYNAMIC_ICONV /* Check if the iconv.dll can be found. */ ! if (!iconv_enabled(TRUE)) return (void *)-1; #endif *************** *** 2553,2559 **** * Try opening the iconv.dll and return TRUE if iconv() can be used. */ int ! iconv_enabled() { if (hIconvDLL != 0 && hMsvcrtDLL != 0) return TRUE; --- 2553,2560 ---- * Try opening the iconv.dll and return TRUE if iconv() can be used. */ int ! iconv_enabled(verbose) ! int verbose; { if (hIconvDLL != 0 && hMsvcrtDLL != 0) return TRUE; *************** *** 2561,2566 **** --- 2562,2572 ---- hMsvcrtDLL = LoadLibrary(DYNAMIC_MSVCRT_DLL); if (hIconvDLL == 0 || hMsvcrtDLL == 0) { + /* Only give the message when 'verbose' is set, otherwise it might be + * done whenever a conversion is attempted. */ + if (verbose && p_verbose > 0) + EMSG2(_("E370: Could not load library %s"), + hIconvDLL == 0 ? DYNAMIC_ICONV_DLL : DYNAMIC_MSVCRT_DLL); iconv_end(); return FALSE; } *************** *** 2574,2579 **** --- 2580,2588 ---- || iconvctl == NULL || iconv_errno == NULL) { iconv_end(); + if (verbose && p_verbose > 0) + EMSG2(_("E448: Could not load library function %s"), + "for libiconv"); return FALSE; } return TRUE; *************** *** 2607,2612 **** --- 2616,2624 ---- #if defined(FEAT_GUI_GTK) || defined(PROTO) static int xim_preediting INIT(= FALSE); /* XIM in showmode() */ static int xim_input_style; + #ifndef FEAT_GUI_GTK + # define gboolean int + #endif static gboolean use_status_area = 0; static int im_xim_str2keycode __ARGS((unsigned int *code, unsigned int *state)); *** ../vim60.69/src/os_win32.c Wed Oct 31 15:20:56 2001 --- src/os_win32.c Sun Nov 4 14:17:10 2001 *************** *** 255,261 **** --- 255,265 ---- STRCPY(gettail(dirname), GETTEXT_DLL); hLibintlDLL = LoadLibrary((char *)dirname); if (!hLibintlDLL) + { + if (p_verbose > 0) + EMSG2(_("E370: Could not load library %s"), GETTEXT_DLL); return 0; + } } for (i = 0; libintl_entry[i].name != NULL && libintl_entry[i].ptr != NULL; ++i) *************** *** 264,269 **** --- 268,276 ---- libintl_entry[i].name))) { dyn_libintl_end(); + if (p_verbose > 0) + EMSG2(_("E448: Could not load library function %s"), + libintl_entry[i].name); return 0; } } *** ../vim60.69/src/proto/if_perl.pro Tue Sep 25 21:49:36 2001 --- src/proto/if_perl.pro Sun Nov 4 13:32:23 2001 *************** *** 1,5 **** /* auto/if_perl.c */ ! int perl_enabled __ARGS((void)); void perl_end __ARGS((void)); void msg_split __ARGS((char_u *s, int attr)); void perl_win_free __ARGS((win_T *wp)); --- 1,5 ---- /* auto/if_perl.c */ ! int perl_enabled __ARGS((int verbose)); void perl_end __ARGS((void)); void msg_split __ARGS((char_u *s, int attr)); void perl_win_free __ARGS((win_T *wp)); *** ../vim60.69/src/proto/if_python.pro Tue Sep 25 21:49:16 2001 --- src/proto/if_python.pro Sun Nov 4 13:56:44 2001 *************** *** 1,5 **** /* if_python.c */ ! int python_enabled __ARGS((void)); void python_end __ARGS((void)); void ex_python __ARGS((exarg_T *eap)); void ex_pyfile __ARGS((exarg_T *eap)); --- 1,5 ---- /* if_python.c */ ! int python_enabled __ARGS((int verbose)); void python_end __ARGS((void)); void ex_python __ARGS((exarg_T *eap)); void ex_pyfile __ARGS((exarg_T *eap)); *** ../vim60.69/src/proto/if_ruby.pro Tue Sep 25 21:49:17 2001 --- src/proto/if_ruby.pro Sun Nov 4 13:56:49 2001 *************** *** 1,5 **** /* if_ruby.c */ ! int ruby_enabled __ARGS((void)); void ruby_end __ARGS((void)); void ex_ruby __ARGS((exarg_T *eap)); void ex_rubydo __ARGS((exarg_T *eap)); --- 1,5 ---- /* if_ruby.c */ ! int ruby_enabled __ARGS((int verbose)); void ruby_end __ARGS((void)); void ex_ruby __ARGS((exarg_T *eap)); void ex_rubydo __ARGS((exarg_T *eap)); *** ../vim60.69/src/proto/if_tcl.pro Tue Sep 25 21:49:33 2001 --- src/proto/if_tcl.pro Sun Nov 4 13:56:40 2001 *************** *** 1,6 **** /* if_tcl.c */ void tcl_init __ARGS((char *arg)); ! int tcl_enabled __ARGS((void)); void tcl_end __ARGS((void)); void ex_tcl __ARGS((exarg_T *eap)); void ex_tclfile __ARGS((exarg_T *eap)); --- 1,6 ---- /* if_tcl.c */ void tcl_init __ARGS((char *arg)); ! int tcl_enabled __ARGS((int verbose)); void tcl_end __ARGS((void)); void ex_tcl __ARGS((exarg_T *eap)); void ex_tclfile __ARGS((exarg_T *eap)); *** ../vim60.69/src/proto/mbyte.pro Tue Sep 25 21:49:21 2001 --- src/proto/mbyte.pro Sun Nov 4 14:07:02 2001 *************** *** 55,61 **** char_u *enc_canonize __ARGS((char_u *enc)); int enc_default __ARGS((void)); void *my_iconv_open __ARGS((char_u *to, char_u *from)); ! int iconv_enabled __ARGS((void)); void iconv_end __ARGS((void)); int im_xim_isvalid_imactivate __ARGS((void)); void im_set_active __ARGS((int active)); --- 55,61 ---- char_u *enc_canonize __ARGS((char_u *enc)); int enc_default __ARGS((void)); void *my_iconv_open __ARGS((char_u *to, char_u *from)); ! int iconv_enabled __ARGS((int verbose)); void iconv_end __ARGS((void)); int im_xim_isvalid_imactivate __ARGS((void)); void im_set_active __ARGS((int active)); *** ../vim60.69/src/version.c Sun Nov 4 13:19:04 2001 --- src/version.c Sun Nov 4 14:22:24 2001 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 70, /**/ -- Engineers will go without food and hygiene for days to solve a problem. (Other times just because they forgot.) (Scott Adams - The Dilbert principle) /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ ((( Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim ))) \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///