|
Karsten Hopp |
e0b256 |
To: vim_dev@googlegroups.com
|
|
Karsten Hopp |
e0b256 |
Subject: Patch 7.3.253
|
|
Karsten Hopp |
e0b256 |
Fcc: outbox
|
|
Karsten Hopp |
e0b256 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
e0b256 |
Mime-Version: 1.0
|
|
Karsten Hopp |
e0b256 |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
e0b256 |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
e0b256 |
------------
|
|
Karsten Hopp |
e0b256 |
|
|
Karsten Hopp |
e0b256 |
Patch 7.3.253
|
|
Karsten Hopp |
e0b256 |
Problem: "echo 'abc' > ''" returns 0 or 1, depending on 'ignorecase'.
|
|
Karsten Hopp |
e0b256 |
Checks in mb_strnicmp() for illegal and truncated bytes are
|
|
Karsten Hopp |
e0b256 |
wrong. Should not assume that byte length is equal before case
|
|
Karsten Hopp |
e0b256 |
folding.
|
|
Karsten Hopp |
e0b256 |
Solution: Add utf_safe_read_char_adv() and utf_strnicmp(). Add a test for
|
|
Karsten Hopp |
e0b256 |
this. (Ivan Krasilnikov)
|
|
Karsten Hopp |
e0b256 |
Files: src/mbyte.c src/testdir/test82.in, src/testdir/test82.ok,
|
|
Karsten Hopp |
e0b256 |
src/testdir/Makefile, src/testdir/Make_amiga.mak,
|
|
Karsten Hopp |
e0b256 |
src/testdir/Make_dos.mak, src/testdir/Make_ming.mak,
|
|
Karsten Hopp |
e0b256 |
src/testdir/Make_os2.mak, src/testdir/Make_vms.mms
|
|
Karsten Hopp |
e0b256 |
|
|
Karsten Hopp |
e0b256 |
|
|
Karsten Hopp |
e0b256 |
*** ../vim-7.3.252/src/mbyte.c 2011-07-07 15:08:53.000000000 +0200
|
|
Karsten Hopp |
e0b256 |
--- src/mbyte.c 2011-07-15 20:13:52.000000000 +0200
|
|
Karsten Hopp |
e0b256 |
***************
|
|
Karsten Hopp |
e0b256 |
*** 132,137 ****
|
|
Karsten Hopp |
e0b256 |
--- 132,138 ----
|
|
Karsten Hopp |
e0b256 |
static int dbcs_char2cells __ARGS((int c));
|
|
Karsten Hopp |
e0b256 |
static int dbcs_ptr2cells_len __ARGS((char_u *p, int size));
|
|
Karsten Hopp |
e0b256 |
static int dbcs_ptr2char __ARGS((char_u *p));
|
|
Karsten Hopp |
e0b256 |
+ static int utf_safe_read_char_adv __ARGS((char_u **s, size_t *n));
|
|
Karsten Hopp |
e0b256 |
|
|
Karsten Hopp |
e0b256 |
/*
|
|
Karsten Hopp |
e0b256 |
* Lookup table to quickly get the length in bytes of a UTF-8 character from
|
|
Karsten Hopp |
e0b256 |
***************
|
|
Karsten Hopp |
e0b256 |
*** 1701,1706 ****
|
|
Karsten Hopp |
e0b256 |
--- 1702,1767 ----
|
|
Karsten Hopp |
e0b256 |
}
|
|
Karsten Hopp |
e0b256 |
|
|
Karsten Hopp |
e0b256 |
/*
|
|
Karsten Hopp |
e0b256 |
+ * Convert a UTF-8 byte sequence to a wide character.
|
|
Karsten Hopp |
e0b256 |
+ * String is assumed to be terminated by NUL or after "n" bytes, whichever
|
|
Karsten Hopp |
e0b256 |
+ * comes first.
|
|
Karsten Hopp |
e0b256 |
+ * The function is safe in the sense that it never accesses memory beyond the
|
|
Karsten Hopp |
e0b256 |
+ * first "n" bytes of "s".
|
|
Karsten Hopp |
e0b256 |
+ *
|
|
Karsten Hopp |
e0b256 |
+ * On success, returns decoded codepoint, advances "s" to the beginning of
|
|
Karsten Hopp |
e0b256 |
+ * next character and decreases "n" accordingly.
|
|
Karsten Hopp |
e0b256 |
+ *
|
|
Karsten Hopp |
e0b256 |
+ * If end of string was reached, returns 0 and, if "n" > 0, advances "s" past
|
|
Karsten Hopp |
e0b256 |
+ * NUL byte.
|
|
Karsten Hopp |
e0b256 |
+ *
|
|
Karsten Hopp |
e0b256 |
+ * If byte sequence is illegal or incomplete, returns -1 and does not advance
|
|
Karsten Hopp |
e0b256 |
+ * "s".
|
|
Karsten Hopp |
e0b256 |
+ */
|
|
Karsten Hopp |
e0b256 |
+ static int
|
|
Karsten Hopp |
e0b256 |
+ utf_safe_read_char_adv(s, n)
|
|
Karsten Hopp |
e0b256 |
+ char_u **s;
|
|
Karsten Hopp |
e0b256 |
+ size_t *n;
|
|
Karsten Hopp |
e0b256 |
+ {
|
|
Karsten Hopp |
e0b256 |
+ int c, k;
|
|
Karsten Hopp |
e0b256 |
+
|
|
Karsten Hopp |
e0b256 |
+ if (*n == 0) /* end of buffer */
|
|
Karsten Hopp |
e0b256 |
+ return 0;
|
|
Karsten Hopp |
e0b256 |
+
|
|
Karsten Hopp |
e0b256 |
+ k = utf8len_tab_zero[**s];
|
|
Karsten Hopp |
e0b256 |
+
|
|
Karsten Hopp |
e0b256 |
+ if (k == 1)
|
|
Karsten Hopp |
e0b256 |
+ {
|
|
Karsten Hopp |
e0b256 |
+ /* ASCII character or NUL */
|
|
Karsten Hopp |
e0b256 |
+ (*n)--;
|
|
Karsten Hopp |
e0b256 |
+ return *(*s)++;
|
|
Karsten Hopp |
e0b256 |
+ }
|
|
Karsten Hopp |
e0b256 |
+
|
|
Karsten Hopp |
e0b256 |
+ if ((size_t)k <= *n)
|
|
Karsten Hopp |
e0b256 |
+ {
|
|
Karsten Hopp |
e0b256 |
+ /* We have a multibyte sequence and it isn't truncated by buffer
|
|
Karsten Hopp |
e0b256 |
+ * limits so utf_ptr2char() is safe to use. Or the first byte is
|
|
Karsten Hopp |
e0b256 |
+ * illegal (k=0), and it's also safe to use utf_ptr2char(). */
|
|
Karsten Hopp |
e0b256 |
+ c = utf_ptr2char(*s);
|
|
Karsten Hopp |
e0b256 |
+
|
|
Karsten Hopp |
e0b256 |
+ /* On failure, utf_ptr2char() returns the first byte, so here we
|
|
Karsten Hopp |
e0b256 |
+ * check equality with the first byte. The only non-ASCII character
|
|
Karsten Hopp |
e0b256 |
+ * which equals the first byte of its own UTF-8 representation is
|
|
Karsten Hopp |
e0b256 |
+ * U+00C3 (UTF-8: 0xC3 0x83), so need to check that special case too.
|
|
Karsten Hopp |
e0b256 |
+ * It's safe even if n=1, else we would have k=2 > n. */
|
|
Karsten Hopp |
e0b256 |
+ if (c != (int)(**s) || (c == 0xC3 && (*s)[1] == 0x83))
|
|
Karsten Hopp |
e0b256 |
+ {
|
|
Karsten Hopp |
e0b256 |
+ /* byte sequence was successfully decoded */
|
|
Karsten Hopp |
e0b256 |
+ *s += k;
|
|
Karsten Hopp |
e0b256 |
+ *n -= k;
|
|
Karsten Hopp |
e0b256 |
+ return c;
|
|
Karsten Hopp |
e0b256 |
+ }
|
|
Karsten Hopp |
e0b256 |
+ }
|
|
Karsten Hopp |
e0b256 |
+
|
|
Karsten Hopp |
e0b256 |
+ /* byte sequence is incomplete or illegal */
|
|
Karsten Hopp |
e0b256 |
+ return -1;
|
|
Karsten Hopp |
e0b256 |
+ }
|
|
Karsten Hopp |
e0b256 |
+
|
|
Karsten Hopp |
e0b256 |
+ /*
|
|
Karsten Hopp |
e0b256 |
* Get character at **pp and advance *pp to the next character.
|
|
Karsten Hopp |
e0b256 |
* Note: composing characters are skipped!
|
|
Karsten Hopp |
e0b256 |
*/
|
|
Karsten Hopp |
e0b256 |
***************
|
|
Karsten Hopp |
e0b256 |
*** 2667,2673 ****
|
|
Karsten Hopp |
e0b256 |
{0x10400,0x10427,1,40}
|
|
Karsten Hopp |
e0b256 |
};
|
|
Karsten Hopp |
e0b256 |
|
|
Karsten Hopp |
e0b256 |
! static int utf_convert(int a, convertStruct table[], int tableSize);
|
|
Karsten Hopp |
e0b256 |
|
|
Karsten Hopp |
e0b256 |
/*
|
|
Karsten Hopp |
e0b256 |
* Generic conversion function for case operations.
|
|
Karsten Hopp |
e0b256 |
--- 2728,2735 ----
|
|
Karsten Hopp |
e0b256 |
{0x10400,0x10427,1,40}
|
|
Karsten Hopp |
e0b256 |
};
|
|
Karsten Hopp |
e0b256 |
|
|
Karsten Hopp |
e0b256 |
! static int utf_convert __ARGS((int a, convertStruct table[], int tableSize));
|
|
Karsten Hopp |
e0b256 |
! static int utf_strnicmp __ARGS((char_u *s1, char_u *s2, size_t n1, size_t n2));
|
|
Karsten Hopp |
e0b256 |
|
|
Karsten Hopp |
e0b256 |
/*
|
|
Karsten Hopp |
e0b256 |
* Generic conversion function for case operations.
|
|
Karsten Hopp |
e0b256 |
***************
|
|
Karsten Hopp |
e0b256 |
*** 3079,3084 ****
|
|
Karsten Hopp |
e0b256 |
--- 3141,3220 ----
|
|
Karsten Hopp |
e0b256 |
return (utf_tolower(a) != a);
|
|
Karsten Hopp |
e0b256 |
}
|
|
Karsten Hopp |
e0b256 |
|
|
Karsten Hopp |
e0b256 |
+ static int
|
|
Karsten Hopp |
e0b256 |
+ utf_strnicmp(s1, s2, n1, n2)
|
|
Karsten Hopp |
e0b256 |
+ char_u *s1, *s2;
|
|
Karsten Hopp |
e0b256 |
+ size_t n1, n2;
|
|
Karsten Hopp |
e0b256 |
+ {
|
|
Karsten Hopp |
e0b256 |
+ int c1, c2, cdiff;
|
|
Karsten Hopp |
e0b256 |
+ char_u buffer[6];
|
|
Karsten Hopp |
e0b256 |
+
|
|
Karsten Hopp |
e0b256 |
+ for (;;)
|
|
Karsten Hopp |
e0b256 |
+ {
|
|
Karsten Hopp |
e0b256 |
+ c1 = utf_safe_read_char_adv(&s1, &n1;;
|
|
Karsten Hopp |
e0b256 |
+ c2 = utf_safe_read_char_adv(&s2, &n2;;
|
|
Karsten Hopp |
e0b256 |
+
|
|
Karsten Hopp |
e0b256 |
+ if (c1 <= 0 || c2 <= 0)
|
|
Karsten Hopp |
e0b256 |
+ break;
|
|
Karsten Hopp |
e0b256 |
+
|
|
Karsten Hopp |
e0b256 |
+ if (c1 == c2)
|
|
Karsten Hopp |
e0b256 |
+ continue;
|
|
Karsten Hopp |
e0b256 |
+
|
|
Karsten Hopp |
e0b256 |
+ cdiff = utf_fold(c1) - utf_fold(c2);
|
|
Karsten Hopp |
e0b256 |
+ if (cdiff != 0)
|
|
Karsten Hopp |
e0b256 |
+ return cdiff;
|
|
Karsten Hopp |
e0b256 |
+ }
|
|
Karsten Hopp |
e0b256 |
+
|
|
Karsten Hopp |
e0b256 |
+ /* some string ended or has an incomplete/illegal character sequence */
|
|
Karsten Hopp |
e0b256 |
+
|
|
Karsten Hopp |
e0b256 |
+ if (c1 == 0 || c2 == 0)
|
|
Karsten Hopp |
e0b256 |
+ {
|
|
Karsten Hopp |
e0b256 |
+ /* some string ended. shorter string is smaller */
|
|
Karsten Hopp |
e0b256 |
+ if (c1 == 0 && c2 == 0)
|
|
Karsten Hopp |
e0b256 |
+ return 0;
|
|
Karsten Hopp |
e0b256 |
+ return c1 == 0 ? -1 : 1;
|
|
Karsten Hopp |
e0b256 |
+ }
|
|
Karsten Hopp |
e0b256 |
+
|
|
Karsten Hopp |
e0b256 |
+ /* Continue with bytewise comparison to produce some result that
|
|
Karsten Hopp |
e0b256 |
+ * would make comparison operations involving this function transitive.
|
|
Karsten Hopp |
e0b256 |
+ *
|
|
Karsten Hopp |
e0b256 |
+ * If only one string had an error, comparison should be made with
|
|
Karsten Hopp |
e0b256 |
+ * folded version of the other string. In this case it is enough
|
|
Karsten Hopp |
e0b256 |
+ * to fold just one character to determine the result of comparison. */
|
|
Karsten Hopp |
e0b256 |
+
|
|
Karsten Hopp |
e0b256 |
+ if (c1 != -1 && c2 == -1)
|
|
Karsten Hopp |
e0b256 |
+ {
|
|
Karsten Hopp |
e0b256 |
+ n1 = utf_char2bytes(utf_fold(c1), buffer);
|
|
Karsten Hopp |
e0b256 |
+ s1 = buffer;
|
|
Karsten Hopp |
e0b256 |
+ }
|
|
Karsten Hopp |
e0b256 |
+ else if (c2 != -1 && c1 == -1)
|
|
Karsten Hopp |
e0b256 |
+ {
|
|
Karsten Hopp |
e0b256 |
+ n2 = utf_char2bytes(utf_fold(c2), buffer);
|
|
Karsten Hopp |
e0b256 |
+ s2 = buffer;
|
|
Karsten Hopp |
e0b256 |
+ }
|
|
Karsten Hopp |
e0b256 |
+
|
|
Karsten Hopp |
e0b256 |
+ while (n1 > 0 && n2 > 0 && *s1 != NUL && *s2 != NUL)
|
|
Karsten Hopp |
e0b256 |
+ {
|
|
Karsten Hopp |
e0b256 |
+ cdiff = (int)(*s1) - (int)(*s2);
|
|
Karsten Hopp |
e0b256 |
+ if (cdiff != 0)
|
|
Karsten Hopp |
e0b256 |
+ return cdiff;
|
|
Karsten Hopp |
e0b256 |
+
|
|
Karsten Hopp |
e0b256 |
+ s1++;
|
|
Karsten Hopp |
e0b256 |
+ s2++;
|
|
Karsten Hopp |
e0b256 |
+ n1--;
|
|
Karsten Hopp |
e0b256 |
+ n2--;
|
|
Karsten Hopp |
e0b256 |
+ }
|
|
Karsten Hopp |
e0b256 |
+
|
|
Karsten Hopp |
e0b256 |
+ if (n1 > 0 && *s1 == NUL)
|
|
Karsten Hopp |
e0b256 |
+ n1 = 0;
|
|
Karsten Hopp |
e0b256 |
+ if (n2 > 0 && *s2 == NUL)
|
|
Karsten Hopp |
e0b256 |
+ n2 = 0;
|
|
Karsten Hopp |
e0b256 |
+
|
|
Karsten Hopp |
e0b256 |
+ if (n1 == 0 && n2 == 0)
|
|
Karsten Hopp |
e0b256 |
+ return 0;
|
|
Karsten Hopp |
e0b256 |
+ return n1 == 0 ? -1 : 1;
|
|
Karsten Hopp |
e0b256 |
+ }
|
|
Karsten Hopp |
e0b256 |
+
|
|
Karsten Hopp |
e0b256 |
/*
|
|
Karsten Hopp |
e0b256 |
* Version of strnicmp() that handles multi-byte characters.
|
|
Karsten Hopp |
e0b256 |
* Needed for Big5, Sjift-JIS and UTF-8 encoding. Other DBCS encodings can
|
|
Karsten Hopp |
e0b256 |
***************
|
|
Karsten Hopp |
e0b256 |
*** 3092,3140 ****
|
|
Karsten Hopp |
e0b256 |
char_u *s1, *s2;
|
|
Karsten Hopp |
e0b256 |
size_t nn;
|
|
Karsten Hopp |
e0b256 |
{
|
|
Karsten Hopp |
e0b256 |
! int i, j, l;
|
|
Karsten Hopp |
e0b256 |
int cdiff;
|
|
Karsten Hopp |
e0b256 |
- int incomplete = FALSE;
|
|
Karsten Hopp |
e0b256 |
int n = (int)nn;
|
|
Karsten Hopp |
e0b256 |
|
|
Karsten Hopp |
e0b256 |
! for (i = 0; i < n; i += l)
|
|
Karsten Hopp |
e0b256 |
{
|
|
Karsten Hopp |
e0b256 |
! if (s1[i] == NUL && s2[i] == NUL) /* both strings end */
|
|
Karsten Hopp |
e0b256 |
! return 0;
|
|
Karsten Hopp |
e0b256 |
! if (enc_utf8)
|
|
Karsten Hopp |
e0b256 |
! {
|
|
Karsten Hopp |
e0b256 |
! l = utf_byte2len(s1[i]);
|
|
Karsten Hopp |
e0b256 |
! if (l > n - i)
|
|
Karsten Hopp |
e0b256 |
! {
|
|
Karsten Hopp |
e0b256 |
! l = n - i; /* incomplete character */
|
|
Karsten Hopp |
e0b256 |
! incomplete = TRUE;
|
|
Karsten Hopp |
e0b256 |
! }
|
|
Karsten Hopp |
e0b256 |
! /* Check directly first, it's faster. */
|
|
Karsten Hopp |
e0b256 |
! for (j = 0; j < l; ++j)
|
|
Karsten Hopp |
e0b256 |
! {
|
|
Karsten Hopp |
e0b256 |
! if (s1[i + j] != s2[i + j])
|
|
Karsten Hopp |
e0b256 |
! break;
|
|
Karsten Hopp |
e0b256 |
! if (s1[i + j] == 0)
|
|
Karsten Hopp |
e0b256 |
! /* Both stings have the same bytes but are incomplete or
|
|
Karsten Hopp |
e0b256 |
! * have illegal bytes, accept them as equal. */
|
|
Karsten Hopp |
e0b256 |
! l = j;
|
|
Karsten Hopp |
e0b256 |
! }
|
|
Karsten Hopp |
e0b256 |
! if (j < l)
|
|
Karsten Hopp |
e0b256 |
! {
|
|
Karsten Hopp |
e0b256 |
! /* If one of the two characters is incomplete return -1. */
|
|
Karsten Hopp |
e0b256 |
! if (incomplete || i + utf_byte2len(s2[i]) > n)
|
|
Karsten Hopp |
e0b256 |
! return -1;
|
|
Karsten Hopp |
e0b256 |
! /* Don't case-fold illegal bytes or truncated characters. */
|
|
Karsten Hopp |
e0b256 |
! if (utf_ptr2len(s1 + i) < l || utf_ptr2len(s2 + i) < l)
|
|
Karsten Hopp |
e0b256 |
! return -1;
|
|
Karsten Hopp |
e0b256 |
! cdiff = utf_fold(utf_ptr2char(s1 + i))
|
|
Karsten Hopp |
e0b256 |
! - utf_fold(utf_ptr2char(s2 + i));
|
|
Karsten Hopp |
e0b256 |
! if (cdiff != 0)
|
|
Karsten Hopp |
e0b256 |
! return cdiff;
|
|
Karsten Hopp |
e0b256 |
! }
|
|
Karsten Hopp |
e0b256 |
! }
|
|
Karsten Hopp |
e0b256 |
! else
|
|
Karsten Hopp |
e0b256 |
{
|
|
Karsten Hopp |
e0b256 |
l = (*mb_ptr2len)(s1 + i);
|
|
Karsten Hopp |
e0b256 |
if (l <= 1)
|
|
Karsten Hopp |
e0b256 |
{
|
|
Karsten Hopp |
e0b256 |
--- 3228,3248 ----
|
|
Karsten Hopp |
e0b256 |
char_u *s1, *s2;
|
|
Karsten Hopp |
e0b256 |
size_t nn;
|
|
Karsten Hopp |
e0b256 |
{
|
|
Karsten Hopp |
e0b256 |
! int i, l;
|
|
Karsten Hopp |
e0b256 |
int cdiff;
|
|
Karsten Hopp |
e0b256 |
int n = (int)nn;
|
|
Karsten Hopp |
e0b256 |
|
|
Karsten Hopp |
e0b256 |
! if (enc_utf8)
|
|
Karsten Hopp |
e0b256 |
{
|
|
Karsten Hopp |
e0b256 |
! return utf_strnicmp(s1, s2, nn, nn);
|
|
Karsten Hopp |
e0b256 |
! }
|
|
Karsten Hopp |
e0b256 |
! else
|
|
Karsten Hopp |
e0b256 |
! {
|
|
Karsten Hopp |
e0b256 |
! for (i = 0; i < n; i += l)
|
|
Karsten Hopp |
e0b256 |
{
|
|
Karsten Hopp |
e0b256 |
+ if (s1[i] == NUL && s2[i] == NUL) /* both strings end */
|
|
Karsten Hopp |
e0b256 |
+ return 0;
|
|
Karsten Hopp |
e0b256 |
+
|
|
Karsten Hopp |
e0b256 |
l = (*mb_ptr2len)(s1 + i);
|
|
Karsten Hopp |
e0b256 |
if (l <= 1)
|
|
Karsten Hopp |
e0b256 |
{
|
|
Karsten Hopp |
e0b256 |
*** ../vim-7.3.252/src/testdir/test82.in 2011-07-15 21:16:03.000000000 +0200
|
|
Karsten Hopp |
e0b256 |
--- src/testdir/test82.in 2011-07-15 18:22:46.000000000 +0200
|
|
Karsten Hopp |
e0b256 |
***************
|
|
Karsten Hopp |
e0b256 |
*** 0 ****
|
|
Karsten Hopp |
e0b256 |
--- 1,93 ----
|
|
Karsten Hopp |
e0b256 |
+ Tests for case-insensitive UTF-8 comparisons (utf_strnicmp() in mbyte.c)
|
|
Karsten Hopp |
e0b256 |
+
|
|
Karsten Hopp |
e0b256 |
+ STARTTEST
|
|
Karsten Hopp |
e0b256 |
+ :so small.vim
|
|
Karsten Hopp |
e0b256 |
+ :if !has("multi_byte")
|
|
Karsten Hopp |
e0b256 |
+ : e! test.ok
|
|
Karsten Hopp |
e0b256 |
+ : w! test.out
|
|
Karsten Hopp |
e0b256 |
+ : qa!
|
|
Karsten Hopp |
e0b256 |
+ :endif
|
|
Karsten Hopp |
e0b256 |
+ :set enc=utf8
|
|
Karsten Hopp |
e0b256 |
+ ggdG
|
|
Karsten Hopp |
e0b256 |
+ :
|
|
Karsten Hopp |
e0b256 |
+ :function! Ch(a, op, b, expected)
|
|
Karsten Hopp |
e0b256 |
+ : if eval(printf('"%s" %s "%s"', a:a, a:op, a:b)) != a:expected
|
|
Karsten Hopp |
e0b256 |
+ : call append(line('$'), printf('"%s" %s "%s" should return %d', a:a, a:op, a:b, a:expected))
|
|
Karsten Hopp |
e0b256 |
+ : else
|
|
Karsten Hopp |
e0b256 |
+ : let b:passed += 1
|
|
Karsten Hopp |
e0b256 |
+ : endif
|
|
Karsten Hopp |
e0b256 |
+ :endfunction
|
|
Karsten Hopp |
e0b256 |
+ :
|
|
Karsten Hopp |
e0b256 |
+ :function! Chk(a, b, result)
|
|
Karsten Hopp |
e0b256 |
+ : if a:result == 0
|
|
Karsten Hopp |
e0b256 |
+ : call Ch(a:a, '==?', a:b, 1)
|
|
Karsten Hopp |
e0b256 |
+ : call Ch(a:a, '!=?', a:b, 0)
|
|
Karsten Hopp |
e0b256 |
+ : call Ch(a:a, '<=?', a:b, 1)
|
|
Karsten Hopp |
e0b256 |
+ : call Ch(a:a, '>=?', a:b, 1)
|
|
Karsten Hopp |
e0b256 |
+ : call Ch(a:a, '
|
|
Karsten Hopp |
e0b256 |
+ : call Ch(a:a, '>?', a:b, 0)
|
|
Karsten Hopp |
e0b256 |
+ : elseif a:result > 0
|
|
Karsten Hopp |
e0b256 |
+ : call Ch(a:a, '==?', a:b, 0)
|
|
Karsten Hopp |
e0b256 |
+ : call Ch(a:a, '!=?', a:b, 1)
|
|
Karsten Hopp |
e0b256 |
+ : call Ch(a:a, '<=?', a:b, 0)
|
|
Karsten Hopp |
e0b256 |
+ : call Ch(a:a, '>=?', a:b, 1)
|
|
Karsten Hopp |
e0b256 |
+ : call Ch(a:a, '
|
|
Karsten Hopp |
e0b256 |
+ : call Ch(a:a, '>?', a:b, 1)
|
|
Karsten Hopp |
e0b256 |
+ : else
|
|
Karsten Hopp |
e0b256 |
+ : call Ch(a:a, '==?', a:b, 0)
|
|
Karsten Hopp |
e0b256 |
+ : call Ch(a:a, '!=?', a:b, 1)
|
|
Karsten Hopp |
e0b256 |
+ : call Ch(a:a, '<=?', a:b, 1)
|
|
Karsten Hopp |
e0b256 |
+ : call Ch(a:a, '>=?', a:b, 0)
|
|
Karsten Hopp |
e0b256 |
+ : call Ch(a:a, '
|
|
Karsten Hopp |
e0b256 |
+ : call Ch(a:a, '>?', a:b, 0)
|
|
Karsten Hopp |
e0b256 |
+ : endif
|
|
Karsten Hopp |
e0b256 |
+ :endfunction
|
|
Karsten Hopp |
e0b256 |
+ :
|
|
Karsten Hopp |
e0b256 |
+ :function! Check(a, b, result)
|
|
Karsten Hopp |
e0b256 |
+ : call Chk(a:a, a:b, a:result)
|
|
Karsten Hopp |
e0b256 |
+ : call Chk(a:b, a:a, -a:result)
|
|
Karsten Hopp |
e0b256 |
+ :endfunction
|
|
Karsten Hopp |
e0b256 |
+ :
|
|
Karsten Hopp |
e0b256 |
+ :function! LT(a, b)
|
|
Karsten Hopp |
e0b256 |
+ : call Check(a:a, a:b, -1)
|
|
Karsten Hopp |
e0b256 |
+ :endfunction
|
|
Karsten Hopp |
e0b256 |
+ :
|
|
Karsten Hopp |
e0b256 |
+ :function! GT(a, b)
|
|
Karsten Hopp |
e0b256 |
+ : call Check(a:a, a:b, 1)
|
|
Karsten Hopp |
e0b256 |
+ :endfunction
|
|
Karsten Hopp |
e0b256 |
+ :
|
|
Karsten Hopp |
e0b256 |
+ :function! EQ(a, b)
|
|
Karsten Hopp |
e0b256 |
+ : call Check(a:a, a:b, 0)
|
|
Karsten Hopp |
e0b256 |
+ :endfunction
|
|
Karsten Hopp |
e0b256 |
+ :
|
|
Karsten Hopp |
e0b256 |
+ :let b:passed=0
|
|
Karsten Hopp |
e0b256 |
+ :call EQ('', '')
|
|
Karsten Hopp |
e0b256 |
+ :call LT('', 'a')
|
|
Karsten Hopp |
e0b256 |
+ :call EQ('abc', 'abc')
|
|
Karsten Hopp |
e0b256 |
+ :call EQ('Abc', 'abC')
|
|
Karsten Hopp |
e0b256 |
+ :call LT('ab', 'abc')
|
|
Karsten Hopp |
e0b256 |
+ :call LT('AB', 'abc')
|
|
Karsten Hopp |
e0b256 |
+ :call LT('ab', 'aBc')
|
|
Karsten Hopp |
e0b256 |
+ :call EQ('\xd0\xb9\xd1\x86\xd1\x83\xd0\xba\xd0\xb5\xd0\xbd', '\xd0\xb9\xd0\xa6\xd0\xa3\xd0\xba\xd0\x95\xd0\xbd')
|
|
Karsten Hopp |
e0b256 |
+ :call LT('\xd0\xb9\xd1\x86\xd1\x83\xd0\xba\xd0\xb5\xd0\xbd', '\xd0\xaf\xd1\x86\xd1\x83\xd0\xba\xd0\xb5\xd0\xbd')
|
|
Karsten Hopp |
e0b256 |
+ :call EQ('\xe2\x84\xaa', 'k')
|
|
Karsten Hopp |
e0b256 |
+ :call LT('\xe2\x84\xaa', 'kkkkkk')
|
|
Karsten Hopp |
e0b256 |
+ :call EQ('\xe2\x84\xaa\xe2\x84\xaa\xe2\x84\xaa', 'kkk')
|
|
Karsten Hopp |
e0b256 |
+ :call LT('kk', '\xe2\x84\xaa\xe2\x84\xaa\xe2\x84\xaa')
|
|
Karsten Hopp |
e0b256 |
+ :call EQ('\xe2\x84\xaa\xe2\x84\xa6k\xe2\x84\xaak\xcf\x89', 'k\xcf\x89\xe2\x84\xaakk\xe2\x84\xa6')
|
|
Karsten Hopp |
e0b256 |
+ :call EQ('Abc\x80', 'AbC\x80')
|
|
Karsten Hopp |
e0b256 |
+ :call LT('Abc\x80', 'AbC\x81')
|
|
Karsten Hopp |
e0b256 |
+ :call LT('Abc', 'AbC\x80')
|
|
Karsten Hopp |
e0b256 |
+ :call LT('abc\x80DEF', 'abc\x80def') " case folding stops at the first bad character
|
|
Karsten Hopp |
e0b256 |
+ :call LT('\xc3XYZ', '\xc3xyz')
|
|
Karsten Hopp |
e0b256 |
+ :call EQ('\xef\xbc\xba', '\xef\xbd\x9a') " FF3A (upper), FF5A (lower)
|
|
Karsten Hopp |
e0b256 |
+ :call GT('\xef\xbc\xba', '\xef\xbc\xff') " first string is ok and equals \xef\xbd\x9a after folding, second string is illegal and was left unchanged, then the strings were bytewise compared
|
|
Karsten Hopp |
e0b256 |
+ :call LT('\xc3', '\xc3\x83')
|
|
Karsten Hopp |
e0b256 |
+ :call EQ('\xc3\xa3xYz', '\xc3\x83XyZ')
|
|
Karsten Hopp |
e0b256 |
+ :for n in range(0x60, 0xFF) | call LT(printf('xYz\x%.2X', n-1), printf('XyZ\x%.2X', n)) | endfor
|
|
Karsten Hopp |
e0b256 |
+ :for n in range(0x80, 0xBF) | call EQ(printf('xYz\xc2\x%.2XUvW', n), printf('XyZ\xc2\x%.2XuVw', n)) | endfor
|
|
Karsten Hopp |
e0b256 |
+ :for n in range(0xC0, 0xFF) | call LT(printf('xYz\xc2\x%.2XUvW', n), printf('XyZ\xc2\x%.2XuVw', n)) | endfor
|
|
Karsten Hopp |
e0b256 |
+ :call append(0, printf('%d checks passed', b:passed))
|
|
Karsten Hopp |
e0b256 |
+ :wq! test.out
|
|
Karsten Hopp |
e0b256 |
+ ENDTEST
|
|
Karsten Hopp |
e0b256 |
+
|
|
Karsten Hopp |
e0b256 |
*** ../vim-7.3.252/src/testdir/test82.ok 2011-07-15 21:16:03.000000000 +0200
|
|
Karsten Hopp |
e0b256 |
--- src/testdir/test82.ok 2011-07-15 18:37:33.000000000 +0200
|
|
Karsten Hopp |
e0b256 |
***************
|
|
Karsten Hopp |
e0b256 |
*** 0 ****
|
|
Karsten Hopp |
e0b256 |
--- 1,2 ----
|
|
Karsten Hopp |
e0b256 |
+ 3732 checks passed
|
|
Karsten Hopp |
e0b256 |
+
|
|
Karsten Hopp |
e0b256 |
*** ../vim-7.3.252/src/testdir/Makefile 2011-06-26 05:36:07.000000000 +0200
|
|
Karsten Hopp |
e0b256 |
--- src/testdir/Makefile 2011-07-15 18:30:08.000000000 +0200
|
|
Karsten Hopp |
e0b256 |
***************
|
|
Karsten Hopp |
e0b256 |
*** 26,32 ****
|
|
Karsten Hopp |
e0b256 |
test64.out test65.out test66.out test67.out test68.out \
|
|
Karsten Hopp |
e0b256 |
test69.out test70.out test71.out test72.out test73.out \
|
|
Karsten Hopp |
e0b256 |
test74.out test75.out test76.out test77.out test78.out \
|
|
Karsten Hopp |
e0b256 |
! test79.out test80.out test81.out
|
|
Karsten Hopp |
e0b256 |
|
|
Karsten Hopp |
e0b256 |
SCRIPTS_GUI = test16.out
|
|
Karsten Hopp |
e0b256 |
|
|
Karsten Hopp |
e0b256 |
--- 26,32 ----
|
|
Karsten Hopp |
e0b256 |
test64.out test65.out test66.out test67.out test68.out \
|
|
Karsten Hopp |
e0b256 |
test69.out test70.out test71.out test72.out test73.out \
|
|
Karsten Hopp |
e0b256 |
test74.out test75.out test76.out test77.out test78.out \
|
|
Karsten Hopp |
e0b256 |
! test79.out test80.out test81.out test82.out
|
|
Karsten Hopp |
e0b256 |
|
|
Karsten Hopp |
e0b256 |
SCRIPTS_GUI = test16.out
|
|
Karsten Hopp |
e0b256 |
|
|
Karsten Hopp |
e0b256 |
*** ../vim-7.3.252/src/testdir/Make_amiga.mak 2011-06-26 05:36:07.000000000 +0200
|
|
Karsten Hopp |
e0b256 |
--- src/testdir/Make_amiga.mak 2011-07-15 18:29:50.000000000 +0200
|
|
Karsten Hopp |
e0b256 |
***************
|
|
Karsten Hopp |
e0b256 |
*** 29,35 ****
|
|
Karsten Hopp |
e0b256 |
test66.out test67.out test68.out test69.out test70.out \
|
|
Karsten Hopp |
e0b256 |
test71.out test72.out test73.out test74.out test75.out \
|
|
Karsten Hopp |
e0b256 |
test76.out test77.out test78.out test79.out test80.out \
|
|
Karsten Hopp |
e0b256 |
! test81.out
|
|
Karsten Hopp |
e0b256 |
|
|
Karsten Hopp |
e0b256 |
.SUFFIXES: .in .out
|
|
Karsten Hopp |
e0b256 |
|
|
Karsten Hopp |
e0b256 |
--- 29,35 ----
|
|
Karsten Hopp |
e0b256 |
test66.out test67.out test68.out test69.out test70.out \
|
|
Karsten Hopp |
e0b256 |
test71.out test72.out test73.out test74.out test75.out \
|
|
Karsten Hopp |
e0b256 |
test76.out test77.out test78.out test79.out test80.out \
|
|
Karsten Hopp |
e0b256 |
! test81.out test82.out
|
|
Karsten Hopp |
e0b256 |
|
|
Karsten Hopp |
e0b256 |
.SUFFIXES: .in .out
|
|
Karsten Hopp |
e0b256 |
|
|
Karsten Hopp |
e0b256 |
***************
|
|
Karsten Hopp |
e0b256 |
*** 130,132 ****
|
|
Karsten Hopp |
e0b256 |
--- 130,133 ----
|
|
Karsten Hopp |
e0b256 |
test79.out: test79.in
|
|
Karsten Hopp |
e0b256 |
test80.out: test80.in
|
|
Karsten Hopp |
e0b256 |
test81.out: test81.in
|
|
Karsten Hopp |
e0b256 |
+ test82.out: test82.in
|
|
Karsten Hopp |
e0b256 |
*** ../vim-7.3.252/src/testdir/Make_dos.mak 2011-06-26 05:36:07.000000000 +0200
|
|
Karsten Hopp |
e0b256 |
--- src/testdir/Make_dos.mak 2011-07-15 18:30:02.000000000 +0200
|
|
Karsten Hopp |
e0b256 |
***************
|
|
Karsten Hopp |
e0b256 |
*** 29,35 ****
|
|
Karsten Hopp |
e0b256 |
test42.out test52.out test65.out test66.out test67.out \
|
|
Karsten Hopp |
e0b256 |
test68.out test69.out test71.out test72.out test73.out \
|
|
Karsten Hopp |
e0b256 |
test74.out test75.out test76.out test77.out test78.out \
|
|
Karsten Hopp |
e0b256 |
! test79.out test80.out test81.out
|
|
Karsten Hopp |
e0b256 |
|
|
Karsten Hopp |
e0b256 |
SCRIPTS32 = test50.out test70.out
|
|
Karsten Hopp |
e0b256 |
|
|
Karsten Hopp |
e0b256 |
--- 29,35 ----
|
|
Karsten Hopp |
e0b256 |
test42.out test52.out test65.out test66.out test67.out \
|
|
Karsten Hopp |
e0b256 |
test68.out test69.out test71.out test72.out test73.out \
|
|
Karsten Hopp |
e0b256 |
test74.out test75.out test76.out test77.out test78.out \
|
|
Karsten Hopp |
e0b256 |
! test79.out test80.out test81.out test82.out
|
|
Karsten Hopp |
e0b256 |
|
|
Karsten Hopp |
e0b256 |
SCRIPTS32 = test50.out test70.out
|
|
Karsten Hopp |
e0b256 |
|
|
Karsten Hopp |
e0b256 |
*** ../vim-7.3.252/src/testdir/Make_ming.mak 2011-06-26 05:36:07.000000000 +0200
|
|
Karsten Hopp |
e0b256 |
--- src/testdir/Make_ming.mak 2011-07-15 18:30:15.000000000 +0200
|
|
Karsten Hopp |
e0b256 |
***************
|
|
Karsten Hopp |
e0b256 |
*** 49,55 ****
|
|
Karsten Hopp |
e0b256 |
test42.out test52.out test65.out test66.out test67.out \
|
|
Karsten Hopp |
e0b256 |
test68.out test69.out test71.out test72.out test73.out \
|
|
Karsten Hopp |
e0b256 |
test74.out test75.out test76.out test77.out test78.out \
|
|
Karsten Hopp |
e0b256 |
! test79.out test80.out test81.out
|
|
Karsten Hopp |
e0b256 |
|
|
Karsten Hopp |
e0b256 |
SCRIPTS32 = test50.out test70.out
|
|
Karsten Hopp |
e0b256 |
|
|
Karsten Hopp |
e0b256 |
--- 49,55 ----
|
|
Karsten Hopp |
e0b256 |
test42.out test52.out test65.out test66.out test67.out \
|
|
Karsten Hopp |
e0b256 |
test68.out test69.out test71.out test72.out test73.out \
|
|
Karsten Hopp |
e0b256 |
test74.out test75.out test76.out test77.out test78.out \
|
|
Karsten Hopp |
e0b256 |
! test79.out test80.out test81.out test82.out
|
|
Karsten Hopp |
e0b256 |
|
|
Karsten Hopp |
e0b256 |
SCRIPTS32 = test50.out test70.out
|
|
Karsten Hopp |
e0b256 |
|
|
Karsten Hopp |
e0b256 |
*** ../vim-7.3.252/src/testdir/Make_os2.mak 2011-06-26 05:36:07.000000000 +0200
|
|
Karsten Hopp |
e0b256 |
--- src/testdir/Make_os2.mak 2011-07-15 18:30:25.000000000 +0200
|
|
Karsten Hopp |
e0b256 |
***************
|
|
Karsten Hopp |
e0b256 |
*** 29,35 ****
|
|
Karsten Hopp |
e0b256 |
test66.out test67.out test68.out test69.out test70.out \
|
|
Karsten Hopp |
e0b256 |
test71.out test72.out test73.out test74.out test75.out \
|
|
Karsten Hopp |
e0b256 |
test76.out test77.out test78.out test79.out test80.out \
|
|
Karsten Hopp |
e0b256 |
! test81.out
|
|
Karsten Hopp |
e0b256 |
|
|
Karsten Hopp |
e0b256 |
.SUFFIXES: .in .out
|
|
Karsten Hopp |
e0b256 |
|
|
Karsten Hopp |
e0b256 |
--- 29,35 ----
|
|
Karsten Hopp |
e0b256 |
test66.out test67.out test68.out test69.out test70.out \
|
|
Karsten Hopp |
e0b256 |
test71.out test72.out test73.out test74.out test75.out \
|
|
Karsten Hopp |
e0b256 |
test76.out test77.out test78.out test79.out test80.out \
|
|
Karsten Hopp |
e0b256 |
! test81.out test82.out
|
|
Karsten Hopp |
e0b256 |
|
|
Karsten Hopp |
e0b256 |
.SUFFIXES: .in .out
|
|
Karsten Hopp |
e0b256 |
|
|
Karsten Hopp |
e0b256 |
*** ../vim-7.3.252/src/testdir/Make_vms.mms 2011-06-26 05:36:07.000000000 +0200
|
|
Karsten Hopp |
e0b256 |
--- src/testdir/Make_vms.mms 2011-07-15 18:30:33.000000000 +0200
|
|
Karsten Hopp |
e0b256 |
***************
|
|
Karsten Hopp |
e0b256 |
*** 4,10 ****
|
|
Karsten Hopp |
e0b256 |
# Authors: Zoltan Arpadffy, <arpadffy@polarhome.com>
|
|
Karsten Hopp |
e0b256 |
# Sandor Kopanyi, <sandor.kopanyi@mailbox.hu>
|
|
Karsten Hopp |
e0b256 |
#
|
|
Karsten Hopp |
e0b256 |
! # Last change: 2011 Jun 26
|
|
Karsten Hopp |
e0b256 |
#
|
|
Karsten Hopp |
e0b256 |
# This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64.
|
|
Karsten Hopp |
e0b256 |
# Edit the lines in the Configuration section below to select.
|
|
Karsten Hopp |
e0b256 |
--- 4,10 ----
|
|
Karsten Hopp |
e0b256 |
# Authors: Zoltan Arpadffy, <arpadffy@polarhome.com>
|
|
Karsten Hopp |
e0b256 |
# Sandor Kopanyi, <sandor.kopanyi@mailbox.hu>
|
|
Karsten Hopp |
e0b256 |
#
|
|
Karsten Hopp |
e0b256 |
! # Last change: 2011 Jul 15
|
|
Karsten Hopp |
e0b256 |
#
|
|
Karsten Hopp |
e0b256 |
# This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64.
|
|
Karsten Hopp |
e0b256 |
# Edit the lines in the Configuration section below to select.
|
|
Karsten Hopp |
e0b256 |
***************
|
|
Karsten Hopp |
e0b256 |
*** 75,81 ****
|
|
Karsten Hopp |
e0b256 |
test61.out test62.out test63.out test64.out test65.out \
|
|
Karsten Hopp |
e0b256 |
test66.out test67.out test68.out test69.out \
|
|
Karsten Hopp |
e0b256 |
test71.out test72.out test74.out test75.out test76.out \
|
|
Karsten Hopp |
e0b256 |
! test77.out test78.out test79.out test80.out test81.out
|
|
Karsten Hopp |
e0b256 |
|
|
Karsten Hopp |
e0b256 |
# Known problems:
|
|
Karsten Hopp |
e0b256 |
# Test 30: a problem around mac format - unknown reason
|
|
Karsten Hopp |
e0b256 |
--- 75,82 ----
|
|
Karsten Hopp |
e0b256 |
test61.out test62.out test63.out test64.out test65.out \
|
|
Karsten Hopp |
e0b256 |
test66.out test67.out test68.out test69.out \
|
|
Karsten Hopp |
e0b256 |
test71.out test72.out test74.out test75.out test76.out \
|
|
Karsten Hopp |
e0b256 |
! test77.out test78.out test79.out test80.out test81.out \
|
|
Karsten Hopp |
e0b256 |
! test82.out
|
|
Karsten Hopp |
e0b256 |
|
|
Karsten Hopp |
e0b256 |
# Known problems:
|
|
Karsten Hopp |
e0b256 |
# Test 30: a problem around mac format - unknown reason
|
|
Karsten Hopp |
e0b256 |
*** ../vim-7.3.252/src/version.c 2011-07-15 17:56:11.000000000 +0200
|
|
Karsten Hopp |
e0b256 |
--- src/version.c 2011-07-15 21:12:26.000000000 +0200
|
|
Karsten Hopp |
e0b256 |
***************
|
|
Karsten Hopp |
e0b256 |
*** 711,712 ****
|
|
Karsten Hopp |
e0b256 |
--- 711,714 ----
|
|
Karsten Hopp |
e0b256 |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
e0b256 |
+ /**/
|
|
Karsten Hopp |
e0b256 |
+ 253,
|
|
Karsten Hopp |
e0b256 |
/**/
|
|
Karsten Hopp |
e0b256 |
|
|
Karsten Hopp |
e0b256 |
--
|
|
Karsten Hopp |
e0b256 |
"Intelligence has much less practical application than you'd think."
|
|
Karsten Hopp |
e0b256 |
-- Scott Adams, Dilbert.
|
|
Karsten Hopp |
e0b256 |
|
|
Karsten Hopp |
e0b256 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
e0b256 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
e0b256 |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
Karsten Hopp |
e0b256 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|