Skip to content

Commit

Permalink
patch 9.1.0368: MS-Windows: Hard to define the Vim Patchlevel with le…
Browse files Browse the repository at this point in the history
…ading zeroes

Problem:  MS-Windows: Hard to define the Vim Patchlevel with leading
          zeroes for the installer
Solution: re-define VIM_VERSION_PATCHLEVEL_STR with leading zeroes,
          interpret Patchlevel as decimal in Make_mvc.mak
          (RestorerZ)

closes: #14471

Signed-off-by: RestorerZ <restorer@mail2k.ru>
Signed-off-by: Christian Brabandt <cb@256bit.org>
  • Loading branch information
RestorerZ authored and chrisbra committed Apr 23, 2024
1 parent a16f251 commit dc5cd1c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Make_mvc.mak
Expand Up @@ -187,7 +187,7 @@ MINOR= 1
!ENDIF

!IF ![$(PS) $(PSFLAGS) try{Out-File -FilePath '.\patchlvl.tmp' -InputObject \
\"PATCHLEVEL=$$(((Get-Content -Path '.\version.c' \
\"PATCHLEVEL=$$([decimal^]((Get-Content -Path '.\version.c' \
-TotalCount ((Select-String -Pattern 'static int included_patches' \
-Path '.\version.c').LineNumber+3))[-1^]).Trim().TrimEnd(','))\"} \
catch{exit 1}]
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -704,6 +704,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
368,
/**/
367,
/**/
Expand Down
17 changes: 16 additions & 1 deletion src/version.h
Expand Up @@ -31,7 +31,22 @@
#ifndef VIM_VERSION_PATCHLEVEL
# define VIM_VERSION_PATCHLEVEL 0
#endif
#define VIM_VERSION_PATCHLEVEL_STR VIM_TOSTR(VIM_VERSION_PATCHLEVEL)

// Patchlevel with leading zeros
// For compatibility with the installer from "vim-win32-installer" and WinGet.
// For details see https://github.com/vim/vim-win32-installer/pull/277
// and https://github.com/vim/vim-win32-installer/pull/285
#if VIM_VERSION_PATCHLEVEL < 10
#define LEADZERO(x) 000 ## x
#elif VIM_VERSION_PATCHLEVEL < 100
#define LEADZERO(x) 00 ## x
#elif VIM_VERSION_PATCHLEVEL < 1000
#define LEADZERO(x) 0 ## x
#else
#define LEADZERO(x) x
#endif

#define VIM_VERSION_PATCHLEVEL_STR VIM_TOSTR(LEADZERO(VIM_VERSION_PATCHLEVEL))
// Used by MacOS port; should be one of: development, alpha, beta, final
#define VIM_VERSION_RELEASE final

Expand Down

0 comments on commit dc5cd1c

Please sign in to comment.