Blame SOURCES/7.4.236

22c937
To: vim_dev@googlegroups.com
22c937
Subject: Patch 7.4.236
22c937
Fcc: outbox
22c937
From: Bram Moolenaar <Bram@moolenaar.net>
22c937
Mime-Version: 1.0
22c937
Content-Type: text/plain; charset=UTF-8
22c937
Content-Transfer-Encoding: 8bit
22c937
------------
22c937
22c937
Patch 7.4.236
22c937
Problem:    It's not that easy to check the Vim patch version.
22c937
Solution:   Make has("patch-7.4.123") work. (partly by Marc Weber)
22c937
Files:	    runtime/doc/eval.txt, src/eval.c, src/testdir/test60.in,
22c937
	    src/testdir/test60.ok
22c937
22c937
22c937
*** ../vim-7.4.235/runtime/doc/eval.txt	2014-04-01 21:00:45.440733663 +0200
22c937
--- runtime/doc/eval.txt	2014-04-01 21:19:52.232717888 +0200
22c937
***************
22c937
*** 6395,6407 ****
22c937
      Example: >
22c937
  	:if has("gui_running")
22c937
  <							*has-patch*
22c937
! 3.  Included patches.  First check |v:version| for the version of Vim.
22c937
!     Then the "patch123" feature means that patch 123 has been included for
22c937
!     this version.  Example (checking version 6.2.148 or later): >
22c937
  	:if v:version > 602 || v:version == 602 && has("patch148")
22c937
! <   Note that it's possible for patch 147 to be omitted even though 148 is
22c937
      included.
22c937
  
22c937
  all_builtin_terms	Compiled with all builtin terminals enabled.
22c937
  amiga			Amiga version of Vim.
22c937
  arabic			Compiled with Arabic support |Arabic|.
22c937
--- 6408,6430 ----
22c937
      Example: >
22c937
  	:if has("gui_running")
22c937
  <							*has-patch*
22c937
! 3.  Included patches.  The "patch123" feature means that patch 123 has been
22c937
!     included.  Note that this form does not check the version of Vim, you need
22c937
!     to inspect |v:version| for that:
22c937
!     Example (checking version 6.2.148 or later): >
22c937
  	:if v:version > 602 || v:version == 602 && has("patch148")
22c937
! <    Note that it's possible for patch 147 to be omitted even though 148 is
22c937
      included.
22c937
  
22c937
+ 4.  Beyond a certain patch level.  The "patch-7.4.123" feature means that
22c937
+     the Vim version is 7.4 and patch 123 or later was included, or the Vim
22c937
+     version is later than 7.4.
22c937
+     The example above can be simplified to: >
22c937
+ 	:if has("patch-6.2.148")
22c937
+ <    Note that this does not check if the patch was actually included, some
22c937
+     patches may have been skipped.  That is unusual though.
22c937
+ 
22c937
+ acl			Compiled with |ACL| support.
22c937
  all_builtin_terms	Compiled with all builtin terminals enabled.
22c937
  amiga			Amiga version of Vim.
22c937
  arabic			Compiled with Arabic support |Arabic|.
22c937
*** ../vim-7.4.235/src/eval.c	2014-04-01 21:00:45.428733664 +0200
22c937
--- src/eval.c	2014-04-01 21:50:59.084692208 +0200
22c937
***************
22c937
*** 12638,12644 ****
22c937
      if (n == FALSE)
22c937
      {
22c937
  	if (STRNICMP(name, "patch", 5) == 0)
22c937
! 	    n = has_patch(atoi((char *)name + 5));
22c937
  	else if (STRICMP(name, "vim_starting") == 0)
22c937
  	    n = (starting != 0);
22c937
  #ifdef FEAT_MBYTE
22c937
--- 12638,12664 ----
22c937
      if (n == FALSE)
22c937
      {
22c937
  	if (STRNICMP(name, "patch", 5) == 0)
22c937
! 	{
22c937
! 	    if (name[5] == '-'
22c937
! 		    && STRLEN(name) > 11
22c937
! 		    && vim_isdigit(name[6])
22c937
! 		    && vim_isdigit(name[8])
22c937
! 		    && vim_isdigit(name[10]))
22c937
! 	    {
22c937
! 		int major = atoi((char *)name + 6);
22c937
! 		int minor = atoi((char *)name + 8);
22c937
! 		int patch = atoi((char *)name + 10);
22c937
! 
22c937
! 		/* Expect "patch-9.9.01234". */
22c937
! 		n = (major < VIM_VERSION_MAJOR
22c937
! 		     || (major == VIM_VERSION_MAJOR
22c937
! 			 && (minor < VIM_VERSION_MINOR
22c937
! 			     || (minor == VIM_VERSION_MINOR
22c937
! 				 && patch <= highest_patch()))));
22c937
! 	    }
22c937
! 	    else
22c937
! 		n = has_patch(atoi((char *)name + 5));
22c937
! 	}
22c937
  	else if (STRICMP(name, "vim_starting") == 0)
22c937
  	    n = (starting != 0);
22c937
  #ifdef FEAT_MBYTE
22c937
*** ../vim-7.4.235/src/testdir/test60.in	2014-01-14 15:24:24.000000000 +0100
22c937
--- src/testdir/test60.in	2014-04-01 22:01:40.256683388 +0200
22c937
***************
22c937
*** 1,4 ****
22c937
! Tests for the exists() function.  vim: set ft=vim ts=8 :
22c937
  
22c937
  STARTTEST
22c937
  :so small.vim
22c937
--- 1,4 ----
22c937
! Tests for the exists() and has() functions.  vim: set ft=vim ts=8 sw=2 :
22c937
  
22c937
  STARTTEST
22c937
  :so small.vim
22c937
***************
22c937
*** 588,593 ****
22c937
--- 588,603 ----
22c937
      redir END
22c937
  endfunction
22c937
  :call TestExists()
22c937
+ :"
22c937
+ :function TestHas()
22c937
+   redir >> test.out
22c937
+   for pl in ['6.9.999', '7.1.999', '7.4.123', '9.1.0', '9.9.1']
22c937
+     echo 'has patch ' . pl . ': ' . has('patch-' . pl)
22c937
+   endfor
22c937
+   redir END
22c937
+ endfunc
22c937
+ :call TestHas()
22c937
+ :"
22c937
  :delfunc TestExists
22c937
  :delfunc RunTest
22c937
  :delfunc TestFuncArg
22c937
*** ../vim-7.4.235/src/testdir/test60.ok	2014-01-14 15:24:24.000000000 +0100
22c937
--- src/testdir/test60.ok	2014-04-01 22:01:46.664683300 +0200
22c937
***************
22c937
*** 204,206 ****
22c937
--- 204,211 ----
22c937
   g:footest#x = 1
22c937
     footest#F() 0
22c937
  UndefFun() 0
22c937
+ has patch 6.9.999: 1
22c937
+ has patch 7.1.999: 1
22c937
+ has patch 7.4.123: 1
22c937
+ has patch 9.1.0: 0
22c937
+ has patch 9.9.1: 0
22c937
*** ../vim-7.4.235/src/version.c	2014-04-01 21:00:45.440733663 +0200
22c937
--- src/version.c	2014-04-01 21:22:27.964715746 +0200
22c937
***************
22c937
*** 736,737 ****
22c937
--- 736,739 ----
22c937
  {   /* Add new patch number below this line */
22c937
+ /**/
22c937
+     236,
22c937
  /**/
22c937
22c937
-- 
22c937
When a fly lands on the ceiling, does it do a half roll or
22c937
a half loop?
22c937
22c937
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
22c937
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
22c937
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
22c937
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///