To: vim_dev@googlegroups.com Subject: Patch 8.1.0103 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.0103 Problem: Long version string cannot be translated. Solution: Build the string in init_longVersion(). Files: src/globals.h, src/version.h, src/version.c, src/proto/version.pro, src/main.c *** ../vim-8.1.0102/src/globals.h 2018-06-23 14:21:38.467484932 +0200 --- src/globals.h 2018-06-23 15:43:26.522795007 +0200 *************** *** 1131,1142 **** EXTERN char breakat_flags[256]; /* which characters are in 'breakat' */ #endif ! /* these are in version.c */ extern char *Version; #if defined(HAVE_DATE_TIME) && defined(VMS) && defined(VAXC) extern char longVersion[]; #else ! extern char *longVersion; #endif /* --- 1131,1142 ---- EXTERN char breakat_flags[256]; /* which characters are in 'breakat' */ #endif ! /* These are in version.c, call init_longVersion() before use. */ extern char *Version; #if defined(HAVE_DATE_TIME) && defined(VMS) && defined(VAXC) extern char longVersion[]; #else ! EXTERN char *longVersion; #endif /* *** ../vim-8.1.0102/src/version.h 2018-05-17 13:33:02.000000000 +0200 --- src/version.h 2018-06-23 15:35:20.481563682 +0200 *************** *** 36,40 **** #define VIM_VERSION_NODOT "vim81" #define VIM_VERSION_SHORT "8.1" #define VIM_VERSION_MEDIUM "8.1" ! #define VIM_VERSION_LONG "VIM - Vi IMproved 8.1 (2018 May 18)" ! #define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 8.1 (2018 May 18, compiled " --- 36,42 ---- #define VIM_VERSION_NODOT "vim81" #define VIM_VERSION_SHORT "8.1" #define VIM_VERSION_MEDIUM "8.1" ! #define VIM_VERSION_LONG "VIM - Vi IMproved 8.1 (2018 May 18)" ! #define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 8.1 (2018 May 18, compiled " ! #define VIM_VERSION_LONG_ONLY "VIM - Vi IMproved 8.1" ! #define VIM_VERSION_DATE_ONLY "2018 May 18" *** ../vim-8.1.0102/src/version.c 2018-06-23 15:09:02.351412460 +0200 --- src/version.c 2018-06-23 16:11:00.128696631 +0200 *************** *** 37,43 **** + sizeof(__TIME__) + 3]; void ! make_version(void) { /* * Construct the long version string. Necessary because --- 37,43 ---- + sizeof(__TIME__) + 3]; void ! init_longVersion(void) { /* * Construct the long version string. Necessary because *************** *** 49,56 **** strcat(longVersion, __TIME__); strcat(longVersion, ")"); } # else ! char *longVersion = VIM_VERSION_LONG_DATE __DATE__ " " __TIME__ ")"; # endif #else char *longVersion = VIM_VERSION_LONG; --- 49,73 ---- strcat(longVersion, __TIME__); strcat(longVersion, ")"); } + # else ! void ! init_longVersion(void) ! { ! char *date_time = __DATE__ " " __TIME__; ! char *msg = _("%s (%s, compiled %s)"); ! size_t len = strlen(msg) ! + strlen(VIM_VERSION_LONG_ONLY) ! + strlen(VIM_VERSION_DATE_ONLY) ! + strlen(date_time); ! ! longVersion = (char *)alloc(len); ! if (longVersion == NULL) ! longVersion = VIM_VERSION_LONG; ! else ! vim_snprintf(longVersion, len, msg, ! VIM_VERSION_LONG_ONLY, VIM_VERSION_DATE_ONLY, date_time); ! } # endif #else char *longVersion = VIM_VERSION_LONG; *************** *** 1148,1153 **** --- 1167,1173 ---- * When adding features here, don't forget to update the list of * internal variables in eval.c! */ + init_longVersion(); MSG(longVersion); #ifdef WIN3264 # ifdef FEAT_GUI_W32 *** ../vim-8.1.0102/src/proto/version.pro 2018-05-17 13:52:55.000000000 +0200 --- src/proto/version.pro 2018-06-23 15:40:19.395834338 +0200 *************** *** 1,5 **** /* version.c */ ! void make_version(void); int highest_patch(void); int has_patch(int n); void ex_version(exarg_T *eap); --- 1,5 ---- /* version.c */ ! void init_longVersion(void); int highest_patch(void); int has_patch(int n); void ex_version(exarg_T *eap); *** ../vim-8.1.0102/src/main.c 2018-06-21 21:38:29.599534681 +0200 --- src/main.c 2018-06-23 15:31:50.962855677 +0200 *************** *** 940,949 **** /* Init the table of Normal mode commands. */ init_normal_cmds(); - #if defined(HAVE_DATE_TIME) && defined(VMS) && defined(VAXC) - make_version(); /* Construct the long version string. */ - #endif - /* * Allocate space for the generic buffers (needed for set_init_1() and * EMSG2()). --- 940,945 ---- *************** *** 3215,3220 **** --- 3211,3217 ---- reset_signals(); /* kill us with CTRL-C here, if you like */ #endif + init_longVersion(); mch_errmsg(longVersion); mch_errmsg("\n"); mch_errmsg(_(main_errors[n])); *************** *** 3268,3273 **** --- 3265,3271 ---- reset_signals(); /* kill us with CTRL-C here, if you like */ #endif + init_longVersion(); mch_msg(longVersion); mch_msg(_("\n\nUsage:")); for (i = 0; ; ++i) *** ../vim-8.1.0102/src/version.c 2018-06-23 15:09:02.351412460 +0200 --- src/version.c 2018-06-23 16:11:00.128696631 +0200 *************** *** 763,764 **** --- 780,783 ---- { /* Add new patch number below this line */ + /**/ + 103, /**/ -- From "know your smileys": |-( Contact lenses, but has lost them /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///