Merge remote-tracking branch 'fedora/master' into rhel-7.0

This commit is contained in:
Karsten Hopp 2013-07-17 11:21:25 +02:00
commit bf1ee5366c
330 changed files with 98635 additions and 4 deletions

55
7.3.1000 Normal file
View File

@ -0,0 +1,55 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1000
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1000 (whoa!)
Problem: Typo in char value causes out of bounds access.
Solution: Fix character value. (Klemens Baum)
Files: src/regexp.c
*** ../vim-7.3.999/src/regexp.c 2013-05-21 00:02:54.000000000 +0200
--- src/regexp.c 2013-05-21 21:25:58.000000000 +0200
***************
*** 6899,6905 ****
{
decomp_T d;
! if (c >= 0x4b20 && c <= 0xfb4f)
{
d = decomp_table[c - 0xfb20];
*c1 = d.a;
--- 6899,6905 ----
{
decomp_T d;
! if (c >= 0xfb20 && c <= 0xfb4f)
{
d = decomp_table[c - 0xfb20];
*c1 = d.a;
*** ../vim-7.3.999/src/version.c 2013-05-21 21:20:16.000000000 +0200
--- src/version.c 2013-05-21 21:22:14.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1000,
/**/
--
ARTHUR: The swallow may fly south with the sun, or the house martin or the
plover seek warmer hot lands in winter, yet these are not strangers to
our land.
SOLDIER: Are you suggesting coconuts migrate?
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// 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 ///

54
7.3.1001 Normal file
View File

@ -0,0 +1,54 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1001
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1001
Problem: Duplicate condition in if.
Solution: Remove one condition.
Files: src/regexp_nfa.c
*** ../vim-7.3.1000/src/regexp_nfa.c 2013-05-21 21:20:16.000000000 +0200
--- src/regexp_nfa.c 2013-05-21 21:56:45.000000000 +0200
***************
*** 1091,1097 ****
{
nfa_inc(&regparse);
! if (*regparse == 'n' || *regparse == 'n')
startc = reg_string ? NL : NFA_NEWL;
else
if (*regparse == 'd'
--- 1091,1097 ----
{
nfa_inc(&regparse);
! if (*regparse == 'n')
startc = reg_string ? NL : NFA_NEWL;
else
if (*regparse == 'd'
*** ../vim-7.3.1000/src/version.c 2013-05-21 21:37:01.000000000 +0200
--- src/version.c 2013-05-21 21:59:09.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1001,
/**/
--
SECOND SOLDIER: It could be carried by an African swallow!
FIRST SOLDIER: Oh yes! An African swallow maybe ... but not a European
swallow. that's my point.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// 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 ///

178
7.3.1002 Normal file
View File

@ -0,0 +1,178 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1002
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1002
Problem: Valgrind errors for Python interface.
Solution: Fix memory leaks when running tests. (ZyX)
Files: src/if_py_both.h
*** ../vim-7.3.1001/src/if_py_both.h 2013-05-21 20:51:55.000000000 +0200
--- src/if_py_both.h 2013-05-21 22:08:25.000000000 +0200
***************
*** 866,871 ****
--- 866,872 ----
DICTKEY_UNREF
copy_tv(&tv, &di->di_tv);
+ clear_tv(&tv);
return 0;
}
***************
*** 1129,1134 ****
--- 1130,1136 ----
{
if (list_append_tv(l, &tv) == FAIL)
{
+ clear_tv(&tv);
PyErr_SetVim(_("Failed to add item to list"));
return -1;
}
***************
*** 1138,1143 ****
--- 1140,1146 ----
li = list_find(l, (long) index);
clear_tv(&li->li_tv);
copy_tv(&tv, &li->li_tv);
+ clear_tv(&tv);
}
return 0;
}
***************
*** 1204,1212 ****
--- 1207,1217 ----
return -1;
if (list_insert_tv(l, &v, li) == FAIL)
{
+ clear_tv(&v);
PyErr_SetVim(_("internal error: failed to add item to list"));
return -1;
}
+ clear_tv(&v);
}
return 0;
}
***************
*** 1346,1352 ****
--- 1351,1360 ----
return NULL;
}
if (ConvertFromPyObject(selfdictObject, &selfdicttv) == -1)
+ {
+ clear_tv(&args);
return NULL;
+ }
selfdict = selfdicttv.vval.v_dict;
}
}
***************
*** 1370,1382 ****
else
result = ConvertToPyObject(&rettv);
- /* FIXME Check what should really be cleared. */
clear_tv(&args);
clear_tv(&rettv);
! /*
! * if (selfdict!=NULL)
! * clear_tv(selfdicttv);
! */
return result;
}
--- 1378,1387 ----
else
result = ConvertToPyObject(&rettv);
clear_tv(&args);
clear_tv(&rettv);
! if (selfdict != NULL)
! clear_tv(&selfdicttv);
return result;
}
***************
*** 1482,1488 ****
}
else if (flags & SOPT_BOOL)
{
! PyObject *r;
r = numval ? Py_True : Py_False;
Py_INCREF(r);
return r;
--- 1487,1493 ----
}
else if (flags & SOPT_BOOL)
{
! PyObject *r;
r = numval ? Py_True : Py_False;
Py_INCREF(r);
return r;
***************
*** 1492,1498 ****
else if (flags & SOPT_STRING)
{
if (stringval)
! return PyBytes_FromString((char *) stringval);
else
{
PyErr_SetString(PyExc_RuntimeError,
--- 1497,1507 ----
else if (flags & SOPT_STRING)
{
if (stringval)
! {
! PyObject *r = PyBytes_FromString((char *) stringval);
! vim_free(stringval);
! return r;
! }
else
{
PyErr_SetString(PyExc_RuntimeError,
***************
*** 1516,1524 ****
int opt_type;
void *from;
{
! win_T *save_curwin;
! tabpage_T *save_curtab;
! buf_T *save_curbuf;
VimTryStart();
switch (opt_type)
--- 1525,1533 ----
int opt_type;
void *from;
{
! win_T *save_curwin = NULL;
! tabpage_T *save_curtab = NULL;
! buf_T *save_curbuf = NULL;
VimTryStart();
switch (opt_type)
*** ../vim-7.3.1001/src/version.c 2013-05-21 22:00:42.000000000 +0200
--- src/version.c 2013-05-21 22:12:54.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1002,
/**/
--
"I've been teaching myself to play the piano for about 5 years and now write
most of my songs on it, mainly because I can never find any paper."
Jeff Lynne, ELO's greatest hits
/// 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 ///

381
7.3.1003 Normal file
View File

@ -0,0 +1,381 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1003
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1003
Problem: Python interface does not compile with Python 2.2
Solution: Fix thread issues and True/False. (ZyX)
Files: src/if_py_both.h, src/if_python3.c, src/if_python.c,
src/testdir/test86.in, src/testdir/test86.ok,
src/testdir/test87.in, src/testdir/test87.ok
*** ../vim-7.3.1002/src/if_py_both.h 2013-05-21 22:13:36.000000000 +0200
--- src/if_py_both.h 2013-05-21 22:16:58.000000000 +0200
***************
*** 31,37 ****
#define INVALID_TABPAGE_VALUE ((tabpage_T *)(-1))
typedef void (*rangeinitializer)(void *);
! typedef void (*runner)(const char *, void *, PyGILState_STATE *);
static int ConvertFromPyObject(PyObject *, typval_T *);
static int _ConvertFromPyObject(PyObject *, typval_T *, PyObject *);
--- 31,41 ----
#define INVALID_TABPAGE_VALUE ((tabpage_T *)(-1))
typedef void (*rangeinitializer)(void *);
! typedef void (*runner)(const char *, void *
! #ifdef PY_CAN_RECURSE
! , PyGILState_STATE *
! #endif
! );
static int ConvertFromPyObject(PyObject *, typval_T *);
static int _ConvertFromPyObject(PyObject *, typval_T *, PyObject *);
***************
*** 3489,3495 ****
}
static void
! run_cmd(const char *cmd, void *arg UNUSED, PyGILState_STATE *pygilstate UNUSED)
{
PyRun_SimpleString((char *) cmd);
}
--- 3493,3503 ----
}
static void
! run_cmd(const char *cmd, void *arg UNUSED
! #ifdef PY_CAN_RECURSE
! , PyGILState_STATE *pygilstate UNUSED
! #endif
! )
{
PyRun_SimpleString((char *) cmd);
}
***************
*** 3498,3504 ****
static int code_hdr_len = 30;
static void
! run_do(const char *cmd, void *arg UNUSED, PyGILState_STATE *pygilstate)
{
PyInt lnum;
size_t len;
--- 3506,3516 ----
static int code_hdr_len = 30;
static void
! run_do(const char *cmd, void *arg UNUSED
! #ifdef PY_CAN_RECURSE
! , PyGILState_STATE *pygilstate
! #endif
! )
{
PyInt lnum;
size_t len;
***************
*** 3528,3540 ****
--- 3540,3556 ----
status = 0;
pymain = PyImport_AddModule("__main__");
pyfunc = PyObject_GetAttrString(pymain, DOPY_FUNC);
+ #ifdef PY_CAN_RECURSE
PyGILState_Release(*pygilstate);
+ #endif
for (lnum = RangeStart; lnum <= RangeEnd; ++lnum)
{
PyObject *line, *linenr, *ret;
+ #ifdef PY_CAN_RECURSE
*pygilstate = PyGILState_Ensure();
+ #endif
if (!(line = GetBufferLine(curbuf, lnum)))
goto err;
if (!(linenr = PyInt_FromLong((long) lnum)))
***************
*** 3554,3570 ****
--- 3570,3592 ----
Py_XDECREF(ret);
PythonIO_Flush();
+ #ifdef PY_CAN_RECURSE
PyGILState_Release(*pygilstate);
+ #endif
}
goto out;
err:
+ #ifdef PY_CAN_RECURSE
*pygilstate = PyGILState_Ensure();
+ #endif
PyErr_PrintEx(0);
PythonIO_Flush();
status = 1;
out:
+ #ifdef PY_CAN_RECURSE
if (!status)
*pygilstate = PyGILState_Ensure();
+ #endif
Py_DECREF(pyfunc);
PyObject_SetAttrString(pymain, DOPY_FUNC, NULL);
if (status)
***************
*** 3574,3580 ****
}
static void
! run_eval(const char *cmd, typval_T *rettv, PyGILState_STATE *pygilstate UNUSED)
{
PyObject *r;
--- 3596,3606 ----
}
static void
! run_eval(const char *cmd, typval_T *rettv
! #ifdef PY_CAN_RECURSE
! , PyGILState_STATE *pygilstate UNUSED
! #endif
! )
{
PyObject *r;
*** ../vim-7.3.1002/src/if_python3.c 2013-05-21 20:51:55.000000000 +0200
--- src/if_python3.c 2013-05-21 22:16:58.000000000 +0200
***************
*** 693,698 ****
--- 693,700 ----
static struct PyModuleDef vimmodule;
+ #define PY_CAN_RECURSE
+
/*
* Include the code shared with if_python.c
*/
*** ../vim-7.3.1002/src/if_python.c 2013-05-21 20:51:55.000000000 +0200
--- src/if_python.c 2013-05-21 22:16:58.000000000 +0200
***************
*** 641,647 ****
#define DICTKEY_UNREF
#define DICTKEY_DECL
! #define DESTRUCTOR_FINISH(self) Py_TYPE(self)->tp_free((PyObject*)self);
#define WIN_PYTHON_REF(win) win->w_python_ref
#define BUF_PYTHON_REF(buf) buf->b_python_ref
--- 641,647 ----
#define DICTKEY_UNREF
#define DICTKEY_DECL
! #define DESTRUCTOR_FINISH(self) self->ob_type->tp_free((PyObject*)self);
#define WIN_PYTHON_REF(win) win->w_python_ref
#define BUF_PYTHON_REF(buf) buf->b_python_ref
***************
*** 656,661 ****
--- 656,670 ----
static PyObject *ListGetattr(PyObject *, char *);
static PyObject *FunctionGetattr(PyObject *, char *);
+ #ifndef Py_VISIT
+ # define Py_VISIT(obj) visit(obj, arg)
+ #endif
+ #ifndef Py_CLEAR
+ # define Py_CLEAR(obj) \
+ Py_XDECREF(obj); \
+ obj = NULL;
+ #endif
+
/*
* Include the code shared with if_python3.c
*/
***************
*** 881,887 ****
Python_RestoreThread(); /* enter python */
#endif
! run((char *) cmd, arg, &pygilstate);
#ifdef PY_CAN_RECURSE
PyGILState_Release(pygilstate);
--- 890,900 ----
Python_RestoreThread(); /* enter python */
#endif
! run((char *) cmd, arg
! #ifdef PY_CAN_RECURSE
! , &pygilstate
! #endif
! );
#ifdef PY_CAN_RECURSE
PyGILState_Release(pygilstate);
*** ../vim-7.3.1002/src/testdir/test86.in 2013-05-21 20:40:35.000000000 +0200
--- src/testdir/test86.in 2013-05-21 22:16:58.000000000 +0200
***************
*** 518,523 ****
--- 518,527 ----
:edit c
:buffer #
py << EOF
+ try:
+ from __builtin__ import next
+ except ImportError:
+ next = lambda o: o.next()
# Check GCing iterator that was not fully exhausted
i = iter(vim.buffers)
cb.append('i:' + str(next(i)))
***************
*** 577,591 ****
cb.append('Number of tabs: ' + str(len(vim.tabpages)))
cb.append('Current tab pages:')
def W(w):
! if '(unknown)' in repr(w):
return '<window object (unknown)>'
else:
return repr(w)
for t in vim.tabpages:
cb.append(' ' + repr(t) + '(' + str(t.number) + ')' + ': ' + str(len(t.windows)) + ' windows, current is ' + W(t.window))
cb.append(' Windows:')
for w in t.windows:
! cb.append(' ' + W(w) + '(' + str(w.number) + ')' + ': displays buffer ' + repr(w.buffer) + '; cursor is at ' + repr(w.cursor))
# Other values depend on the size of the terminal, so they are checked partly:
for attr in ('height', 'row', 'width', 'col'):
try:
--- 581,602 ----
cb.append('Number of tabs: ' + str(len(vim.tabpages)))
cb.append('Current tab pages:')
def W(w):
! if repr(w).find('(unknown)') != -1:
return '<window object (unknown)>'
else:
return repr(w)
+
+ def Cursor(w, start=len(cb)):
+ if w.buffer is cb:
+ return repr((start - w.cursor[0], w.cursor[1]))
+ else:
+ return repr(w.cursor)
+
for t in vim.tabpages:
cb.append(' ' + repr(t) + '(' + str(t.number) + ')' + ': ' + str(len(t.windows)) + ' windows, current is ' + W(t.window))
cb.append(' Windows:')
for w in t.windows:
! cb.append(' ' + W(w) + '(' + str(w.number) + ')' + ': displays buffer ' + repr(w.buffer) + '; cursor is at ' + Cursor(w))
# Other values depend on the size of the terminal, so they are checked partly:
for attr in ('height', 'row', 'width', 'col'):
try:
*** ../vim-7.3.1002/src/testdir/test86.ok 2013-05-21 20:40:35.000000000 +0200
--- src/testdir/test86.ok 2013-05-21 22:18:02.000000000 +0200
***************
*** 333,339 ****
Current tab pages:
<tabpage 0>(1): 1 windows, current is <window object (unknown)>
Windows:
! <window object (unknown)>(1): displays buffer <buffer test86.in>; cursor is at (990, 0)
<tabpage 1>(2): 1 windows, current is <window object (unknown)>
Windows:
<window object (unknown)>(1): displays buffer <buffer 0>; cursor is at (1, 0)
--- 333,339 ----
Current tab pages:
<tabpage 0>(1): 1 windows, current is <window object (unknown)>
Windows:
! <window object (unknown)>(1): displays buffer <buffer test86.in>; cursor is at (27, 0)
<tabpage 1>(2): 1 windows, current is <window object (unknown)>
Windows:
<window object (unknown)>(1): displays buffer <buffer 0>; cursor is at (1, 0)
*** ../vim-7.3.1002/src/testdir/test87.in 2013-05-21 20:40:35.000000000 +0200
--- src/testdir/test87.in 2013-05-21 22:16:58.000000000 +0200
***************
*** 561,578 ****
:vnew b.2
:vnew c.2
py3 << EOF
def W(w):
if '(unknown)' in repr(w):
return '<window object (unknown)>'
else:
return repr(w)
! cb.append('Number of tabs: ' + str(len(vim.tabpages)))
! cb.append('Current tab pages:')
for t in vim.tabpages:
cb.append(' ' + repr(t) + '(' + str(t.number) + ')' + ': ' + str(len(t.windows)) + ' windows, current is ' + W(t.window))
cb.append(' Windows:')
for w in t.windows:
! cb.append(' ' + W(w) + '(' + str(w.number) + ')' + ': displays buffer ' + repr(w.buffer) + '; cursor is at ' + repr(w.cursor))
# Other values depend on the size of the terminal, so they are checked partly:
for attr in ('height', 'row', 'width', 'col'):
try:
--- 561,586 ----
:vnew b.2
:vnew c.2
py3 << EOF
+ cb.append('Number of tabs: ' + str(len(vim.tabpages)))
+ cb.append('Current tab pages:')
+
def W(w):
if '(unknown)' in repr(w):
return '<window object (unknown)>'
else:
return repr(w)
!
! def Cursor(w, start=len(cb)):
! if w.buffer is cb:
! return repr((start - w.cursor[0], w.cursor[1]))
! else:
! return repr(w.cursor)
!
for t in vim.tabpages:
cb.append(' ' + repr(t) + '(' + str(t.number) + ')' + ': ' + str(len(t.windows)) + ' windows, current is ' + W(t.window))
cb.append(' Windows:')
for w in t.windows:
! cb.append(' ' + W(w) + '(' + str(w.number) + ')' + ': displays buffer ' + repr(w.buffer) + '; cursor is at ' + Cursor(w))
# Other values depend on the size of the terminal, so they are checked partly:
for attr in ('height', 'row', 'width', 'col'):
try:
*** ../vim-7.3.1002/src/testdir/test87.ok 2013-05-21 20:40:35.000000000 +0200
--- src/testdir/test87.ok 2013-05-21 22:18:31.000000000 +0200
***************
*** 322,328 ****
Current tab pages:
<tabpage 0>(1): 1 windows, current is <window object (unknown)>
Windows:
! <window object (unknown)>(1): displays buffer <buffer test87.in>; cursor is at (966, 0)
<tabpage 1>(2): 1 windows, current is <window object (unknown)>
Windows:
<window object (unknown)>(1): displays buffer <buffer 0>; cursor is at (1, 0)
--- 322,328 ----
Current tab pages:
<tabpage 0>(1): 1 windows, current is <window object (unknown)>
Windows:
! <window object (unknown)>(1): displays buffer <buffer test87.in>; cursor is at (27, 0)
<tabpage 1>(2): 1 windows, current is <window object (unknown)>
Windows:
<window object (unknown)>(1): displays buffer <buffer 0>; cursor is at (1, 0)
*** ../vim-7.3.1002/src/version.c 2013-05-21 22:13:36.000000000 +0200
--- src/version.c 2013-05-21 22:19:01.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1003,
/**/
--
./configure
Checking whether build environment is sane ...
build environment is grinning and holding a spatula. Guess not.
/// 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 ///

364
7.3.1004 Normal file
View File

@ -0,0 +1,364 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1004
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1004
Problem: No error when option could not be set.
Solution: Report an error. (ZyX)
Files: src/if_py_both.h, src/option.c, src/proto/option.pro,
src/testdir/test86.ok, src/testdir/test87.ok
*** ../vim-7.3.1003/src/if_py_both.h 2013-05-21 22:23:50.000000000 +0200
--- src/if_py_both.h 2013-05-21 22:34:04.000000000 +0200
***************
*** 1521,1526 ****
--- 1521,1545 ----
}
static int
+ set_option_value_err(key, numval, stringval, opt_flags)
+ char_u *key;
+ int numval;
+ char_u *stringval;
+ int opt_flags;
+ {
+ char_u *errmsg;
+
+ if ((errmsg = set_option_value(key, numval, stringval, opt_flags)))
+ {
+ if (VimTryEnd())
+ return FAIL;
+ PyErr_SetVim((char *)errmsg);
+ return FAIL;
+ }
+ return OK;
+ }
+
+ static int
set_option_value_for(key, numval, stringval, opt_flags, opt_type, from)
char_u *key;
int numval;
***************
*** 1532,1537 ****
--- 1551,1557 ----
win_T *save_curwin = NULL;
tabpage_T *save_curtab = NULL;
buf_T *save_curbuf = NULL;
+ int r = 0;
VimTryStart();
switch (opt_type)
***************
*** 1545,1560 ****
PyErr_SetVim("Problem while switching windows.");
return -1;
}
! set_option_value(key, numval, stringval, opt_flags);
restore_win(save_curwin, save_curtab);
break;
case SREQ_BUF:
switch_buffer(&save_curbuf, (buf_T *)from);
! set_option_value(key, numval, stringval, opt_flags);
restore_buffer(save_curbuf);
break;
case SREQ_GLOBAL:
! set_option_value(key, numval, stringval, opt_flags);
break;
}
return VimTryEnd();
--- 1565,1586 ----
PyErr_SetVim("Problem while switching windows.");
return -1;
}
! r = set_option_value_err(key, numval, stringval, opt_flags);
restore_win(save_curwin, save_curtab);
+ if (r == FAIL)
+ return -1;
break;
case SREQ_BUF:
switch_buffer(&save_curbuf, (buf_T *)from);
! r = set_option_value_err(key, numval, stringval, opt_flags);
restore_buffer(save_curbuf);
+ if (r == FAIL)
+ return -1;
break;
case SREQ_GLOBAL:
! r = set_option_value_err(key, numval, stringval, opt_flags);
! if (r == FAIL)
! return -1;
break;
}
return VimTryEnd();
***************
*** 1611,1616 ****
--- 1637,1643 ----
if (flags & SOPT_BOOL)
{
int istrue = PyObject_IsTrue(valObject);
+
if (istrue == -1)
return -1;
r = set_option_value_for(key, istrue, NULL,
*** ../vim-7.3.1003/src/option.c 2013-05-19 19:16:25.000000000 +0200
--- src/option.c 2013-05-21 22:34:41.000000000 +0200
***************
*** 3018,3024 ****
# define insecure_flag(opt_idx, opt_flags) (&options[opt_idx].flags)
#endif
static void set_string_option_global __ARGS((int opt_idx, char_u **varp));
! static void set_string_option __ARGS((int opt_idx, char_u *value, int opt_flags));
static char_u *did_set_string_option __ARGS((int opt_idx, char_u **varp, int new_value_alloced, char_u *oldval, char_u *errbuf, int opt_flags));
static char_u *set_chars_option __ARGS((char_u **varp));
#ifdef FEAT_SYN_HL
--- 3018,3024 ----
# define insecure_flag(opt_idx, opt_flags) (&options[opt_idx].flags)
#endif
static void set_string_option_global __ARGS((int opt_idx, char_u **varp));
! static char_u *set_string_option __ARGS((int opt_idx, char_u *value, int opt_flags));
static char_u *did_set_string_option __ARGS((int opt_idx, char_u **varp, int new_value_alloced, char_u *oldval, char_u *errbuf, int opt_flags));
static char_u *set_chars_option __ARGS((char_u **varp));
#ifdef FEAT_SYN_HL
***************
*** 5600,5607 ****
/*
* Set a string option to a new value, and handle the effects.
*/
! static void
set_string_option(opt_idx, value, opt_flags)
int opt_idx;
char_u *value;
--- 5600,5609 ----
/*
* Set a string option to a new value, and handle the effects.
+ *
+ * Returns NULL on success or error message on error.
*/
! static char_u *
set_string_option(opt_idx, value, opt_flags)
int opt_idx;
char_u *value;
***************
*** 5610,5618 ****
char_u *s;
char_u **varp;
char_u *oldval;
if (options[opt_idx].var == NULL) /* don't set hidden option */
! return;
s = vim_strsave(value);
if (s != NULL)
--- 5612,5621 ----
char_u *s;
char_u **varp;
char_u *oldval;
+ char_u *r = NULL;
if (options[opt_idx].var == NULL) /* don't set hidden option */
! return NULL;
s = vim_strsave(value);
if (s != NULL)
***************
*** 5624,5633 ****
: opt_flags);
oldval = *varp;
*varp = s;
! if (did_set_string_option(opt_idx, varp, TRUE, oldval, NULL,
! opt_flags) == NULL)
did_set_option(opt_idx, opt_flags, TRUE);
}
}
/*
--- 5627,5637 ----
: opt_flags);
oldval = *varp;
*varp = s;
! if ((r = did_set_string_option(opt_idx, varp, TRUE, oldval, NULL,
! opt_flags)) == NULL)
did_set_option(opt_idx, opt_flags, TRUE);
}
+ return r;
}
/*
***************
*** 8969,8976 ****
/*
* Set the value of option "name".
* Use "string" for string options, use "number" for other options.
*/
! void
set_option_value(name, number, string, opt_flags)
char_u *name;
long number;
--- 8973,8982 ----
/*
* Set the value of option "name".
* Use "string" for string options, use "number" for other options.
+ *
+ * Returns NULL on success or error message on error.
*/
! char_u *
set_option_value(name, number, string, opt_flags)
char_u *name;
long number;
***************
*** 8992,9002 ****
if (sandbox > 0 && (flags & P_SECURE))
{
EMSG(_(e_sandbox));
! return;
}
#endif
if (flags & P_STRING)
! set_string_option(opt_idx, string, opt_flags);
else
{
varp = get_varp_scope(&(options[opt_idx]), opt_flags);
--- 8998,9008 ----
if (sandbox > 0 && (flags & P_SECURE))
{
EMSG(_(e_sandbox));
! return NULL;
}
#endif
if (flags & P_STRING)
! return set_string_option(opt_idx, string, opt_flags);
else
{
varp = get_varp_scope(&(options[opt_idx]), opt_flags);
***************
*** 9017,9035 ****
* num option using a string. */
EMSG3(_("E521: Number required: &%s = '%s'"),
name, string);
! return; /* do nothing as we hit an error */
}
}
if (flags & P_NUM)
! (void)set_num_option(opt_idx, varp, number,
NULL, 0, opt_flags);
else
! (void)set_bool_option(opt_idx, varp, (int)number,
opt_flags);
}
}
}
}
/*
--- 9023,9042 ----
* num option using a string. */
EMSG3(_("E521: Number required: &%s = '%s'"),
name, string);
! return NULL; /* do nothing as we hit an error */
}
}
if (flags & P_NUM)
! return set_num_option(opt_idx, varp, number,
NULL, 0, opt_flags);
else
! return set_bool_option(opt_idx, varp, (int)number,
opt_flags);
}
}
}
+ return NULL;
}
/*
*** ../vim-7.3.1003/src/proto/option.pro 2013-05-06 03:52:44.000000000 +0200
--- src/proto/option.pro 2013-05-21 22:27:50.000000000 +0200
***************
*** 23,29 ****
char_u *check_stl_option __ARGS((char_u *s));
int get_option_value __ARGS((char_u *name, long *numval, char_u **stringval, int opt_flags));
int get_option_value_strict __ARGS((char_u *name, long *numval, char_u **stringval, int opt_type, void *from));
! void set_option_value __ARGS((char_u *name, long number, char_u *string, int opt_flags));
char_u *get_term_code __ARGS((char_u *tname));
char_u *get_highlight_default __ARGS((void));
char_u *get_encoding_default __ARGS((void));
--- 23,29 ----
char_u *check_stl_option __ARGS((char_u *s));
int get_option_value __ARGS((char_u *name, long *numval, char_u **stringval, int opt_flags));
int get_option_value_strict __ARGS((char_u *name, long *numval, char_u **stringval, int opt_type, void *from));
! char_u *set_option_value __ARGS((char_u *name, long number, char_u *string, int opt_flags));
char_u *get_term_code __ARGS((char_u *tname));
char_u *get_highlight_default __ARGS((void));
char_u *get_encoding_default __ARGS((void));
*** ../vim-7.3.1003/src/testdir/test86.ok 2013-05-21 22:23:51.000000000 +0200
--- src/testdir/test86.ok 2013-05-21 22:27:50.000000000 +0200
***************
*** 166,171 ****
--- 166,172 ----
inv: -100! KeyError
gopts1! KeyError
p/wopts1: 8
+ inv: -100! error
p/bopts1! KeyError
inv: -100! KeyError
bopts1! KeyError
***************
*** 184,189 ****
--- 185,191 ----
inv: 'abc'! KeyError
gopts1! KeyError
p/wopts1: ''
+ inv: 'abc'! error
p/bopts1! KeyError
inv: 'abc'! KeyError
bopts1! KeyError
*** ../vim-7.3.1003/src/testdir/test87.ok 2013-05-21 22:23:51.000000000 +0200
--- src/testdir/test87.ok 2013-05-21 22:27:50.000000000 +0200
***************
*** 155,160 ****
--- 155,161 ----
inv: -100! KeyError
gopts1! KeyError
p/wopts1: 8
+ inv: -100! error
p/bopts1! KeyError
inv: -100! KeyError
bopts1! KeyError
***************
*** 173,178 ****
--- 174,180 ----
inv: 'abc'! KeyError
gopts1! KeyError
p/wopts1: b''
+ inv: 'abc'! error
p/bopts1! KeyError
inv: 'abc'! KeyError
bopts1! KeyError
*** ../vim-7.3.1003/src/version.c 2013-05-21 22:23:51.000000000 +0200
--- src/version.c 2013-05-21 22:37:33.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1004,
/**/
--
FIRST SOLDIER: So they wouldn't be able to bring a coconut back anyway.
SECOND SOLDIER: Wait a minute! Suppose two swallows carried it together?
FIRST SOLDIER: No, they'd have to have it on a line.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// 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 ///

265
7.3.1005 Normal file
View File

@ -0,0 +1,265 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1005
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1005
Problem: Get stuck on regexp "\n*" and on "%s/^\n\+/\r".
Solution: Fix handling of matching a line break. (idea by Hirohito Higashi)
Files: src/regexp_nfa.c
*** ../vim-7.3.1004/src/regexp_nfa.c 2013-05-21 22:00:42.000000000 +0200
--- src/regexp_nfa.c 2013-05-22 22:53:08.000000000 +0200
***************
*** 2462,2468 ****
List *l; /* runtime state list */
nfa_state_T *state; /* state to update */
regsub_T *m; /* pointers to subexpressions */
! int off;
int lid;
int *match; /* found match? */
{
--- 2462,2468 ----
List *l; /* runtime state list */
nfa_state_T *state; /* state to update */
regsub_T *m; /* pointers to subexpressions */
! int off; /* byte offset, when -1 go to next line */
int lid;
int *match; /* found match? */
{
***************
*** 2585,2592 ****
{
save.startpos[subidx] = m->startpos[subidx];
save.endpos[subidx] = m->endpos[subidx];
! m->startpos[subidx].lnum = reglnum;
! m->startpos[subidx].col = (colnr_T)(reginput - regline + off);
}
else
{
--- 2585,2601 ----
{
save.startpos[subidx] = m->startpos[subidx];
save.endpos[subidx] = m->endpos[subidx];
! if (off == -1)
! {
! m->startpos[subidx].lnum = reglnum + 1;
! m->startpos[subidx].col = 0;
! }
! else
! {
! m->startpos[subidx].lnum = reglnum;
! m->startpos[subidx].col =
! (colnr_T)(reginput - regline + off);
! }
}
else
{
***************
*** 2633,2640 ****
{
save.startpos[subidx] = m->startpos[subidx];
save.endpos[subidx] = m->endpos[subidx];
! m->endpos[subidx].lnum = reglnum;
! m->endpos[subidx].col = (colnr_T)(reginput - regline + off);
}
else
{
--- 2642,2657 ----
{
save.startpos[subidx] = m->startpos[subidx];
save.endpos[subidx] = m->endpos[subidx];
! if (off == -1)
! {
! m->endpos[subidx].lnum = reglnum + 1;
! m->endpos[subidx].col = 0;
! }
! else
! {
! m->endpos[subidx].lnum = reglnum;
! m->endpos[subidx].col = (colnr_T)(reginput - regline + off);
! }
}
else
{
***************
*** 2834,2840 ****
int match = FALSE;
int flag = 0;
int old_reglnum = -1;
! int reginput_updated = FALSE;
thread_T *t;
char_u *old_reginput = NULL;
char_u *old_regline = NULL;
--- 2851,2857 ----
int match = FALSE;
int flag = 0;
int old_reglnum = -1;
! int go_to_nextline;
thread_T *t;
char_u *old_reginput = NULL;
char_u *old_regline = NULL;
***************
*** 2917,2924 ****
/*
* Run for each character.
*/
! do {
! again:
#ifdef FEAT_MBYTE
if (has_mbyte)
{
--- 2934,2941 ----
/*
* Run for each character.
*/
! for (;;)
! {
#ifdef FEAT_MBYTE
if (has_mbyte)
{
***************
*** 2932,2938 ****
--- 2949,2958 ----
n = 1;
}
if (c == NUL)
+ {
n = 0;
+ go_to_nextline = FALSE;
+ }
/* swap lists */
thislist = &list[flag];
***************
*** 3007,3013 ****
(char *)t->sub.end[j]);
fprintf(log_fd, "\n");
#endif
! goto nextchar; /* found the left-most longest match */
case NFA_END_INVISIBLE:
/* This is only encountered after a NFA_START_INVISIBLE node.
--- 3027,3035 ----
(char *)t->sub.end[j]);
fprintf(log_fd, "\n");
#endif
! /* Found the left-most longest match, do not look at any other
! * states at this position. */
! goto nextchar;
case NFA_END_INVISIBLE:
/* This is only encountered after a NFA_START_INVISIBLE node.
***************
*** 3206,3220 ****
case NFA_NEWL:
if (!reg_line_lbr && REG_MULTI
! && c == NUL && reglnum <= reg_maxline)
{
! if (reginput_updated == FALSE)
! {
! reg_nextline();
! reginput_updated = TRUE;
! }
! addstate(nextlist, t->state->out, &t->sub, n, listid + 1,
! &match);
}
break;
--- 3228,3240 ----
case NFA_NEWL:
if (!reg_line_lbr && REG_MULTI
! && c == NUL && reglnum <= reg_maxline)
{
! go_to_nextline = TRUE;
! /* Pass -1 for the offset, which means taking the position
! * at the start of the next line. */
! addstate(nextlist, t->state->out, &t->sub, -1,
! listid + 1, &match);
}
break;
***************
*** 3247,3254 ****
break;
case NFA_ANY:
! /* Any printable char, not just any char. '\0' (end of input)
! * must not match */
if (c > 0)
addstate(nextlist, t->state->out, &t->sub, n, listid + 1,
&match);
--- 3267,3273 ----
break;
case NFA_ANY:
! /* Any char except '\0', (end of input) does not match. */
if (c > 0)
addstate(nextlist, t->state->out, &t->sub, n, listid + 1,
&match);
***************
*** 3433,3444 ****
addstate(nextlist, start, m, n, listid + 1, &match);
}
- if (reginput_updated)
- {
- reginput_updated = FALSE;
- goto again;
- }
-
#ifdef ENABLE_LOG
fprintf(log_fd, ">>> Thislist had %d states available: ", thislist->n);
for (i = 0; i< thislist->n; i++)
--- 3452,3457 ----
***************
*** 3447,3454 ****
#endif
nextchar:
! reginput += n;
! } while (c || reginput_updated);
#ifdef ENABLE_LOG
if (log_fd != stderr)
--- 3460,3474 ----
#endif
nextchar:
! /* Advance to the next character, or advance to the next line, or
! * finish. */
! if (n != 0)
! reginput += n;
! else if (go_to_nextline)
! reg_nextline();
! else
! break;
! }
#ifdef ENABLE_LOG
if (log_fd != stderr)
*** ../vim-7.3.1004/src/version.c 2013-05-21 22:38:14.000000000 +0200
--- src/version.c 2013-05-22 22:57:59.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1005,
/**/
--
"Lisp has all the visual appeal of oatmeal with nail clippings thrown in."
-- Larry Wall
/// 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 ///

74
7.3.1006 Normal file
View File

@ -0,0 +1,74 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1006
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1006
Problem: NFA engine not used for "\_[0-9]".
Solution: Enable this, fixed in patch 1005.
Files: src/regexp_nfa.c
*** ../vim-7.3.1005/src/regexp_nfa.c 2013-05-22 23:00:34.000000000 +0200
--- src/regexp_nfa.c 2013-05-23 22:19:29.000000000 +0200
***************
*** 679,687 ****
/* "\_[" is collection plus newline */
if (c == '[')
! /* TODO: make this work
! * goto collection; */
! return FAIL;
/* "\_x" is character class plus newline */
/*FALLTHROUGH*/
--- 679,685 ----
/* "\_[" is collection plus newline */
if (c == '[')
! goto collection;
/* "\_x" is character class plus newline */
/*FALLTHROUGH*/
***************
*** 891,898 ****
}
break;
- /* collection: */
case Magic('['):
/*
* Glue is emitted between several atoms from the [].
* It is either NFA_OR, or NFA_CONCAT.
--- 889,896 ----
}
break;
case Magic('['):
+ collection:
/*
* Glue is emitted between several atoms from the [].
* It is either NFA_OR, or NFA_CONCAT.
*** ../vim-7.3.1005/src/version.c 2013-05-22 23:00:34.000000000 +0200
--- src/version.c 2013-05-23 22:23:07.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1006,
/**/
--
BLACK KNIGHT: I'm invincible!
ARTHUR: You're a looney.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// 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 ///

57
7.3.1007 Normal file
View File

@ -0,0 +1,57 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1007
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1007
Problem: Can't build on Minix 3.2.1.
Solution: Add a condition to an #ifdef. (Gautam Tirumala)
Files: src/memfile.c
*** ../vim-7.3.1006/src/memfile.c 2013-05-06 04:21:35.000000000 +0200
--- src/memfile.c 2013-05-23 22:22:22.000000000 +0200
***************
*** 127,133 ****
{
memfile_T *mfp;
off_t size;
! #if defined(STATFS) && defined(UNIX) && !defined(__QNX__)
# define USE_FSTATFS
struct STATFS stf;
#endif
--- 127,133 ----
{
memfile_T *mfp;
off_t size;
! #if defined(STATFS) && defined(UNIX) && !defined(__QNX__) && !defined(__minix)
# define USE_FSTATFS
struct STATFS stf;
#endif
*** ../vim-7.3.1006/src/version.c 2013-05-23 22:25:10.000000000 +0200
--- src/version.c 2013-05-23 22:26:16.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1007,
/**/
--
Mrs Abbott: I'm a paediatrician.
Basil: Feet?
Mrs Abbott: Children.
Sybil: Oh, Basil!
Basil: Well, children have feet, don't they? That's how they move
around, my dear. You must take a look next time, it's most
interesting. (Fawlty Towers)
/// 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 ///

76
7.3.1008 Normal file
View File

@ -0,0 +1,76 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1008
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1008
Problem: Test 95 fails on MS-Windows.
Solution: Set 'nomore'. Change \i to \f. Change multi-byte character to
something that is not matching \i. (Ken Takata)
Files: src/testdir/test95.in, src/testdir/test95.ok
*** ../vim-7.3.1007/src/testdir/test95.in 2013-05-21 13:30:17.000000000 +0200
--- src/testdir/test95.in 2013-05-23 22:36:22.000000000 +0200
***************
*** 30,39 ****
:call add(tl, ['\p\+', 'ìa', 'ìa'])
:"""" Test recognition of some character classes
! :call add(tl, ['\i\+', '&*§xx ', 'xx'])
! :call add(tl, ['\%#=1\i\+', '&*§xx ', 'xx'])
:call add(tl, ['\f\+', '&*Ÿfname ', 'fname'])
! :call add(tl, ['\%#=1\i\+', '&*Ÿfname ', 'fname'])
:"""" Combining different tests and features
:call add(tl, ['[^[=a=]]\+', 'ddaãâbcd', 'dd'])
--- 30,39 ----
:call add(tl, ['\p\+', 'ìa', 'ìa'])
:"""" Test recognition of some character classes
! :call add(tl, ['\i\+', '&*¨xx ', 'xx'])
! :call add(tl, ['\%#=1\i\+', '&*¨xx ', 'xx'])
:call add(tl, ['\f\+', '&*Ÿfname ', 'fname'])
! :call add(tl, ['\%#=1\f\+', '&*Ÿfname ', 'fname'])
:"""" Combining different tests and features
:call add(tl, ['[^[=a=]]\+', 'ddaãâbcd', 'dd'])
*** ../vim-7.3.1007/src/testdir/test95.ok 2013-05-21 13:30:17.000000000 +0200
--- src/testdir/test95.ok 2013-05-23 19:34:01.000000000 +0200
***************
*** 8,12 ****
OK - \i\+
OK - \%#=1\i\+
OK - \f\+
! OK - \%#=1\i\+
OK - [^[=a=]]\+
--- 8,12 ----
OK - \i\+
OK - \%#=1\i\+
OK - \f\+
! OK - \%#=1\f\+
OK - [^[=a=]]\+
*** ../vim-7.3.1007/src/version.c 2013-05-23 22:26:50.000000000 +0200
--- src/version.c 2013-05-23 22:39:37.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1008,
/**/
--
BLACK KNIGHT: The Black Knight always triumphs. Have at you!
ARTHUR takes his last leg off. The BLACK KNIGHT's body lands upright.
BLACK KNIGHT: All right, we'll call it a draw.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// 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 ///

50
7.3.1009 Normal file
View File

@ -0,0 +1,50 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1009
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1009
Problem: Compiler warning for ambiguous else.
Solution: Add curly braces.
Files: src/if_py_both.h
*** ../vim-7.3.1008/src/if_py_both.h 2013-05-21 22:38:14.000000000 +0200
--- src/if_py_both.h 2013-05-24 18:54:32.000000000 +0200
***************
*** 2163,2169 ****
--- 2163,2171 ----
TabPageObject *tabObject = self->tabObject;
if (tabObject)
+ {
Py_DECREF((PyObject *)(tabObject));
+ }
DESTRUCTOR_FINISH(self);
}
*** ../vim-7.3.1008/src/version.c 2013-05-23 22:43:03.000000000 +0200
--- src/version.c 2013-05-24 18:58:10.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1009,
/**/
--
BEDEVERE: Why do you think she is a witch?
SECOND VILLAGER: She turned me into a newt.
BEDEVERE: A newt?
SECOND VILLAGER: (After looking at himself for some time) I got better.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// 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 ///

174
7.3.1010 Normal file
View File

@ -0,0 +1,174 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1010
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1010
Problem: New regexp: adding \Z makes every character match.
Solution: Only apply ireg_icombine for composing characters.
Alsl add missing change from patch 1008. (Ken Takata)
Files: src/regexp_nfa.c, src/testdir/test95.in, src/testdir/test95.ok
*** ../vim-7.3.1009/src/regexp_nfa.c 2013-05-23 22:25:10.000000000 +0200
--- src/regexp_nfa.c 2013-05-24 20:20:14.000000000 +0200
***************
*** 2859,2865 ****
List *listtbl[2][2];
List *ll;
int listid = 1;
! int endnode = 0;
List *thislist;
List *nextlist;
List *neglist;
--- 2859,2865 ----
List *listtbl[2][2];
List *ll;
int listid = 1;
! int endnode;
List *thislist;
List *nextlist;
List *neglist;
***************
*** 3192,3204 ****
case NFA_MULTIBYTE:
case NFA_COMPOSING:
! switch (t->state->c)
! {
! case NFA_MULTIBYTE: endnode = NFA_END_MULTIBYTE; break;
! case NFA_COMPOSING: endnode = NFA_END_COMPOSING; break;
! default: endnode = 0;
! }
!
result = OK;
sta = t->state->out;
len = 1;
--- 3192,3198 ----
case NFA_MULTIBYTE:
case NFA_COMPOSING:
! endnode = t->state->c + 1;
result = OK;
sta = t->state->out;
len = 1;
***************
*** 3206,3212 ****
{
if (reginput[len-1] != sta->c)
{
! result = OK - 1;
break;
}
len++;
--- 3200,3206 ----
{
if (reginput[len-1] != sta->c)
{
! result = FAIL;
break;
}
len++;
***************
*** 3215,3225 ****
/* if input char length doesn't match regexp char length */
if (len -1 < n || sta->c != endnode)
! result = OK - 1;
end = t->state->out1; /* NFA_END_MULTIBYTE or
NFA_END_COMPOSING */
/* If \Z was present, then ignore composing characters */
! if (regflags & RF_ICOMBINE)
result = 1 ^ sta->negated;
ADD_POS_NEG_STATE(end);
break;
--- 3209,3219 ----
/* if input char length doesn't match regexp char length */
if (len -1 < n || sta->c != endnode)
! result = FAIL;
end = t->state->out1; /* NFA_END_MULTIBYTE or
NFA_END_COMPOSING */
/* If \Z was present, then ignore composing characters */
! if (ireg_icombine && endnode == NFA_END_COMPOSING)
result = 1 ^ sta->negated;
ADD_POS_NEG_STATE(end);
break;
*** ../vim-7.3.1009/src/testdir/test95.in 2013-05-23 22:43:03.000000000 +0200
--- src/testdir/test95.in 2013-05-24 20:18:13.000000000 +0200
***************
*** 7,13 ****
STARTTEST
:so small.vim
:so mbyte.vim
! :set nocp encoding=utf-8 viminfo+=nviminfo
:" tl is a List of Lists with:
:" regexp pattern
:" text to test the pattern on
--- 7,13 ----
STARTTEST
:so small.vim
:so mbyte.vim
! :set nocp encoding=utf-8 viminfo+=nviminfo nomore
:" tl is a List of Lists with:
:" regexp pattern
:" text to test the pattern on
***************
*** 35,45 ****
:call add(tl, ['\f\+', '&*Ÿfname ', 'fname'])
:call add(tl, ['\%#=1\f\+', '&*Ÿfname ', 'fname'])
:"""" Combining different tests and features
:call add(tl, ['[^[=a=]]\+', 'ddaãâbcd', 'dd'])
:"""" Run the tests
-
:"
:for t in tl
: let l = matchlist(t[1], t[0])
--- 35,47 ----
:call add(tl, ['\f\+', '&*Ÿfname ', 'fname'])
:call add(tl, ['\%#=1\f\+', '&*Ÿfname ', 'fname'])
+ :"""" Test \Z
+ :call add(tl, ['ú\Z', 'x'])
+
:"""" Combining different tests and features
:call add(tl, ['[^[=a=]]\+', 'ddaãâbcd', 'dd'])
:"""" Run the tests
:"
:for t in tl
: let l = matchlist(t[1], t[0])
*** ../vim-7.3.1009/src/testdir/test95.ok 2013-05-23 22:43:03.000000000 +0200
--- src/testdir/test95.ok 2013-05-24 20:18:55.000000000 +0200
***************
*** 9,12 ****
--- 9,13 ----
OK - \%#=1\i\+
OK - \f\+
OK - \%#=1\f\+
+ OK - ú\Z
OK - [^[=a=]]\+
*** ../vim-7.3.1009/src/version.c 2013-05-24 18:58:39.000000000 +0200
--- src/version.c 2013-05-24 20:21:52.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1010,
/**/
--
Never under any circumstances take a sleeping pill
and a laxative on the same night.
/// 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 ///

475
7.3.1011 Normal file
View File

@ -0,0 +1,475 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1011
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1011
Problem: New regexp engine is inefficient with multi-byte characters.
Solution: Handle a character at a time instead of a byte at a time. Also
make \Z partly work.
Files: src/regexp_nfa.c, src/testdir/test95.in, src/testdir/test95.ok
*** ../vim-7.3.1010/src/regexp_nfa.c 2013-05-24 20:25:28.000000000 +0200
--- src/regexp_nfa.c 2013-05-24 21:49:43.000000000 +0200
***************
*** 46,54 ****
NFA_NCLOSE, /* End of subexpr. marked with \%( ... \) */
NFA_START_INVISIBLE,
NFA_END_INVISIBLE,
- NFA_MULTIBYTE, /* Next nodes in NFA are part of the same
- multibyte char */
- NFA_END_MULTIBYTE, /* End of multibyte char in the NFA */
NFA_COMPOSING, /* Next nodes in NFA are part of the
composing multibyte char */
NFA_END_COMPOSING, /* End of a composing char in the NFA */
--- 46,51 ----
***************
*** 195,220 ****
*post_ptr++ = c; \
} while (0)
- #define EMIT_MBYTE(c) \
- len = (*mb_char2bytes)(c, buf); \
- EMIT(buf[0]); \
- for (i = 1; i < len; i++) \
- { \
- EMIT(buf[i]); \
- EMIT(NFA_CONCAT); \
- } \
- EMIT(NFA_MULTIBYTE);
-
- #define EMIT_COMPOSING_UTF(input) \
- len = utfc_ptr2len(input); \
- EMIT(input[0]); \
- for (i = 1; i < len; i++) \
- { \
- EMIT(input[i]); \
- EMIT(NFA_CONCAT); \
- } \
- EMIT(NFA_COMPOSING);
-
/*
* Initialize internal variables before NFA compilation.
* Return OK on success, FAIL otherwise.
--- 192,197 ----
***************
*** 611,618 ****
#ifdef FEAT_MBYTE
char_u *old_regparse = regparse;
int clen;
- int len;
- static char_u buf[30];
int i;
#endif
int extra = 0;
--- 588,593 ----
***************
*** 845,858 ****
return FAIL;
c = coll_get_char();
! #ifdef FEAT_MBYTE
! if ((*mb_char2len)(c) > 1)
! {
! EMIT_MBYTE(c);
! }
! else
! #endif
! EMIT(c);
break;
/* Catch \%^ and \%$ regardless of where they appear in the
--- 820,826 ----
return FAIL;
c = coll_get_char();
! EMIT(c);
break;
/* Catch \%^ and \%$ regardless of where they appear in the
***************
*** 1135,1146 ****
* skip it. */
for (c = startc + 1; c <= endc; c++)
{
! if ((*mb_char2len)(c) > 1)
! {
! EMIT_MBYTE(c);
! }
! else
! EMIT(c);
TRY_NEG();
EMIT_GLUE();
}
--- 1103,1109 ----
* skip it. */
for (c = startc + 1; c <= endc; c++)
{
! EMIT(c);
TRY_NEG();
EMIT_GLUE();
}
***************
*** 1187,1200 ****
if (got_coll_char == TRUE && startc == 0)
EMIT(0x0a);
else
! #ifdef FEAT_MBYTE
! if ((*mb_char2len)(startc) > 1)
! {
! EMIT_MBYTE(startc);
! }
! else
! #endif
! EMIT(startc);
TRY_NEG();
EMIT_GLUE();
}
--- 1150,1156 ----
if (got_coll_char == TRUE && startc == 0)
EMIT(0x0a);
else
! EMIT(startc);
TRY_NEG();
EMIT_GLUE();
}
***************
*** 1242,1271 ****
int plen;
nfa_do_multibyte:
! /* length of current char, with composing chars,
! * from pointer */
! plen = (*mb_ptr2len)(old_regparse);
! if (enc_utf8 && clen != plen)
! {
! /* A composing character is always handled as a
! * separate atom, surrounded by NFA_COMPOSING and
! * NFA_END_COMPOSING. Note that right now we are
* building the postfix form, not the NFA itself;
* a composing char could be: a, b, c, NFA_COMPOSING
! * where 'a', 'b', 'c' are chars with codes > 256.
! */
! EMIT_COMPOSING_UTF(old_regparse);
regparse = old_regparse + plen;
}
else
- /* A multi-byte character is always handled as a
- * separate atom, surrounded by NFA_MULTIBYTE and
- * NFA_END_MULTIBYTE */
- if (plen > 1)
- {
- EMIT_MBYTE(c);
- }
- else
#endif
{
c = no_Magic(c);
--- 1198,1227 ----
int plen;
nfa_do_multibyte:
! /* Length of current char with composing chars. */
! if (enc_utf8 && clen != (plen = (*mb_ptr2len)(old_regparse)))
! {
! /* A base character plus composing characters.
! * This requires creating a separate atom as if enclosing
! * the characters in (), where NFA_COMPOSING is the ( and
! * NFA_END_COMPOSING is the ). Note that right now we are
* building the postfix form, not the NFA itself;
* a composing char could be: a, b, c, NFA_COMPOSING
! * where 'b' and 'c' are chars with codes > 256. */
! i = 0;
! for (;;)
! {
! EMIT(c);
! if (i > 0)
! EMIT(NFA_CONCAT);
! if (i += utf_char2len(c) >= plen)
! break;
! c = utf_ptr2char(old_regparse + i);
! }
! EMIT(NFA_COMPOSING);
regparse = old_regparse + plen;
}
else
#endif
{
c = no_Magic(c);
***************
*** 1702,1710 ****
case NFA_START_INVISIBLE: STRCPY(code, "NFA_START_INVISIBLE"); break;
case NFA_END_INVISIBLE: STRCPY(code, "NFA_END_INVISIBLE"); break;
- case NFA_MULTIBYTE: STRCPY(code, "NFA_MULTIBYTE"); break;
- case NFA_END_MULTIBYTE: STRCPY(code, "NFA_END_MULTIBYTE"); break;
-
case NFA_COMPOSING: STRCPY(code, "NFA_COMPOSING"); break;
case NFA_END_COMPOSING: STRCPY(code, "NFA_END_COMPOSING"); break;
--- 1658,1663 ----
***************
*** 2194,2200 ****
}
e1 = POP();
e1.start->negated = TRUE;
! if (e1.start->c == NFA_MULTIBYTE || e1.start->c == NFA_COMPOSING)
e1.start->out1->negated = TRUE;
PUSH(e1);
break;
--- 2147,2153 ----
}
e1 = POP();
e1.start->negated = TRUE;
! if (e1.start->c == NFA_COMPOSING)
e1.start->out1->negated = TRUE;
PUSH(e1);
break;
***************
*** 2311,2316 ****
--- 2264,2279 ----
PUSH(frag(s, list1(&s1->out)));
break;
+ case NFA_COMPOSING: /* char with composing char */
+ #if 0
+ /* TODO */
+ if (regflags & RF_ICOMBINE)
+ {
+ goto normalchar;
+ }
+ #endif
+ /* FALLTHROUGH */
+
case NFA_MOPEN + 0: /* Submatch */
case NFA_MOPEN + 1:
case NFA_MOPEN + 2:
***************
*** 2322,2329 ****
case NFA_MOPEN + 8:
case NFA_MOPEN + 9:
case NFA_NOPEN: /* \%( "Invisible Submatch" */
- case NFA_MULTIBYTE: /* mbyte char */
- case NFA_COMPOSING: /* composing char */
if (nfa_calc_size == TRUE)
{
nstate += 2;
--- 2285,2290 ----
***************
*** 2336,2344 ****
case NFA_NOPEN:
mclose = NFA_NCLOSE;
break;
- case NFA_MULTIBYTE:
- mclose = NFA_END_MULTIBYTE;
- break;
case NFA_COMPOSING:
mclose = NFA_END_COMPOSING;
break;
--- 2297,2302 ----
***************
*** 2377,2385 ****
goto theend;
patch(e.out, s1);
! if (mopen == NFA_MULTIBYTE || mopen == NFA_COMPOSING)
! /* MULTIBYTE->out1 = END_MULTIBYTE
! * COMPOSING->out1 = END_COMPOSING */
patch(list1(&s->out1), s1);
PUSH(frag(s, list1(&s1->out)));
--- 2335,2342 ----
goto theend;
patch(e.out, s1);
! if (mopen == NFA_COMPOSING)
! /* COMPOSING->out1 = END_COMPOSING */
patch(list1(&s->out1), s1);
PUSH(frag(s, list1(&s1->out)));
***************
*** 2540,2556 ****
case NFA_COMPOSING:
/* nfa_regmatch() will match all the bytes of this composing char. */
break;
-
- case NFA_MULTIBYTE:
- /* nfa_regmatch() will match all the bytes of this multibyte char. */
- break;
#endif
- case NFA_END_MULTIBYTE:
- /* Successfully matched this mbyte char */
- addstate(l, state->out, m, off, lid, match);
- break;
-
case NFA_NOPEN:
case NFA_NCLOSE:
addstate(l, state->out, m, off, lid, match);
--- 2497,2504 ----
***************
*** 2841,2847 ****
regsub_T *submatch;
regsub_T *m;
{
! int c = -1;
int n;
int i = 0;
int result;
--- 2789,2795 ----
regsub_T *submatch;
regsub_T *m;
{
! int c;
int n;
int i = 0;
int result;
***************
*** 2859,2865 ****
List *listtbl[2][2];
List *ll;
int listid = 1;
- int endnode;
List *thislist;
List *nextlist;
List *neglist;
--- 2807,2812 ----
***************
*** 3190,3222 ****
break;
}
! case NFA_MULTIBYTE:
case NFA_COMPOSING:
! endnode = t->state->c + 1;
result = OK;
sta = t->state->out;
! len = 1;
! while (sta->c != endnode && len <= n)
{
! if (reginput[len-1] != sta->c)
! {
! result = FAIL;
break;
! }
! len++;
sta = sta->out;
}
/* if input char length doesn't match regexp char length */
! if (len -1 < n || sta->c != endnode)
result = FAIL;
! end = t->state->out1; /* NFA_END_MULTIBYTE or
! NFA_END_COMPOSING */
/* If \Z was present, then ignore composing characters */
! if (ireg_icombine && endnode == NFA_END_COMPOSING)
result = 1 ^ sta->negated;
ADD_POS_NEG_STATE(end);
break;
case NFA_NEWL:
if (!reg_line_lbr && REG_MULTI
--- 3137,3171 ----
break;
}
! #ifdef FEAT_MBYTE
case NFA_COMPOSING:
! {
! int mc = c;
!
result = OK;
sta = t->state->out;
! len = 0;
! while (sta->c != NFA_END_COMPOSING && len < n)
{
! if (len > 0)
! mc = mb_ptr2char(reginput + len);
! if (mc != sta->c)
break;
! len += mb_char2len(mc);
sta = sta->out;
}
/* if input char length doesn't match regexp char length */
! if (len < n || sta->c != NFA_END_COMPOSING)
result = FAIL;
! end = t->state->out1; /* NFA_END_COMPOSING */
/* If \Z was present, then ignore composing characters */
! if (ireg_icombine)
result = 1 ^ sta->negated;
ADD_POS_NEG_STATE(end);
break;
+ }
+ #endif
case NFA_NEWL:
if (!reg_line_lbr && REG_MULTI
***************
*** 3425,3430 ****
--- 3374,3387 ----
if (!result)
result = ireg_ic == TRUE
&& MB_TOLOWER(t->state->c) == MB_TOLOWER(c);
+ #ifdef FEAT_MBYTE
+ /* If there is a composing character which is not being
+ * ignored there can be no match. Match with composing
+ * character uses NFA_COMPOSING above. */
+ if (result && enc_utf8 && !ireg_icombine
+ && n != utf_char2len(c))
+ result = FALSE;
+ #endif
ADD_POS_NEG_STATE(t->state);
break;
}
*** ../vim-7.3.1010/src/testdir/test95.in 2013-05-24 20:25:28.000000000 +0200
--- src/testdir/test95.in 2013-05-24 20:45:08.000000000 +0200
***************
*** 35,40 ****
--- 35,44 ----
:call add(tl, ['\f\+', '&*Ÿfname ', 'fname'])
:call add(tl, ['\%#=1\f\+', '&*Ÿfname ', 'fname'])
+ :"""" Test composing character matching
+ :call add(tl, ['.ม', 'xม่x yมy', 'yม'])
+ :call add(tl, ['.ม่', 'xม่x yมy', 'xม่'])
+
:"""" Test \Z
:call add(tl, ['ú\Z', 'x'])
*** ../vim-7.3.1010/src/testdir/test95.ok 2013-05-24 20:25:28.000000000 +0200
--- src/testdir/test95.ok 2013-05-24 20:44:41.000000000 +0200
***************
*** 9,13 ****
--- 9,15 ----
OK - \%#=1\i\+
OK - \f\+
OK - \%#=1\f\+
+ OK - .ม
+ OK - .ม่
OK - ú\Z
OK - [^[=a=]]\+
*** ../vim-7.3.1010/src/version.c 2013-05-24 20:25:28.000000000 +0200
--- src/version.c 2013-05-24 21:56:02.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1011,
/**/
--
If you had to identify, in one word, the reason why the
human race has not achieved, and never will achieve, its
full potential, that word would be "meetings."
/// 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 ///

196
7.3.1012 Normal file
View File

@ -0,0 +1,196 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1012
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1012
Problem: \Z does not work properly with the new regexp engine.
Solution: Make \Z work. Add tests.
Files: src/regexp_nfa.c, src/testdir/test95.in, src/testdir/test95.ok
*** ../vim-7.3.1011/src/regexp_nfa.c 2013-05-24 21:59:50.000000000 +0200
--- src/regexp_nfa.c 2013-05-24 22:46:00.000000000 +0200
***************
*** 1184,1197 ****
EMIT(NFA_CONCAT);
}
return OK;
! } /* if exists closing ] */
! else if (reg_strict)
{
syntax_error = TRUE;
EMSG_RET_FAIL(_(e_missingbracket));
}
- /* FALLTHROUGH */
default:
{
#ifdef FEAT_MBYTE
--- 1184,1198 ----
EMIT(NFA_CONCAT);
}
return OK;
! } /* if exists closing ] */
!
! if (reg_strict)
{
syntax_error = TRUE;
EMSG_RET_FAIL(_(e_missingbracket));
}
+ /* FALLTHROUGH */
default:
{
#ifdef FEAT_MBYTE
***************
*** 1214,1220 ****
EMIT(c);
if (i > 0)
EMIT(NFA_CONCAT);
! if (i += utf_char2len(c) >= plen)
break;
c = utf_ptr2char(old_regparse + i);
}
--- 1215,1221 ----
EMIT(c);
if (i > 0)
EMIT(NFA_CONCAT);
! if ((i += utf_char2len(c)) >= plen)
break;
c = utf_ptr2char(old_regparse + i);
}
***************
*** 2269,2275 ****
/* TODO */
if (regflags & RF_ICOMBINE)
{
! goto normalchar;
}
#endif
/* FALLTHROUGH */
--- 2270,2276 ----
/* TODO */
if (regflags & RF_ICOMBINE)
{
! /* use the base character only */
}
#endif
/* FALLTHROUGH */
***************
*** 3145,3167 ****
result = OK;
sta = t->state->out;
len = 0;
! while (sta->c != NFA_END_COMPOSING && len < n)
{
! if (len > 0)
! mc = mb_ptr2char(reginput + len);
! if (mc != sta->c)
! break;
! len += mb_char2len(mc);
! sta = sta->out;
}
/* if input char length doesn't match regexp char length */
if (len < n || sta->c != NFA_END_COMPOSING)
result = FAIL;
end = t->state->out1; /* NFA_END_COMPOSING */
- /* If \Z was present, then ignore composing characters */
- if (ireg_icombine)
- result = 1 ^ sta->negated;
ADD_POS_NEG_STATE(end);
break;
}
--- 3146,3176 ----
result = OK;
sta = t->state->out;
len = 0;
! if (ireg_icombine)
{
! /* If \Z was present, then ignore composing characters. */
! /* TODO: How about negated? */
! if (sta->c != c)
! result = FAIL;
! len = n;
! while (sta->c != NFA_END_COMPOSING)
! sta = sta->out;
}
+ else
+ while (sta->c != NFA_END_COMPOSING && len < n)
+ {
+ if (len > 0)
+ mc = mb_ptr2char(reginput + len);
+ if (mc != sta->c)
+ break;
+ len += mb_char2len(mc);
+ sta = sta->out;
+ }
/* if input char length doesn't match regexp char length */
if (len < n || sta->c != NFA_END_COMPOSING)
result = FAIL;
end = t->state->out1; /* NFA_END_COMPOSING */
ADD_POS_NEG_STATE(end);
break;
}
*** ../vim-7.3.1011/src/testdir/test95.in 2013-05-24 21:59:50.000000000 +0200
--- src/testdir/test95.in 2013-05-24 23:02:13.000000000 +0200
***************
*** 41,46 ****
--- 41,55 ----
:"""" Test \Z
:call add(tl, ['ú\Z', 'x'])
+ :call add(tl, ['יהוה\Z', 'יהוה', 'יהוה'])
+ :call add(tl, ['יְהוָה\Z', 'יהוה', 'יהוה'])
+ :call add(tl, ['יהוה\Z', 'יְהוָה', 'יְהוָה'])
+ :call add(tl, ['יְהוָה\Z', 'יְהוָה', 'יְהוָה'])
+ :call add(tl, ['יְ\Z', 'וְיַ', 'יַ'])
+ :call add(tl, ["ק\u200d\u05b9x\\Z", "xק\u200d\u05b9xy", "ק\u200d\u05b9x"])
+ :call add(tl, ["ק\u200d\u05b9x\\Z", "xק\u200dxy", "ק\u200dx"])
+ :call add(tl, ["ק\u200dx\\Z", "xק\u200d\u05b9xy", "ק\u200d\u05b9x"])
+ :call add(tl, ["ק\u200dx\\Z", "xק\u200dxy", "ק\u200dx"])
:"""" Combining different tests and features
:call add(tl, ['[^[=a=]]\+', 'ddaãâbcd', 'dd'])
*** ../vim-7.3.1011/src/testdir/test95.ok 2013-05-24 21:59:50.000000000 +0200
--- src/testdir/test95.ok 2013-05-24 23:02:59.000000000 +0200
***************
*** 12,15 ****
--- 12,24 ----
OK - .ม
OK - .ม่
OK - ú\Z
+ OK - יהוה\Z
+ OK - יְהוָה\Z
+ OK - יהוה\Z
+ OK - יְהוָה\Z
+ OK - יְ\Z
+ OK - קֹx\Z
+ OK - קֹx\Z
+ OK - קx\Z
+ OK - קx\Z
OK - [^[=a=]]\+
*** ../vim-7.3.1011/src/version.c 2013-05-24 21:59:50.000000000 +0200
--- src/version.c 2013-05-24 23:08:21.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1012,
/**/
--
BEDEVERE: And that, my lord, is how we know the Earth to be banana-shaped.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// 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 ///

347
7.3.1013 Normal file
View File

@ -0,0 +1,347 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1013
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1013
Problem: New regexp logging is a bit messy.
Solution: Consistently use #defines, add explanatory comment. (Taro Muraoka)
Files: src/regexp_nfa.c
*** ../vim-7.3.1012/src/regexp_nfa.c 2013-05-24 23:10:45.000000000 +0200
--- src/regexp_nfa.c 2013-05-25 12:17:35.000000000 +0200
***************
*** 5,16 ****
* This file is included in "regexp.c".
*/
#ifdef DEBUG
! /* Comment this out to disable log files. They can get pretty big */
# define ENABLE_LOG
! # define LOG_NAME "log_nfarun.log"
! # define NFA_REGEXP_DEBUG_LOG
! # define NFA_REGEXP_DEBUG_LOG_NAME "nfa_regexp_debug.log"
#endif
/* Upper limit allowed for {m,n} repetitions handled by NFA */
--- 5,32 ----
* This file is included in "regexp.c".
*/
+ /*
+ * Logging of NFA engine.
+ *
+ * The NFA engine can write four log files:
+ * - Error log: Contains NFA engine's fatal errors.
+ * - Dump log: Contains compiled NFA state machine's information.
+ * - Run log: Contains information of matching procedure.
+ * - Debug log: Contains detailed information of matching procedure. Can be
+ * disabled by undefining NFA_REGEXP_DEBUG_LOG.
+ * The first one can also be used without debug mode.
+ * The last three are enabled when compiled as debug mode and individually
+ * disabled by commenting them out.
+ * The log files can get quite big!
+ * Do disable all of this when compiling Vim for debugging, undefine DEBUG in
+ * regexp.c
+ */
#ifdef DEBUG
! # define NFA_REGEXP_ERROR_LOG "nfa_regexp_error.log"
# define ENABLE_LOG
! # define NFA_REGEXP_DUMP_LOG "nfa_regexp_dump.log"
! # define NFA_REGEXP_RUN_LOG "nfa_regexp_run.log"
! # define NFA_REGEXP_DEBUG_LOG "nfa_regexp_debug.log"
#endif
/* Upper limit allowed for {m,n} repetitions handled by NFA */
***************
*** 1769,1775 ****
int *p;
FILE *f;
! f = fopen("LOG.log", "a");
if (f != NULL)
{
fprintf(f, "\n-------------------------\n");
--- 1785,1791 ----
int *p;
FILE *f;
! f = fopen(NFA_REGEXP_DUMP_LOG, "a");
if (f != NULL)
{
fprintf(f, "\n-------------------------\n");
***************
*** 1827,1833 ****
nfa_dump(prog)
nfa_regprog_T *prog;
{
! FILE *debugf = fopen("LOG.log", "a");
if (debugf != NULL)
{
--- 1843,1849 ----
nfa_dump(prog)
nfa_regprog_T *prog;
{
! FILE *debugf = fopen(NFA_REGEXP_DUMP_LOG, "a");
if (debugf != NULL)
{
***************
*** 1994,2007 ****
static void
st_error(postfix, end, p)
! int *postfix;
! int *end;
! int *p;
{
FILE *df;
int *p2;
! df = fopen("stack.err", "a");
if (df)
{
fprintf(df, "Error popping the stack!\n");
--- 2010,2024 ----
static void
st_error(postfix, end, p)
! int *postfix UNUSED;
! int *end UNUSED;
! int *p UNUSED;
{
+ #ifdef NFA_REGEXP_ERROR_LOG
FILE *df;
int *p2;
! df = fopen(NFA_REGEXP_ERROR_LOG, "a");
if (df)
{
fprintf(df, "Error popping the stack!\n");
***************
*** 2036,2041 ****
--- 2053,2059 ----
fprintf(df, "\n--------------------------\n");
fclose(df);
}
+ #endif
EMSG(_("E874: (NFA) Could not pop the stack !"));
}
***************
*** 2148,2155 ****
--- 2166,2175 ----
}
e1 = POP();
e1.start->negated = TRUE;
+ #ifdef FEAT_MBYTE
if (e1.start->c == NFA_COMPOSING)
e1.start->out1->negated = TRUE;
+ #endif
PUSH(e1);
break;
***************
*** 2265,2270 ****
--- 2285,2291 ----
PUSH(frag(s, list1(&s1->out)));
break;
+ #ifdef FEAT_MBYTE
case NFA_COMPOSING: /* char with composing char */
#if 0
/* TODO */
***************
*** 2274,2279 ****
--- 2295,2301 ----
}
#endif
/* FALLTHROUGH */
+ #endif
case NFA_MOPEN + 0: /* Submatch */
case NFA_MOPEN + 1:
***************
*** 2298,2306 ****
--- 2320,2330 ----
case NFA_NOPEN:
mclose = NFA_NCLOSE;
break;
+ #ifdef FEAT_MBYTE
case NFA_COMPOSING:
mclose = NFA_END_COMPOSING;
break;
+ #endif
default:
/* NFA_MOPEN(0) ... NFA_MOPEN(9) */
mclose = *p + NSUBEXP;
***************
*** 2336,2344 ****
--- 2360,2370 ----
goto theend;
patch(e.out, s1);
+ #ifdef FEAT_MBYTE
if (mopen == NFA_COMPOSING)
/* COMPOSING->out1 = END_COMPOSING */
patch(list1(&s->out1), s1);
+ #endif
PUSH(frag(s, list1(&s1->out)));
break;
***************
*** 2802,2809 ****
thread_T *t;
char_u *old_reginput = NULL;
char_u *old_regline = NULL;
- nfa_state_T *sta;
- nfa_state_T *end;
List list[3];
List *listtbl[2][2];
List *ll;
--- 2828,2833 ----
***************
*** 2813,2825 ****
List *neglist;
int *listids = NULL;
int j = 0;
- int len = 0;
#ifdef NFA_REGEXP_DEBUG_LOG
! FILE *debug = fopen(NFA_REGEXP_DEBUG_LOG_NAME, "a");
if (debug == NULL)
{
! EMSG2(_("(NFA) COULD NOT OPEN %s !"), NFA_REGEXP_DEBUG_LOG_NAME);
return FALSE;
}
#endif
--- 2837,2848 ----
List *neglist;
int *listids = NULL;
int j = 0;
#ifdef NFA_REGEXP_DEBUG_LOG
! FILE *debug = fopen(NFA_REGEXP_DEBUG_LOG, "a");
if (debug == NULL)
{
! EMSG2(_("(NFA) COULD NOT OPEN %s !"), NFA_REGEXP_DEBUG_LOG);
return FALSE;
}
#endif
***************
*** 2836,2842 ****
vim_memset(list[2].t, 0, size);
#ifdef ENABLE_LOG
! log_fd = fopen(LOG_NAME, "a");
if (log_fd != NULL)
{
fprintf(log_fd, "**********************************\n");
--- 2859,2865 ----
vim_memset(list[2].t, 0, size);
#ifdef ENABLE_LOG
! log_fd = fopen(NFA_REGEXP_RUN_LOG, "a");
if (log_fd != NULL)
{
fprintf(log_fd, "**********************************\n");
***************
*** 3025,3031 ****
nfa_restore_listids(start, listids);
#ifdef ENABLE_LOG
! log_fd = fopen(LOG_NAME, "a");
if (log_fd != NULL)
{
fprintf(log_fd, "****************************\n");
--- 3048,3054 ----
nfa_restore_listids(start, listids);
#ifdef ENABLE_LOG
! log_fd = fopen(NFA_REGEXP_RUN_LOG, "a");
if (log_fd != NULL)
{
fprintf(log_fd, "****************************\n");
***************
*** 3141,3147 ****
#ifdef FEAT_MBYTE
case NFA_COMPOSING:
{
! int mc = c;
result = OK;
sta = t->state->out;
--- 3164,3173 ----
#ifdef FEAT_MBYTE
case NFA_COMPOSING:
{
! int mc = c;
! int len = 0;
! nfa_state_T *end;
! nfa_state_T *sta;
result = OK;
sta = t->state->out;
***************
*** 3469,3475 ****
need_clear_subexpr = TRUE;
#ifdef ENABLE_LOG
! f = fopen(LOG_NAME, "a");
if (f != NULL)
{
fprintf(f, "\n\n\n\n\n\n\t\t=======================================================\n");
--- 3495,3501 ----
need_clear_subexpr = TRUE;
#ifdef ENABLE_LOG
! f = fopen(NFA_REGEXP_RUN_LOG, "a");
if (f != NULL)
{
fprintf(f, "\n\n\n\n\n\n\t\t=======================================================\n");
***************
*** 3662,3668 ****
*/
#ifdef ENABLE_LOG
{
! FILE *f = fopen(LOG_NAME, "a");
if (f != NULL)
{
--- 3688,3694 ----
*/
#ifdef ENABLE_LOG
{
! FILE *f = fopen(NFA_REGEXP_RUN_LOG, "a");
if (f != NULL)
{
*** ../vim-7.3.1012/src/version.c 2013-05-24 23:10:45.000000000 +0200
--- src/version.c 2013-05-25 12:06:33.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1013,
/**/
--
Scientists decoded the first message from an alien civilization:
SIMPLY SEND 6 TIMES 10 TO THE 50 ATOMS OF HYDROGEN TO THE STAR
SYSTEM AT THE TOP OF THE LIST, CROSS OFF THAT STAR SYSTEM, THEN PUT
YOUR STAR SYSTEM AT THE BOTTOM OF THE LIST AND SEND IT TO 100 OTHER
STAR SYSTEMS. WITHIN ONE TENTH GALACTIC ROTATION YOU WILL RECEIVE
ENOUGH HYDROGREN TO POWER YOUR CIVILIZATION UNTIL ENTROPY REACHES ITS
MAXIMUM! IT REALLY WORKS!
/// 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 ///

192
7.3.1014 Normal file
View File

@ -0,0 +1,192 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1014
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1014
Problem: New regexp state dump is hard to read.
Solution: Make the state dump more pretty. (Taro Muraoka)
Files: src/regexp_nfa.c
*** ../vim-7.3.1013/src/regexp_nfa.c 2013-05-25 12:18:34.000000000 +0200
--- src/regexp_nfa.c 2013-05-25 12:25:43.000000000 +0200
***************
*** 183,189 ****
#ifdef DEBUG
static void nfa_set_code __ARGS((int c));
static void nfa_postfix_dump __ARGS((char_u *expr, int retval));
! static void nfa_print_state __ARGS((FILE *debugf, nfa_state_T *state, int ident));
static void nfa_dump __ARGS((nfa_regprog_T *prog));
#endif
static int *re2post __ARGS((void));
--- 183,190 ----
#ifdef DEBUG
static void nfa_set_code __ARGS((int c));
static void nfa_postfix_dump __ARGS((char_u *expr, int retval));
! static void nfa_print_state __ARGS((FILE *debugf, nfa_state_T *state));
! static void nfa_print_state2 __ARGS((FILE *debugf, nfa_state_T *state, garray_T *indent));
static void nfa_dump __ARGS((nfa_regprog_T *prog));
#endif
static int *re2post __ARGS((void));
***************
*** 1811,1839 ****
* Print the NFA starting with a root node "state".
*/
static void
! nfa_print_state(debugf, state, ident)
FILE *debugf;
nfa_state_T *state;
- int ident;
{
! int i;
if (state == NULL)
return;
fprintf(debugf, "(%2d)", abs(state->id));
! for (i = 0; i < ident; i++)
! fprintf(debugf, "%c", ' ');
nfa_set_code(state->c);
! fprintf(debugf, "%s %s (%d) (id=%d)\n",
! state->negated ? "NOT" : "", code, state->c, abs(state->id));
if (state->id < 0)
return;
state->id = abs(state->id) * -1;
! nfa_print_state(debugf, state->out, ident + 4);
! nfa_print_state(debugf, state->out1, ident + 4);
}
/*
--- 1812,1885 ----
* Print the NFA starting with a root node "state".
*/
static void
! nfa_print_state(debugf, state)
FILE *debugf;
nfa_state_T *state;
{
! garray_T indent;
!
! ga_init2(&indent, 1, 64);
! ga_append(&indent, '\0');
! nfa_print_state2(debugf, state, &indent);
! ga_clear(&indent);
! }
!
! static void
! nfa_print_state2(debugf, state, indent)
! FILE *debugf;
! nfa_state_T *state;
! garray_T *indent;
! {
! char_u *p;
if (state == NULL)
return;
fprintf(debugf, "(%2d)", abs(state->id));
!
! /* Output indent */
! p = (char_u *)indent->ga_data;
! if (indent->ga_len >= 3)
! {
! int last = indent->ga_len - 3;
! char_u save[2];
!
! STRNCPY(save, &p[last], 2);
! STRNCPY(&p[last], "+-", 2);
! fprintf(debugf, " %s", p);
! STRNCPY(&p[last], save, 2);
! }
! else
! fprintf(debugf, " %s", p);
nfa_set_code(state->c);
! fprintf(debugf, "%s%s (%d) (id=%d)\n",
! state->negated ? "NOT " : "", code, state->c, abs(state->id));
if (state->id < 0)
return;
state->id = abs(state->id) * -1;
!
! /* grow indent for state->out */
! indent->ga_len -= 1;
! if (state->out1)
! ga_concat(indent, "| ");
! else
! ga_concat(indent, " ");
! ga_append(indent, '\0');
!
! nfa_print_state2(debugf, state->out, indent);
!
! /* replace last part of indent for state->out1 */
! indent->ga_len -= 3;
! ga_concat(indent, " ");
! ga_append(indent, '\0');
!
! nfa_print_state2(debugf, state->out1, indent);
!
! /* shrink indent */
! indent->ga_len -= 3;
! ga_append(indent, '\0');
}
/*
***************
*** 1847,1853 ****
if (debugf != NULL)
{
! nfa_print_state(debugf, prog->start, 0);
fclose(debugf);
}
}
--- 1893,1899 ----
if (debugf != NULL)
{
! nfa_print_state(debugf, prog->start);
fclose(debugf);
}
}
***************
*** 3505,3511 ****
#endif
fprintf(f, "\tInput text is \"%s\" \n", reginput);
fprintf(f, " =======================================================\n\n\n\n\n\n\n");
! nfa_print_state(f, start, 0);
fprintf(f, "\n\n");
fclose(f);
}
--- 3551,3557 ----
#endif
fprintf(f, "\tInput text is \"%s\" \n", reginput);
fprintf(f, " =======================================================\n\n\n\n\n\n\n");
! nfa_print_state(f, start);
fprintf(f, "\n\n");
fclose(f);
}
*** ../vim-7.3.1013/src/version.c 2013-05-25 12:18:34.000000000 +0200
--- src/version.c 2013-05-25 12:27:22.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1014,
/**/
--
Lower life forms have more fun!
/// 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 ///

172
7.3.1015 Normal file
View File

@ -0,0 +1,172 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1015
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1015
Problem: New regexp engine: Matching composing characters is wrong.
Solution: Fix matching composing characters.
Files: src/regexp_nfa.c, src/testdir/test95.in, src/testdir/test95.ok
*** ../vim-7.3.1014/src/regexp_nfa.c 2013-05-25 12:28:08.000000000 +0200
--- src/regexp_nfa.c 2013-05-25 14:25:42.000000000 +0200
***************
*** 716,721 ****
--- 716,722 ----
* the composing char is matched here. */
if (enc_utf8 && c == Magic('.') && utf_iscomposing(peekchr()))
{
+ old_regparse = regparse;
c = getchr();
goto nfa_do_multibyte;
}
***************
*** 1217,1225 ****
nfa_do_multibyte:
/* Length of current char with composing chars. */
! if (enc_utf8 && clen != (plen = (*mb_ptr2len)(old_regparse)))
{
! /* A base character plus composing characters.
* This requires creating a separate atom as if enclosing
* the characters in (), where NFA_COMPOSING is the ( and
* NFA_END_COMPOSING is the ). Note that right now we are
--- 1218,1228 ----
nfa_do_multibyte:
/* Length of current char with composing chars. */
! if (enc_utf8 && (clen != (plen = (*mb_ptr2len)(old_regparse))
! || utf_iscomposing(c)))
{
! /* A base character plus composing characters, or just one
! * or more composing characters.
* This requires creating a separate atom as if enclosing
* the characters in (), where NFA_COMPOSING is the ( and
* NFA_END_COMPOSING is the ). Note that right now we are
***************
*** 1400,1406 ****
/* Save pos after the repeated atom and the \{} */
new_regparse = regparse;
- new_regparse = regparse;
quest = (greedy == TRUE? NFA_QUEST : NFA_QUEST_NONGREEDY);
for (i = 0; i < maxval; i++)
{
--- 1403,1408 ----
***************
*** 3218,3228 ****
result = OK;
sta = t->state->out;
len = 0;
if (ireg_icombine)
{
! /* If \Z was present, then ignore composing characters. */
/* TODO: How about negated? */
! if (sta->c != c)
result = FAIL;
len = n;
while (sta->c != NFA_END_COMPOSING)
--- 3220,3238 ----
result = OK;
sta = t->state->out;
len = 0;
+ if (utf_iscomposing(sta->c))
+ {
+ /* Only match composing character(s), ignore base
+ * character. Used for ".{composing}" and "{composing}"
+ * (no preceding character). */
+ len += mb_char2len(c);
+ }
if (ireg_icombine)
{
! /* If \Z was present, then ignore composing characters.
! * When ignoring the base character this always matches. */
/* TODO: How about negated? */
! if (len == 0 && sta->c != c)
result = FAIL;
len = n;
while (sta->c != NFA_END_COMPOSING)
*** ../vim-7.3.1014/src/testdir/test95.in 2013-05-24 23:10:45.000000000 +0200
--- src/testdir/test95.in 2013-05-25 14:36:50.000000000 +0200
***************
*** 38,43 ****
--- 38,52 ----
:"""" Test composing character matching
:call add(tl, ['.ม', 'xม่x yมy', 'yม'])
:call add(tl, ['.ม่', 'xม่x yมy', 'xม่'])
+ :call add(tl, ["\u05b9", " x\u05b9 ", "x\u05b9"])
+ :call add(tl, [".\u05b9", " x\u05b9 ", "x\u05b9"])
+ :call add(tl, ["\u05b9\u05bb", " x\u05b9\u05bb ", "x\u05b9\u05bb"])
+ :call add(tl, [".\u05b9\u05bb", " x\u05b9\u05bb ", "x\u05b9\u05bb"])
+ :call add(tl, ["\u05bb\u05b9", " x\u05b9\u05bb "])
+ :call add(tl, [".\u05bb\u05b9", " x\u05b9\u05bb "])
+ :call add(tl, ["\u05b9", " y\u05bb x\u05b9 ", "x\u05b9"])
+ :call add(tl, [".\u05b9", " y\u05bb x\u05b9 ", "x\u05b9"])
+
:"""" Test \Z
:call add(tl, ['ú\Z', 'x'])
***************
*** 50,55 ****
--- 59,66 ----
:call add(tl, ["ק\u200d\u05b9x\\Z", "xק\u200dxy", "ק\u200dx"])
:call add(tl, ["ק\u200dx\\Z", "xק\u200d\u05b9xy", "ק\u200d\u05b9x"])
:call add(tl, ["ק\u200dx\\Z", "xק\u200dxy", "ק\u200dx"])
+ :call add(tl, ["\u05b9\\+\\Z", "xyz", "xyz"])
+ :call add(tl, ["\\Z\u05b9\\+", "xyz", "xyz"])
:"""" Combining different tests and features
:call add(tl, ['[^[=a=]]\+', 'ddaãâbcd', 'dd'])
*** ../vim-7.3.1014/src/testdir/test95.ok 2013-05-24 23:10:45.000000000 +0200
--- src/testdir/test95.ok 2013-05-25 14:36:54.000000000 +0200
***************
*** 11,16 ****
--- 11,24 ----
OK - \%#=1\f\+
OK - .ม
OK - .ม่
+ OK - ֹ
+ OK - .ֹ
+ OK - ֹֻ
+ OK - .ֹֻ
+ OK - ֹֻ
+ OK - .ֹֻ
+ OK - ֹ
+ OK - .ֹ
OK - ú\Z
OK - יהוה\Z
OK - יְהוָה\Z
***************
*** 21,24 ****
--- 29,34 ----
OK - קֹx\Z
OK - קx\Z
OK - קx\Z
+ OK - ֹ\+\Z
+ OK - \Zֹ\+
OK - [^[=a=]]\+
*** ../vim-7.3.1014/src/version.c 2013-05-25 12:28:08.000000000 +0200
--- src/version.c 2013-05-25 14:41:05.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1015,
/**/
--
If your company is not involved in something called "ISO 9000" you probably
have no idea what it is. If your company _is_ involved in ISO 9000 then you
definitely have no idea what it is.
(Scott Adams - The Dilbert principle)
/// 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 ///

153
7.3.1016 Normal file
View File

@ -0,0 +1,153 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1016
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1016
Problem: Unused field in nfa_state.
Solution: Remove lastthread.
Files: src/regexp.h, src/regexp_nfa.c
*** ../vim-7.3.1015/src/regexp.h 2013-05-19 19:16:25.000000000 +0200
--- src/regexp.h 2013-05-25 15:23:33.000000000 +0200
***************
*** 74,80 ****
int id;
int lastlist;
int visits;
- thread_T *lastthread;
int negated;
};
--- 74,79 ----
*** ../vim-7.3.1015/src/regexp_nfa.c 2013-05-25 14:41:58.000000000 +0200
--- src/regexp_nfa.c 2013-05-25 15:23:28.000000000 +0200
***************
*** 1865,1880 ****
/* grow indent for state->out */
indent->ga_len -= 1;
if (state->out1)
! ga_concat(indent, "| ");
else
! ga_concat(indent, " ");
ga_append(indent, '\0');
nfa_print_state2(debugf, state->out, indent);
/* replace last part of indent for state->out1 */
indent->ga_len -= 3;
! ga_concat(indent, " ");
ga_append(indent, '\0');
nfa_print_state2(debugf, state->out1, indent);
--- 1865,1880 ----
/* grow indent for state->out */
indent->ga_len -= 1;
if (state->out1)
! ga_concat(indent, (char_u *)"| ");
else
! ga_concat(indent, (char_u *)" ");
ga_append(indent, '\0');
nfa_print_state2(debugf, state->out, indent);
/* replace last part of indent for state->out1 */
indent->ga_len -= 3;
! ga_concat(indent, (char_u *)" ");
ga_append(indent, '\0');
nfa_print_state2(debugf, state->out1, indent);
***************
*** 1948,1954 ****
s->id = istate;
s->lastlist = 0;
- s->lastthread = NULL;
s->visits = 0;
s->negated = FALSE;
--- 1948,1953 ----
***************
*** 2498,2503 ****
--- 2497,2503 ----
{
regsub_T save;
int subidx = 0;
+ thread_T *lastthread;
if (l == NULL || state == NULL)
return;
***************
*** 2531,2539 ****
{
/* add the state to the list */
state->lastlist = lid;
! state->lastthread = &l->t[l->n++];
! state->lastthread->state = state;
! state->lastthread->sub = *m;
}
}
--- 2531,2539 ----
{
/* add the state to the list */
state->lastlist = lid;
! lastthread = &l->t[l->n++];
! lastthread->state = state;
! lastthread->sub = *m;
}
}
***************
*** 2983,2989 ****
fprintf(log_fd, ">>> Reginput is \"%s\"\n", reginput);
fprintf(log_fd, ">>> Advanced one character ... Current char is %c (code %d) \n", c, (int)c);
fprintf(log_fd, ">>> Thislist has %d states available: ", thislist->n);
! for (i = 0; i< thislist->n; i++)
fprintf(log_fd, "%d ", abs(thislist->t[i].state->id));
fprintf(log_fd, "\n");
#endif
--- 2983,2989 ----
fprintf(log_fd, ">>> Reginput is \"%s\"\n", reginput);
fprintf(log_fd, ">>> Advanced one character ... Current char is %c (code %d) \n", c, (int)c);
fprintf(log_fd, ">>> Thislist has %d states available: ", thislist->n);
! for (i = 0; i < thislist->n; i++)
fprintf(log_fd, "%d ", abs(thislist->t[i].state->id));
fprintf(log_fd, "\n");
#endif
***************
*** 3690,3696 ****
prog->state[i].id = i;
prog->state[i].lastlist = 0;
prog->state[i].visits = 0;
- prog->state[i].lastthread = NULL;
}
retval = nfa_regtry(prog->start, col);
--- 3690,3695 ----
*** ../vim-7.3.1015/src/version.c 2013-05-25 14:41:58.000000000 +0200
--- src/version.c 2013-05-25 15:28:53.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1016,
/**/
--
For large projects, Team Leaders use sophisticated project management software
to keep track of who's doing what. The software collects the lies and guesses
of the project team and organizes them in to instantly outdated charts that
are too boring to look at closely. This is called "planning".
(Scott Adams - The Dilbert principle)
/// 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 ///

416
7.3.1017 Normal file
View File

@ -0,0 +1,416 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1017
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1017
Problem: Zero width match changes length of match.
Solution: For a zero width match put new states in the current position in
the state list.
Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok,
src/regexp.h
*** ../vim-7.3.1016/src/regexp_nfa.c 2013-05-25 15:31:02.000000000 +0200
--- src/regexp_nfa.c 2013-05-25 20:18:25.000000000 +0200
***************
*** 2471,2494 ****
* NFA execution code.
****************************************************************/
! /* thread_T contains runtime information of a NFA state */
! struct thread
{
nfa_state_T *state;
! regsub_T sub; /* submatch info */
! };
typedef struct
{
! thread_T *t;
! int n;
! } List;
! static void addstate __ARGS((List *l, nfa_state_T *state, regsub_T *m, int off, int lid, int *match));
static void
addstate(l, state, m, off, lid, match)
! List *l; /* runtime state list */
nfa_state_T *state; /* state to update */
regsub_T *m; /* pointers to subexpressions */
int off; /* byte offset, when -1 go to next line */
--- 2471,2497 ----
* NFA execution code.
****************************************************************/
! /* nfa_thread_T contains runtime information of a NFA state */
! typedef struct
{
nfa_state_T *state;
! regsub_T sub; /* Submatch info. TODO: expensive! */
! } nfa_thread_T;
!
typedef struct
{
! nfa_thread_T *t;
! int n;
! } nfa_list_T;
! static void addstate __ARGS((nfa_list_T *l, nfa_state_T *state, regsub_T *m, int off, int lid, int *match));
!
! static void addstate_here __ARGS((nfa_list_T *l, nfa_state_T *state, regsub_T *m, int lid, int *match, int *ip));
static void
addstate(l, state, m, off, lid, match)
! nfa_list_T *l; /* runtime state list */
nfa_state_T *state; /* state to update */
regsub_T *m; /* pointers to subexpressions */
int off; /* byte offset, when -1 go to next line */
***************
*** 2497,2503 ****
{
regsub_T save;
int subidx = 0;
! thread_T *lastthread;
if (l == NULL || state == NULL)
return;
--- 2500,2506 ----
{
regsub_T save;
int subidx = 0;
! nfa_thread_T *lastthread;
if (l == NULL || state == NULL)
return;
***************
*** 2533,2539 ****
state->lastlist = lid;
lastthread = &l->t[l->n++];
lastthread->state = state;
! lastthread->sub = *m;
}
}
--- 2536,2542 ----
state->lastlist = lid;
lastthread = &l->t[l->n++];
lastthread->state = state;
! lastthread->sub = *m; /* TODO: expensive! */
}
}
***************
*** 2698,2703 ****
--- 2701,2754 ----
}
/*
+ * Like addstate(), but the new state(s) are put at position "*ip".
+ * Used for zero-width matches, next state to use is the added one.
+ * This makes sure the order of states to be tried does not change, which
+ * matters for alternatives.
+ */
+ static void
+ addstate_here(l, state, m, lid, matchp, ip)
+ nfa_list_T *l; /* runtime state list */
+ nfa_state_T *state; /* state to update */
+ regsub_T *m; /* pointers to subexpressions */
+ int lid;
+ int *matchp; /* found match? */
+ int *ip;
+ {
+ int tlen = l->n;
+ int count;
+ int i = *ip;
+
+ /* first add the state(s) at the end, so that we know how many there are */
+ addstate(l, state, m, 0, lid, matchp);
+
+ /* when "*ip" was at the end of the list, nothing to do */
+ if (i + 1 == tlen)
+ return;
+
+ /* re-order to put the new state at the current position */
+ count = l->n - tlen;
+ if (count > 1)
+ {
+ /* make space for new states, then move them from the
+ * end to the current position */
+ mch_memmove(&(l->t[i + count]),
+ &(l->t[i + 1]),
+ sizeof(nfa_thread_T) * (l->n - i - 1));
+ mch_memmove(&(l->t[i]),
+ &(l->t[l->n - 1]),
+ sizeof(nfa_thread_T) * count);
+ }
+ else
+ {
+ /* overwrite the current state */
+ l->t[i] = l->t[l->n - 1];
+ }
+ --l->n;
+ *ip = i - 1;
+ }
+
+ /*
* Check character class "class" against current character c.
*/
static int
***************
*** 2872,2888 ****
int match = FALSE;
int flag = 0;
int old_reglnum = -1;
! int go_to_nextline;
! thread_T *t;
char_u *old_reginput = NULL;
char_u *old_regline = NULL;
! List list[3];
! List *listtbl[2][2];
! List *ll;
int listid = 1;
! List *thislist;
! List *nextlist;
! List *neglist;
int *listids = NULL;
int j = 0;
#ifdef NFA_REGEXP_DEBUG_LOG
--- 2923,2939 ----
int match = FALSE;
int flag = 0;
int old_reglnum = -1;
! int go_to_nextline = FALSE;
! nfa_thread_T *t;
char_u *old_reginput = NULL;
char_u *old_regline = NULL;
! nfa_list_T list[3];
! nfa_list_T *listtbl[2][2];
! nfa_list_T *ll;
int listid = 1;
! nfa_list_T *thislist;
! nfa_list_T *nextlist;
! nfa_list_T *neglist;
int *listids = NULL;
int j = 0;
#ifdef NFA_REGEXP_DEBUG_LOG
***************
*** 2896,2905 ****
#endif
/* Allocate memory for the lists of nodes */
! size = (nstate + 1) * sizeof(thread_T);
! list[0].t = (thread_T *)lalloc(size, TRUE);
! list[1].t = (thread_T *)lalloc(size, TRUE);
! list[2].t = (thread_T *)lalloc(size, TRUE);
if (list[0].t == NULL || list[1].t == NULL || list[2].t == NULL)
goto theend;
vim_memset(list[0].t, 0, size);
--- 2947,2956 ----
#endif
/* Allocate memory for the lists of nodes */
! size = (nstate + 1) * sizeof(nfa_thread_T);
! list[0].t = (nfa_thread_T *)lalloc(size, TRUE);
! list[1].t = (nfa_thread_T *)lalloc(size, TRUE);
! list[2].t = (nfa_thread_T *)lalloc(size, TRUE);
if (list[0].t == NULL || list[1].t == NULL || list[2].t == NULL)
goto theend;
vim_memset(list[0].t, 0, size);
***************
*** 3056,3063 ****
* nfa_regmatch(). Submatches are stored in *m, and used in
* the parent call. */
if (start->c == NFA_MOPEN + 0)
! addstate(thislist, t->state->out, &t->sub, 0, listid,
! &match);
else
{
*m = t->sub;
--- 3107,3114 ----
* nfa_regmatch(). Submatches are stored in *m, and used in
* the parent call. */
if (start->c == NFA_MOPEN + 0)
! addstate_here(thislist, t->state->out, &t->sub, listid,
! &match, &i);
else
{
*m = t->sub;
***************
*** 3130,3137 ****
t->sub.end[j] = m->end[j];
}
/* t->state->out1 is the corresponding END_INVISIBLE node */
! addstate(thislist, t->state->out1->out, &t->sub, 0, listid,
! &match);
}
else
{
--- 3181,3188 ----
t->sub.end[j] = m->end[j];
}
/* t->state->out1 is the corresponding END_INVISIBLE node */
! addstate_here(thislist, t->state->out1->out, &t->sub,
! listid, &match, &i);
}
else
{
***************
*** 3142,3155 ****
case NFA_BOL:
if (reginput == regline)
! addstate(thislist, t->state->out, &t->sub, 0, listid,
! &match);
break;
case NFA_EOL:
if (c == NUL)
! addstate(thislist, t->state->out, &t->sub, 0, listid,
! &match);
break;
case NFA_BOW:
--- 3193,3206 ----
case NFA_BOL:
if (reginput == regline)
! addstate_here(thislist, t->state->out, &t->sub, listid,
! &match, &i);
break;
case NFA_EOL:
if (c == NUL)
! addstate_here(thislist, t->state->out, &t->sub, listid,
! &match, &i);
break;
case NFA_BOW:
***************
*** 3176,3183 ****
&& vim_iswordc_buf(reginput[-1], reg_buf)))
bow = FALSE;
if (bow)
! addstate(thislist, t->state->out, &t->sub, 0, listid,
! &match);
break;
}
--- 3227,3234 ----
&& vim_iswordc_buf(reginput[-1], reg_buf)))
bow = FALSE;
if (bow)
! addstate_here(thislist, t->state->out, &t->sub, listid,
! &match, &i);
break;
}
***************
*** 3204,3211 ****
|| (reginput[0] != NUL && vim_iswordc_buf(c, reg_buf)))
eow = FALSE;
if (eow)
! addstate(thislist, t->state->out, &t->sub, 0, listid,
! &match);
break;
}
--- 3255,3262 ----
|| (reginput[0] != NUL && vim_iswordc_buf(c, reg_buf)))
eow = FALSE;
if (eow)
! addstate_here(thislist, t->state->out, &t->sub, listid,
! &match, &i);
break;
}
*** ../vim-7.3.1016/src/testdir/test64.in 2013-05-21 13:30:17.000000000 +0200
--- src/testdir/test64.in 2013-05-25 19:54:40.000000000 +0200
***************
*** 270,275 ****
--- 270,276 ----
:call add(tl, ['aa \zsax', ' ax']) " must match before \zs
:call add(tl, ['abc \zsmatch\ze abc', 'abc abc abc match abc abc', 'match'])
:call add(tl, ['\v(a \zsif .*){2}', 'a if then a if last', 'if last', 'a if last'])
+ :call add(tl, ['\>\zs.', 'aword. ', '.'])
:"""" Tests for \@ features
:call add(tl, ['abc\@=', 'abc', 'ab'])
***************
*** 299,304 ****
--- 300,311 ----
:call add(tl, ['\%u0020', 'yes no', ' '])
:call add(tl, ['\%U00000020', 'yes no', ' '])
+ :"""" Alternatives, must use first longest match
+ :call add(tl, ['goo\|go', 'google', 'goo'])
+ :call add(tl, ['\<goo\|\<go', 'google', 'goo'])
+ :call add(tl, ['\<goo\|go', 'google', 'goo'])
+
+
:"""" Run the tests
:"
*** ../vim-7.3.1016/src/testdir/test64.ok 2013-05-21 13:30:17.000000000 +0200
--- src/testdir/test64.ok 2013-05-25 19:54:43.000000000 +0200
***************
*** 209,214 ****
--- 209,215 ----
OK - aa \zsax
OK - abc \zsmatch\ze abc
OK - \v(a \zsif .*){2}
+ OK - \>\zs.
OK - abc\@=
OK - abc\@=cd
OK - abc\@=
***************
*** 231,234 ****
--- 232,238 ----
OK - \%x20
OK - \%u0020
OK - \%U00000020
+ OK - goo\|go
+ OK - \<goo\|\<go
+ OK - \<goo\|go
192.168.0.1
*** ../vim-7.3.1016/src/regexp.h 2013-05-25 15:31:02.000000000 +0200
--- src/regexp.h 2013-05-25 20:17:53.000000000 +0200
***************
*** 29,36 ****
typedef struct regengine regengine_T;
- typedef struct thread thread_T;
-
/*
* Structure returned by vim_regcomp() to pass on to vim_regexec().
* This is the general structure. For the actual matcher, two specific
--- 29,34 ----
*** ../vim-7.3.1016/src/version.c 2013-05-25 15:31:02.000000000 +0200
--- src/version.c 2013-05-25 20:15:23.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1017,
/**/
--
A salesperson says: Translation:
"backward compatible" Old technology
"Premium" Overpriced
"Can't keep it on the shelf" Unavailable
"Stands alone" Piece of shit
"Proprietary" Incompatible
(Scott Adams - The Dilbert principle)
/// 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 ///

97
7.3.1018 Normal file
View File

@ -0,0 +1,97 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1018
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1018
Problem: New regexp engine wastes memory.
Solution: Allocate prog with actual number of states, not estimated maximum
number of sates.
Files: src/regexp_nfa.c
*** ../vim-7.3.1017/src/regexp_nfa.c 2013-05-25 20:19:45.000000000 +0200
--- src/regexp_nfa.c 2013-05-25 20:57:21.000000000 +0200
***************
*** 3758,3764 ****
char_u *expr;
int re_flags;
{
! nfa_regprog_T *prog;
size_t prog_size;
int *postfix;
--- 3758,3764 ----
char_u *expr;
int re_flags;
{
! nfa_regprog_T *prog = NULL;
size_t prog_size;
int *postfix;
***************
*** 3774,3788 ****
if (nfa_regcomp_start(expr, re_flags) == FAIL)
return NULL;
- /* Space for compiled regexp */
- prog_size = sizeof(nfa_regprog_T) + sizeof(nfa_state_T) * nstate_max;
- prog = (nfa_regprog_T *)lalloc(prog_size, TRUE);
- if (prog == NULL)
- goto fail;
- vim_memset(prog, 0, prog_size);
-
/* Build postfix form of the regexp. Needed to build the NFA
! * (and count its size) */
postfix = re2post();
if (postfix == NULL)
goto fail; /* Cascaded (syntax?) error */
--- 3774,3781 ----
if (nfa_regcomp_start(expr, re_flags) == FAIL)
return NULL;
/* Build postfix form of the regexp. Needed to build the NFA
! * (and count its size). */
postfix = re2post();
if (postfix == NULL)
goto fail; /* Cascaded (syntax?) error */
***************
*** 3809,3814 ****
--- 3802,3814 ----
* Count number of NFA states in "nstate". Do not build the NFA.
*/
post2nfa(postfix, post_ptr, TRUE);
+
+ /* Space for compiled regexp */
+ prog_size = sizeof(nfa_regprog_T) + sizeof(nfa_state_T) * nstate;
+ prog = (nfa_regprog_T *)lalloc(prog_size, TRUE);
+ if (prog == NULL)
+ goto fail;
+ vim_memset(prog, 0, prog_size);
state_ptr = prog->state;
/*
*** ../vim-7.3.1017/src/version.c 2013-05-25 20:19:45.000000000 +0200
--- src/version.c 2013-05-25 21:17:39.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1018,
/**/
--
Sometimes you can protect millions of dollars in your budget simply by buying
a bag of cookies, dropping it on the budget anylyst's desk, and saying
something deeply personal such as "How was your weekend, big guy?"
(Scott Adams - The Dilbert principle)
/// 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 ///

152
7.3.1019 Normal file
View File

@ -0,0 +1,152 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1019
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1019
Problem: These do not work with the new regexp engine: \%o123, \%x123,
\%d123, \%u123 and \%U123.
Solution: Implement these items.
Files: src/regexp_nfa.c
*** ../vim-7.3.1018/src/regexp_nfa.c 2013-05-25 21:18:30.000000000 +0200
--- src/regexp_nfa.c 2013-05-25 21:56:16.000000000 +0200
***************
*** 604,610 ****
char_u *endp;
#ifdef FEAT_MBYTE
char_u *old_regparse = regparse;
- int clen;
int i;
#endif
int extra = 0;
--- 604,609 ----
***************
*** 623,637 ****
cpo_bsl = vim_strchr(p_cpo, CPO_BACKSL) != NULL;
c = getchr();
-
- #ifdef FEAT_MBYTE
- /* clen has the length of the current char, without composing chars */
- clen = (*mb_char2len)(c);
- if (has_mbyte && clen > 1)
- goto nfa_do_multibyte;
- #endif
switch (c)
{
case Magic('^'):
EMIT(NFA_BOL);
break;
--- 622,633 ----
cpo_bsl = vim_strchr(p_cpo, CPO_BACKSL) != NULL;
c = getchr();
switch (c)
{
+ case NUL:
+ syntax_error = TRUE;
+ EMSG_RET_FAIL(_("E865: (NFA) Regexp end encountered prematurely"));
+
case Magic('^'):
EMIT(NFA_BOL);
break;
***************
*** 747,756 ****
return FAIL; /* cascaded error */
break;
- case NUL:
- syntax_error = TRUE;
- EMSG_RET_FAIL(_("E865: (NFA) Regexp end encountered prematurely"));
-
case Magic('|'):
case Magic('&'):
case Magic(')'):
--- 743,748 ----
***************
*** 834,844 ****
case 'x': /* %xab hex 2 */
case 'u': /* %uabcd hex 4 */
case 'U': /* %U1234abcd hex 8 */
! /* Not yet supported */
! return FAIL;
! c = coll_get_char();
! EMIT(c);
break;
/* Catch \%^ and \%$ regardless of where they appear in the
--- 826,851 ----
case 'x': /* %xab hex 2 */
case 'u': /* %uabcd hex 4 */
case 'U': /* %U1234abcd hex 8 */
! {
! int i;
! switch (c)
! {
! case 'd': i = getdecchrs(); break;
! case 'o': i = getoctchrs(); break;
! case 'x': i = gethexchrs(2); break;
! case 'u': i = gethexchrs(4); break;
! case 'U': i = gethexchrs(8); break;
! default: i = -1; break;
! }
!
! if (i < 0)
! EMSG2_RET_FAIL(
! _("E678: Invalid character after %s%%[dxouU]"),
! reg_magic == MAGIC_ALL);
! /* TODO: what if a composing character follows? */
! EMIT(i);
! }
break;
/* Catch \%^ and \%$ regardless of where they appear in the
***************
*** 1217,1225 ****
int plen;
nfa_do_multibyte:
! /* Length of current char with composing chars. */
! if (enc_utf8 && (clen != (plen = (*mb_ptr2len)(old_regparse))
! || utf_iscomposing(c)))
{
/* A base character plus composing characters, or just one
* or more composing characters.
--- 1224,1233 ----
int plen;
nfa_do_multibyte:
! /* plen is length of current char with composing chars */
! if (enc_utf8 && ((*mb_char2len)(c)
! != (plen = (*mb_ptr2len)(old_regparse))
! || utf_iscomposing(c)))
{
/* A base character plus composing characters, or just one
* or more composing characters.
*** ../vim-7.3.1018/src/version.c 2013-05-25 21:18:30.000000000 +0200
--- src/version.c 2013-05-25 22:00:51.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1019,
/**/
--
The budget process was invented by an alien race of sadistic beings who
resemble large cats.
(Scott Adams - The Dilbert principle)
/// 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 ///

1945
7.3.1020 Normal file

File diff suppressed because it is too large Load Diff

229
7.3.1021 Normal file
View File

@ -0,0 +1,229 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1021
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1021
Problem: New regexp engine does not ignore order of composing chars.
Solution: Ignore composing chars order.
Files: src/regexp_nfa.c, src/testdir/test95.in, src/testdir/test95.ok
*** ../vim-7.3.1020/src/regexp_nfa.c 2013-05-25 22:04:19.000000000 +0200
--- src/regexp_nfa.c 2013-05-26 14:27:11.000000000 +0200
***************
*** 3275,3282 ****
int len = 0;
nfa_state_T *end;
nfa_state_T *sta;
- result = OK;
sta = t->state->out;
len = 0;
if (utf_iscomposing(sta->c))
--- 3275,3284 ----
int len = 0;
nfa_state_T *end;
nfa_state_T *sta;
+ int cchars[MAX_MCO];
+ int ccount = 0;
+ int j;
sta = t->state->out;
len = 0;
if (utf_iscomposing(sta->c))
***************
*** 3293,3316 ****
/* TODO: How about negated? */
if (len == 0 && sta->c != c)
result = FAIL;
! len = n;
while (sta->c != NFA_END_COMPOSING)
sta = sta->out;
}
! else
! while (sta->c != NFA_END_COMPOSING && len < n)
{
- if (len > 0)
- mc = mb_ptr2char(reginput + len);
- if (mc != sta->c)
- break;
len += mb_char2len(mc);
sta = sta->out;
}
! /* if input char length doesn't match regexp char length */
! if (len < n || sta->c != NFA_END_COMPOSING)
result = FAIL;
end = t->state->out1; /* NFA_END_COMPOSING */
ADD_POS_NEG_STATE(end);
break;
--- 3295,3346 ----
/* TODO: How about negated? */
if (len == 0 && sta->c != c)
result = FAIL;
! else
! result = OK;
while (sta->c != NFA_END_COMPOSING)
sta = sta->out;
}
!
! /* Check base character matches first, unless ignored. */
! else if (len > 0 || mc == sta->c)
! {
! if (len == 0)
{
len += mb_char2len(mc);
sta = sta->out;
}
! /* We don't care about the order of composing characters.
! * Get them into cchars[] first. */
! while (len < n)
! {
! mc = mb_ptr2char(reginput + len);
! cchars[ccount++] = mc;
! len += mb_char2len(mc);
! if (ccount == MAX_MCO)
! break;
! }
!
! /* Check that each composing char in the pattern matches a
! * composing char in the text. We do not check if all
! * composing chars are matched. */
! result = OK;
! while (sta->c != NFA_END_COMPOSING)
! {
! for (j = 0; j < ccount; ++j)
! if (cchars[j] == sta->c)
! break;
! if (j == ccount)
! {
! result = FAIL;
! break;
! }
! sta = sta->out;
! }
! }
! else
result = FAIL;
+
end = t->state->out1; /* NFA_END_COMPOSING */
ADD_POS_NEG_STATE(end);
break;
*** ../vim-7.3.1020/src/testdir/test95.in 2013-05-25 23:15:21.000000000 +0200
--- src/testdir/test95.in 2013-05-26 14:12:13.000000000 +0200
***************
*** 9,14 ****
--- 9,15 ----
:so mbyte.vim
:set nocp encoding=utf-8 viminfo+=nviminfo nomore
:" tl is a List of Lists with:
+ :" 2: test auto/old/new 0: test auto/old 1: test auto/new
:" regexp pattern
:" text to test the pattern on
:" expected match (optional)
***************
*** 40,49 ****
:call add(tl, [2, ".\u05b9", " x\u05b9 ", "x\u05b9"])
:call add(tl, [2, "\u05b9\u05bb", " x\u05b9\u05bb ", "x\u05b9\u05bb"])
:call add(tl, [2, ".\u05b9\u05bb", " x\u05b9\u05bb ", "x\u05b9\u05bb"])
! :"call add(tl, [2, "\u05bb\u05b9", " x\u05b9\u05bb "])
! :"call add(tl, [2, ".\u05bb\u05b9", " x\u05b9\u05bb "])
:call add(tl, [2, "\u05b9", " y\u05bb x\u05b9 ", "x\u05b9"])
:call add(tl, [2, ".\u05b9", " y\u05bb x\u05b9 ", "x\u05b9"])
:"""" Test \Z
--- 41,54 ----
:call add(tl, [2, ".\u05b9", " x\u05b9 ", "x\u05b9"])
:call add(tl, [2, "\u05b9\u05bb", " x\u05b9\u05bb ", "x\u05b9\u05bb"])
:call add(tl, [2, ".\u05b9\u05bb", " x\u05b9\u05bb ", "x\u05b9\u05bb"])
! :call add(tl, [2, "\u05bb\u05b9", " x\u05b9\u05bb ", "x\u05b9\u05bb"])
! :call add(tl, [2, ".\u05bb\u05b9", " x\u05b9\u05bb ", "x\u05b9\u05bb"])
:call add(tl, [2, "\u05b9", " y\u05bb x\u05b9 ", "x\u05b9"])
:call add(tl, [2, ".\u05b9", " y\u05bb x\u05b9 ", "x\u05b9"])
+ :call add(tl, [2, "\u05b9", " y\u05bb\u05b9 x\u05b9 ", "y\u05bb\u05b9"])
+ :call add(tl, [2, ".\u05b9", " y\u05bb\u05b9 x\u05b9 ", "y\u05bb\u05b9"])
+ :call add(tl, [1, "\u05b9\u05bb", " y\u05b9 x\u05b9\u05bb ", "x\u05b9\u05bb"])
+ :call add(tl, [2, ".\u05b9\u05bb", " y\u05bb x\u05b9\u05bb ", "x\u05b9\u05bb"])
:"""" Test \Z
***************
*** 74,80 ****
: let text = t[2]
: let matchidx = 3
: for engine in [0, 1, 2]
! : if engine == 2 && !re
: continue
: endif
: let &regexpengine = engine
--- 79,85 ----
: let text = t[2]
: let matchidx = 3
: for engine in [0, 1, 2]
! : if engine == 2 && re == 0 || engine == 1 && re == 1
: continue
: endif
: let &regexpengine = engine
*** ../vim-7.3.1020/src/testdir/test95.ok 2013-05-25 23:15:21.000000000 +0200
--- src/testdir/test95.ok 2013-05-26 14:12:36.000000000 +0200
***************
*** 41,52 ****
--- 41,69 ----
OK 0 - .ֹֻ
OK 1 - .ֹֻ
OK 2 - .ֹֻ
+ OK 0 - ֹֻ
+ OK 1 - ֹֻ
+ OK 2 - ֹֻ
+ OK 0 - .ֹֻ
+ OK 1 - .ֹֻ
+ OK 2 - .ֹֻ
OK 0 - ֹ
OK 1 - ֹ
OK 2 - ֹ
OK 0 - .ֹ
OK 1 - .ֹ
OK 2 - .ֹ
+ OK 0 - ֹ
+ OK 1 - ֹ
+ OK 2 - ֹ
+ OK 0 - .ֹ
+ OK 1 - .ֹ
+ OK 2 - .ֹ
+ OK 0 - ֹֻ
+ OK 2 - ֹֻ
+ OK 0 - .ֹֻ
+ OK 1 - .ֹֻ
+ OK 2 - .ֹֻ
OK 0 - ú\Z
OK 1 - ú\Z
OK 2 - ú\Z
*** ../vim-7.3.1020/src/version.c 2013-05-25 23:15:21.000000000 +0200
--- src/version.c 2013-05-26 13:54:16.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1021,
/**/
--
Engineers are always delighted to share wisdom, even in areas in which they
have no experience whatsoever. Their logic provides them with inherent
insight into any field of expertise. This can be a problem when dealing with
the illogical people who believe that knowledge can only be derived through
experience.
(Scott Adams - The Dilbert principle)
/// 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 ///

873
7.3.1022 Normal file
View File

@ -0,0 +1,873 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1022
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1022
Problem: Compiler warning for shadowed variable. (John Little)
Solution: Move declaration, rename variables.
Files: src/regexp_nfa.c
*** ../vim-7.3.1021/src/regexp_nfa.c 2013-05-26 14:32:01.000000000 +0200
--- src/regexp_nfa.c 2013-05-26 14:50:27.000000000 +0200
***************
*** 604,610 ****
char_u *endp;
#ifdef FEAT_MBYTE
char_u *old_regparse = regparse;
- int i;
#endif
int extra = 0;
int first;
--- 604,609 ----
***************
*** 827,850 ****
case 'u': /* %uabcd hex 4 */
case 'U': /* %U1234abcd hex 8 */
{
! int i;
switch (c)
{
! case 'd': i = getdecchrs(); break;
! case 'o': i = getoctchrs(); break;
! case 'x': i = gethexchrs(2); break;
! case 'u': i = gethexchrs(4); break;
! case 'U': i = gethexchrs(8); break;
! default: i = -1; break;
}
! if (i < 0)
EMSG2_RET_FAIL(
_("E678: Invalid character after %s%%[dxouU]"),
reg_magic == MAGIC_ALL);
/* TODO: what if a composing character follows? */
! EMIT(i);
}
break;
--- 826,849 ----
case 'u': /* %uabcd hex 4 */
case 'U': /* %U1234abcd hex 8 */
{
! int nr;
switch (c)
{
! case 'd': nr = getdecchrs(); break;
! case 'o': nr = getoctchrs(); break;
! case 'x': nr = gethexchrs(2); break;
! case 'u': nr = gethexchrs(4); break;
! case 'U': nr = gethexchrs(8); break;
! default: nr = -1; break;
}
! if (nr < 0)
EMSG2_RET_FAIL(
_("E678: Invalid character after %s%%[dxouU]"),
reg_magic == MAGIC_ALL);
/* TODO: what if a composing character follows? */
! EMIT(nr);
}
break;
***************
*** 1229,1234 ****
--- 1228,1235 ----
!= (plen = (*mb_ptr2len)(old_regparse))
|| utf_iscomposing(c)))
{
+ int i = 0;
+
/* A base character plus composing characters, or just one
* or more composing characters.
* This requires creating a separate atom as if enclosing
***************
*** 1237,1243 ****
* building the postfix form, not the NFA itself;
* a composing char could be: a, b, c, NFA_COMPOSING
* where 'b' and 'c' are chars with codes > 256. */
- i = 0;
for (;;)
{
EMIT(c);
--- 1238,1243 ----
***************
*** 2923,2931 ****
regsub_T *submatch;
regsub_T *m;
{
- int c;
- int n;
- int i = 0;
int result;
int size = 0;
int match = FALSE;
--- 2923,2928 ----
***************
*** 2939,2944 ****
--- 2936,2942 ----
nfa_list_T *listtbl[2][2];
nfa_list_T *ll;
int listid = 1;
+ int listidx;
nfa_list_T *thislist;
nfa_list_T *nextlist;
nfa_list_T *neglist;
***************
*** 3004,3010 ****
#define ADD_POS_NEG_STATE(node) \
ll = listtbl[result ? 1 : 0][node->negated]; \
if (ll != NULL) \
! addstate(ll, node->out , &t->sub, n, listid + 1, &match);
/*
--- 3002,3008 ----
#define ADD_POS_NEG_STATE(node) \
ll = listtbl[result ? 1 : 0][node->negated]; \
if (ll != NULL) \
! addstate(ll, node->out , &t->sub, clen, listid + 1, &match);
/*
***************
*** 3012,3032 ****
*/
for (;;)
{
#ifdef FEAT_MBYTE
if (has_mbyte)
{
! c = (*mb_ptr2char)(reginput);
! n = (*mb_ptr2len)(reginput);
}
else
#endif
{
! c = *reginput;
! n = 1;
}
! if (c == NUL)
{
! n = 0;
go_to_nextline = FALSE;
}
--- 3010,3033 ----
*/
for (;;)
{
+ int curc;
+ int clen;
+
#ifdef FEAT_MBYTE
if (has_mbyte)
{
! curc = (*mb_ptr2char)(reginput);
! clen = (*mb_ptr2len)(reginput);
}
else
#endif
{
! curc = *reginput;
! clen = 1;
}
! if (curc == NUL)
{
! clen = 0;
go_to_nextline = FALSE;
}
***************
*** 3040,3049 ****
#ifdef ENABLE_LOG
fprintf(log_fd, "------------------------------------------\n");
fprintf(log_fd, ">>> Reginput is \"%s\"\n", reginput);
! fprintf(log_fd, ">>> Advanced one character ... Current char is %c (code %d) \n", c, (int)c);
fprintf(log_fd, ">>> Thislist has %d states available: ", thislist->n);
! for (i = 0; i < thislist->n; i++)
! fprintf(log_fd, "%d ", abs(thislist->t[i].state->id));
fprintf(log_fd, "\n");
#endif
--- 3041,3054 ----
#ifdef ENABLE_LOG
fprintf(log_fd, "------------------------------------------\n");
fprintf(log_fd, ">>> Reginput is \"%s\"\n", reginput);
! fprintf(log_fd, ">>> Advanced one character ... Current char is %c (code %d) \n", curc, (int)curc);
fprintf(log_fd, ">>> Thislist has %d states available: ", thislist->n);
! {
! int i;
!
! for (i = 0; i < thislist->n; i++)
! fprintf(log_fd, "%d ", abs(thislist->t[i].state->id));
! }
fprintf(log_fd, "\n");
#endif
***************
*** 3057,3072 ****
break;
/* compute nextlist */
! for (i = 0; i < thislist->n || neglist->n > 0; ++i)
{
if (neglist->n > 0)
{
t = &neglist->t[0];
neglist->n--;
! i--;
}
else
! t = &thislist->t[i];
#ifdef NFA_REGEXP_DEBUG_LOG
nfa_set_code(t->state->c);
--- 3062,3077 ----
break;
/* compute nextlist */
! for (listidx = 0; listidx < thislist->n || neglist->n > 0; ++listidx)
{
if (neglist->n > 0)
{
t = &neglist->t[0];
neglist->n--;
! listidx--;
}
else
! t = &thislist->t[listidx];
#ifdef NFA_REGEXP_DEBUG_LOG
nfa_set_code(t->state->c);
***************
*** 3116,3122 ****
* the parent call. */
if (start->c == NFA_MOPEN + 0)
addstate_here(thislist, t->state->out, &t->sub, listid,
! &match, &i);
else
{
*m = t->sub;
--- 3121,3127 ----
* the parent call. */
if (start->c == NFA_MOPEN + 0)
addstate_here(thislist, t->state->out, &t->sub, listid,
! &match, &listidx);
else
{
*m = t->sub;
***************
*** 3190,3196 ****
}
/* t->state->out1 is the corresponding END_INVISIBLE node */
addstate_here(thislist, t->state->out1->out, &t->sub,
! listid, &match, &i);
}
else
{
--- 3195,3201 ----
}
/* t->state->out1 is the corresponding END_INVISIBLE node */
addstate_here(thislist, t->state->out1->out, &t->sub,
! listid, &match, &listidx);
}
else
{
***************
*** 3202,3221 ****
case NFA_BOL:
if (reginput == regline)
addstate_here(thislist, t->state->out, &t->sub, listid,
! &match, &i);
break;
case NFA_EOL:
! if (c == NUL)
addstate_here(thislist, t->state->out, &t->sub, listid,
! &match, &i);
break;
case NFA_BOW:
{
int bow = TRUE;
! if (c == NUL)
bow = FALSE;
#ifdef FEAT_MBYTE
else if (has_mbyte)
--- 3207,3226 ----
case NFA_BOL:
if (reginput == regline)
addstate_here(thislist, t->state->out, &t->sub, listid,
! &match, &listidx);
break;
case NFA_EOL:
! if (curc == NUL)
addstate_here(thislist, t->state->out, &t->sub, listid,
! &match, &listidx);
break;
case NFA_BOW:
{
int bow = TRUE;
! if (curc == NUL)
bow = FALSE;
#ifdef FEAT_MBYTE
else if (has_mbyte)
***************
*** 3230,3242 ****
bow = FALSE;
}
#endif
! else if (!vim_iswordc_buf(c, reg_buf)
|| (reginput > regline
&& vim_iswordc_buf(reginput[-1], reg_buf)))
bow = FALSE;
if (bow)
addstate_here(thislist, t->state->out, &t->sub, listid,
! &match, &i);
break;
}
--- 3235,3247 ----
bow = FALSE;
}
#endif
! else if (!vim_iswordc_buf(curc, reg_buf)
|| (reginput > regline
&& vim_iswordc_buf(reginput[-1], reg_buf)))
bow = FALSE;
if (bow)
addstate_here(thislist, t->state->out, &t->sub, listid,
! &match, &listidx);
break;
}
***************
*** 3260,3277 ****
}
#endif
else if (!vim_iswordc_buf(reginput[-1], reg_buf)
! || (reginput[0] != NUL && vim_iswordc_buf(c, reg_buf)))
eow = FALSE;
if (eow)
addstate_here(thislist, t->state->out, &t->sub, listid,
! &match, &i);
break;
}
#ifdef FEAT_MBYTE
case NFA_COMPOSING:
{
! int mc = c;
int len = 0;
nfa_state_T *end;
nfa_state_T *sta;
--- 3265,3283 ----
}
#endif
else if (!vim_iswordc_buf(reginput[-1], reg_buf)
! || (reginput[0] != NUL
! && vim_iswordc_buf(curc, reg_buf)))
eow = FALSE;
if (eow)
addstate_here(thislist, t->state->out, &t->sub, listid,
! &match, &listidx);
break;
}
#ifdef FEAT_MBYTE
case NFA_COMPOSING:
{
! int mc = curc;
int len = 0;
nfa_state_T *end;
nfa_state_T *sta;
***************
*** 3286,3299 ****
/* Only match composing character(s), ignore base
* character. Used for ".{composing}" and "{composing}"
* (no preceding character). */
! len += mb_char2len(c);
}
if (ireg_icombine)
{
/* If \Z was present, then ignore composing characters.
* When ignoring the base character this always matches. */
/* TODO: How about negated? */
! if (len == 0 && sta->c != c)
result = FAIL;
else
result = OK;
--- 3292,3305 ----
/* Only match composing character(s), ignore base
* character. Used for ".{composing}" and "{composing}"
* (no preceding character). */
! len += mb_char2len(mc);
}
if (ireg_icombine)
{
/* If \Z was present, then ignore composing characters.
* When ignoring the base character this always matches. */
/* TODO: How about negated? */
! if (len == 0 && sta->c != curc)
result = FAIL;
else
result = OK;
***************
*** 3312,3318 ****
/* We don't care about the order of composing characters.
* Get them into cchars[] first. */
! while (len < n)
{
mc = mb_ptr2char(reginput + len);
cchars[ccount++] = mc;
--- 3318,3324 ----
/* We don't care about the order of composing characters.
* Get them into cchars[] first. */
! while (len < clen)
{
mc = mb_ptr2char(reginput + len);
cchars[ccount++] = mc;
***************
*** 3349,3355 ****
case NFA_NEWL:
if (!reg_line_lbr && REG_MULTI
! && c == NUL && reglnum <= reg_maxline)
{
go_to_nextline = TRUE;
/* Pass -1 for the offset, which means taking the position
--- 3355,3361 ----
case NFA_NEWL:
if (!reg_line_lbr && REG_MULTI
! && curc == NUL && reglnum <= reg_maxline)
{
go_to_nextline = TRUE;
/* Pass -1 for the offset, which means taking the position
***************
*** 3375,3409 ****
case NFA_CLASS_RETURN:
case NFA_CLASS_BACKSPACE:
case NFA_CLASS_ESCAPE:
! result = check_char_class(t->state->c, c);
ADD_POS_NEG_STATE(t->state);
break;
case NFA_END_NEG_RANGE:
/* This follows a series of negated nodes, like:
* CHAR(x), NFA_NOT, CHAR(y), NFA_NOT etc. */
! if (c > 0)
! addstate(nextlist, t->state->out, &t->sub, n, listid + 1,
! &match);
break;
case NFA_ANY:
/* Any char except '\0', (end of input) does not match. */
! if (c > 0)
! addstate(nextlist, t->state->out, &t->sub, n, listid + 1,
! &match);
break;
/*
* Character classes like \a for alpha, \d for digit etc.
*/
case NFA_IDENT: /* \i */
! result = vim_isIDc(c);
ADD_POS_NEG_STATE(t->state);
break;
case NFA_SIDENT: /* \I */
! result = !VIM_ISDIGIT(c) && vim_isIDc(c);
ADD_POS_NEG_STATE(t->state);
break;
--- 3381,3415 ----
case NFA_CLASS_RETURN:
case NFA_CLASS_BACKSPACE:
case NFA_CLASS_ESCAPE:
! result = check_char_class(t->state->c, curc);
ADD_POS_NEG_STATE(t->state);
break;
case NFA_END_NEG_RANGE:
/* This follows a series of negated nodes, like:
* CHAR(x), NFA_NOT, CHAR(y), NFA_NOT etc. */
! if (curc > 0)
! addstate(nextlist, t->state->out, &t->sub, clen,
! listid + 1, &match);
break;
case NFA_ANY:
/* Any char except '\0', (end of input) does not match. */
! if (curc > 0)
! addstate(nextlist, t->state->out, &t->sub, clen,
! listid + 1, &match);
break;
/*
* Character classes like \a for alpha, \d for digit etc.
*/
case NFA_IDENT: /* \i */
! result = vim_isIDc(curc);
ADD_POS_NEG_STATE(t->state);
break;
case NFA_SIDENT: /* \I */
! result = !VIM_ISDIGIT(curc) && vim_isIDc(curc);
ADD_POS_NEG_STATE(t->state);
break;
***************
*** 3413,3429 ****
break;
case NFA_SKWORD: /* \K */
! result = !VIM_ISDIGIT(c) && vim_iswordp_buf(reginput, reg_buf);
ADD_POS_NEG_STATE(t->state);
break;
case NFA_FNAME: /* \f */
! result = vim_isfilec(c);
ADD_POS_NEG_STATE(t->state);
break;
case NFA_SFNAME: /* \F */
! result = !VIM_ISDIGIT(c) && vim_isfilec(c);
ADD_POS_NEG_STATE(t->state);
break;
--- 3419,3436 ----
break;
case NFA_SKWORD: /* \K */
! result = !VIM_ISDIGIT(curc)
! && vim_iswordp_buf(reginput, reg_buf);
ADD_POS_NEG_STATE(t->state);
break;
case NFA_FNAME: /* \f */
! result = vim_isfilec(curc);
ADD_POS_NEG_STATE(t->state);
break;
case NFA_SFNAME: /* \F */
! result = !VIM_ISDIGIT(curc) && vim_isfilec(curc);
ADD_POS_NEG_STATE(t->state);
break;
***************
*** 3433,3529 ****
break;
case NFA_SPRINT: /* \P */
! result = !VIM_ISDIGIT(c) && ptr2cells(reginput) == 1;
ADD_POS_NEG_STATE(t->state);
break;
case NFA_WHITE: /* \s */
! result = vim_iswhite(c);
ADD_POS_NEG_STATE(t->state);
break;
case NFA_NWHITE: /* \S */
! result = c != NUL && !vim_iswhite(c);
ADD_POS_NEG_STATE(t->state);
break;
case NFA_DIGIT: /* \d */
! result = ri_digit(c);
ADD_POS_NEG_STATE(t->state);
break;
case NFA_NDIGIT: /* \D */
! result = c != NUL && !ri_digit(c);
ADD_POS_NEG_STATE(t->state);
break;
case NFA_HEX: /* \x */
! result = ri_hex(c);
ADD_POS_NEG_STATE(t->state);
break;
case NFA_NHEX: /* \X */
! result = c != NUL && !ri_hex(c);
ADD_POS_NEG_STATE(t->state);
break;
case NFA_OCTAL: /* \o */
! result = ri_octal(c);
ADD_POS_NEG_STATE(t->state);
break;
case NFA_NOCTAL: /* \O */
! result = c != NUL && !ri_octal(c);
ADD_POS_NEG_STATE(t->state);
break;
case NFA_WORD: /* \w */
! result = ri_word(c);
ADD_POS_NEG_STATE(t->state);
break;
case NFA_NWORD: /* \W */
! result = c != NUL && !ri_word(c);
ADD_POS_NEG_STATE(t->state);
break;
case NFA_HEAD: /* \h */
! result = ri_head(c);
ADD_POS_NEG_STATE(t->state);
break;
case NFA_NHEAD: /* \H */
! result = c != NUL && !ri_head(c);
ADD_POS_NEG_STATE(t->state);
break;
case NFA_ALPHA: /* \a */
! result = ri_alpha(c);
ADD_POS_NEG_STATE(t->state);
break;
case NFA_NALPHA: /* \A */
! result = c != NUL && !ri_alpha(c);
ADD_POS_NEG_STATE(t->state);
break;
case NFA_LOWER: /* \l */
! result = ri_lower(c);
ADD_POS_NEG_STATE(t->state);
break;
case NFA_NLOWER: /* \L */
! result = c != NUL && !ri_lower(c);
ADD_POS_NEG_STATE(t->state);
break;
case NFA_UPPER: /* \u */
! result = ri_upper(c);
ADD_POS_NEG_STATE(t->state);
break;
case NFA_NUPPER: /* \U */
! result = c != NUL && !ri_upper(c);
ADD_POS_NEG_STATE(t->state);
break;
--- 3440,3536 ----
break;
case NFA_SPRINT: /* \P */
! result = !VIM_ISDIGIT(curc) && ptr2cells(reginput) == 1;
ADD_POS_NEG_STATE(t->state);
break;
case NFA_WHITE: /* \s */
! result = vim_iswhite(curc);
ADD_POS_NEG_STATE(t->state);
break;
case NFA_NWHITE: /* \S */
! result = curc != NUL && !vim_iswhite(curc);
ADD_POS_NEG_STATE(t->state);
break;
case NFA_DIGIT: /* \d */
! result = ri_digit(curc);
ADD_POS_NEG_STATE(t->state);
break;
case NFA_NDIGIT: /* \D */
! result = curc != NUL && !ri_digit(curc);
ADD_POS_NEG_STATE(t->state);
break;
case NFA_HEX: /* \x */
! result = ri_hex(curc);
ADD_POS_NEG_STATE(t->state);
break;
case NFA_NHEX: /* \X */
! result = curc != NUL && !ri_hex(curc);
ADD_POS_NEG_STATE(t->state);
break;
case NFA_OCTAL: /* \o */
! result = ri_octal(curc);
ADD_POS_NEG_STATE(t->state);
break;
case NFA_NOCTAL: /* \O */
! result = curc != NUL && !ri_octal(curc);
ADD_POS_NEG_STATE(t->state);
break;
case NFA_WORD: /* \w */
! result = ri_word(curc);
ADD_POS_NEG_STATE(t->state);
break;
case NFA_NWORD: /* \W */
! result = curc != NUL && !ri_word(curc);
ADD_POS_NEG_STATE(t->state);
break;
case NFA_HEAD: /* \h */
! result = ri_head(curc);
ADD_POS_NEG_STATE(t->state);
break;
case NFA_NHEAD: /* \H */
! result = curc != NUL && !ri_head(curc);
ADD_POS_NEG_STATE(t->state);
break;
case NFA_ALPHA: /* \a */
! result = ri_alpha(curc);
ADD_POS_NEG_STATE(t->state);
break;
case NFA_NALPHA: /* \A */
! result = curc != NUL && !ri_alpha(curc);
ADD_POS_NEG_STATE(t->state);
break;
case NFA_LOWER: /* \l */
! result = ri_lower(curc);
ADD_POS_NEG_STATE(t->state);
break;
case NFA_NLOWER: /* \L */
! result = curc != NUL && !ri_lower(curc);
ADD_POS_NEG_STATE(t->state);
break;
case NFA_UPPER: /* \u */
! result = ri_upper(curc);
ADD_POS_NEG_STATE(t->state);
break;
case NFA_NUPPER: /* \U */
! result = curc != NUL && !ri_upper(curc);
ADD_POS_NEG_STATE(t->state);
break;
***************
*** 3549,3565 ****
/* TODO: put this in #ifdef later */
if (t->state->c < -256)
EMSGN("INTERNAL: Negative state char: %ld", t->state->c);
! result = (no_Magic(t->state->c) == c);
if (!result)
result = ireg_ic == TRUE
! && MB_TOLOWER(t->state->c) == MB_TOLOWER(c);
#ifdef FEAT_MBYTE
/* If there is a composing character which is not being
* ignored there can be no match. Match with composing
* character uses NFA_COMPOSING above. */
if (result && enc_utf8 && !ireg_icombine
! && n != utf_char2len(c))
result = FALSE;
#endif
ADD_POS_NEG_STATE(t->state);
--- 3556,3572 ----
/* TODO: put this in #ifdef later */
if (t->state->c < -256)
EMSGN("INTERNAL: Negative state char: %ld", t->state->c);
! result = (no_Magic(t->state->c) == curc);
if (!result)
result = ireg_ic == TRUE
! && MB_TOLOWER(t->state->c) == MB_TOLOWER(curc);
#ifdef FEAT_MBYTE
/* If there is a composing character which is not being
* ignored there can be no match. Match with composing
* character uses NFA_COMPOSING above. */
if (result && enc_utf8 && !ireg_icombine
! && clen != utf_char2len(curc))
result = FALSE;
#endif
ADD_POS_NEG_STATE(t->state);
***************
*** 3578,3598 ****
#ifdef ENABLE_LOG
fprintf(log_fd, "(---) STARTSTATE\n");
#endif
! addstate(nextlist, start, m, n, listid + 1, &match);
}
#ifdef ENABLE_LOG
fprintf(log_fd, ">>> Thislist had %d states available: ", thislist->n);
! for (i = 0; i< thislist->n; i++)
! fprintf(log_fd, "%d ", abs(thislist->t[i].state->id));
fprintf(log_fd, "\n");
#endif
nextchar:
/* Advance to the next character, or advance to the next line, or
* finish. */
! if (n != 0)
! reginput += n;
else if (go_to_nextline)
reg_nextline();
else
--- 3585,3609 ----
#ifdef ENABLE_LOG
fprintf(log_fd, "(---) STARTSTATE\n");
#endif
! addstate(nextlist, start, m, clen, listid + 1, &match);
}
#ifdef ENABLE_LOG
fprintf(log_fd, ">>> Thislist had %d states available: ", thislist->n);
! {
! int i;
!
! for (i = 0; i < thislist->n; i++)
! fprintf(log_fd, "%d ", abs(thislist->t[i].state->id));
! }
fprintf(log_fd, "\n");
#endif
nextchar:
/* Advance to the next character, or advance to the next line, or
* finish. */
! if (clen != 0)
! reginput += clen;
else if (go_to_nextline)
reg_nextline();
else
*** ../vim-7.3.1021/src/version.c 2013-05-26 14:32:01.000000000 +0200
--- src/version.c 2013-05-26 14:39:12.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1022,
/**/
--
Female engineers become irresistible at the age of consent and remain that
way until about thirty minutes after their clinical death. Longer if it's a
warm day.
(Scott Adams - The Dilbert principle)
/// 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 ///

109
7.3.1023 Normal file
View File

@ -0,0 +1,109 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1023
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1023
Problem: Searching for composing char only and using \Z has different
results.
Solution: Make it match the composing char, matching everything is not
useful.
Files: src/regexp_nfa.c, src/testdir/test95.in, src/testdir/test95.ok
*** ../vim-7.3.1022/src/regexp_nfa.c 2013-05-26 14:54:07.000000000 +0200
--- src/regexp_nfa.c 2013-05-26 15:02:26.000000000 +0200
***************
*** 3294,3300 ****
* (no preceding character). */
len += mb_char2len(mc);
}
! if (ireg_icombine)
{
/* If \Z was present, then ignore composing characters.
* When ignoring the base character this always matches. */
--- 3294,3300 ----
* (no preceding character). */
len += mb_char2len(mc);
}
! if (ireg_icombine && len == 0)
{
/* If \Z was present, then ignore composing characters.
* When ignoring the base character this always matches. */
*** ../vim-7.3.1022/src/testdir/test95.in 2013-05-26 14:32:01.000000000 +0200
--- src/testdir/test95.in 2013-05-26 15:07:01.000000000 +0200
***************
*** 62,71 ****
:call add(tl, [2, "ק\u200d\u05b9x\\Z", "xק\u200dxy", "ק\u200dx"])
:call add(tl, [2, "ק\u200dx\\Z", "xק\u200d\u05b9xy", "ק\u200d\u05b9x"])
:call add(tl, [2, "ק\u200dx\\Z", "xק\u200dxy", "ק\u200dx"])
! :"call add(tl, [2, "\u05b9\\Z", "xyz"])
! :"call add(tl, [2, "\\Z\u05b9", "xyz"])
! :"call add(tl, [2, "\u05b9\\+\\Z", "xyz", "xyz"])
! :"call add(tl, [2, "\\Z\u05b9\\+", "xyz", "xyz"])
:"""" Combining different tests and features
:call add(tl, [2, '[^[=a=]]\+', 'ddaãâbcd', 'dd'])
--- 62,73 ----
:call add(tl, [2, "ק\u200d\u05b9x\\Z", "xק\u200dxy", "ק\u200dx"])
:call add(tl, [2, "ק\u200dx\\Z", "xק\u200d\u05b9xy", "ק\u200d\u05b9x"])
:call add(tl, [2, "ק\u200dx\\Z", "xק\u200dxy", "ק\u200dx"])
! :call add(tl, [2, "\u05b9\\Z", "xyz"])
! :call add(tl, [2, "\\Z\u05b9", "xyz"])
! :call add(tl, [2, "\u05b9\\Z", "xy\u05b9z", "y\u05b9"])
! :call add(tl, [2, "\\Z\u05b9", "xy\u05b9z", "y\u05b9"])
! :call add(tl, [1, "\u05b9\\+\\Z", "xy\u05b9z\u05b9 ", "y\u05b9z\u05b9"])
! :call add(tl, [1, "\\Z\u05b9\\+", "xy\u05b9z\u05b9 ", "y\u05b9z\u05b9"])
:"""" Combining different tests and features
:call add(tl, [2, '[^[=a=]]\+', 'ddaãâbcd', 'dd'])
*** ../vim-7.3.1022/src/testdir/test95.ok 2013-05-26 14:32:01.000000000 +0200
--- src/testdir/test95.ok 2013-05-26 15:12:17.000000000 +0200
***************
*** 94,99 ****
--- 94,115 ----
OK 0 - קx\Z
OK 1 - קx\Z
OK 2 - קx\Z
+ OK 0 - ֹ\Z
+ OK 1 - ֹ\Z
+ OK 2 - ֹ\Z
+ OK 0 - \Zֹ
+ OK 1 - \Zֹ
+ OK 2 - \Zֹ
+ OK 0 - ֹ\Z
+ OK 1 - ֹ\Z
+ OK 2 - ֹ\Z
+ OK 0 - \Zֹ
+ OK 1 - \Zֹ
+ OK 2 - \Zֹ
+ OK 0 - ֹ\+\Z
+ OK 2 - ֹ\+\Z
+ OK 0 - \Zֹ\+
+ OK 2 - \Zֹ\+
OK 0 - [^[=a=]]\+
OK 1 - [^[=a=]]\+
OK 2 - [^[=a=]]\+
*** ../vim-7.3.1022/src/version.c 2013-05-26 15:14:11.000000000 +0200
--- src/version.c 2013-05-26 15:08:43.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1023,
/**/
--
Engineers are widely recognized as superior marriage material: intelligent,
dependable, employed, honest, and handy around the house.
(Scott Adams - The Dilbert principle)
/// 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 ///

457
7.3.1024 Normal file
View File

@ -0,0 +1,457 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1024
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1024
Problem: New regexp: End of matching pattern not set correctly. (Cesar
Romani)
Solution: Quit the loop after finding the match. Store nfa_has_zend in the
program.
Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok,
src/regexp.h
*** ../vim-7.3.1023/src/regexp_nfa.c 2013-05-26 15:14:49.000000000 +0200
--- src/regexp_nfa.c 2013-05-26 16:51:44.000000000 +0200
***************
*** 2651,2657 ****
break;
case NFA_MCLOSE + 0:
! if (nfa_has_zend == TRUE)
{
addstate(l, state->out, m, off, lid, match);
break;
--- 2651,2657 ----
break;
case NFA_MCLOSE + 0:
! if (nfa_has_zend)
{
addstate(l, state->out, m, off, lid, match);
break;
***************
*** 3109,3115 ****
fprintf(log_fd, "\n");
#endif
/* Found the left-most longest match, do not look at any other
! * states at this position. */
goto nextchar;
case NFA_END_INVISIBLE:
--- 3109,3119 ----
fprintf(log_fd, "\n");
#endif
/* Found the left-most longest match, do not look at any other
! * states at this position. When the list of states is going
! * to be empty quit without advancing, so that "reginput" is
! * correct. */
! if (nextlist->n == 0 && neglist->n == 0)
! clen = 0;
goto nextchar;
case NFA_END_INVISIBLE:
***************
*** 3783,3790 ****
regline = line;
reglnum = 0; /* relative to line */
! nstate = prog->nstate;
for (i = 0; i < nstate; ++i)
{
prog->state[i].id = i;
--- 3787,3795 ----
regline = line;
reglnum = 0; /* relative to line */
! nfa_has_zend = prog->has_zend;
+ nstate = prog->nstate;
for (i = 0; i < nstate; ++i)
{
prog->state[i].id = i;
***************
*** 3871,3876 ****
--- 3876,3882 ----
prog->regflags = regflags;
prog->engine = &nfa_regengine;
prog->nstate = nstate;
+ prog->has_zend = nfa_has_zend;
#ifdef ENABLE_LOG
nfa_postfix_dump(expr, OK);
nfa_dump(prog);
*** ../vim-7.3.1023/src/testdir/test64.in 2013-05-25 23:15:21.000000000 +0200
--- src/testdir/test64.in 2013-05-26 16:50:38.000000000 +0200
***************
*** 15,25 ****
:" etc.
:" When there is no match use only the first two items.
:let tl = []
!
:""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
:"""" Previously written tests """"""""""""""""""""""""""""""""
:""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
!
:call add(tl, [2, 'ab', 'aab', 'ab'])
:call add(tl, [2, 'b', 'abcdef', 'b'])
:call add(tl, [2, 'bc*', 'abccccdef', 'bcccc'])
--- 15,25 ----
:" etc.
:" When there is no match use only the first two items.
:let tl = []
! :"
:""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
:"""" Previously written tests """"""""""""""""""""""""""""""""
:""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
! :"
:call add(tl, [2, 'ab', 'aab', 'ab'])
:call add(tl, [2, 'b', 'abcdef', 'b'])
:call add(tl, [2, 'bc*', 'abccccdef', 'bcccc'])
***************
*** 138,153 ****
:"
:call add(tl, [2, '\v(a*)+', 'aaaa', 'aaaa', ''])
:call add(tl, [2, 'x', 'abcdef'])
!
:""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
:""""" Simple tests """""""""""""""""""""""""""""""""""""""""""
:""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
!
:" Search single groups
:call add(tl, [2, 'ab', 'aab', 'ab'])
:call add(tl, [2, 'ab', 'baced'])
:call add(tl, [2, 'ab', ' ab ', 'ab'])
!
:" Search multi-modifiers
:call add(tl, [2, 'x*', 'xcd', 'x'])
:call add(tl, [2, 'x*', 'xxxxxxxxxxxxxxxxsofijiojgf', 'xxxxxxxxxxxxxxxx'])
--- 138,153 ----
:"
:call add(tl, [2, '\v(a*)+', 'aaaa', 'aaaa', ''])
:call add(tl, [2, 'x', 'abcdef'])
! :"
:""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
:""""" Simple tests """""""""""""""""""""""""""""""""""""""""""
:""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
! :"
:" Search single groups
:call add(tl, [2, 'ab', 'aab', 'ab'])
:call add(tl, [2, 'ab', 'baced'])
:call add(tl, [2, 'ab', ' ab ', 'ab'])
! :"
:" Search multi-modifiers
:call add(tl, [2, 'x*', 'xcd', 'x'])
:call add(tl, [2, 'x*', 'xxxxxxxxxxxxxxxxsofijiojgf', 'xxxxxxxxxxxxxxxx'])
***************
*** 162,168 ****
:call add(tl, [2, 'x\?', 'x sdfoij', 'x'])
:call add(tl, [2, 'x\?', 'abc sfoij', '']) " empty match is good
:call add(tl, [2, 'x\?', 'xxxxxxxxxx c', 'x'])
!
:call add(tl, [2, 'a\{0,0}', 'abcdfdoij', ''])
:call add(tl, [2, 'a\{0,1}', 'asiubid axxxaaa', 'a']) " same thing as 'a?'
:call add(tl, [2, 'a\{1,0}', 'asiubid axxxaaa', 'a']) " same thing as 'a\{0,1}'
--- 162,168 ----
:call add(tl, [2, 'x\?', 'x sdfoij', 'x'])
:call add(tl, [2, 'x\?', 'abc sfoij', '']) " empty match is good
:call add(tl, [2, 'x\?', 'xxxxxxxxxx c', 'x'])
! :"
:call add(tl, [2, 'a\{0,0}', 'abcdfdoij', ''])
:call add(tl, [2, 'a\{0,1}', 'asiubid axxxaaa', 'a']) " same thing as 'a?'
:call add(tl, [2, 'a\{1,0}', 'asiubid axxxaaa', 'a']) " same thing as 'a\{0,1}'
***************
*** 182,188 ****
:call add(tl, [2, 'a\{,5}', 'aaaaaaaaaa', 'aaaaa'])
:call add(tl, [2, 'a\{}', 'bbbcddiuhfcd', '']) " same thing as 'a*'
:call add(tl, [2, 'a\{}', 'aaaaioudfh coisf jda', 'aaaa'])
!
:call add(tl, [2, 'a\{-0,0}', 'abcdfdoij', ''])
:call add(tl, [2, 'a\{-0,1}', 'asiubid axxxaaa', '']) " anti-greedy version of 'a?'
:call add(tl, [2, 'a\{-3,6}', 'aa siofuh'])
--- 182,188 ----
:call add(tl, [2, 'a\{,5}', 'aaaaaaaaaa', 'aaaaa'])
:call add(tl, [2, 'a\{}', 'bbbcddiuhfcd', '']) " same thing as 'a*'
:call add(tl, [2, 'a\{}', 'aaaaioudfh coisf jda', 'aaaa'])
! :"
:call add(tl, [2, 'a\{-0,0}', 'abcdfdoij', ''])
:call add(tl, [2, 'a\{-0,1}', 'asiubid axxxaaa', '']) " anti-greedy version of 'a?'
:call add(tl, [2, 'a\{-3,6}', 'aa siofuh'])
***************
*** 200,206 ****
:call add(tl, [2, 'a\{-,5}', 'aaaaaaaaaa', ''])
:call add(tl, [0, 'a\{-}', 'bbbcddiuhfcd', '']) " anti-greedy version of 'a*'
:call add(tl, [0, 'a\{-}', 'aaaaioudfh coisf jda', ''])
!
:" Test groups of characters and submatches
:call add(tl, [2, '\(abc\)*', 'abcabcabc', 'abcabcabc', 'abc'])
:call add(tl, [2, '\(ab\)\+', 'abababaaaaa', 'ababab', 'ab'])
--- 200,206 ----
:call add(tl, [2, 'a\{-,5}', 'aaaaaaaaaa', ''])
:call add(tl, [0, 'a\{-}', 'bbbcddiuhfcd', '']) " anti-greedy version of 'a*'
:call add(tl, [0, 'a\{-}', 'aaaaioudfh coisf jda', ''])
! :"
:" Test groups of characters and submatches
:call add(tl, [2, '\(abc\)*', 'abcabcabc', 'abcabcabc', 'abc'])
:call add(tl, [2, '\(ab\)\+', 'abababaaaaa', 'ababab', 'ab'])
***************
*** 213,219 ****
:call add(tl, [2, '\v((ab)|c*)+', 'abcccaba', 'abcccab', '', 'ab'])
:call add(tl, [2, '\v(a(c*)+b)+', 'acbababaaa', 'acbabab', 'ab', ''])
:call add(tl, [2, '\v(a|b*)+', 'aaaa', 'aaaa', ''])
!
:" Test greedy-ness and lazy-ness
:call add(tl, [2, 'a\{-2,7}','aaaaaaaaaaaaa', 'aa'])
:call add(tl, [2, 'a\{2,7}','aaaaaaaaaaaaaaaaaaaa', 'aaaaaaa'])
--- 213,219 ----
:call add(tl, [2, '\v((ab)|c*)+', 'abcccaba', 'abcccab', '', 'ab'])
:call add(tl, [2, '\v(a(c*)+b)+', 'acbababaaa', 'acbabab', 'ab', ''])
:call add(tl, [2, '\v(a|b*)+', 'aaaa', 'aaaa', ''])
! :"
:" Test greedy-ness and lazy-ness
:call add(tl, [2, 'a\{-2,7}','aaaaaaaaaaaaa', 'aa'])
:call add(tl, [2, 'a\{2,7}','aaaaaaaaaaaaaaaaaaaa', 'aaaaaaa'])
***************
*** 221,230 ****
:call add(tl, [2, '\vx(.*)yz(.*)','xayxayzxayzxayz','xayxayzxayzxayz', 'ayxayzxayzxa',''])
:call add(tl, [2, '\v(a{1,2}){-2,3}','aaaaaaa','aaaa','aa'])
:call add(tl, [2, '\v(a{-1,3})+','aa','aa','a'])
!
:" Test Character classes
:call add(tl, [2, '\d\+e\d\d','test 10e23 fd','10e23'])
!
:" Test collections and character range []
:call add(tl, [2, '\v[a]', 'abcd', 'a'])
:call add(tl, [2, 'a[bcd]', 'abcd', 'ab'])
--- 221,230 ----
:call add(tl, [2, '\vx(.*)yz(.*)','xayxayzxayzxayz','xayxayzxayzxayz', 'ayxayzxayzxa',''])
:call add(tl, [2, '\v(a{1,2}){-2,3}','aaaaaaa','aaaa','aa'])
:call add(tl, [2, '\v(a{-1,3})+','aa','aa','a'])
! :"
:" Test Character classes
:call add(tl, [2, '\d\+e\d\d','test 10e23 fd','10e23'])
! :"
:" Test collections and character range []
:call add(tl, [2, '\v[a]', 'abcd', 'a'])
:call add(tl, [2, 'a[bcd]', 'abcd', 'ab'])
***************
*** 250,257 ****
:call add(tl, [2, 'abc[0-9]*ddd', 'adf abc44482ddd oijs', 'abc44482ddd'])
:call add(tl, [2, '\_[0-9]\+', 'asfi9888u', '9888'])
:call add(tl, [2, '[0-9\n]\+', 'asfi9888u', '9888'])
!
!
:"""" Test recognition of some character classes
:call add(tl, [2, '[0-9]', '8', '8'])
:call add(tl, [2, '[^0-9]', '8'])
--- 250,257 ----
:call add(tl, [2, 'abc[0-9]*ddd', 'adf abc44482ddd oijs', 'abc44482ddd'])
:call add(tl, [2, '\_[0-9]\+', 'asfi9888u', '9888'])
:call add(tl, [2, '[0-9\n]\+', 'asfi9888u', '9888'])
! :"
! :"
:"""" Test recognition of some character classes
:call add(tl, [2, '[0-9]', '8', '8'])
:call add(tl, [2, '[^0-9]', '8'])
***************
*** 262,268 ****
:call add(tl, [2, '[a-zA-Z]', 'a', 'a'])
:call add(tl, [2, '[A-Z]', 'a'])
:call add(tl, [2, '\C[^A-Z]\+', 'ABCOIJDEOIFNSD jsfoij sa', ' jsfoij sa'])
!
:"""" Tests for \z features
:call add(tl, [2, 'xx \ze test', 'xx ']) " must match after \ze
:call add(tl, [0, 'abc\zeend', 'oij abcend', 'abc'])
--- 262,268 ----
:call add(tl, [2, '[a-zA-Z]', 'a', 'a'])
:call add(tl, [2, '[A-Z]', 'a'])
:call add(tl, [2, '\C[^A-Z]\+', 'ABCOIJDEOIFNSD jsfoij sa', ' jsfoij sa'])
! :"
:"""" Tests for \z features
:call add(tl, [2, 'xx \ze test', 'xx ']) " must match after \ze
:call add(tl, [0, 'abc\zeend', 'oij abcend', 'abc'])
***************
*** 271,277 ****
:call add(tl, [0, 'abc \zsmatch\ze abc', 'abc abc abc match abc abc', 'match'])
:call add(tl, [2, '\v(a \zsif .*){2}', 'a if then a if last', 'if last', 'a if last'])
:call add(tl, [2, '\>\zs.', 'aword. ', '.'])
!
:"""" Tests for \@ features
:call add(tl, [0, 'abc\@=', 'abc', 'ab'])
:call add(tl, [0, 'abc\@=cd', 'abcd', 'abcd'])
--- 271,277 ----
:call add(tl, [0, 'abc \zsmatch\ze abc', 'abc abc abc match abc abc', 'match'])
:call add(tl, [2, '\v(a \zsif .*){2}', 'a if then a if last', 'if last', 'a if last'])
:call add(tl, [2, '\>\zs.', 'aword. ', '.'])
! :"
:"""" Tests for \@ features
:call add(tl, [0, 'abc\@=', 'abc', 'ab'])
:call add(tl, [0, 'abc\@=cd', 'abcd', 'abcd'])
***************
*** 284,290 ****
:call add(tl, [2, '.*John\&.*Bob', 'here is John, and here is B']) " no match
:call add(tl, [0, '.*John\&.*Bob', 'John is Bobs friend', 'John is Bob'])
:call add(tl, [0, '\v(test1)@=.*yep', 'this is a test1, yep it is', 'test1, yep', 'test1'])
!
:"""" Combining different tests and features
:call add(tl, [2, '[[:alpha:]]\{-2,6}', '787abcdiuhsasiuhb4', 'ab'])
:call add(tl, [2, '', 'abcd', ''])
--- 284,290 ----
:call add(tl, [2, '.*John\&.*Bob', 'here is John, and here is B']) " no match
:call add(tl, [0, '.*John\&.*Bob', 'John is Bobs friend', 'John is Bob'])
:call add(tl, [0, '\v(test1)@=.*yep', 'this is a test1, yep it is', 'test1, yep', 'test1'])
! :"
:"""" Combining different tests and features
:call add(tl, [2, '[[:alpha:]]\{-2,6}', '787abcdiuhsasiuhb4', 'ab'])
:call add(tl, [2, '', 'abcd', ''])
***************
*** 292,313 ****
:call add(tl, [2, '\v%(ab(xyz)c)', ' abxyzc ', 'abxyzc', 'xyz'])
:call add(tl, [2, '\v(test|)empty', 'tesempty', 'empty', ''])
:call add(tl, [2, '\v(a|aa)(a|aa)', 'aaa', 'aa', 'a', 'a'])
!
:"""" \%u and friends
:call add(tl, [2, '\%d32', 'yes no', ' '])
:call add(tl, [2, '\%o40', 'yes no', ' '])
:call add(tl, [2, '\%x20', 'yes no', ' '])
:call add(tl, [2, '\%u0020', 'yes no', ' '])
:call add(tl, [2, '\%U00000020', 'yes no', ' '])
!
:"""" Alternatives, must use first longest match
:call add(tl, [2, 'goo\|go', 'google', 'goo'])
:call add(tl, [2, '\<goo\|\<go', 'google', 'goo'])
:call add(tl, [2, '\<goo\|go', 'google', 'goo'])
!
!
:"""" Run the tests
!
:"
:for t in tl
: let re = t[0]
--- 292,313 ----
:call add(tl, [2, '\v%(ab(xyz)c)', ' abxyzc ', 'abxyzc', 'xyz'])
:call add(tl, [2, '\v(test|)empty', 'tesempty', 'empty', ''])
:call add(tl, [2, '\v(a|aa)(a|aa)', 'aaa', 'aa', 'a', 'a'])
! :"
:"""" \%u and friends
:call add(tl, [2, '\%d32', 'yes no', ' '])
:call add(tl, [2, '\%o40', 'yes no', ' '])
:call add(tl, [2, '\%x20', 'yes no', ' '])
:call add(tl, [2, '\%u0020', 'yes no', ' '])
:call add(tl, [2, '\%U00000020', 'yes no', ' '])
! :"
:"""" Alternatives, must use first longest match
:call add(tl, [2, 'goo\|go', 'google', 'goo'])
:call add(tl, [2, '\<goo\|\<go', 'google', 'goo'])
:call add(tl, [2, '\<goo\|go', 'google', 'goo'])
! :"
! :"
:"""" Run the tests
! :"
:"
:for t in tl
: let re = t[0]
***************
*** 347,353 ****
: endfor
:endfor
:unlet t tl e l
!
:" Check that \_[0-9] matching EOL does not break a following \>
:" This only works on a buffer line, not with expression evaluation
/^Find this
--- 347,353 ----
: endfor
:endfor
:unlet t tl e l
! :"
:" Check that \_[0-9] matching EOL does not break a following \>
:" This only works on a buffer line, not with expression evaluation
/^Find this
***************
*** 359,369 ****
/^Find this
/\%#=2\<\(\(25\_[0-5]\|2\_[0-4]\_[0-9]\|\_[01]\?\_[0-9]\_[0-9]\?\)\.\)\{3\}\(25\_[0-5]\|2\_[0-4]\_[0-9]\|\_[01]\?\_[0-9]\_[0-9]\?\)\>
y$Gop:"
!
:/\%#=1^Results/,$wq! test.out
ENDTEST
Find this:
localnet/192.168.0.1
Results of test64:
--- 359,383 ----
/^Find this
/\%#=2\<\(\(25\_[0-5]\|2\_[0-4]\_[0-9]\|\_[01]\?\_[0-9]\_[0-9]\?\)\.\)\{3\}\(25\_[0-5]\|2\_[0-4]\_[0-9]\|\_[01]\?\_[0-9]\_[0-9]\?\)\>
y$Gop:"
! :"
! :" Check that using a pattern on two lines doesn't get messed up by using
! :" matchstr() with \ze in between.
! :set re=0
! /^Substitute here
! :.+1,.+2s/""/\='"'.matchstr(getline("."), '\d\+\ze<').'"'
! /^Substitute here
! :.+1,.+2yank
! Gop:"
! :"
! :"
:/\%#=1^Results/,$wq! test.out
ENDTEST
Find this:
localnet/192.168.0.1
+ Substitute here:
+ <T="">Ta 5</Title>
+ <T="">Ac 7</Title>
+
Results of test64:
*** ../vim-7.3.1023/src/testdir/test64.ok 2013-05-25 23:15:21.000000000 +0200
--- src/testdir/test64.ok 2013-05-26 16:42:18.000000000 +0200
***************
*** 693,695 ****
--- 693,698 ----
192.168.0.1
192.168.0.1
192.168.0.1
+
+ <T="5">Ta 5</Title>
+ <T="7">Ac 7</Title>
*** ../vim-7.3.1023/src/regexp.h 2013-05-25 20:19:45.000000000 +0200
--- src/regexp.h 2013-05-26 16:30:50.000000000 +0200
***************
*** 86,91 ****
--- 86,92 ----
regprog_T regprog;
nfa_state_T *start;
+ int has_zend; /* pattern contains \ze */
int nstate;
nfa_state_T state[0]; /* actually longer.. */
} nfa_regprog_T;
*** ../vim-7.3.1023/src/version.c 2013-05-26 15:14:49.000000000 +0200
--- src/version.c 2013-05-26 16:55:29.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1024,
/**/
--
An alien life briefly visits earth. Just before departing it leaves a
message in the dust on the back of a white van. The world is shocked
and wants to know what it means. After months of studies the worlds
best linguistic scientists are able to decipher the message: "Wash me!".
/// 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 ///

218
7.3.1025 Normal file
View File

@ -0,0 +1,218 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1025
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1025
Problem: New regexp: not matching newline in string. (Marc Weber)
Solution: Check for "\n" character.
Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok
*** ../vim-7.3.1024/src/regexp_nfa.c 2013-05-26 16:57:23.000000000 +0200
--- src/regexp_nfa.c 2013-05-26 17:38:27.000000000 +0200
***************
*** 165,173 ****
static int *post_end;
static int *post_ptr;
! static int nstate; /* Number of states in the NFA. */
static int istate; /* Index in the state vector, used in new_state() */
- static int nstate_max; /* Upper bound of estimated number of states. */
static int nfa_regcomp_start __ARGS((char_u*expr, int re_flags));
--- 165,173 ----
static int *post_end;
static int *post_ptr;
! static int nstate; /* Number of states in the NFA. Also used when
! * executing. */
static int istate; /* Index in the state vector, used in new_state() */
static int nfa_regcomp_start __ARGS((char_u*expr, int re_flags));
***************
*** 219,228 ****
int re_flags; /* see vim_regcomp() */
{
size_t postfix_size;
nstate = 0;
istate = 0;
! /* A reasonable estimation for size */
nstate_max = (int)(STRLEN(expr) + 1) * NFA_POSTFIX_MULTIPLIER;
/* Some items blow up in size, such as [A-z]. Add more space for that.
--- 219,229 ----
int re_flags; /* see vim_regcomp() */
{
size_t postfix_size;
+ int nstate_max;
nstate = 0;
istate = 0;
! /* A reasonable estimation for maximum size */
nstate_max = (int)(STRLEN(expr) + 1) * NFA_POSTFIX_MULTIPLIER;
/* Some items blow up in size, such as [A-z]. Add more space for that.
***************
*** 1968,1977 ****
* Frag_T.out is a list of places that need to be set to the
* next state for this fragment.
*/
typedef union Ptrlist Ptrlist;
struct Frag
{
! nfa_state_T *start;
Ptrlist *out;
};
typedef struct Frag Frag_T;
--- 1969,1988 ----
* Frag_T.out is a list of places that need to be set to the
* next state for this fragment.
*/
+
+ /* Since the out pointers in the list are always
+ * uninitialized, we use the pointers themselves
+ * as storage for the Ptrlists. */
typedef union Ptrlist Ptrlist;
+ union Ptrlist
+ {
+ Ptrlist *next;
+ nfa_state_T *s;
+ };
+
struct Frag
{
! nfa_state_T *start;
Ptrlist *out;
};
typedef struct Frag Frag_T;
***************
*** 1999,2015 ****
}
/*
- * Since the out pointers in the list are always
- * uninitialized, we use the pointers themselves
- * as storage for the Ptrlists.
- */
- union Ptrlist
- {
- Ptrlist *next;
- nfa_state_T *s;
- };
-
- /*
* Create singleton list containing just outp.
*/
static Ptrlist *
--- 2010,2015 ----
***************
*** 3358,3365 ****
#endif
case NFA_NEWL:
! if (!reg_line_lbr && REG_MULTI
! && curc == NUL && reglnum <= reg_maxline)
{
go_to_nextline = TRUE;
/* Pass -1 for the offset, which means taking the position
--- 3358,3365 ----
#endif
case NFA_NEWL:
! if (curc == NUL && !reg_line_lbr && REG_MULTI
! && reglnum <= reg_maxline)
{
go_to_nextline = TRUE;
/* Pass -1 for the offset, which means taking the position
***************
*** 3367,3372 ****
--- 3367,3378 ----
addstate(nextlist, t->state->out, &t->sub, -1,
listid + 1, &match);
}
+ else if (curc == '\n' && reg_line_lbr)
+ {
+ /* match \n as if it is an ordinary character */
+ addstate(nextlist, t->state->out, &t->sub, 1,
+ listid + 1, &match);
+ }
break;
case NFA_CLASS_ALNUM:
***************
*** 3832,3838 ****
--- 3838,3849 ----
* (and count its size). */
postfix = re2post();
if (postfix == NULL)
+ {
+ /* TODO: only give this error for debugging? */
+ if (post_ptr >= post_end)
+ EMSGN("Internal error: estimated max number of states insufficient: %ld", post_end - post_start);
goto fail; /* Cascaded (syntax?) error */
+ }
/*
* In order to build the NFA, we parse the input regexp twice:
*** ../vim-7.3.1024/src/testdir/test64.in 2013-05-26 16:57:23.000000000 +0200
--- src/testdir/test64.in 2013-05-26 17:37:51.000000000 +0200
***************
*** 250,255 ****
--- 250,258 ----
:call add(tl, [2, 'abc[0-9]*ddd', 'adf abc44482ddd oijs', 'abc44482ddd'])
:call add(tl, [2, '\_[0-9]\+', 'asfi9888u', '9888'])
:call add(tl, [2, '[0-9\n]\+', 'asfi9888u', '9888'])
+ :call add(tl, [2, '\_[0-9]\+', "asfi\n9888u", "\n9888"])
+ :call add(tl, [2, '\_f', " \na ", "\n"])
+ :call add(tl, [2, '\_f\+', " \na ", "\na"])
:"
:"
:"""" Test recognition of some character classes
*** ../vim-7.3.1024/src/testdir/test64.ok 2013-05-26 16:57:23.000000000 +0200
--- src/testdir/test64.ok 2013-05-26 17:38:51.000000000 +0200
***************
*** 576,581 ****
--- 576,590 ----
OK 0 - [0-9\n]\+
OK 1 - [0-9\n]\+
OK 2 - [0-9\n]\+
+ OK 0 - \_[0-9]\+
+ OK 1 - \_[0-9]\+
+ OK 2 - \_[0-9]\+
+ OK 0 - \_f
+ OK 1 - \_f
+ OK 2 - \_f
+ OK 0 - \_f\+
+ OK 1 - \_f\+
+ OK 2 - \_f\+
OK 0 - [0-9]
OK 1 - [0-9]
OK 2 - [0-9]
*** ../vim-7.3.1024/src/version.c 2013-05-26 16:57:23.000000000 +0200
--- src/version.c 2013-05-26 17:44:16.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1025,
/**/
--
Every engineer dreams about saving the universe and having sex with aliens.
This is much more glamorous than the real life of an engineer, which consists
of hiding from the universe and having sex without the participation of other
life forms. (Scott Adams - The Dilbert principle)
/// 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 ///

108
7.3.1026 Normal file
View File

@ -0,0 +1,108 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1026
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1026
Problem: New regexp: pattern that includs a new-line matches too early.
(john McGowan)
Solution: Do not start searching in the second line.
Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok
*** ../vim-7.3.1025/src/regexp_nfa.c 2013-05-26 17:45:41.000000000 +0200
--- src/regexp_nfa.c 2013-05-26 18:38:01.000000000 +0200
***************
*** 3585,3596 ****
} /* for (thislist = thislist; thislist->state; thislist++) */
! /* The first found match is the leftmost one, but there may be a
! * longer one. Keep running the NFA, but don't start from the
! * beginning. Also, do not add the start state in recursive calls of
! * nfa_regmatch(), because recursive calls should only start in the
! * first position. */
! if (match == FALSE && start->c == NFA_MOPEN + 0)
{
#ifdef ENABLE_LOG
fprintf(log_fd, "(---) STARTSTATE\n");
--- 3585,3599 ----
} /* for (thislist = thislist; thislist->state; thislist++) */
! /* Look for the start of a match in the current position by adding the
! * start state to the list of states.
! * The first found match is the leftmost one, thus the order of states
! * matters!
! * Do not add the start state in recursive calls of nfa_regmatch(),
! * because recursive calls should only start in the first position.
! * Also don't start a match past the first line. */
! if (match == FALSE && start->c == NFA_MOPEN + 0
! && reglnum == 0 && clen != 0)
{
#ifdef ENABLE_LOG
fprintf(log_fd, "(---) STARTSTATE\n");
*** ../vim-7.3.1025/src/testdir/test64.in 2013-05-26 17:45:41.000000000 +0200
--- src/testdir/test64.in 2013-05-26 18:34:04.000000000 +0200
***************
*** 372,377 ****
--- 372,383 ----
:.+1,.+2yank
Gop:"
:"
+ :" Check a pattern with a line break matches in the right position.
+ /^Multiline
+ /\S.*\nx
+ :.yank
+ y$Gop:"
+ :"
:"
:/\%#=1^Results/,$wq! test.out
ENDTEST
***************
*** 383,386 ****
--- 389,399 ----
<T="">Ta 5</Title>
<T="">Ac 7</Title>
+ Multiline:
+ abc
+ def
+ ghi
+ xjk
+ lmn
+
Results of test64:
*** ../vim-7.3.1025/src/testdir/test64.ok 2013-05-26 17:45:41.000000000 +0200
--- src/testdir/test64.ok 2013-05-26 18:34:00.000000000 +0200
***************
*** 705,707 ****
--- 705,708 ----
<T="5">Ta 5</Title>
<T="7">Ac 7</Title>
+ ghi
*** ../vim-7.3.1025/src/version.c 2013-05-26 17:45:41.000000000 +0200
--- src/version.c 2013-05-26 18:35:52.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1026,
/**/
--
For society, it's probably a good thing that engineers value function over
appearance. For example, you wouldn't want engineers to build nuclear power
plants that only _look_ like they would keep all the radiation inside.
(Scott Adams - The Dilbert principle)
/// 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 ///

80
7.3.1027 Normal file
View File

@ -0,0 +1,80 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1027
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1027
Problem: New regexp performance: Calling no_Magic() very often.
Solution: Remove magicness inline.
Files: src/regexp_nfa.c
*** ../vim-7.3.1026/src/regexp_nfa.c 2013-05-26 18:40:11.000000000 +0200
--- src/regexp_nfa.c 2013-05-26 19:18:32.000000000 +0200
***************
*** 3563,3576 ****
break;
default: /* regular character */
/* TODO: put this in #ifdef later */
! if (t->state->c < -256)
! EMSGN("INTERNAL: Negative state char: %ld", t->state->c);
! result = (no_Magic(t->state->c) == curc);
! if (!result)
! result = ireg_ic == TRUE
! && MB_TOLOWER(t->state->c) == MB_TOLOWER(curc);
#ifdef FEAT_MBYTE
/* If there is a composing character which is not being
* ignored there can be no match. Match with composing
--- 3563,3580 ----
break;
default: /* regular character */
+ {
+ int c = t->state->c;
+
/* TODO: put this in #ifdef later */
! if (c < -256)
! EMSGN("INTERNAL: Negative state char: %ld", c);
! if (is_Magic(c))
! c = un_Magic(c);
! result = (c == curc);
! if (!result && ireg_ic)
! result = MB_TOLOWER(c) == MB_TOLOWER(curc);
#ifdef FEAT_MBYTE
/* If there is a composing character which is not being
* ignored there can be no match. Match with composing
***************
*** 3581,3586 ****
--- 3585,3591 ----
#endif
ADD_POS_NEG_STATE(t->state);
break;
+ }
}
} /* for (thislist = thislist; thislist->state; thislist++) */
*** ../vim-7.3.1026/src/version.c 2013-05-26 18:40:11.000000000 +0200
--- src/version.c 2013-05-26 19:16:07.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1027,
/**/
--
It doesn't really matter what you are able to do if you don't do it.
(Bram Moolenaar)
/// 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 ///

895
7.3.1028 Normal file
View File

@ -0,0 +1,895 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1028
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1028
Problem: New regexp performance: Copying a lot of position state.
Solution: Only copy the sub-expressions that are being used.
Files: src/regexp_nfa.c, src/regexp.h
*** ../vim-7.3.1027/src/regexp_nfa.c 2013-05-26 19:19:48.000000000 +0200
--- src/regexp_nfa.c 2013-05-26 21:35:33.000000000 +0200
***************
*** 161,166 ****
--- 161,170 ----
/* NFA regexp \ze operator encountered. */
static int nfa_has_zend = FALSE;
+ /* Number of sub expressions actually being used during execution. 1 if only
+ * the whole match (subexpr 0) is used. */
+ static int nfa_nsubexpr;
+
static int *post_start; /* holds the postfix form of r.e. */
static int *post_end;
static int *post_ptr;
***************
*** 1645,1656 ****
return OK;
}
! typedef struct
{
! char_u *start[NSUBEXP];
! char_u *end[NSUBEXP];
! lpos_T startpos[NSUBEXP];
! lpos_T endpos[NSUBEXP];
} regsub_T;
static int nfa_regmatch __ARGS((nfa_state_T *start, regsub_T *submatch, regsub_T *m));
--- 1649,1666 ----
return OK;
}
! typedef union
{
! struct multipos
! {
! lpos_T start;
! lpos_T end;
! } multilist[NSUBEXP];
! struct linepos
! {
! char_u *start;
! char_u *end;
! } linelist[NSUBEXP];
} regsub_T;
static int nfa_regmatch __ARGS((nfa_state_T *start, regsub_T *submatch, regsub_T *m));
***************
*** 2479,2514 ****
* NFA execution code.
****************************************************************/
! /* nfa_thread_T contains runtime information of a NFA state */
typedef struct
{
nfa_state_T *state;
! regsub_T sub; /* Submatch info. TODO: expensive! */
} nfa_thread_T;
!
typedef struct
{
nfa_thread_T *t;
int n;
} nfa_list_T;
! static void addstate __ARGS((nfa_list_T *l, nfa_state_T *state, regsub_T *m, int off, int lid, int *match));
! static void addstate_here __ARGS((nfa_list_T *l, nfa_state_T *state, regsub_T *m, int lid, int *match, int *ip));
static void
! addstate(l, state, m, off, lid, match)
nfa_list_T *l; /* runtime state list */
nfa_state_T *state; /* state to update */
regsub_T *m; /* pointers to subexpressions */
int off; /* byte offset, when -1 go to next line */
int lid;
- int *match; /* found match? */
{
! regsub_T save;
! int subidx = 0;
nfa_thread_T *lastthread;
if (l == NULL || state == NULL)
return;
--- 2489,2527 ----
* NFA execution code.
****************************************************************/
! /* nfa_thread_T contains execution information of a NFA state */
typedef struct
{
nfa_state_T *state;
! regsub_T sub; /* submatch info, only party used */
} nfa_thread_T;
! /* nfa_list_T contains the alternative NFA execution states. */
typedef struct
{
nfa_thread_T *t;
int n;
} nfa_list_T;
! /* Used during execution: whether a match has been found. */
! static int nfa_match;
!
! static void addstate __ARGS((nfa_list_T *l, nfa_state_T *state, regsub_T *m, int off, int lid));
! static void addstate_here __ARGS((nfa_list_T *l, nfa_state_T *state, regsub_T *m, int lid, int *ip));
static void
! addstate(l, state, m, off, lid)
nfa_list_T *l; /* runtime state list */
nfa_state_T *state; /* state to update */
regsub_T *m; /* pointers to subexpressions */
int off; /* byte offset, when -1 go to next line */
int lid;
{
! int subidx;
nfa_thread_T *lastthread;
+ lpos_T save_lpos;
+ char_u *save_ptr;
if (l == NULL || state == NULL)
return;
***************
*** 2544,2550 ****
state->lastlist = lid;
lastthread = &l->t[l->n++];
lastthread->state = state;
! lastthread->sub = *m; /* TODO: expensive! */
}
}
--- 2557,2572 ----
state->lastlist = lid;
lastthread = &l->t[l->n++];
lastthread->state = state;
!
! /* Copy the match start and end positions. */
! if (REG_MULTI)
! mch_memmove(&lastthread->sub.multilist[0],
! &m->multilist[0],
! sizeof(struct multipos) * nfa_nsubexpr);
! else
! mch_memmove(&lastthread->sub.linelist[0],
! &m->linelist[0],
! sizeof(struct linepos) * nfa_nsubexpr);
}
}
***************
*** 2556,2571 ****
switch (state->c)
{
case NFA_MATCH:
! *match = TRUE;
break;
case NFA_SPLIT:
! addstate(l, state->out, m, off, lid, match);
! addstate(l, state->out1, m, off, lid, match);
break;
case NFA_SKIP_CHAR:
! addstate(l, state->out, m, off, lid, match);
break;
#if 0
--- 2578,2593 ----
switch (state->c)
{
case NFA_MATCH:
! nfa_match = TRUE;
break;
case NFA_SPLIT:
! addstate(l, state->out, m, off, lid);
! addstate(l, state->out1, m, off, lid);
break;
case NFA_SKIP_CHAR:
! addstate(l, state->out, m, off, lid);
break;
#if 0
***************
*** 2587,2593 ****
case NFA_NOPEN:
case NFA_NCLOSE:
! addstate(l, state->out, m, off, lid, match);
break;
/* If this state is reached, then a recursive call of nfa_regmatch()
--- 2609,2615 ----
case NFA_NOPEN:
case NFA_NCLOSE:
! addstate(l, state->out, m, off, lid);
break;
/* If this state is reached, then a recursive call of nfa_regmatch()
***************
*** 2609,2659 ****
case NFA_MOPEN + 8:
case NFA_MOPEN + 9:
case NFA_ZSTART:
- subidx = state->c - NFA_MOPEN;
if (state->c == NFA_ZSTART)
subidx = 0;
if (REG_MULTI)
{
! save.startpos[subidx] = m->startpos[subidx];
! save.endpos[subidx] = m->endpos[subidx];
if (off == -1)
{
! m->startpos[subidx].lnum = reglnum + 1;
! m->startpos[subidx].col = 0;
}
else
{
! m->startpos[subidx].lnum = reglnum;
! m->startpos[subidx].col =
(colnr_T)(reginput - regline + off);
}
}
else
{
! save.start[subidx] = m->start[subidx];
! save.end[subidx] = m->end[subidx];
! m->start[subidx] = reginput + off;
}
! addstate(l, state->out, m, off, lid, match);
if (REG_MULTI)
! {
! m->startpos[subidx] = save.startpos[subidx];
! m->endpos[subidx] = save.endpos[subidx];
! }
else
! {
! m->start[subidx] = save.start[subidx];
! m->end[subidx] = save.end[subidx];
! }
break;
case NFA_MCLOSE + 0:
if (nfa_has_zend)
{
! addstate(l, state->out, m, off, lid, match);
break;
}
case NFA_MCLOSE + 1:
--- 2631,2674 ----
case NFA_MOPEN + 8:
case NFA_MOPEN + 9:
case NFA_ZSTART:
if (state->c == NFA_ZSTART)
subidx = 0;
+ else
+ subidx = state->c - NFA_MOPEN;
if (REG_MULTI)
{
! save_lpos = m->multilist[subidx].start;
if (off == -1)
{
! m->multilist[subidx].start.lnum = reglnum + 1;
! m->multilist[subidx].start.col = 0;
}
else
{
! m->multilist[subidx].start.lnum = reglnum;
! m->multilist[subidx].start.col =
(colnr_T)(reginput - regline + off);
}
}
else
{
! save_ptr = m->linelist[subidx].start;
! m->linelist[subidx].start = reginput + off;
}
! addstate(l, state->out, m, off, lid);
if (REG_MULTI)
! m->multilist[subidx].start = save_lpos;
else
! m->linelist[subidx].start = save_ptr;
break;
case NFA_MCLOSE + 0:
if (nfa_has_zend)
{
! addstate(l, state->out, m, off, lid);
break;
}
case NFA_MCLOSE + 1:
***************
*** 2666,2709 ****
case NFA_MCLOSE + 8:
case NFA_MCLOSE + 9:
case NFA_ZEND:
- subidx = state->c - NFA_MCLOSE;
if (state->c == NFA_ZEND)
subidx = 0;
if (REG_MULTI)
{
! save.startpos[subidx] = m->startpos[subidx];
! save.endpos[subidx] = m->endpos[subidx];
if (off == -1)
{
! m->endpos[subidx].lnum = reglnum + 1;
! m->endpos[subidx].col = 0;
}
else
{
! m->endpos[subidx].lnum = reglnum;
! m->endpos[subidx].col = (colnr_T)(reginput - regline + off);
}
}
else
{
! save.start[subidx] = m->start[subidx];
! save.end[subidx] = m->end[subidx];
! m->end[subidx] = reginput + off;
}
! addstate(l, state->out, m, off, lid, match);
if (REG_MULTI)
! {
! m->startpos[subidx] = save.startpos[subidx];
! m->endpos[subidx] = save.endpos[subidx];
! }
else
! {
! m->start[subidx] = save.start[subidx];
! m->end[subidx] = save.end[subidx];
! }
break;
}
}
--- 2681,2718 ----
case NFA_MCLOSE + 8:
case NFA_MCLOSE + 9:
case NFA_ZEND:
if (state->c == NFA_ZEND)
subidx = 0;
+ else
+ subidx = state->c - NFA_MCLOSE;
if (REG_MULTI)
{
! save_lpos = m->multilist[subidx].end;
if (off == -1)
{
! m->multilist[subidx].end.lnum = reglnum + 1;
! m->multilist[subidx].end.col = 0;
}
else
{
! m->multilist[subidx].end.lnum = reglnum;
! m->multilist[subidx].end.col =
! (colnr_T)(reginput - regline + off);
}
}
else
{
! save_ptr = m->linelist[subidx].end;
! m->linelist[subidx].end = reginput + off;
}
! addstate(l, state->out, m, off, lid);
if (REG_MULTI)
! m->multilist[subidx].end = save_lpos;
else
! m->linelist[subidx].end = save_ptr;
break;
}
}
***************
*** 2715,2726 ****
* matters for alternatives.
*/
static void
! addstate_here(l, state, m, lid, matchp, ip)
nfa_list_T *l; /* runtime state list */
nfa_state_T *state; /* state to update */
regsub_T *m; /* pointers to subexpressions */
int lid;
- int *matchp; /* found match? */
int *ip;
{
int tlen = l->n;
--- 2724,2734 ----
* matters for alternatives.
*/
static void
! addstate_here(l, state, m, lid, ip)
nfa_list_T *l; /* runtime state list */
nfa_state_T *state; /* state to update */
regsub_T *m; /* pointers to subexpressions */
int lid;
int *ip;
{
int tlen = l->n;
***************
*** 2728,2734 ****
int i = *ip;
/* first add the state(s) at the end, so that we know how many there are */
! addstate(l, state, m, 0, lid, matchp);
/* when "*ip" was at the end of the list, nothing to do */
if (i + 1 == tlen)
--- 2736,2742 ----
int i = *ip;
/* first add the state(s) at the end, so that we know how many there are */
! addstate(l, state, m, 0, lid);
/* when "*ip" was at the end of the list, nothing to do */
if (i + 1 == tlen)
***************
*** 2925,2931 ****
{
int result;
int size = 0;
- int match = FALSE;
int flag = 0;
int old_reglnum = -1;
int go_to_nextline = FALSE;
--- 2933,2938 ----
***************
*** 2951,2956 ****
--- 2958,2964 ----
return FALSE;
}
#endif
+ nfa_match = FALSE;
/* Allocate memory for the lists of nodes */
size = (nstate + 1) * sizeof(nfa_thread_T);
***************
*** 2989,2995 ****
#ifdef ENABLE_LOG
fprintf(log_fd, "(---) STARTSTATE\n");
#endif
! addstate(thislist, start, m, 0, listid, &match);
/* There are two cases when the NFA advances: 1. input char matches the
* NFA node and 2. input char does not match the NFA node, but the next
--- 2997,3003 ----
#ifdef ENABLE_LOG
fprintf(log_fd, "(---) STARTSTATE\n");
#endif
! addstate(thislist, start, m, 0, listid);
/* There are two cases when the NFA advances: 1. input char matches the
* NFA node and 2. input char does not match the NFA node, but the next
***************
*** 3002,3008 ****
#define ADD_POS_NEG_STATE(node) \
ll = listtbl[result ? 1 : 0][node->negated]; \
if (ll != NULL) \
! addstate(ll, node->out , &t->sub, clen, listid + 1, &match);
/*
--- 3010,3016 ----
#define ADD_POS_NEG_STATE(node) \
ll = listtbl[result ? 1 : 0][node->negated]; \
if (ll != NULL) \
! addstate(ll, node->out , &t->sub, clen, listid + 1);
/*
***************
*** 3090,3096 ****
switch (t->state->c)
{
case NFA_MATCH:
! match = TRUE;
*submatch = t->sub;
#ifdef ENABLE_LOG
for (j = 0; j < 4; j++)
--- 3098,3104 ----
switch (t->state->c)
{
case NFA_MATCH:
! nfa_match = TRUE;
*submatch = t->sub;
#ifdef ENABLE_LOG
for (j = 0; j < 4; j++)
***************
*** 3125,3135 ****
* the parent call. */
if (start->c == NFA_MOPEN + 0)
addstate_here(thislist, t->state->out, &t->sub, listid,
! &match, &listidx);
else
{
*m = t->sub;
! match = TRUE;
}
break;
--- 3133,3143 ----
* the parent call. */
if (start->c == NFA_MOPEN + 0)
addstate_here(thislist, t->state->out, &t->sub, listid,
! &listidx);
else
{
*m = t->sub;
! nfa_match = TRUE;
}
break;
***************
*** 3186,3205 ****
reglnum = old_reglnum;
/* Copy submatch info from the recursive call */
if (REG_MULTI)
! for (j = 1; j < NSUBEXP; j++)
{
! t->sub.startpos[j] = m->startpos[j];
! t->sub.endpos[j] = m->endpos[j];
}
else
! for (j = 1; j < NSUBEXP; j++)
{
! t->sub.start[j] = m->start[j];
! t->sub.end[j] = m->end[j];
}
/* t->state->out1 is the corresponding END_INVISIBLE node */
addstate_here(thislist, t->state->out1->out, &t->sub,
! listid, &match, &listidx);
}
else
{
--- 3194,3213 ----
reglnum = old_reglnum;
/* Copy submatch info from the recursive call */
if (REG_MULTI)
! for (j = 1; j < nfa_nsubexpr; j++)
{
! t->sub.multilist[j].start = m->multilist[j].start;
! t->sub.multilist[j].end = m->multilist[j].end;
}
else
! for (j = 1; j < nfa_nsubexpr; j++)
{
! t->sub.linelist[j].start = m->linelist[j].start;
! t->sub.linelist[j].end = m->linelist[j].end;
}
/* t->state->out1 is the corresponding END_INVISIBLE node */
addstate_here(thislist, t->state->out1->out, &t->sub,
! listid, &listidx);
}
else
{
***************
*** 3211,3223 ****
case NFA_BOL:
if (reginput == regline)
addstate_here(thislist, t->state->out, &t->sub, listid,
! &match, &listidx);
break;
case NFA_EOL:
if (curc == NUL)
addstate_here(thislist, t->state->out, &t->sub, listid,
! &match, &listidx);
break;
case NFA_BOW:
--- 3219,3231 ----
case NFA_BOL:
if (reginput == regline)
addstate_here(thislist, t->state->out, &t->sub, listid,
! &listidx);
break;
case NFA_EOL:
if (curc == NUL)
addstate_here(thislist, t->state->out, &t->sub, listid,
! &listidx);
break;
case NFA_BOW:
***************
*** 3245,3251 ****
bow = FALSE;
if (bow)
addstate_here(thislist, t->state->out, &t->sub, listid,
! &match, &listidx);
break;
}
--- 3253,3259 ----
bow = FALSE;
if (bow)
addstate_here(thislist, t->state->out, &t->sub, listid,
! &listidx);
break;
}
***************
*** 3274,3280 ****
eow = FALSE;
if (eow)
addstate_here(thislist, t->state->out, &t->sub, listid,
! &match, &listidx);
break;
}
--- 3282,3288 ----
eow = FALSE;
if (eow)
addstate_here(thislist, t->state->out, &t->sub, listid,
! &listidx);
break;
}
***************
*** 3364,3377 ****
go_to_nextline = TRUE;
/* Pass -1 for the offset, which means taking the position
* at the start of the next line. */
! addstate(nextlist, t->state->out, &t->sub, -1,
! listid + 1, &match);
}
else if (curc == '\n' && reg_line_lbr)
{
/* match \n as if it is an ordinary character */
! addstate(nextlist, t->state->out, &t->sub, 1,
! listid + 1, &match);
}
break;
--- 3372,3383 ----
go_to_nextline = TRUE;
/* Pass -1 for the offset, which means taking the position
* at the start of the next line. */
! addstate(nextlist, t->state->out, &t->sub, -1, listid + 1);
}
else if (curc == '\n' && reg_line_lbr)
{
/* match \n as if it is an ordinary character */
! addstate(nextlist, t->state->out, &t->sub, 1, listid + 1);
}
break;
***************
*** 3400,3413 ****
* CHAR(x), NFA_NOT, CHAR(y), NFA_NOT etc. */
if (curc > 0)
addstate(nextlist, t->state->out, &t->sub, clen,
! listid + 1, &match);
break;
case NFA_ANY:
/* Any char except '\0', (end of input) does not match. */
if (curc > 0)
addstate(nextlist, t->state->out, &t->sub, clen,
! listid + 1, &match);
break;
/*
--- 3406,3419 ----
* CHAR(x), NFA_NOT, CHAR(y), NFA_NOT etc. */
if (curc > 0)
addstate(nextlist, t->state->out, &t->sub, clen,
! listid + 1);
break;
case NFA_ANY:
/* Any char except '\0', (end of input) does not match. */
if (curc > 0)
addstate(nextlist, t->state->out, &t->sub, clen,
! listid + 1);
break;
/*
***************
*** 3597,3609 ****
* Do not add the start state in recursive calls of nfa_regmatch(),
* because recursive calls should only start in the first position.
* Also don't start a match past the first line. */
! if (match == FALSE && start->c == NFA_MOPEN + 0
&& reglnum == 0 && clen != 0)
{
#ifdef ENABLE_LOG
fprintf(log_fd, "(---) STARTSTATE\n");
#endif
! addstate(nextlist, start, m, clen, listid + 1, &match);
}
#ifdef ENABLE_LOG
--- 3603,3615 ----
* Do not add the start state in recursive calls of nfa_regmatch(),
* because recursive calls should only start in the first position.
* Also don't start a match past the first line. */
! if (nfa_match == FALSE && start->c == NFA_MOPEN + 0
&& reglnum == 0 && clen != 0)
{
#ifdef ENABLE_LOG
fprintf(log_fd, "(---) STARTSTATE\n");
#endif
! addstate(nextlist, start, m, clen, listid + 1);
}
#ifdef ENABLE_LOG
***************
*** 3640,3653 ****
vim_free(list[1].t);
vim_free(list[2].t);
list[0].t = list[1].t = list[2].t = NULL;
! if (listids != NULL)
! vim_free(listids);
#undef ADD_POS_NEG_STATE
#ifdef NFA_REGEXP_DEBUG_LOG
fclose(debug);
#endif
! return match;
}
/*
--- 3646,3658 ----
vim_free(list[1].t);
vim_free(list[2].t);
list[0].t = list[1].t = list[2].t = NULL;
! vim_free(listids);
#undef ADD_POS_NEG_STATE
#ifdef NFA_REGEXP_DEBUG_LOG
fclose(debug);
#endif
! return nfa_match;
}
/*
***************
*** 3690,3706 ****
if (REG_MULTI)
{
/* Use 0xff to set lnum to -1 */
! vim_memset(sub.startpos, 0xff, sizeof(lpos_T) * NSUBEXP);
! vim_memset(sub.endpos, 0xff, sizeof(lpos_T) * NSUBEXP);
! vim_memset(m.startpos, 0xff, sizeof(lpos_T) * NSUBEXP);
! vim_memset(m.endpos, 0xff, sizeof(lpos_T) * NSUBEXP);
}
else
{
! vim_memset(sub.start, 0, sizeof(char_u *) * NSUBEXP);
! vim_memset(sub.end, 0, sizeof(char_u *) * NSUBEXP);
! vim_memset(m.start, 0, sizeof(char_u *) * NSUBEXP);
! vim_memset(m.end, 0, sizeof(char_u *) * NSUBEXP);
}
if (nfa_regmatch(start, &sub, &m) == FALSE)
--- 3695,3707 ----
if (REG_MULTI)
{
/* Use 0xff to set lnum to -1 */
! vim_memset(sub.multilist, 0xff, sizeof(struct multipos) * nfa_nsubexpr);
! vim_memset(m.multilist, 0xff, sizeof(struct multipos) * nfa_nsubexpr);
}
else
{
! vim_memset(sub.linelist, 0, sizeof(struct linepos) * nfa_nsubexpr);
! vim_memset(m.linelist, 0, sizeof(struct linepos) * nfa_nsubexpr);
}
if (nfa_regmatch(start, &sub, &m) == FALSE)
***************
*** 3709,3718 ****
cleanup_subexpr();
if (REG_MULTI)
{
! for (i = 0; i < NSUBEXP; i++)
{
! reg_startpos[i] = sub.startpos[i];
! reg_endpos[i] = sub.endpos[i];
}
if (reg_startpos[0].lnum < 0)
--- 3710,3719 ----
cleanup_subexpr();
if (REG_MULTI)
{
! for (i = 0; i < nfa_nsubexpr; i++)
{
! reg_startpos[i] = sub.multilist[i].start;
! reg_endpos[i] = sub.multilist[i].end;
}
if (reg_startpos[0].lnum < 0)
***************
*** 3731,3740 ****
}
else
{
! for (i = 0; i < NSUBEXP; i++)
{
! reg_startp[i] = sub.start[i];
! reg_endp[i] = sub.end[i];
}
if (reg_startp[0] == NULL)
--- 3732,3741 ----
}
else
{
! for (i = 0; i < nfa_nsubexpr; i++)
{
! reg_startp[i] = sub.linelist[i].start;
! reg_endp[i] = sub.linelist[i].end;
}
if (reg_startp[0] == NULL)
***************
*** 3802,3807 ****
--- 3803,3809 ----
reglnum = 0; /* relative to line */
nfa_has_zend = prog->has_zend;
+ nfa_nsubexpr = prog->nsubexp;
nstate = prog->nstate;
for (i = 0; i < nstate; ++i)
***************
*** 3896,3901 ****
--- 3898,3904 ----
prog->engine = &nfa_regengine;
prog->nstate = nstate;
prog->has_zend = nfa_has_zend;
+ prog->nsubexp = regnpar;
#ifdef ENABLE_LOG
nfa_postfix_dump(expr, OK);
nfa_dump(prog);
*** ../vim-7.3.1027/src/regexp.h 2013-05-26 16:57:23.000000000 +0200
--- src/regexp.h 2013-05-26 20:08:09.000000000 +0200
***************
*** 87,92 ****
--- 87,93 ----
regprog_T regprog;
nfa_state_T *start;
int has_zend; /* pattern contains \ze */
+ int nsubexp; /* number of () */
int nstate;
nfa_state_T state[0]; /* actually longer.. */
} nfa_regprog_T;
*** ../vim-7.3.1027/src/version.c 2013-05-26 19:19:48.000000000 +0200
--- src/version.c 2013-05-26 21:44:20.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1028,
/**/
--
Q: What's a light-year?
A: One-third less calories than a regular year.
/// 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 ///

404
7.3.1029 Normal file
View File

@ -0,0 +1,404 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1029
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1029
Problem: New regexp performance: Unused position state being copied.
Solution: Keep track of which positions are actually valid.
Files: src/regexp_nfa.c
*** ../vim-7.3.1028/src/regexp_nfa.c 2013-05-26 21:47:22.000000000 +0200
--- src/regexp_nfa.c 2013-05-26 22:45:26.000000000 +0200
***************
*** 1649,1670 ****
return OK;
}
- typedef union
- {
- struct multipos
- {
- lpos_T start;
- lpos_T end;
- } multilist[NSUBEXP];
- struct linepos
- {
- char_u *start;
- char_u *end;
- } linelist[NSUBEXP];
- } regsub_T;
-
- static int nfa_regmatch __ARGS((nfa_state_T *start, regsub_T *submatch, regsub_T *m));
-
#ifdef DEBUG
static char_u code[50];
--- 1649,1654 ----
***************
*** 2489,2494 ****
--- 2473,2498 ----
* NFA execution code.
****************************************************************/
+ typedef struct
+ {
+ int in_use; /* number of subexpr with useful info */
+
+ /* When REG_MULTI is TRUE multilist is used, otherwise linelist. */
+ union
+ {
+ struct multipos
+ {
+ lpos_T start;
+ lpos_T end;
+ } multilist[NSUBEXP];
+ struct linepos
+ {
+ char_u *start;
+ char_u *end;
+ } linelist[NSUBEXP];
+ };
+ } regsub_T;
+
/* nfa_thread_T contains execution information of a NFA state */
typedef struct
{
***************
*** 2507,2513 ****
static int nfa_match;
static void addstate __ARGS((nfa_list_T *l, nfa_state_T *state, regsub_T *m, int off, int lid));
-
static void addstate_here __ARGS((nfa_list_T *l, nfa_state_T *state, regsub_T *m, int lid, int *ip));
static void
--- 2511,2516 ----
***************
*** 2521,2527 ****
--- 2524,2532 ----
int subidx;
nfa_thread_T *lastthread;
lpos_T save_lpos;
+ int save_in_use;
char_u *save_ptr;
+ int i;
if (l == NULL || state == NULL)
return;
***************
*** 2557,2572 ****
state->lastlist = lid;
lastthread = &l->t[l->n++];
lastthread->state = state;
!
! /* Copy the match start and end positions. */
! if (REG_MULTI)
! mch_memmove(&lastthread->sub.multilist[0],
! &m->multilist[0],
! sizeof(struct multipos) * nfa_nsubexpr);
! else
! mch_memmove(&lastthread->sub.linelist[0],
! &m->linelist[0],
! sizeof(struct linepos) * nfa_nsubexpr);
}
}
--- 2562,2580 ----
state->lastlist = lid;
lastthread = &l->t[l->n++];
lastthread->state = state;
! lastthread->sub.in_use = m->in_use;
! if (m->in_use > 0)
! {
! /* Copy the match start and end positions. */
! if (REG_MULTI)
! mch_memmove(&lastthread->sub.multilist[0],
! &m->multilist[0],
! sizeof(struct multipos) * m->in_use);
! else
! mch_memmove(&lastthread->sub.linelist[0],
! &m->linelist[0],
! sizeof(struct linepos) * m->in_use);
! }
}
}
***************
*** 2636,2644 ****
else
subidx = state->c - NFA_MOPEN;
if (REG_MULTI)
{
! save_lpos = m->multilist[subidx].start;
if (off == -1)
{
m->multilist[subidx].start.lnum = reglnum + 1;
--- 2644,2668 ----
else
subidx = state->c - NFA_MOPEN;
+ /* Set the position (with "off") in the subexpression. Save and
+ * restore it when it was in use. Otherwise fill any gap. */
if (REG_MULTI)
{
! if (subidx < m->in_use)
! {
! save_lpos = m->multilist[subidx].start;
! save_in_use = -1;
! }
! else
! {
! save_in_use = m->in_use;
! for (i = m->in_use; i < subidx; ++i)
! {
! m->multilist[i].start.lnum = -1;
! m->multilist[i].end.lnum = -1;
! }
! m->in_use = subidx + 1;
! }
if (off == -1)
{
m->multilist[subidx].start.lnum = reglnum + 1;
***************
*** 2653,2668 ****
}
else
{
! save_ptr = m->linelist[subidx].start;
m->linelist[subidx].start = reginput + off;
}
addstate(l, state->out, m, off, lid);
! if (REG_MULTI)
! m->multilist[subidx].start = save_lpos;
else
! m->linelist[subidx].start = save_ptr;
break;
case NFA_MCLOSE + 0:
--- 2677,2711 ----
}
else
{
! if (subidx < m->in_use)
! {
! save_ptr = m->linelist[subidx].start;
! save_in_use = -1;
! }
! else
! {
! save_in_use = m->in_use;
! for (i = m->in_use; i < subidx; ++i)
! {
! m->linelist[i].start = NULL;
! m->linelist[i].end = NULL;
! }
! m->in_use = subidx + 1;
! }
m->linelist[subidx].start = reginput + off;
}
addstate(l, state->out, m, off, lid);
! if (save_in_use == -1)
! {
! if (REG_MULTI)
! m->multilist[subidx].start = save_lpos;
! else
! m->linelist[subidx].start = save_ptr;
! }
else
! m->in_use = save_in_use;
break;
case NFA_MCLOSE + 0:
***************
*** 2686,2691 ****
--- 2729,2739 ----
else
subidx = state->c - NFA_MCLOSE;
+ /* We don't fill in gaps here, there must have been an MOPEN that
+ * has done that. */
+ save_in_use = m->in_use;
+ if (m->in_use <= subidx)
+ m->in_use = subidx + 1;
if (REG_MULTI)
{
save_lpos = m->multilist[subidx].end;
***************
*** 2713,2718 ****
--- 2761,2767 ----
m->multilist[subidx].end = save_lpos;
else
m->linelist[subidx].end = save_ptr;
+ m->in_use = save_in_use;
break;
}
}
***************
*** 2917,2922 ****
--- 2966,2973 ----
}
}
+ static int nfa_regmatch __ARGS((nfa_state_T *start, regsub_T *submatch, regsub_T *m));
+
/*
* Main matching routine.
*
***************
*** 2960,2966 ****
#endif
nfa_match = FALSE;
! /* Allocate memory for the lists of nodes */
size = (nstate + 1) * sizeof(nfa_thread_T);
list[0].t = (nfa_thread_T *)lalloc(size, TRUE);
list[1].t = (nfa_thread_T *)lalloc(size, TRUE);
--- 3011,3017 ----
#endif
nfa_match = FALSE;
! /* Allocate memory for the lists of nodes. */
size = (nstate + 1) * sizeof(nfa_thread_T);
list[0].t = (nfa_thread_T *)lalloc(size, TRUE);
list[1].t = (nfa_thread_T *)lalloc(size, TRUE);
***************
*** 3099,3105 ****
{
case NFA_MATCH:
nfa_match = TRUE;
! *submatch = t->sub;
#ifdef ENABLE_LOG
for (j = 0; j < 4; j++)
if (REG_MULTI)
--- 3150,3168 ----
{
case NFA_MATCH:
nfa_match = TRUE;
! submatch->in_use = t->sub.in_use;
! if (REG_MULTI)
! for (j = 0; j < submatch->in_use; j++)
! {
! submatch->multilist[j].start = t->sub.multilist[j].start;
! submatch->multilist[j].end = t->sub.multilist[j].end;
! }
! else
! for (j = 0; j < submatch->in_use; j++)
! {
! submatch->linelist[j].start = t->sub.linelist[j].start;
! submatch->linelist[j].end = t->sub.linelist[j].end;
! }
#ifdef ENABLE_LOG
for (j = 0; j < 4; j++)
if (REG_MULTI)
***************
*** 3194,3210 ****
reglnum = old_reglnum;
/* Copy submatch info from the recursive call */
if (REG_MULTI)
! for (j = 1; j < nfa_nsubexpr; j++)
{
t->sub.multilist[j].start = m->multilist[j].start;
t->sub.multilist[j].end = m->multilist[j].end;
}
else
! for (j = 1; j < nfa_nsubexpr; j++)
{
t->sub.linelist[j].start = m->linelist[j].start;
t->sub.linelist[j].end = m->linelist[j].end;
}
/* t->state->out1 is the corresponding END_INVISIBLE node */
addstate_here(thislist, t->state->out1->out, &t->sub,
listid, &listidx);
--- 3257,3275 ----
reglnum = old_reglnum;
/* Copy submatch info from the recursive call */
if (REG_MULTI)
! for (j = 1; j < m->in_use; j++)
{
t->sub.multilist[j].start = m->multilist[j].start;
t->sub.multilist[j].end = m->multilist[j].end;
}
else
! for (j = 1; j < m->in_use; j++)
{
t->sub.linelist[j].start = m->linelist[j].start;
t->sub.linelist[j].end = m->linelist[j].end;
}
+ t->sub.in_use = m->in_use;
+
/* t->state->out1 is the corresponding END_INVISIBLE node */
addstate_here(thislist, t->state->out1->out, &t->sub,
listid, &listidx);
***************
*** 3703,3708 ****
--- 3768,3775 ----
vim_memset(sub.linelist, 0, sizeof(struct linepos) * nfa_nsubexpr);
vim_memset(m.linelist, 0, sizeof(struct linepos) * nfa_nsubexpr);
}
+ sub.in_use = 0;
+ m.in_use = 0;
if (nfa_regmatch(start, &sub, &m) == FALSE)
return 0;
***************
*** 3710,3716 ****
cleanup_subexpr();
if (REG_MULTI)
{
! for (i = 0; i < nfa_nsubexpr; i++)
{
reg_startpos[i] = sub.multilist[i].start;
reg_endpos[i] = sub.multilist[i].end;
--- 3777,3783 ----
cleanup_subexpr();
if (REG_MULTI)
{
! for (i = 0; i < sub.in_use; i++)
{
reg_startpos[i] = sub.multilist[i].start;
reg_endpos[i] = sub.multilist[i].end;
***************
*** 3732,3738 ****
}
else
{
! for (i = 0; i < nfa_nsubexpr; i++)
{
reg_startp[i] = sub.linelist[i].start;
reg_endp[i] = sub.linelist[i].end;
--- 3799,3805 ----
}
else
{
! for (i = 0; i < sub.in_use; i++)
{
reg_startp[i] = sub.linelist[i].start;
reg_endp[i] = sub.linelist[i].end;
*** ../vim-7.3.1028/src/version.c 2013-05-26 21:47:22.000000000 +0200
--- src/version.c 2013-05-26 22:53:55.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1029,
/**/
--
I used to be indecisive, now I'm not sure.
/// 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 ///

77
7.3.1030 Normal file
View File

@ -0,0 +1,77 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1030
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1030 (after 7.3.1028)
Problem: Can't build for debugging.
Solution: Fix struct member names.
Files: src/regexp_nfa.c
*** ../vim-7.3.1029/src/regexp_nfa.c 2013-05-26 22:56:16.000000000 +0200
--- src/regexp_nfa.c 2013-05-26 23:12:12.000000000 +0200
***************
*** 3164,3182 ****
submatch->linelist[j].end = t->sub.linelist[j].end;
}
#ifdef ENABLE_LOG
! for (j = 0; j < 4; j++)
if (REG_MULTI)
fprintf(log_fd, "\n *** group %d, start: c=%d, l=%d, end: c=%d, l=%d",
j,
! t->sub.startpos[j].col,
! (int)t->sub.startpos[j].lnum,
! t->sub.endpos[j].col,
! (int)t->sub.endpos[j].lnum);
else
fprintf(log_fd, "\n *** group %d, start: \"%s\", end: \"%s\"",
j,
! (char *)t->sub.start[j],
! (char *)t->sub.end[j]);
fprintf(log_fd, "\n");
#endif
/* Found the left-most longest match, do not look at any other
--- 3164,3182 ----
submatch->linelist[j].end = t->sub.linelist[j].end;
}
#ifdef ENABLE_LOG
! for (j = 0; j < t->sub.in_use; j++)
if (REG_MULTI)
fprintf(log_fd, "\n *** group %d, start: c=%d, l=%d, end: c=%d, l=%d",
j,
! t->sub.multilist[j].start.col,
! (int)t->sub.multilist[j].start.lnum,
! t->sub.multilist[j].end.col,
! (int)t->sub.multilist[j].end.lnum);
else
fprintf(log_fd, "\n *** group %d, start: \"%s\", end: \"%s\"",
j,
! (char *)t->sub.linelist[j].start,
! (char *)t->sub.linelist[j].end);
fprintf(log_fd, "\n");
#endif
/* Found the left-most longest match, do not look at any other
*** ../vim-7.3.1029/src/version.c 2013-05-26 22:56:16.000000000 +0200
--- src/version.c 2013-05-26 23:11:27.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1030,
/**/
--
I think that you'll agree that engineers are very effective in their social
interactions. It's the "normal" people who are nuts.
(Scott Adams - The Dilbert principle)
/// 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 ///

80
7.3.1031 Normal file
View File

@ -0,0 +1,80 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1031
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1031
Problem: Compiler warnings for shadowed variable. (John Little)
Solution: Move the variable declarations to the scope where they are used.
Files: src/regexp_nfa.c
*** ../vim-7.3.1030/src/regexp_nfa.c 2013-05-26 23:13:03.000000000 +0200
--- src/regexp_nfa.c 2013-05-27 11:15:35.000000000 +0200
***************
*** 2999,3005 ****
nfa_list_T *nextlist;
nfa_list_T *neglist;
int *listids = NULL;
- int j = 0;
#ifdef NFA_REGEXP_DEBUG_LOG
FILE *debug = fopen(NFA_REGEXP_DEBUG_LOG, "a");
--- 2999,3004 ----
***************
*** 3149,3154 ****
--- 3148,3156 ----
switch (t->state->c)
{
case NFA_MATCH:
+ {
+ int j;
+
nfa_match = TRUE;
submatch->in_use = t->sub.in_use;
if (REG_MULTI)
***************
*** 3186,3191 ****
--- 3188,3194 ----
if (nextlist->n == 0 && neglist->n == 0)
clen = 0;
goto nextchar;
+ }
case NFA_END_INVISIBLE:
/* This is only encountered after a NFA_START_INVISIBLE node.
***************
*** 3251,3256 ****
--- 3254,3261 ----
#endif
if (result == TRUE)
{
+ int j;
+
/* Restore position in input text */
reginput = old_reginput;
regline = old_regline;
*** ../vim-7.3.1030/src/version.c 2013-05-26 23:13:03.000000000 +0200
--- src/version.c 2013-05-27 11:21:28.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1031,
/**/
--
It's totally unfair to suggest - as many have - that engineers are socially
inept. Engineers simply have different objectives when it comes to social
interaction.
(Scott Adams - The Dilbert principle)
/// 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 ///

339
7.3.1032 Normal file
View File

@ -0,0 +1,339 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1032
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1032
Problem: "\ze" is not supported by the new regexp engine.
Solution: Make "\ze" work.
Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok
*** ../vim-7.3.1031/src/regexp_nfa.c 2013-05-27 11:21:59.000000000 +0200
--- src/regexp_nfa.c 2013-05-27 20:06:16.000000000 +0200
***************
*** 159,165 ****
static int syntax_error = FALSE;
/* NFA regexp \ze operator encountered. */
! static int nfa_has_zend = FALSE;
/* Number of sub expressions actually being used during execution. 1 if only
* the whole match (subexpr 0) is used. */
--- 159,165 ----
static int syntax_error = FALSE;
/* NFA regexp \ze operator encountered. */
! static int nfa_has_zend;
/* Number of sub expressions actually being used during execution. 1 if only
* the whole match (subexpr 0) is used. */
***************
*** 791,799 ****
case 'e':
EMIT(NFA_ZEND);
nfa_has_zend = TRUE;
! /* TODO: Currently \ze does not work properly. */
! return FAIL;
! /* break; */
case '1':
case '2':
case '3':
--- 791,797 ----
case 'e':
EMIT(NFA_ZEND);
nfa_has_zend = TRUE;
! break;
case '1':
case '2':
case '3':
***************
*** 2711,2716 ****
--- 2709,2716 ----
case NFA_MCLOSE + 0:
if (nfa_has_zend)
{
+ /* Do not overwrite the position set by \ze. If no \ze
+ * encountered end will be set in nfa_regtry(). */
addstate(l, state->out, m, off, lid);
break;
}
***************
*** 3635,3640 ****
--- 3635,3641 ----
case NFA_SKIP_CHAR:
case NFA_ZSTART:
+ case NFA_ZEND:
/* TODO: should not happen? */
break;
***************
*** 3795,3800 ****
--- 3796,3802 ----
}
if (reg_endpos[0].lnum < 0)
{
+ /* pattern has a \ze but it didn't match, use current end */
reg_endpos[0].lnum = reglnum;
reg_endpos[0].col = (int)(reginput - regline);
}
*** ../vim-7.3.1031/src/testdir/test64.in 2013-05-26 18:40:11.000000000 +0200
--- src/testdir/test64.in 2013-05-27 20:02:44.000000000 +0200
***************
*** 151,158 ****
:" Search multi-modifiers
:call add(tl, [2, 'x*', 'xcd', 'x'])
:call add(tl, [2, 'x*', 'xxxxxxxxxxxxxxxxsofijiojgf', 'xxxxxxxxxxxxxxxx'])
! :call add(tl, [2, 'x*', 'abcdoij', '']) " empty match is good
! :call add(tl, [2, 'x\+', 'abcdoin']) " no match here
:call add(tl, [2, 'x\+', 'abcdeoijdfxxiuhfij', 'xx'])
:call add(tl, [2, 'x\+', 'xxxxx', 'xxxxx'])
:call add(tl, [2, 'x\+', 'abc x siufhiush xxxxxxxxx', 'x'])
--- 151,160 ----
:" Search multi-modifiers
:call add(tl, [2, 'x*', 'xcd', 'x'])
:call add(tl, [2, 'x*', 'xxxxxxxxxxxxxxxxsofijiojgf', 'xxxxxxxxxxxxxxxx'])
! :" empty match is good
! :call add(tl, [2, 'x*', 'abcdoij', ''])
! :" no match here
! :call add(tl, [2, 'x\+', 'abcdoin'])
:call add(tl, [2, 'x\+', 'abcdeoijdfxxiuhfij', 'xx'])
:call add(tl, [2, 'x\+', 'xxxxx', 'xxxxx'])
:call add(tl, [2, 'x\+', 'abc x siufhiush xxxxxxxxx', 'x'])
***************
*** 160,171 ****
:call add(tl, [2, 'x\=', 'abc sfoij', '']) " empty match is good
:call add(tl, [2, 'x\=', 'xxxxxxxxx c', 'x'])
:call add(tl, [2, 'x\?', 'x sdfoij', 'x'])
! :call add(tl, [2, 'x\?', 'abc sfoij', '']) " empty match is good
:call add(tl, [2, 'x\?', 'xxxxxxxxxx c', 'x'])
:"
:call add(tl, [2, 'a\{0,0}', 'abcdfdoij', ''])
! :call add(tl, [2, 'a\{0,1}', 'asiubid axxxaaa', 'a']) " same thing as 'a?'
! :call add(tl, [2, 'a\{1,0}', 'asiubid axxxaaa', 'a']) " same thing as 'a\{0,1}'
:call add(tl, [2, 'a\{3,6}', 'aa siofuh'])
:call add(tl, [2, 'a\{3,6}', 'aaaaa asfoij afaa', 'aaaaa'])
:call add(tl, [2, 'a\{3,6}', 'aaaaaaaa', 'aaaaaa'])
--- 162,176 ----
:call add(tl, [2, 'x\=', 'abc sfoij', '']) " empty match is good
:call add(tl, [2, 'x\=', 'xxxxxxxxx c', 'x'])
:call add(tl, [2, 'x\?', 'x sdfoij', 'x'])
! :" empty match is good
! :call add(tl, [2, 'x\?', 'abc sfoij', ''])
:call add(tl, [2, 'x\?', 'xxxxxxxxxx c', 'x'])
:"
:call add(tl, [2, 'a\{0,0}', 'abcdfdoij', ''])
! :" same thing as 'a?'
! :call add(tl, [2, 'a\{0,1}', 'asiubid axxxaaa', 'a'])
! :" same thing as 'a\{0,1}'
! :call add(tl, [2, 'a\{1,0}', 'asiubid axxxaaa', 'a'])
:call add(tl, [2, 'a\{3,6}', 'aa siofuh'])
:call add(tl, [2, 'a\{3,6}', 'aaaaa asfoij afaa', 'aaaaa'])
:call add(tl, [2, 'a\{3,6}', 'aaaaaaaa', 'aaaaaa'])
***************
*** 173,190 ****
:call add(tl, [2, 'a\{2}', 'aaaa', 'aa'])
:call add(tl, [2, 'a\{2}', 'iuash fiusahfliusah fiushfilushfi uhsaifuh askfj nasfvius afg aaaa sfiuhuhiushf', 'aa'])
:call add(tl, [2, 'a\{2}', 'abcdefghijklmnopqrestuvwxyz1234567890'])
! :call add(tl, [2, 'a\{0,}', 'oij sdigfusnf', '']) " same thing as 'a*'
:call add(tl, [2, 'a\{0,}', 'aaaaa aa', 'aaaaa'])
:call add(tl, [2, 'a\{2,}', 'sdfiougjdsafg'])
:call add(tl, [0, 'a\{2,}', 'aaaaasfoij ', 'aaaaa'])
:call add(tl, [2, 'a\{,0}', 'oidfguih iuhi hiu aaaa', ''])
:call add(tl, [2, 'a\{,5}', 'abcd', 'a'])
:call add(tl, [2, 'a\{,5}', 'aaaaaaaaaa', 'aaaaa'])
! :call add(tl, [2, 'a\{}', 'bbbcddiuhfcd', '']) " same thing as 'a*'
:call add(tl, [2, 'a\{}', 'aaaaioudfh coisf jda', 'aaaa'])
:"
:call add(tl, [2, 'a\{-0,0}', 'abcdfdoij', ''])
! :call add(tl, [2, 'a\{-0,1}', 'asiubid axxxaaa', '']) " anti-greedy version of 'a?'
:call add(tl, [2, 'a\{-3,6}', 'aa siofuh'])
:call add(tl, [2, 'a\{-3,6}', 'aaaaa asfoij afaa', 'aaa'])
:call add(tl, [2, 'a\{-3,6}', 'aaaaaaaa', 'aaa'])
--- 178,198 ----
:call add(tl, [2, 'a\{2}', 'aaaa', 'aa'])
:call add(tl, [2, 'a\{2}', 'iuash fiusahfliusah fiushfilushfi uhsaifuh askfj nasfvius afg aaaa sfiuhuhiushf', 'aa'])
:call add(tl, [2, 'a\{2}', 'abcdefghijklmnopqrestuvwxyz1234567890'])
! :" same thing as 'a*'
! :call add(tl, [2, 'a\{0,}', 'oij sdigfusnf', ''])
:call add(tl, [2, 'a\{0,}', 'aaaaa aa', 'aaaaa'])
:call add(tl, [2, 'a\{2,}', 'sdfiougjdsafg'])
:call add(tl, [0, 'a\{2,}', 'aaaaasfoij ', 'aaaaa'])
:call add(tl, [2, 'a\{,0}', 'oidfguih iuhi hiu aaaa', ''])
:call add(tl, [2, 'a\{,5}', 'abcd', 'a'])
:call add(tl, [2, 'a\{,5}', 'aaaaaaaaaa', 'aaaaa'])
! :" same thing as 'a*'
! :call add(tl, [2, 'a\{}', 'bbbcddiuhfcd', ''])
:call add(tl, [2, 'a\{}', 'aaaaioudfh coisf jda', 'aaaa'])
:"
:call add(tl, [2, 'a\{-0,0}', 'abcdfdoij', ''])
! :" anti-greedy version of 'a?'
! :call add(tl, [2, 'a\{-0,1}', 'asiubid axxxaaa', ''])
:call add(tl, [2, 'a\{-3,6}', 'aa siofuh'])
:call add(tl, [2, 'a\{-3,6}', 'aaaaa asfoij afaa', 'aaa'])
:call add(tl, [2, 'a\{-3,6}', 'aaaaaaaa', 'aaa'])
***************
*** 198,204 ****
:call add(tl, [2, 'a\{-,0}', 'oidfguih iuhi hiu aaaa', ''])
:call add(tl, [2, 'a\{-,5}', 'abcd', ''])
:call add(tl, [2, 'a\{-,5}', 'aaaaaaaaaa', ''])
! :call add(tl, [0, 'a\{-}', 'bbbcddiuhfcd', '']) " anti-greedy version of 'a*'
:call add(tl, [0, 'a\{-}', 'aaaaioudfh coisf jda', ''])
:"
:" Test groups of characters and submatches
--- 206,213 ----
:call add(tl, [2, 'a\{-,0}', 'oidfguih iuhi hiu aaaa', ''])
:call add(tl, [2, 'a\{-,5}', 'abcd', ''])
:call add(tl, [2, 'a\{-,5}', 'aaaaaaaaaa', ''])
! :" anti-greedy version of 'a*'
! :call add(tl, [0, 'a\{-}', 'bbbcddiuhfcd', ''])
:call add(tl, [0, 'a\{-}', 'aaaaioudfh coisf jda', ''])
:"
:" Test groups of characters and submatches
***************
*** 243,252 ****
:call add(tl, [2, '[^[:alpha:]]\+','abcccadfoij7787ysf287yrnccdu','7787'])
:call add(tl, [2, '[-a]', '-', '-'])
:call add(tl, [2, '[a-]', '-', '-'])
! :call add(tl, [2, '[-./[:alnum:]_~]\+', 'log13.file', 'log13.file']) " filename regexp
! :call add(tl, [2, '[\]\^\-\\]\+', '\^\\\-\---^', '\^\\\-\---^']) " special chars
! :call add(tl, [2, '[[.a.]]\+', 'aa', 'aa']) " collation elem
! :call add(tl, [2, 'abc[0-9]*ddd', 'siuhabc ii']) " middle of regexp
:call add(tl, [2, 'abc[0-9]*ddd', 'adf abc44482ddd oijs', 'abc44482ddd'])
:call add(tl, [2, '\_[0-9]\+', 'asfi9888u', '9888'])
:call add(tl, [2, '[0-9\n]\+', 'asfi9888u', '9888'])
--- 252,265 ----
:call add(tl, [2, '[^[:alpha:]]\+','abcccadfoij7787ysf287yrnccdu','7787'])
:call add(tl, [2, '[-a]', '-', '-'])
:call add(tl, [2, '[a-]', '-', '-'])
! :" filename regexp
! :call add(tl, [2, '[-./[:alnum:]_~]\+', 'log13.file', 'log13.file'])
! :" special chars
! :call add(tl, [2, '[\]\^\-\\]\+', '\^\\\-\---^', '\^\\\-\---^'])
! :" collation elem
! :call add(tl, [2, '[[.a.]]\+', 'aa', 'aa'])
! :" middle of regexp
! :call add(tl, [2, 'abc[0-9]*ddd', 'siuhabc ii'])
:call add(tl, [2, 'abc[0-9]*ddd', 'adf abc44482ddd oijs', 'abc44482ddd'])
:call add(tl, [2, '\_[0-9]\+', 'asfi9888u', '9888'])
:call add(tl, [2, '[0-9\n]\+', 'asfi9888u', '9888'])
***************
*** 267,277 ****
:call add(tl, [2, '\C[^A-Z]\+', 'ABCOIJDEOIFNSD jsfoij sa', ' jsfoij sa'])
:"
:"""" Tests for \z features
! :call add(tl, [2, 'xx \ze test', 'xx ']) " must match after \ze
! :call add(tl, [0, 'abc\zeend', 'oij abcend', 'abc'])
:call add(tl, [2, 'abc\zsdd', 'ddabcddxyzt', 'dd'])
! :call add(tl, [2, 'aa \zsax', ' ax']) " must match before \zs
! :call add(tl, [0, 'abc \zsmatch\ze abc', 'abc abc abc match abc abc', 'match'])
:call add(tl, [2, '\v(a \zsif .*){2}', 'a if then a if last', 'if last', 'a if last'])
:call add(tl, [2, '\>\zs.', 'aword. ', '.'])
:"
--- 280,296 ----
:call add(tl, [2, '\C[^A-Z]\+', 'ABCOIJDEOIFNSD jsfoij sa', ' jsfoij sa'])
:"
:"""" Tests for \z features
! :" match ends at \ze
! :call add(tl, [2, 'xx \ze test', 'xx '])
! :call add(tl, [2, 'abc\zeend', 'oij abcend', 'abc'])
! :call add(tl, [2, 'aa\zebb\|aaxx', ' aabb ', 'aa'])
! :call add(tl, [2, 'aa\zebb\|aaxx', ' aaxx ', 'aaxx'])
! :call add(tl, [2, 'aabb\|aa\zebb', ' aabb ', 'aabb'])
! :call add(tl, [2, 'aa\zebb\|aaebb', ' aabb ', 'aa'])
! :" match starts at \zs
:call add(tl, [2, 'abc\zsdd', 'ddabcddxyzt', 'dd'])
! :call add(tl, [2, 'aa \zsax', ' ax'])
! :call add(tl, [2, 'abc \zsmatch\ze abc', 'abc abc abc match abc abc', 'match'])
:call add(tl, [2, '\v(a \zsif .*){2}', 'a if then a if last', 'if last', 'a if last'])
:call add(tl, [2, '\>\zs.', 'aword. ', '.'])
:"
***************
*** 279,290 ****
:call add(tl, [0, 'abc\@=', 'abc', 'ab'])
:call add(tl, [0, 'abc\@=cd', 'abcd', 'abcd'])
:call add(tl, [0, 'abc\@=', 'ababc', 'ab'])
! :call add(tl, [2, 'abcd\@=e', 'abcd']) " will never match, no matter the input text
! :call add(tl, [2, 'abcd\@=e', 'any text in here ... ']) " will never match
:call add(tl, [0, '\v(abc)@=..', 'xabcd', 'ab', 'abc'])
! :call add(tl, [2, '\(.*John\)\@=.*Bob', 'here is John, and here is B']) " no match
:call add(tl, [0, '\(John.*\)\@=.*Bob', 'John is Bobs friend', 'John is Bob', 'John is Bobs friend'])
! :call add(tl, [2, '.*John\&.*Bob', 'here is John, and here is B']) " no match
:call add(tl, [0, '.*John\&.*Bob', 'John is Bobs friend', 'John is Bob'])
:call add(tl, [0, '\v(test1)@=.*yep', 'this is a test1, yep it is', 'test1, yep', 'test1'])
:"
--- 298,313 ----
:call add(tl, [0, 'abc\@=', 'abc', 'ab'])
:call add(tl, [0, 'abc\@=cd', 'abcd', 'abcd'])
:call add(tl, [0, 'abc\@=', 'ababc', 'ab'])
! :" will never match, no matter the input text
! :call add(tl, [2, 'abcd\@=e', 'abcd'])
! :" will never match
! :call add(tl, [2, 'abcd\@=e', 'any text in here ... '])
:call add(tl, [0, '\v(abc)@=..', 'xabcd', 'ab', 'abc'])
! :" no match
! :call add(tl, [2, '\(.*John\)\@=.*Bob', 'here is John, and here is B'])
:call add(tl, [0, '\(John.*\)\@=.*Bob', 'John is Bobs friend', 'John is Bob', 'John is Bobs friend'])
! :" no match
! :call add(tl, [2, '.*John\&.*Bob', 'here is John, and here is B'])
:call add(tl, [0, '.*John\&.*Bob', 'John is Bobs friend', 'John is Bob'])
:call add(tl, [0, '\v(test1)@=.*yep', 'this is a test1, yep it is', 'test1, yep', 'test1'])
:"
*** ../vim-7.3.1031/src/testdir/test64.ok 2013-05-26 18:40:11.000000000 +0200
--- src/testdir/test64.ok 2013-05-27 20:04:55.000000000 +0200
***************
*** 617,622 ****
--- 617,635 ----
OK 2 - xx \ze test
OK 0 - abc\zeend
OK 1 - abc\zeend
+ OK 2 - abc\zeend
+ OK 0 - aa\zebb\|aaxx
+ OK 1 - aa\zebb\|aaxx
+ OK 2 - aa\zebb\|aaxx
+ OK 0 - aa\zebb\|aaxx
+ OK 1 - aa\zebb\|aaxx
+ OK 2 - aa\zebb\|aaxx
+ OK 0 - aabb\|aa\zebb
+ OK 1 - aabb\|aa\zebb
+ OK 2 - aabb\|aa\zebb
+ OK 0 - aa\zebb\|aaebb
+ OK 1 - aa\zebb\|aaebb
+ OK 2 - aa\zebb\|aaebb
OK 0 - abc\zsdd
OK 1 - abc\zsdd
OK 2 - abc\zsdd
***************
*** 625,630 ****
--- 638,644 ----
OK 2 - aa \zsax
OK 0 - abc \zsmatch\ze abc
OK 1 - abc \zsmatch\ze abc
+ OK 2 - abc \zsmatch\ze abc
OK 0 - \v(a \zsif .*){2}
OK 1 - \v(a \zsif .*){2}
OK 2 - \v(a \zsif .*){2}
*** ../vim-7.3.1031/src/version.c 2013-05-27 11:21:59.000000000 +0200
--- src/version.c 2013-05-27 20:04:19.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1032,
/**/
--
An operatingsystem is just a name you give to the rest of bloating
idiosyncratic machine-based-features you left out of your editor.
(author unknown)
/// 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 ///

1346
7.3.1033 Normal file

File diff suppressed because it is too large Load Diff

254
7.3.1034 Normal file
View File

@ -0,0 +1,254 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1034
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1034
Problem: New regexp code using strange multi-byte code.
Solution: Use the normal code to advance and backup pointers.
Files: src/regexp_nfa.c
*** ../vim-7.3.1033/src/regexp_nfa.c 2013-05-28 22:03:13.000000000 +0200
--- src/regexp_nfa.c 2013-05-28 22:25:28.000000000 +0200
***************
*** 188,195 ****
static int nfa_regcomp_start __ARGS((char_u*expr, int re_flags));
static int nfa_recognize_char_class __ARGS((char_u *start, char_u *end, int extra_newl));
static int nfa_emit_equi_class __ARGS((int c, int neg));
- static void nfa_inc __ARGS((char_u **p));
- static void nfa_dec __ARGS((char_u **p));
static int nfa_regatom __ARGS((void));
static int nfa_regpiece __ARGS((void));
static int nfa_regconcat __ARGS((void));
--- 188,193 ----
***************
*** 554,601 ****
*/
/*
- * Increments the pointer "p" by one (multi-byte) character.
- */
- static void
- nfa_inc(p)
- char_u **p;
- {
- #ifdef FEAT_MBYTE
- if (has_mbyte)
- mb_ptr2char_adv(p);
- else
- #endif
- *p = *p + 1;
- }
-
- /*
- * Decrements the pointer "p" by one (multi-byte) character.
- */
- static void
- nfa_dec(p)
- char_u **p;
- {
- #ifdef FEAT_MBYTE
- char_u *p2, *oldp;
-
- if (has_mbyte)
- {
- oldp = *p;
- /* Try to find the multibyte char that advances to the current
- * position. */
- do
- {
- *p = *p - 1;
- p2 = *p;
- mb_ptr2char_adv(&p2);
- } while (p2 != oldp);
- }
- #else
- *p = *p - 1;
- #endif
- }
-
- /*
* Parse the lowest level.
*
* An atom can be one of a long list of items. Many atoms match one character
--- 552,557 ----
***************
*** 963,969 ****
EMIT(NFA_OR);
}
regparse = endp;
! nfa_inc(&regparse);
return OK;
}
/*
--- 919,925 ----
EMIT(NFA_OR);
}
regparse = endp;
! mb_ptr_adv(regparse);
return OK;
}
/*
***************
*** 978,984 ****
{
negated = TRUE;
glue = NFA_CONCAT;
! nfa_inc(&regparse);
}
if (*regparse == '-')
{
--- 934,940 ----
{
negated = TRUE;
glue = NFA_CONCAT;
! mb_ptr_adv(regparse);
}
if (*regparse == '-')
{
***************
*** 986,992 ****
EMIT(startc);
TRY_NEG();
EMIT_GLUE();
! nfa_inc(&regparse);
}
/* Emit the OR branches for each character in the [] */
emit_range = FALSE;
--- 942,948 ----
EMIT(startc);
TRY_NEG();
EMIT_GLUE();
! mb_ptr_adv(regparse);
}
/* Emit the OR branches for each character in the [] */
emit_range = FALSE;
***************
*** 1090,1096 ****
{
emit_range = TRUE;
startc = oldstartc;
! nfa_inc(&regparse);
continue; /* reading the end of the range */
}
--- 1046,1052 ----
{
emit_range = TRUE;
startc = oldstartc;
! mb_ptr_adv(regparse);
continue; /* reading the end of the range */
}
***************
*** 1110,1116 ****
)
)
{
! nfa_inc(&regparse);
if (*regparse == 'n')
startc = reg_string ? NL : NFA_NEWL;
--- 1066,1072 ----
)
)
{
! mb_ptr_adv(regparse);
if (*regparse == 'n')
startc = reg_string ? NL : NFA_NEWL;
***************
*** 1125,1131 ****
/* TODO(RE) This needs more testing */
startc = coll_get_char();
got_coll_char = TRUE;
! nfa_dec(&regparse);
}
else
{
--- 1081,1087 ----
/* TODO(RE) This needs more testing */
startc = coll_get_char();
got_coll_char = TRUE;
! mb_ptr_back(old_regparse, regparse);
}
else
{
***************
*** 1210,1226 ****
EMIT_GLUE();
}
! nfa_inc(&regparse);
} /* while (p < endp) */
! nfa_dec(&regparse);
if (*regparse == '-') /* if last, '-' is just a char */
{
EMIT('-');
TRY_NEG();
EMIT_GLUE();
}
! nfa_inc(&regparse);
if (extra == ADD_NL) /* \_[] also matches \n */
{
--- 1166,1182 ----
EMIT_GLUE();
}
! mb_ptr_adv(regparse);
} /* while (p < endp) */
! mb_ptr_back(old_regparse, regparse);
if (*regparse == '-') /* if last, '-' is just a char */
{
EMIT('-');
TRY_NEG();
EMIT_GLUE();
}
! mb_ptr_adv(regparse);
if (extra == ADD_NL) /* \_[] also matches \n */
{
***************
*** 1231,1237 ****
/* skip the trailing ] */
regparse = endp;
! nfa_inc(&regparse);
if (negated == TRUE)
{
/* Mark end of negated char range */
--- 1187,1193 ----
/* skip the trailing ] */
regparse = endp;
! mb_ptr_adv(regparse);
if (negated == TRUE)
{
/* Mark end of negated char range */
*** ../vim-7.3.1033/src/version.c 2013-05-28 22:03:13.000000000 +0200
--- src/version.c 2013-05-28 22:29:18.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1034,
/**/
--
hundred-and-one symptoms of being an internet addict:
7. You finally do take that vacation, but only after buying a cellular modem
and a laptop.
/// 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 ///

53
7.3.1035 Normal file
View File

@ -0,0 +1,53 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1035
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1035
Problem: Compiler warning on 64 bit windows.
Solution: Add type cast. (Mike Williams)
Files: src/if_py_both.h
*** ../vim-7.3.1034/src/if_py_both.h 2013-05-24 18:58:39.000000000 +0200
--- src/if_py_both.h 2013-05-28 19:19:50.000000000 +0200
***************
*** 3547,3553 ****
int status;
PyObject *pyfunc, *pymain;
! if (u_save(RangeStart - 1, RangeEnd + 1) != OK)
{
EMSG(_("cannot save undo information"));
return;
--- 3547,3553 ----
int status;
PyObject *pyfunc, *pymain;
! if (u_save((linenr_T)RangeStart - 1, (linenr_T)RangeEnd + 1) != OK)
{
EMSG(_("cannot save undo information"));
return;
*** ../vim-7.3.1034/src/version.c 2013-05-28 22:30:22.000000000 +0200
--- src/version.c 2013-05-28 22:31:18.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1035,
/**/
--
hundred-and-one symptoms of being an internet addict:
8. You spend half of the plane trip with your laptop on your lap...and your
child in the overhead compartment.
/// 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 ///

515
7.3.1036 Normal file
View File

@ -0,0 +1,515 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1036
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1036
Problem: Can't build on HP-UX.
Solution: Give the union a name. (John Marriott)
Files: src/regexp_nfa.c
*** ../vim-7.3.1035/src/regexp_nfa.c 2013-05-28 22:30:22.000000000 +0200
--- src/regexp_nfa.c 2013-05-28 22:35:55.000000000 +0200
***************
*** 2493,2512 ****
{
int in_use; /* number of subexpr with useful info */
! /* When REG_MULTI is TRUE multilist is used, otherwise linelist. */
union
{
struct multipos
{
lpos_T start;
lpos_T end;
! } multilist[NSUBEXP];
struct linepos
{
char_u *start;
char_u *end;
! } linelist[NSUBEXP];
! };
} regsub_T;
/* nfa_thread_T contains execution information of a NFA state */
--- 2493,2512 ----
{
int in_use; /* number of subexpr with useful info */
! /* When REG_MULTI is TRUE list.multi is used, otherwise list.line. */
union
{
struct multipos
{
lpos_T start;
lpos_T end;
! } multi[NSUBEXP];
struct linepos
{
char_u *start;
char_u *end;
! } line[NSUBEXP];
! } list;
} regsub_T;
/* nfa_thread_T contains execution information of a NFA state */
***************
*** 2536,2550 ****
if (REG_MULTI)
fprintf(log_fd, "\n *** group %d, start: c=%d, l=%d, end: c=%d, l=%d",
j,
! sub->multilist[j].start.col,
! (int)sub->multilist[j].start.lnum,
! sub->multilist[j].end.col,
! (int)sub->multilist[j].end.lnum);
else
fprintf(log_fd, "\n *** group %d, start: \"%s\", end: \"%s\"",
j,
! (char *)sub->linelist[j].start,
! (char *)sub->linelist[j].end);
fprintf(log_fd, "\n");
}
#endif
--- 2536,2550 ----
if (REG_MULTI)
fprintf(log_fd, "\n *** group %d, start: c=%d, l=%d, end: c=%d, l=%d",
j,
! sub->list.multi[j].start.col,
! (int)sub->list.multi[j].start.lnum,
! sub->list.multi[j].end.col,
! (int)sub->list.multi[j].end.lnum);
else
fprintf(log_fd, "\n *** group %d, start: \"%s\", end: \"%s\"",
j,
! (char *)sub->list.line[j].start,
! (char *)sub->list.line[j].end);
fprintf(log_fd, "\n");
}
#endif
***************
*** 2626,2637 ****
{
/* Copy the match start and end positions. */
if (REG_MULTI)
! mch_memmove(&lastthread->sub.multilist[0],
! &sub->multilist[0],
sizeof(struct multipos) * sub->in_use);
else
! mch_memmove(&lastthread->sub.linelist[0],
! &sub->linelist[0],
sizeof(struct linepos) * sub->in_use);
}
}
--- 2626,2637 ----
{
/* Copy the match start and end positions. */
if (REG_MULTI)
! mch_memmove(&lastthread->sub.list.multi[0],
! &sub->list.multi[0],
sizeof(struct multipos) * sub->in_use);
else
! mch_memmove(&lastthread->sub.list.line[0],
! &sub->list.line[0],
sizeof(struct linepos) * sub->in_use);
}
}
***************
*** 2705,2711 ****
{
if (subidx < sub->in_use)
{
! save_lpos = sub->multilist[subidx].start;
save_in_use = -1;
}
else
--- 2705,2711 ----
{
if (subidx < sub->in_use)
{
! save_lpos = sub->list.multi[subidx].start;
save_in_use = -1;
}
else
***************
*** 2713,2732 ****
save_in_use = sub->in_use;
for (i = sub->in_use; i < subidx; ++i)
{
! sub->multilist[i].start.lnum = -1;
! sub->multilist[i].end.lnum = -1;
}
sub->in_use = subidx + 1;
}
if (off == -1)
{
! sub->multilist[subidx].start.lnum = reglnum + 1;
! sub->multilist[subidx].start.col = 0;
}
else
{
! sub->multilist[subidx].start.lnum = reglnum;
! sub->multilist[subidx].start.col =
(colnr_T)(reginput - regline + off);
}
}
--- 2713,2732 ----
save_in_use = sub->in_use;
for (i = sub->in_use; i < subidx; ++i)
{
! sub->list.multi[i].start.lnum = -1;
! sub->list.multi[i].end.lnum = -1;
}
sub->in_use = subidx + 1;
}
if (off == -1)
{
! sub->list.multi[subidx].start.lnum = reglnum + 1;
! sub->list.multi[subidx].start.col = 0;
}
else
{
! sub->list.multi[subidx].start.lnum = reglnum;
! sub->list.multi[subidx].start.col =
(colnr_T)(reginput - regline + off);
}
}
***************
*** 2734,2740 ****
{
if (subidx < sub->in_use)
{
! save_ptr = sub->linelist[subidx].start;
save_in_use = -1;
}
else
--- 2734,2740 ----
{
if (subidx < sub->in_use)
{
! save_ptr = sub->list.line[subidx].start;
save_in_use = -1;
}
else
***************
*** 2742,2753 ****
save_in_use = sub->in_use;
for (i = sub->in_use; i < subidx; ++i)
{
! sub->linelist[i].start = NULL;
! sub->linelist[i].end = NULL;
}
sub->in_use = subidx + 1;
}
! sub->linelist[subidx].start = reginput + off;
}
addstate(l, state->out, sub, off);
--- 2742,2753 ----
save_in_use = sub->in_use;
for (i = sub->in_use; i < subidx; ++i)
{
! sub->list.line[i].start = NULL;
! sub->list.line[i].end = NULL;
}
sub->in_use = subidx + 1;
}
! sub->list.line[subidx].start = reginput + off;
}
addstate(l, state->out, sub, off);
***************
*** 2755,2763 ****
if (save_in_use == -1)
{
if (REG_MULTI)
! sub->multilist[subidx].start = save_lpos;
else
! sub->linelist[subidx].start = save_ptr;
}
else
sub->in_use = save_in_use;
--- 2755,2763 ----
if (save_in_use == -1)
{
if (REG_MULTI)
! sub->list.multi[subidx].start = save_lpos;
else
! sub->list.line[subidx].start = save_ptr;
}
else
sub->in_use = save_in_use;
***************
*** 2793,2823 ****
sub->in_use = subidx + 1;
if (REG_MULTI)
{
! save_lpos = sub->multilist[subidx].end;
if (off == -1)
{
! sub->multilist[subidx].end.lnum = reglnum + 1;
! sub->multilist[subidx].end.col = 0;
}
else
{
! sub->multilist[subidx].end.lnum = reglnum;
! sub->multilist[subidx].end.col =
(colnr_T)(reginput - regline + off);
}
}
else
{
! save_ptr = sub->linelist[subidx].end;
! sub->linelist[subidx].end = reginput + off;
}
addstate(l, state->out, sub, off);
if (REG_MULTI)
! sub->multilist[subidx].end = save_lpos;
else
! sub->linelist[subidx].end = save_ptr;
sub->in_use = save_in_use;
break;
}
--- 2793,2823 ----
sub->in_use = subidx + 1;
if (REG_MULTI)
{
! save_lpos = sub->list.multi[subidx].end;
if (off == -1)
{
! sub->list.multi[subidx].end.lnum = reglnum + 1;
! sub->list.multi[subidx].end.col = 0;
}
else
{
! sub->list.multi[subidx].end.lnum = reglnum;
! sub->list.multi[subidx].end.col =
(colnr_T)(reginput - regline + off);
}
}
else
{
! save_ptr = sub->list.line[subidx].end;
! sub->list.line[subidx].end = reginput + off;
}
addstate(l, state->out, sub, off);
if (REG_MULTI)
! sub->list.multi[subidx].end = save_lpos;
else
! sub->list.line[subidx].end = save_ptr;
sub->in_use = save_in_use;
break;
}
***************
*** 2975,2987 ****
if (REG_MULTI)
{
! if (sub->multilist[subidx].start.lnum < 0
! || sub->multilist[subidx].end.lnum < 0)
goto retempty;
/* TODO: line breaks */
! len = sub->multilist[subidx].end.col
! - sub->multilist[subidx].start.col;
! if (cstrncmp(regline + sub->multilist[subidx].start.col,
reginput, &len) == 0)
{
*bytelen = len;
--- 2975,2987 ----
if (REG_MULTI)
{
! if (sub->list.multi[subidx].start.lnum < 0
! || sub->list.multi[subidx].end.lnum < 0)
goto retempty;
/* TODO: line breaks */
! len = sub->list.multi[subidx].end.col
! - sub->list.multi[subidx].start.col;
! if (cstrncmp(regline + sub->list.multi[subidx].start.col,
reginput, &len) == 0)
{
*bytelen = len;
***************
*** 2990,3000 ****
}
else
{
! if (sub->linelist[subidx].start == NULL
! || sub->linelist[subidx].end == NULL)
goto retempty;
! len = (int)(sub->linelist[subidx].end - sub->linelist[subidx].start);
! if (cstrncmp(sub->linelist[subidx].start, reginput, &len) == 0)
{
*bytelen = len;
return TRUE;
--- 2990,3000 ----
}
else
{
! if (sub->list.line[subidx].start == NULL
! || sub->list.line[subidx].end == NULL)
goto retempty;
! len = (int)(sub->list.line[subidx].end - sub->list.line[subidx].start);
! if (cstrncmp(sub->list.line[subidx].start, reginput, &len) == 0)
{
*bytelen = len;
return TRUE;
***************
*** 3260,3274 ****
if (REG_MULTI)
for (j = 0; j < submatch->in_use; j++)
{
! submatch->multilist[j].start =
! t->sub.multilist[j].start;
! submatch->multilist[j].end = t->sub.multilist[j].end;
}
else
for (j = 0; j < submatch->in_use; j++)
{
! submatch->linelist[j].start = t->sub.linelist[j].start;
! submatch->linelist[j].end = t->sub.linelist[j].end;
}
#ifdef ENABLE_LOG
log_subexpr(&t->sub);
--- 3260,3275 ----
if (REG_MULTI)
for (j = 0; j < submatch->in_use; j++)
{
! submatch->list.multi[j].start =
! t->sub.list.multi[j].start;
! submatch->list.multi[j].end = t->sub.list.multi[j].end;
}
else
for (j = 0; j < submatch->in_use; j++)
{
! submatch->list.line[j].start =
! t->sub.list.line[j].start;
! submatch->list.line[j].end = t->sub.list.line[j].end;
}
#ifdef ENABLE_LOG
log_subexpr(&t->sub);
***************
*** 3355,3368 ****
if (REG_MULTI)
for (j = 1; j < m->in_use; j++)
{
! t->sub.multilist[j].start = m->multilist[j].start;
! t->sub.multilist[j].end = m->multilist[j].end;
}
else
for (j = 1; j < m->in_use; j++)
{
! t->sub.linelist[j].start = m->linelist[j].start;
! t->sub.linelist[j].end = m->linelist[j].end;
}
t->sub.in_use = m->in_use;
--- 3356,3369 ----
if (REG_MULTI)
for (j = 1; j < m->in_use; j++)
{
! t->sub.list.multi[j].start = m->list.multi[j].start;
! t->sub.list.multi[j].end = m->list.multi[j].end;
}
else
for (j = 1; j < m->in_use; j++)
{
! t->sub.list.line[j].start = m->list.line[j].start;
! t->sub.list.line[j].end = m->list.line[j].end;
}
t->sub.in_use = m->in_use;
***************
*** 3907,3919 ****
if (REG_MULTI)
{
/* Use 0xff to set lnum to -1 */
! vim_memset(sub.multilist, 0xff, sizeof(struct multipos) * nfa_nsubexpr);
! vim_memset(m.multilist, 0xff, sizeof(struct multipos) * nfa_nsubexpr);
}
else
{
! vim_memset(sub.linelist, 0, sizeof(struct linepos) * nfa_nsubexpr);
! vim_memset(m.linelist, 0, sizeof(struct linepos) * nfa_nsubexpr);
}
sub.in_use = 0;
m.in_use = 0;
--- 3908,3920 ----
if (REG_MULTI)
{
/* Use 0xff to set lnum to -1 */
! vim_memset(sub.list.multi, 0xff, sizeof(struct multipos) * nfa_nsubexpr);
! vim_memset(m.list.multi, 0xff, sizeof(struct multipos) * nfa_nsubexpr);
}
else
{
! vim_memset(sub.list.line, 0, sizeof(struct linepos) * nfa_nsubexpr);
! vim_memset(m.list.line, 0, sizeof(struct linepos) * nfa_nsubexpr);
}
sub.in_use = 0;
m.in_use = 0;
***************
*** 3926,3933 ****
{
for (i = 0; i < sub.in_use; i++)
{
! reg_startpos[i] = sub.multilist[i].start;
! reg_endpos[i] = sub.multilist[i].end;
}
if (reg_startpos[0].lnum < 0)
--- 3927,3934 ----
{
for (i = 0; i < sub.in_use; i++)
{
! reg_startpos[i] = sub.list.multi[i].start;
! reg_endpos[i] = sub.list.multi[i].end;
}
if (reg_startpos[0].lnum < 0)
***************
*** 3949,3956 ****
{
for (i = 0; i < sub.in_use; i++)
{
! reg_startp[i] = sub.linelist[i].start;
! reg_endp[i] = sub.linelist[i].end;
}
if (reg_startp[0] == NULL)
--- 3950,3957 ----
{
for (i = 0; i < sub.in_use; i++)
{
! reg_startp[i] = sub.list.line[i].start;
! reg_endp[i] = sub.list.line[i].end;
}
if (reg_startp[0] == NULL)
*** ../vim-7.3.1035/src/version.c 2013-05-28 22:31:43.000000000 +0200
--- src/version.c 2013-05-28 22:37:01.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1036,
/**/
--
hundred-and-one symptoms of being an internet addict:
9. All your daydreaming is preoccupied with getting a faster connection to the
net: 28.8...ISDN...cable modem...T1...T3.
/// 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 ///

408
7.3.1037 Normal file
View File

@ -0,0 +1,408 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1037
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1037
Problem: Look-behind matching is very slow on long lines.
Solution: Add a byte limit to how far back an attempt is made.
Files: src/regexp.c, src/regexp_nfa.c, src/testdir/test64.in,
src/testdir/test64.ok
*** ../vim-7.3.1036/src/regexp.c 2013-05-21 21:37:01.000000000 +0200
--- src/regexp.c 2013-05-29 14:34:51.000000000 +0200
***************
*** 701,706 ****
--- 701,707 ----
# define CASEMBC(x)
#endif
static void reginsert __ARGS((int, char_u *));
+ static void reginsert_nr __ARGS((int op, long val, char_u *opnd));
static void reginsert_limits __ARGS((int, long, long, char_u *));
static char_u *re_put_long __ARGS((char_u *pr, long_u val));
static int read_limits __ARGS((long *, long *));
***************
*** 1781,1787 ****
--- 1782,1790 ----
case Magic('@'):
{
int lop = END;
+ int nr;
+ nr = getdecchrs();
switch (no_Magic(getchr()))
{
case '=': lop = MATCH; break; /* \@= */
***************
*** 1803,1809 ****
*flagp |= HASLOOKBH;
}
regtail(ret, regnode(END)); /* operand ends */
! reginsert(lop, ret);
break;
}
--- 1806,1819 ----
*flagp |= HASLOOKBH;
}
regtail(ret, regnode(END)); /* operand ends */
! if (lop == BEHIND || lop == NOBEHIND)
! {
! if (nr < 0)
! nr = 0; /* no limit is same as zero limit */
! reginsert_nr(lop, nr, ret);
! }
! else
! reginsert(lop, ret);
break;
}
***************
*** 2780,2785 ****
--- 2790,2827 ----
/*
* Insert an operator in front of already-emitted operand.
+ * Add a number to the operator.
+ */
+ static void
+ reginsert_nr(op, val, opnd)
+ int op;
+ long val;
+ char_u *opnd;
+ {
+ char_u *src;
+ char_u *dst;
+ char_u *place;
+
+ if (regcode == JUST_CALC_SIZE)
+ {
+ regsize += 7;
+ return;
+ }
+ src = regcode;
+ regcode += 7;
+ dst = regcode;
+ while (src > opnd)
+ *--dst = *--src;
+
+ place = opnd; /* Op node, where operand used to be. */
+ *place++ = op;
+ *place++ = NUL;
+ *place++ = NUL;
+ place = re_put_long(place, (long_u)val);
+ }
+
+ /*
+ * Insert an operator in front of already-emitted operand.
* The operator has the given limit values as operands. Also set next pointer.
*
* Means relocating the operand.
***************
*** 3182,3188 ****
}
/*
! * get and return the value of the decimal string immediately after the
* current position. Return -1 for invalid. Consumes all digits.
*/
static int
--- 3224,3230 ----
}
/*
! * Get and return the value of the decimal string immediately after the
* current position. Return -1 for invalid. Consumes all digits.
*/
static int
***************
*** 3200,3205 ****
--- 3242,3248 ----
nr *= 10;
nr += c - '0';
++regparse;
+ curchr = -1; /* no longer valid */
}
if (i == 0)
***************
*** 5432,5438 ****
/* save the position after the found match for next */
reg_save(&(((regbehind_T *)rp) - 1)->save_after, &backpos);
! /* start looking for a match with operand at the current
* position. Go back one character until we find the
* result, hitting the start of the line or the previous
* line (for multi-line matching).
--- 5475,5481 ----
/* save the position after the found match for next */
reg_save(&(((regbehind_T *)rp) - 1)->save_after, &backpos);
! /* Start looking for a match with operand at the current
* position. Go back one character until we find the
* result, hitting the start of the line or the previous
* line (for multi-line matching).
***************
*** 5444,5450 ****
rp->rs_state = RS_BEHIND2;
reg_restore(&rp->rs_un.regsave, &backpos);
! scan = OPERAND(rp->rs_scan);
}
break;
--- 5487,5493 ----
rp->rs_state = RS_BEHIND2;
reg_restore(&rp->rs_un.regsave, &backpos);
! scan = OPERAND(rp->rs_scan) + 4;
}
break;
***************
*** 5472,5480 ****
--- 5515,5526 ----
}
else
{
+ long limit;
+
/* No match or a match that doesn't end where we want it: Go
* back one character. May go to previous line once. */
no = OK;
+ limit = OPERAND_MIN(rp->rs_scan);
if (REG_MULTI)
{
if (rp->rs_un.regsave.rs_u.pos.col == 0)
***************
*** 5493,5519 ****
}
}
else
#ifdef FEAT_MBYTE
! if (has_mbyte)
! rp->rs_un.regsave.rs_u.pos.col -=
! (*mb_head_off)(regline, regline
+ rp->rs_un.regsave.rs_u.pos.col - 1) + 1;
! else
#endif
! --rp->rs_un.regsave.rs_u.pos.col;
}
else
{
if (rp->rs_un.regsave.rs_u.ptr == regline)
no = FAIL;
else
! --rp->rs_un.regsave.rs_u.ptr;
}
if (no == OK)
{
/* Advanced, prepare for finding match again. */
reg_restore(&rp->rs_un.regsave, &backpos);
! scan = OPERAND(rp->rs_scan);
if (status == RA_MATCH)
{
/* We did match, so subexpr may have been changed,
--- 5539,5579 ----
}
}
else
+ {
#ifdef FEAT_MBYTE
! if (has_mbyte)
! rp->rs_un.regsave.rs_u.pos.col -=
! (*mb_head_off)(regline, regline
+ rp->rs_un.regsave.rs_u.pos.col - 1) + 1;
! else
#endif
! --rp->rs_un.regsave.rs_u.pos.col;
! if (limit > 0
! && ((rp->rs_un.regsave.rs_u.pos.lnum
! < behind_pos.rs_u.pos.lnum
! ? (colnr_T)STRLEN(regline)
! : behind_pos.rs_u.pos.col)
! - rp->rs_un.regsave.rs_u.pos.col > limit))
! no = FAIL;
! }
}
else
{
if (rp->rs_un.regsave.rs_u.ptr == regline)
no = FAIL;
else
! {
! mb_ptr_back(regline, rp->rs_un.regsave.rs_u.ptr);
! if (limit > 0 && (long)(behind_pos.rs_u.ptr
! - rp->rs_un.regsave.rs_u.ptr) > limit)
! no = FAIL;
! }
}
if (no == OK)
{
/* Advanced, prepare for finding match again. */
reg_restore(&rp->rs_un.regsave, &backpos);
! scan = OPERAND(rp->rs_scan) + 4;
if (status == RA_MATCH)
{
/* We did match, so subexpr may have been changed,
***************
*** 7773,7779 ****
#ifdef DEBUG
static char_u regname[][30] = {
"AUTOMATIC Regexp Engine",
! "BACKTACKING Regexp Engine",
"NFA Regexp Engine"
};
#endif
--- 7833,7839 ----
#ifdef DEBUG
static char_u regname[][30] = {
"AUTOMATIC Regexp Engine",
! "BACKTRACKING Regexp Engine",
"NFA Regexp Engine"
};
#endif
*** ../vim-7.3.1036/src/regexp_nfa.c 2013-05-28 22:52:11.000000000 +0200
--- src/regexp_nfa.c 2013-05-29 16:31:13.000000000 +0200
***************
*** 1331,1336 ****
--- 1331,1346 ----
case '=':
EMIT(NFA_PREV_ATOM_NO_WIDTH);
break;
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
case '!':
case '<':
case '>':
***************
*** 3817,3823 ****
* because recursive calls should only start in the first position.
* Also don't start a match past the first line. */
if (nfa_match == FALSE && start->c == NFA_MOPEN + 0
! && reglnum == 0 && clen != 0)
{
#ifdef ENABLE_LOG
fprintf(log_fd, "(---) STARTSTATE\n");
--- 3827,3835 ----
* because recursive calls should only start in the first position.
* Also don't start a match past the first line. */
if (nfa_match == FALSE && start->c == NFA_MOPEN + 0
! && reglnum == 0 && clen != 0
! && (ireg_maxcol == 0
! || (colnr_T)(reginput - regline) < ireg_maxcol))
{
#ifdef ENABLE_LOG
fprintf(log_fd, "(---) STARTSTATE\n");
*** ../vim-7.3.1036/src/testdir/test64.in 2013-05-28 22:03:13.000000000 +0200
--- src/testdir/test64.in 2013-05-29 14:56:44.000000000 +0200
***************
*** 336,341 ****
--- 336,349 ----
:"call add(tl, [2, '\(\i\+\) \1', 'xgoo goox', 'goo goo', 'goo'])
:call add(tl, [2, '\(a\)\(b\)\(c\)\(dd\)\(e\)\(f\)\(g\)\(h\)\(i\)\1\2\3\4\5\6\7\8\9', 'xabcddefghiabcddefghix', 'abcddefghiabcddefghi', 'a', 'b', 'c', 'dd', 'e', 'f', 'g', 'h', 'i'])
:"
+ :"""" Look-behind with limit
+ :call add(tl, [0, '<\@<=span.', 'xxspanxx<spanyyy', 'spany'])
+ :call add(tl, [0, '<\@1<=span.', 'xxspanxx<spanyyy', 'spany'])
+ :call add(tl, [0, '<\@2<=span.', 'xxspanxx<spanyyy', 'spany'])
+ :call add(tl, [0, '\(<<\)\@<=span.', 'xxspanxxxx<spanxx<<spanyyy', 'spany', '<<'])
+ :call add(tl, [0, '\(<<\)\@1<=span.', 'xxspanxxxx<spanxx<<spanyyy'])
+ :call add(tl, [0, '\(<<\)\@2<=span.', 'xxspanxxxx<spanxx<<spanyyy', 'spany', '<<'])
+ :"
:"""" Run the tests
:"
:"
***************
*** 406,411 ****
--- 414,425 ----
y$Gop:"
:"
:"
+ :" Check a pattern with a look beind crossing a line boundary
+ /^Behind:
+ /\(<\_[xy]\+\)\@3<=start
+ :.yank
+ Gop:"
+ :"
:/\%#=1^Results/,$wq! test.out
ENDTEST
***************
*** 423,426 ****
--- 437,448 ----
xjk
lmn
+ Behind:
+ asdfasd<yyy
+ xxstart1
+ asdfasd<yy
+ xxxxstart2
+ asdfasd<yy
+ xxxstart3
+
Results of test64:
*** ../vim-7.3.1036/src/testdir/test64.ok 2013-05-28 22:03:13.000000000 +0200
--- src/testdir/test64.ok 2013-05-29 14:59:37.000000000 +0200
***************
*** 719,724 ****
--- 719,736 ----
OK 0 - \(a\)\(b\)\(c\)\(dd\)\(e\)\(f\)\(g\)\(h\)\(i\)\1\2\3\4\5\6\7\8\9
OK 1 - \(a\)\(b\)\(c\)\(dd\)\(e\)\(f\)\(g\)\(h\)\(i\)\1\2\3\4\5\6\7\8\9
OK 2 - \(a\)\(b\)\(c\)\(dd\)\(e\)\(f\)\(g\)\(h\)\(i\)\1\2\3\4\5\6\7\8\9
+ OK 0 - <\@<=span.
+ OK 1 - <\@<=span.
+ OK 0 - <\@1<=span.
+ OK 1 - <\@1<=span.
+ OK 0 - <\@2<=span.
+ OK 1 - <\@2<=span.
+ OK 0 - \(<<\)\@<=span.
+ OK 1 - \(<<\)\@<=span.
+ OK 0 - \(<<\)\@1<=span.
+ OK 1 - \(<<\)\@1<=span.
+ OK 0 - \(<<\)\@2<=span.
+ OK 1 - \(<<\)\@2<=span.
192.168.0.1
192.168.0.1
192.168.0.1
***************
*** 726,728 ****
--- 738,742 ----
<T="5">Ta 5</Title>
<T="7">Ac 7</Title>
ghi
+
+ xxxstart3
*** ../vim-7.3.1036/src/version.c 2013-05-28 22:52:11.000000000 +0200
--- src/version.c 2013-05-29 13:20:48.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1037,
/**/
--
hundred-and-one symptoms of being an internet addict:
11. You find yourself typing "com" after every period when using a word
processor.com
/// 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 ///

134
7.3.1038 Normal file
View File

@ -0,0 +1,134 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1038
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1038
Problem: Crash when using Cscope.
Solution: Avoid negative argument to vim_strncpy(). (Narendran
Gopalakrishnan)
Files: src/if_cscope.c
*** ../vim-7.3.1037/src/if_cscope.c 2013-05-06 04:21:35.000000000 +0200
--- src/if_cscope.c 2013-05-29 19:12:55.000000000 +0200
***************
*** 2460,2472 ****
/*
* PRIVATE: cs_resolve_file
*
! * construct the full pathname to a file found in the cscope database.
* (Prepends ppath, if there is one and if it's not already prepended,
* otherwise just uses the name found.)
*
! * we need to prepend the prefix because on some cscope's (e.g., the one that
* ships with Solaris 2.6), the output never has the prefix prepended.
! * contrast this with my development system (Digital Unix), which does.
*/
static char *
cs_resolve_file(i, name)
--- 2460,2472 ----
/*
* PRIVATE: cs_resolve_file
*
! * Construct the full pathname to a file found in the cscope database.
* (Prepends ppath, if there is one and if it's not already prepended,
* otherwise just uses the name found.)
*
! * We need to prepend the prefix because on some cscope's (e.g., the one that
* ships with Solaris 2.6), the output never has the prefix prepended.
! * Contrast this with my development system (Digital Unix), which does.
*/
static char *
cs_resolve_file(i, name)
***************
*** 2493,2506 ****
if (csdir != NULL)
{
vim_strncpy(csdir, (char_u *)csinfo[i].fname,
! gettail((char_u *)csinfo[i].fname) - 1 - (char_u *)csinfo[i].fname);
len += (int)STRLEN(csdir);
}
}
- if ((fullname = (char *)alloc(len)) == NULL)
- return NULL;
-
/* Note/example: this won't work if the cscope output already starts
* "../.." and the prefix path is also "../..". if something like this
* happens, you are screwed up and need to fix how you're using cscope. */
--- 2493,2504 ----
if (csdir != NULL)
{
vim_strncpy(csdir, (char_u *)csinfo[i].fname,
! gettail((char_u *)csinfo[i].fname)
! - (char_u *)csinfo[i].fname);
len += (int)STRLEN(csdir);
}
}
/* Note/example: this won't work if the cscope output already starts
* "../.." and the prefix path is also "../..". if something like this
* happens, you are screwed up and need to fix how you're using cscope. */
***************
*** 2511,2526 ****
&& name[0] != '\\' && name[1] != ':'
#endif
)
! (void)sprintf(fullname, "%s/%s", csinfo[i].ppath, name);
! else if (csdir != NULL && csinfo[i].fname != NULL && STRLEN(csdir) > 0)
{
/* Check for csdir to be non empty to avoid empty path concatenated to
! * cscope output. TODO: avoid the unnecessary alloc/free of fullname. */
! vim_free(fullname);
fullname = (char *)concat_fnames(csdir, (char_u *)name, TRUE);
}
else
! (void)sprintf(fullname, "%s", name);
vim_free(csdir);
return fullname;
--- 2509,2528 ----
&& name[0] != '\\' && name[1] != ':'
#endif
)
! {
! if ((fullname = (char *)alloc(len)) != NULL)
! (void)sprintf(fullname, "%s/%s", csinfo[i].ppath, name);
! }
! else if (csdir != NULL && csinfo[i].fname != NULL && *csdir != NUL)
{
/* Check for csdir to be non empty to avoid empty path concatenated to
! * cscope output. */
fullname = (char *)concat_fnames(csdir, (char_u *)name, TRUE);
}
else
! {
! fullname = (char *)vim_strsave((char_u *)name);
! }
vim_free(csdir);
return fullname;
*** ../vim-7.3.1037/src/version.c 2013-05-29 18:45:07.000000000 +0200
--- src/version.c 2013-05-29 19:17:16.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1038,
/**/
--
hundred-and-one symptoms of being an internet addict:
12. You turn off your modem and get this awful empty feeling, like you just
pulled the plug on a loved one.
/// 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 ///

380
7.3.1039 Normal file
View File

@ -0,0 +1,380 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1039
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1039
Problem: New regexp engine does not support \%23c, \%<23c and the like.
Solution: Implement them. (partly by Yasuhiro Matsumoto)
Files: src/regexp.h, src/regexp_nfa.c, src/testdir/test64.in,
src/testdir/test64.ok
*** ../vim-7.3.1038/src/regexp.h 2013-05-28 22:03:13.000000000 +0200
--- src/regexp.h 2013-05-29 20:35:35.000000000 +0200
***************
*** 72,77 ****
--- 72,78 ----
int id;
int lastlist;
int negated;
+ int val;
};
/*
*** ../vim-7.3.1038/src/regexp_nfa.c 2013-05-29 18:45:07.000000000 +0200
--- src/regexp_nfa.c 2013-05-29 20:59:34.000000000 +0200
***************
*** 117,122 ****
--- 117,134 ----
NFA_NLOWER, /* Match non-lowercase char */
NFA_UPPER, /* Match uppercase char */
NFA_NUPPER, /* Match non-uppercase char */
+
+ NFA_CURSOR, /* Match cursor pos */
+ NFA_LNUM, /* Match line number */
+ NFA_LNUM_GT, /* Match > line number */
+ NFA_LNUM_LT, /* Match < line number */
+ NFA_COL, /* Match cursor column */
+ NFA_COL_GT, /* Match > cursor column */
+ NFA_COL_LT, /* Match < cursor column */
+ NFA_VCOL, /* Match cursor virtual column */
+ NFA_VCOL_GT, /* Match > cursor virtual column */
+ NFA_VCOL_LT, /* Match < cursor virtual column */
+
NFA_FIRST_NL = NFA_ANY + ADD_NL,
NFA_LAST_NL = NFA_NUPPER + ADD_NL,
***************
*** 205,214 ****
static nfa_state_T *post2nfa __ARGS((int *postfix, int *end, int nfa_calc_size));
static int check_char_class __ARGS((int class, int c));
static void st_error __ARGS((int *postfix, int *end, int *p));
static void nfa_save_listids __ARGS((nfa_state_T *start, int *list));
static void nfa_restore_listids __ARGS((nfa_state_T *start, int *list));
! static void nfa_set_null_listids __ARGS((nfa_state_T *start));
! static void nfa_set_neg_listids __ARGS((nfa_state_T *start));
static long nfa_regtry __ARGS((nfa_state_T *start, colnr_T col));
static long nfa_regexec_both __ARGS((char_u *line, colnr_T col));
static regprog_T *nfa_regcomp __ARGS((char_u *expr, int re_flags));
--- 217,227 ----
static nfa_state_T *post2nfa __ARGS((int *postfix, int *end, int nfa_calc_size));
static int check_char_class __ARGS((int class, int c));
static void st_error __ARGS((int *postfix, int *end, int *p));
+ static void nfa_set_neg_listids __ARGS((nfa_state_T *start));
+ static void nfa_set_null_listids __ARGS((nfa_state_T *start));
static void nfa_save_listids __ARGS((nfa_state_T *start, int *list));
static void nfa_restore_listids __ARGS((nfa_state_T *start, int *list));
! static int nfa_re_num_cmp __ARGS((long_u val, int op, long_u pos));
static long nfa_regtry __ARGS((nfa_state_T *start, colnr_T col));
static long nfa_regexec_both __ARGS((char_u *line, colnr_T col));
static regprog_T *nfa_regcomp __ARGS((char_u *expr, int re_flags));
***************
*** 831,838 ****
break;
case '#':
! /* TODO: not supported yet */
! return FAIL;
break;
case 'V':
--- 844,850 ----
break;
case '#':
! EMIT(NFA_CURSOR);
break;
case 'V':
***************
*** 844,866 ****
/* TODO: \%[abc] not supported yet */
return FAIL;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- case '<':
- case '>':
- case '\'':
- /* TODO: not supported yet */
- return FAIL;
-
default:
syntax_error = TRUE;
EMSGN(_("E867: (NFA) Unknown operator '\\%%%c'"),
no_Magic(c));
--- 856,891 ----
/* TODO: \%[abc] not supported yet */
return FAIL;
default:
+ {
+ long_u n = 0;
+ int cmp = c;
+
+ if (c == '<' || c == '>')
+ c = getchr();
+ while (VIM_ISDIGIT(c))
+ {
+ n = n * 10 + (c - '0');
+ c = getchr();
+ }
+ if (c == 'l' || c == 'c' || c == 'v')
+ {
+ EMIT(n);
+ if (c == 'l')
+ EMIT(cmp == '<' ? NFA_LNUM_LT :
+ cmp == '>' ? NFA_LNUM_GT : NFA_LNUM);
+ else if (c == 'c')
+ EMIT(cmp == '<' ? NFA_COL_LT :
+ cmp == '>' ? NFA_COL_GT : NFA_COL);
+ else
+ EMIT(cmp == '<' ? NFA_VCOL_LT :
+ cmp == '>' ? NFA_VCOL_GT : NFA_VCOL);
+ break;
+ }
+ else if (c == '\'')
+ /* TODO: \%'m not supported yet */
+ return FAIL;
+ }
syntax_error = TRUE;
EMSGN(_("E867: (NFA) Unknown operator '\\%%%c'"),
no_Magic(c));
***************
*** 1679,1684 ****
--- 1704,1711 ----
case NFA_PREV_ATOM_NO_WIDTH:
STRCPY(code, "NFA_PREV_ATOM_NO_WIDTH"); break;
+ case NFA_PREV_ATOM_NO_WIDTH_NEG:
+ STRCPY(code, "NFA_PREV_ATOM_NO_WIDTH_NEG"); break;
case NFA_NOPEN: STRCPY(code, "NFA_MOPEN_INVISIBLE"); break;
case NFA_NCLOSE: STRCPY(code, "NFA_MCLOSE_INVISIBLE"); break;
case NFA_START_INVISIBLE: STRCPY(code, "NFA_START_INVISIBLE"); break;
***************
*** 2444,2449 ****
--- 2471,2498 ----
PUSH(frag(s, list1(&s1->out)));
break;
+ case NFA_LNUM:
+ case NFA_LNUM_GT:
+ case NFA_LNUM_LT:
+ case NFA_VCOL:
+ case NFA_VCOL_GT:
+ case NFA_VCOL_LT:
+ case NFA_COL:
+ case NFA_COL_GT:
+ case NFA_COL_LT:
+ if (nfa_calc_size == TRUE)
+ {
+ nstate += 1;
+ break;
+ }
+ e1 = POP();
+ s = new_state(*p, NULL, NULL);
+ if (s == NULL)
+ goto theend;
+ s->val = e1.start->c;
+ PUSH(frag(s, list1(&s->out)));
+ break;
+
case NFA_ZSTART:
case NFA_ZEND:
default:
***************
*** 3076,3081 ****
--- 3125,3141 ----
}
}
+ static int
+ nfa_re_num_cmp(val, op, pos)
+ long_u val;
+ int op;
+ long_u pos;
+ {
+ if (op == 1) return pos > val;
+ if (op == 2) return pos < val;
+ return val == pos;
+ }
+
static int nfa_regmatch __ARGS((nfa_state_T *start, regsub_T *submatch, regsub_T *m));
/*
***************
*** 3791,3796 ****
--- 3851,3895 ----
/* TODO: should not happen? */
break;
+ case NFA_LNUM:
+ case NFA_LNUM_GT:
+ case NFA_LNUM_LT:
+ result = (REG_MULTI &&
+ nfa_re_num_cmp(t->state->val, t->state->c - NFA_LNUM,
+ (long_u)(reglnum + reg_firstlnum)));
+ if (result)
+ addstate_here(thislist, t->state->out, &t->sub, &listidx);
+ break;
+
+ case NFA_COL:
+ case NFA_COL_GT:
+ case NFA_COL_LT:
+ result = nfa_re_num_cmp(t->state->val, t->state->c - NFA_COL,
+ (long_u)(reginput - regline) + 1);
+ if (result)
+ addstate_here(thislist, t->state->out, &t->sub, &listidx);
+ break;
+
+ case NFA_VCOL:
+ case NFA_VCOL_GT:
+ case NFA_VCOL_LT:
+ result = nfa_re_num_cmp(t->state->val, t->state->c - NFA_VCOL,
+ (long_u)win_linetabsize(
+ reg_win == NULL ? curwin : reg_win,
+ regline, (colnr_T)(reginput - regline)) + 1);
+ if (result)
+ addstate_here(thislist, t->state->out, &t->sub, &listidx);
+ break;
+
+ case NFA_CURSOR:
+ result = (reg_win != NULL
+ && (reglnum + reg_firstlnum == reg_win->w_cursor.lnum)
+ && ((colnr_T)(reginput - regline)
+ == reg_win->w_cursor.col));
+ if (result)
+ addstate_here(thislist, t->state->out, &t->sub, &listidx);
+ break;
+
default: /* regular character */
{
int c = t->state->c;
*** ../vim-7.3.1038/src/testdir/test64.in 2013-05-29 18:45:07.000000000 +0200
--- src/testdir/test64.in 2013-05-29 21:02:52.000000000 +0200
***************
*** 413,425 ****
:.yank
y$Gop:"
:"
- :"
:" Check a pattern with a look beind crossing a line boundary
/^Behind:
/\(<\_[xy]\+\)\@3<=start
:.yank
Gop:"
:"
:/\%#=1^Results/,$wq! test.out
ENDTEST
--- 413,452 ----
:.yank
y$Gop:"
:"
:" Check a pattern with a look beind crossing a line boundary
/^Behind:
/\(<\_[xy]\+\)\@3<=start
:.yank
Gop:"
:"
+ :" Check patterns matching cursor position.
+ :func! Postest()
+ new
+ call setline(1, ['ffooooo', 'boboooo', 'zoooooo', 'koooooo', 'moooooo', "\t\t\tfoo", 'abababababababfoo', 'bababababababafoo', '********_'])
+ call setpos('.', [0, 1, 0, 0])
+ s/\%>3c.//g
+ call setpos('.', [0, 2, 4, 0])
+ s/\%#.*$//g
+ call setpos('.', [0, 3, 0, 0])
+ s/\%<3c./_/g
+ %s/\%4l\%>5c./_/g
+ %s/\%6l\%>25v./_/g
+ %s/\%>6l\%3c./!/g
+ %s/\%>7l\%12c./?/g
+ %s/\%>7l\%<9l\%>5v\%<8v./#/g
+ 1,$yank
+ quit!
+ endfunc
+ Go-0-:set re=0
+ :call Postest()
+ :put
+ o-1-:set re=1
+ :call Postest()
+ :put
+ o-2-:set re=2
+ :call Postest()
+ :put
+ :"
:/\%#=1^Results/,$wq! test.out
ENDTEST
*** ../vim-7.3.1038/src/testdir/test64.ok 2013-05-29 18:45:07.000000000 +0200
--- src/testdir/test64.ok 2013-05-29 21:02:49.000000000 +0200
***************
*** 740,742 ****
--- 740,772 ----
ghi
xxxstart3
+ -0-
+ ffo
+ bob
+ __ooooo
+ koooo__
+ moooooo
+ f__
+ ab!babababababfoo
+ ba!ab##abab?bafoo
+ **!*****_
+ -1-
+ ffo
+ bob
+ __ooooo
+ koooo__
+ moooooo
+ f__
+ ab!babababababfoo
+ ba!ab##abab?bafoo
+ **!*****_
+ -2-
+ ffo
+ bob
+ __ooooo
+ koooo__
+ moooooo
+ f__
+ ab!babababababfoo
+ ba!ab##abab?bafoo
+ **!*****_
*** ../vim-7.3.1038/src/version.c 2013-05-29 19:17:55.000000000 +0200
--- src/version.c 2013-05-29 21:11:47.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1039,
/**/
--
hundred-and-one symptoms of being an internet addict:
16. You step out of your room and realize that your parents have moved and
you don't have a clue when it happened.
/// 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 ///

298
7.3.1040 Normal file
View File

@ -0,0 +1,298 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1040
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1040
Problem: Python: Problems with debugging dynamic build.
Solution: Python patch 1. (ZyX)
Files: src/if_python.c, src/if_python3.c
*** ../vim-7.3.1039/src/if_python.c 2013-05-21 22:23:51.000000000 +0200
--- src/if_python.c 2013-05-29 21:32:46.000000000 +0200
***************
*** 21,26 ****
--- 21,35 ----
#include <limits.h>
+ /* uncomment this if used with the debug version of python.
+ * Checked on 2.7.4. */
+ /* #define Py_DEBUG */
+ /* Note: most of time you can add -DPy_DEBUG to CFLAGS in place of uncommenting
+ */
+ /* uncomment this if used with the debug version of python, but without its
+ * allocator */
+ /* #define Py_DEBUG_NO_PYMALLOC */
+
/* Python.h defines _POSIX_THREADS itself (if needed) */
#ifdef _POSIX_THREADS
# undef _POSIX_THREADS
***************
*** 240,247 ****
# define PyType_IsSubtype dll_PyType_IsSubtype
# endif
# if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02030000
! # define PyObject_Malloc dll_PyObject_Malloc
! # define PyObject_Free dll_PyObject_Free
# endif
# ifdef PY_USE_CAPSULE
# define PyCapsule_New dll_PyCapsule_New
--- 249,266 ----
# define PyType_IsSubtype dll_PyType_IsSubtype
# endif
# if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02030000
! # ifdef Py_DEBUG
! # define _Py_NegativeRefcount dll__Py_NegativeRefcount
! # define _Py_RefTotal (*dll__Py_RefTotal)
! # define _Py_Dealloc dll__Py_Dealloc
! # endif
! # if defined(Py_DEBUG) && !defined(Py_DEBUG_NO_PYMALLOC)
! # define _PyObject_DebugMalloc dll__PyObject_DebugMalloc
! # define _PyObject_DebugFree dll__PyObject_DebugFree
! # else
! # define PyObject_Malloc dll_PyObject_Malloc
! # define PyObject_Free dll_PyObject_Free
! # endif
# endif
# ifdef PY_USE_CAPSULE
# define PyCapsule_New dll_PyCapsule_New
***************
*** 350,357 ****
--- 369,386 ----
static int (*dll_PyType_IsSubtype)(PyTypeObject *, PyTypeObject *);
# endif
# if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02030000
+ # ifdef Py_DEBUG
+ static void (*dll__Py_NegativeRefcount)(const char *fname, int lineno, PyObject *op);
+ static Py_ssize_t* dll__Py_RefTotal;
+ static void (*dll__Py_Dealloc)(PyObject *obj);
+ # endif
+ # if defined(Py_DEBUG) && !defined(Py_DEBUG_NO_PYMALLOC)
+ static void (*dll__PyObject_DebugFree)(void*);
+ static void* (*dll__PyObject_DebugMalloc)(size_t);
+ # else
static void* (*dll_PyObject_Malloc)(size_t);
static void (*dll_PyObject_Free)(void*);
+ # endif
# endif
# ifdef PY_USE_CAPSULE
static PyObject* (*dll_PyCapsule_New)(void *, char *, PyCapsule_Destructor);
***************
*** 469,480 ****
{"PyType_Type", (PYTHON_PROC*)&dll_PyType_Type},
{"PyType_Ready", (PYTHON_PROC*)&dll_PyType_Ready},
{"Py_FindMethod", (PYTHON_PROC*)&dll_Py_FindMethod},
- # if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02050000 \
- && SIZEOF_SIZE_T != SIZEOF_INT
- {"Py_InitModule4_64", (PYTHON_PROC*)&dll_Py_InitModule4},
- # else
- {"Py_InitModule4", (PYTHON_PROC*)&dll_Py_InitModule4},
- # endif
{"Py_SetPythonHome", (PYTHON_PROC*)&dll_Py_SetPythonHome},
{"Py_Initialize", (PYTHON_PROC*)&dll_Py_Initialize},
{"Py_Finalize", (PYTHON_PROC*)&dll_Py_Finalize},
--- 498,503 ----
***************
*** 496,503 ****
--- 519,550 ----
{"PyType_IsSubtype", (PYTHON_PROC*)&dll_PyType_IsSubtype},
# endif
# if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02030000
+ # ifdef Py_DEBUG
+ {"_Py_NegativeRefcount", (PYTHON_PROC*)&dll__Py_NegativeRefcount},
+ {"_Py_RefTotal", (PYTHON_PROC*)&dll__Py_RefTotal},
+ {"_Py_Dealloc", (PYTHON_PROC*)&dll__Py_Dealloc},
+ # endif
+ # if defined(Py_DEBUG) && !defined(Py_DEBUG_NO_PYMALLOC)
+ {"_PyObject_DebugFree", (PYTHON_PROC*)&dll__PyObject_DebugFree},
+ {"_PyObject_DebugMalloc", (PYTHON_PROC*)&dll__PyObject_DebugMalloc},
+ # else
{"PyObject_Malloc", (PYTHON_PROC*)&dll_PyObject_Malloc},
{"PyObject_Free", (PYTHON_PROC*)&dll_PyObject_Free},
+ # endif
+ # endif
+ # if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02050000 \
+ && SIZEOF_SIZE_T != SIZEOF_INT
+ # ifdef Py_DEBUG
+ {"Py_InitModule4TraceRefs_64", (PYTHON_PROC*)&dll_Py_InitModule4},
+ # else
+ {"Py_InitModule4_64", (PYTHON_PROC*)&dll_Py_InitModule4},
+ # endif
+ # else
+ # ifdef Py_DEBUG
+ {"Py_InitModule4TraceRefs", (PYTHON_PROC*)&dll_Py_InitModule4},
+ # else
+ {"Py_InitModule4", (PYTHON_PROC*)&dll_Py_InitModule4},
+ # endif
# endif
# ifdef PY_USE_CAPSULE
{"PyCapsule_New", (PYTHON_PROC*)&dll_PyCapsule_New},
*** ../vim-7.3.1039/src/if_python3.c 2013-05-21 22:23:51.000000000 +0200
--- src/if_python3.c 2013-05-29 21:32:46.000000000 +0200
***************
*** 24,29 ****
--- 24,34 ----
/* uncomment this if used with the debug version of python */
/* #define Py_DEBUG */
+ /* Note: most of time you can add -DPy_DEBUG to CFLAGS in place of uncommenting
+ */
+ /* uncomment this if used with the debug version of python, but without its
+ * allocator */
+ /* #define Py_DEBUG_NO_PYMALLOC */
#include "vim.h"
***************
*** 207,212 ****
--- 212,222 ----
# define _Py_NegativeRefcount py3__Py_NegativeRefcount
# define _Py_RefTotal (*py3__Py_RefTotal)
# define _Py_Dealloc py3__Py_Dealloc
+ # define PyModule_Create2TraceRefs py3_PyModule_Create2TraceRefs
+ # else
+ # define PyModule_Create2 py3_PyModule_Create2
+ # endif
+ # if defined(Py_DEBUG) && !defined(Py_DEBUG_NO_PYMALLOC)
# define _PyObject_DebugMalloc py3__PyObject_DebugMalloc
# define _PyObject_DebugFree py3__PyObject_DebugFree
# else
***************
*** 218,224 ****
# define PyObject_GC_UnTrack py3_PyObject_GC_UnTrack
# define PyType_GenericAlloc py3_PyType_GenericAlloc
# define PyType_GenericNew py3_PyType_GenericNew
- # define PyModule_Create2 py3_PyModule_Create2
# undef PyUnicode_FromString
# define PyUnicode_FromString py3_PyUnicode_FromString
# undef PyUnicode_Decode
--- 228,233 ----
***************
*** 227,233 ****
# define PyCapsule_New py3_PyCapsule_New
# define PyCapsule_GetPointer py3_PyCapsule_GetPointer
! # ifdef Py_DEBUG
# undef PyObject_NEW
# define PyObject_NEW(type, typeobj) \
( (type *) PyObject_Init( \
--- 236,242 ----
# define PyCapsule_New py3_PyCapsule_New
# define PyCapsule_GetPointer py3_PyCapsule_GetPointer
! # if defined(Py_DEBUG) && !defined(Py_DEBUG_NO_PYMALLOC)
# undef PyObject_NEW
# define PyObject_NEW(type, typeobj) \
( (type *) PyObject_Init( \
***************
*** 317,323 ****
static PyObject* (*py3_PyFloat_FromDouble)(double num);
static double (*py3_PyFloat_AsDouble)(PyObject *);
static PyObject* (*py3_PyObject_GenericGetAttr)(PyObject *obj, PyObject *name);
- static PyObject* (*py3_PyModule_Create2)(struct PyModuleDef* module, int module_api_version);
static PyObject* (*py3_PyType_GenericAlloc)(PyTypeObject *type, Py_ssize_t nitems);
static PyObject* (*py3_PyType_GenericNew)(PyTypeObject *type, PyObject *args, PyObject *kwds);
static PyTypeObject* py3_PyType_Type;
--- 326,331 ----
***************
*** 328,341 ****
static PyObject* (*py3_PyCapsule_New)(void *, char *, PyCapsule_Destructor);
static void* (*py3_PyCapsule_GetPointer)(PyObject *, char *);
# ifdef Py_DEBUG
! static void (*py3__Py_NegativeRefcount)(const char *fname, int lineno, PyObject *op);
! static Py_ssize_t* py3__Py_RefTotal;
! static void (*py3__Py_Dealloc)(PyObject *obj);
! static void (*py3__PyObject_DebugFree)(void*);
! static void* (*py3__PyObject_DebugMalloc)(size_t);
# else
! static void (*py3_PyObject_Free)(void*);
! static void* (*py3_PyObject_Malloc)(size_t);
# endif
static PyObject*(*py3__PyObject_GC_New)(PyTypeObject *);
static void(*py3_PyObject_GC_Del)(void *);
--- 336,354 ----
static PyObject* (*py3_PyCapsule_New)(void *, char *, PyCapsule_Destructor);
static void* (*py3_PyCapsule_GetPointer)(PyObject *, char *);
# ifdef Py_DEBUG
! static void (*py3__Py_NegativeRefcount)(const char *fname, int lineno, PyObject *op);
! static Py_ssize_t* py3__Py_RefTotal;
! static void (*py3__Py_Dealloc)(PyObject *obj);
! static PyObject* (*py3_PyModule_Create2TraceRefs)(struct PyModuleDef* module, int module_api_version);
! # else
! static PyObject* (*py3_PyModule_Create2)(struct PyModuleDef* module, int module_api_version);
! # endif
! # if defined(Py_DEBUG) && !defined(Py_DEBUG_NO_PYMALLOC)
! static void (*py3__PyObject_DebugFree)(void*);
! static void* (*py3__PyObject_DebugMalloc)(size_t);
# else
! static void (*py3_PyObject_Free)(void*);
! static void* (*py3_PyObject_Malloc)(size_t);
# endif
static PyObject*(*py3__PyObject_GC_New)(PyTypeObject *);
static void(*py3_PyObject_GC_Del)(void *);
***************
*** 451,457 ****
{"PyFloat_FromDouble", (PYTHON_PROC*)&py3_PyFloat_FromDouble},
{"PyFloat_AsDouble", (PYTHON_PROC*)&py3_PyFloat_AsDouble},
{"PyObject_GenericGetAttr", (PYTHON_PROC*)&py3_PyObject_GenericGetAttr},
- {"PyModule_Create2", (PYTHON_PROC*)&py3_PyModule_Create2},
{"PyType_GenericAlloc", (PYTHON_PROC*)&py3_PyType_GenericAlloc},
{"PyType_GenericNew", (PYTHON_PROC*)&py3_PyType_GenericNew},
{"PyType_Type", (PYTHON_PROC*)&py3_PyType_Type},
--- 464,469 ----
***************
*** 463,468 ****
--- 475,485 ----
{"_Py_NegativeRefcount", (PYTHON_PROC*)&py3__Py_NegativeRefcount},
{"_Py_RefTotal", (PYTHON_PROC*)&py3__Py_RefTotal},
{"_Py_Dealloc", (PYTHON_PROC*)&py3__Py_Dealloc},
+ {"PyModule_Create2TraceRefs", (PYTHON_PROC*)&py3_PyModule_Create2TraceRefs},
+ # else
+ {"PyModule_Create2", (PYTHON_PROC*)&py3_PyModule_Create2},
+ # endif
+ # if defined(Py_DEBUG) && !defined(Py_DEBUG_NO_PYMALLOC)
{"_PyObject_DebugFree", (PYTHON_PROC*)&py3__PyObject_DebugFree},
{"_PyObject_DebugMalloc", (PYTHON_PROC*)&py3__PyObject_DebugMalloc},
# else
***************
*** 656,662 ****
static void
call_PyObject_Free(void *p)
{
! #ifdef Py_DEBUG
_PyObject_DebugFree(p);
#else
PyObject_Free(p);
--- 673,679 ----
static void
call_PyObject_Free(void *p)
{
! #if defined(Py_DEBUG) && !defined(Py_DEBUG_NO_PYMALLOC)
_PyObject_DebugFree(p);
#else
PyObject_Free(p);
*** ../vim-7.3.1039/src/version.c 2013-05-29 21:14:37.000000000 +0200
--- src/version.c 2013-05-29 21:32:32.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1040,
/**/
--
hundred-and-one symptoms of being an internet addict:
17. You turn on your intercom when leaving the room so you can hear if new
e-mail arrives.
/// 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 ///

179
7.3.1041 Normal file
View File

@ -0,0 +1,179 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1041
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1041
Problem: Python: Invalid read valgrind errors.
Solution: Python patch 2: defer DICTKEY_UNREF until key is no longer needed.
(ZyX)
Files: src/if_py_both.h
*** ../vim-7.3.1040/src/if_py_both.h 2013-05-28 22:31:43.000000000 +0200
--- src/if_py_both.h 2013-05-29 21:36:29.000000000 +0200
***************
*** 1603,1613 ****
flags = get_option_value_strict(key, NULL, NULL,
self->opt_type, self->from);
- DICTKEY_UNREF
-
if (flags == 0)
{
PyErr_SetObject(PyExc_KeyError, keyObject);
return -1;
}
--- 1603,1612 ----
flags = get_option_value_strict(key, NULL, NULL,
self->opt_type, self->from);
if (flags == 0)
{
PyErr_SetObject(PyExc_KeyError, keyObject);
+ DICTKEY_UNREF
return -1;
}
***************
*** 1617,1633 ****
--- 1616,1635 ----
{
PyErr_SetString(PyExc_ValueError,
_("unable to unset global option"));
+ DICTKEY_UNREF
return -1;
}
else if (!(flags & SOPT_GLOBAL))
{
PyErr_SetString(PyExc_ValueError, _("unable to unset option "
"without global value"));
+ DICTKEY_UNREF
return -1;
}
else
{
unset_global_local_option(key, self->from);
+ DICTKEY_UNREF
return 0;
}
}
***************
*** 1639,1647 ****
int istrue = PyObject_IsTrue(valObject);
if (istrue == -1)
! return -1;
! r = set_option_value_for(key, istrue, NULL,
! opt_flags, self->opt_type, self->from);
}
else if (flags & SOPT_NUM)
{
--- 1641,1650 ----
int istrue = PyObject_IsTrue(valObject);
if (istrue == -1)
! r = -1;
! else
! r = set_option_value_for(key, istrue, NULL,
! opt_flags, self->opt_type, self->from);
}
else if (flags & SOPT_NUM)
{
***************
*** 1657,1662 ****
--- 1660,1666 ----
else
{
PyErr_SetString(PyExc_TypeError, _("object must be integer"));
+ DICTKEY_UNREF
return -1;
}
***************
*** 1670,1678 ****
--- 1674,1688 ----
{
if (PyString_AsStringAndSize(valObject, (char **) &val, NULL) == -1)
+ {
+ DICTKEY_UNREF
return -1;
+ }
if (val == NULL)
+ {
+ DICTKEY_UNREF
return -1;
+ }
val = vim_strsave(val);
}
***************
*** 1682,1693 ****
--- 1692,1712 ----
bytes = PyUnicode_AsEncodedString(valObject, (char *)ENC_OPT, NULL);
if (bytes == NULL)
+ {
+ DICTKEY_UNREF
return -1;
+ }
if(PyString_AsStringAndSize(bytes, (char **) &val, NULL) == -1)
+ {
+ DICTKEY_UNREF
return -1;
+ }
if (val == NULL)
+ {
+ DICTKEY_UNREF
return -1;
+ }
val = vim_strsave(val);
Py_XDECREF(bytes);
***************
*** 1695,1700 ****
--- 1714,1720 ----
else
{
PyErr_SetString(PyExc_TypeError, _("object must be string"));
+ DICTKEY_UNREF
return -1;
}
***************
*** 1703,1708 ****
--- 1723,1730 ----
vim_free(val);
}
+ DICTKEY_UNREF
+
return r;
}
*** ../vim-7.3.1040/src/version.c 2013-05-29 21:33:34.000000000 +0200
--- src/version.c 2013-05-29 21:36:47.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1041,
/**/
--
hundred-and-one symptoms of being an internet addict:
18. Your wife drapes a blond wig over your monitor to remind you of what she
looks like.
/// 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 ///

964
7.3.1042 Normal file
View File

@ -0,0 +1,964 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1042
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1042
Problem: Python: can't assign to vim.Buffer.name.
Solution: Python patch 3. (ZyX)
Files: runtime/doc/if_pyth.txt, src/ex_cmds.c, src/if_py_both.h,
src/if_python3.c, src/if_python.c, src/proto/ex_cmds.pro,
src/testdir/test86.in, src/testdir/test86.ok,
src/testdir/test87.in, src/testdir/test87.ok
*** ../vim-7.3.1041/runtime/doc/if_pyth.txt 2013-05-21 19:49:58.000000000 +0200
--- runtime/doc/if_pyth.txt 2013-05-29 21:40:05.000000000 +0200
***************
*** 250,256 ****
object and always use windows from that tab page (or throw vim.error
in case tab page was deleted). You can keep a reference to both
without keeping a reference to vim module object or |python-tabpage|,
! they will not loose their properties in this case.
vim.tabpages *python-tabpages*
A sequence object providing access to the list of vim tab pages. The
--- 250,256 ----
object and always use windows from that tab page (or throw vim.error
in case tab page was deleted). You can keep a reference to both
without keeping a reference to vim module object or |python-tabpage|,
! they will not lose their properties in this case.
vim.tabpages *python-tabpages*
A sequence object providing access to the list of vim tab pages. The
***************
*** 361,366 ****
--- 361,371 ----
this object will raise KeyError. If option is
|global-local| and local value is missing getting it
will return None.
+ b.name String, RW. Contains buffer name (full path).
+ Note: when assigning to b.name |BufFilePre| and
+ |BufFilePost| autocommands are launched.
+ b.number Buffer number. Can be used as |python-buffers| key.
+ Read-only.
The buffer object methods are:
b.append(str) Append a line to the buffer
*** ../vim-7.3.1041/src/ex_cmds.c 2013-04-14 23:19:32.000000000 +0200
--- src/ex_cmds.c 2013-05-29 21:44:19.000000000 +0200
***************
*** 784,789 ****
--- 784,790 ----
*/
last_line = curbuf->b_ml.ml_line_count;
mark_adjust(line1, line2, last_line - line2, 0L);
+ changed_lines(last_line - num_lines + 1, 0, last_line + 1, num_lines);
if (dest >= line2)
{
mark_adjust(line2 + 1, dest, -num_lines, 0L);
***************
*** 799,804 ****
--- 800,806 ----
curbuf->b_op_start.col = curbuf->b_op_end.col = 0;
mark_adjust(last_line - num_lines + 1, last_line,
-(last_line - dest - extra), 0L);
+ changed_lines(last_line - num_lines + 1, 0, last_line + 1, -extra);
/*
* Now we delete the original text -- webb
***************
*** 2414,2419 ****
--- 2416,2473 ----
info_message = FALSE;
}
+ int
+ rename_buffer(new_fname)
+ char_u *new_fname;
+ {
+ char_u *fname, *sfname, *xfname;
+ #ifdef FEAT_AUTOCMD
+ buf_T *buf = curbuf;
+
+ apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, FALSE, buf);
+ /* buffer changed, don't change name now */
+ if (buf != curbuf)
+ return FAIL;
+ # ifdef FEAT_EVAL
+ if (aborting()) /* autocmds may abort script processing */
+ return FAIL;
+ # endif
+ #endif
+ /*
+ * The name of the current buffer will be changed.
+ * A new (unlisted) buffer entry needs to be made to hold the old file
+ * name, which will become the alternate file name.
+ * But don't set the alternate file name if the buffer didn't have a
+ * name.
+ */
+ fname = buf->b_ffname;
+ sfname = buf->b_sfname;
+ xfname = buf->b_fname;
+ buf->b_ffname = NULL;
+ buf->b_sfname = NULL;
+ if (setfname(buf, new_fname, NULL, TRUE) == FAIL)
+ {
+ buf->b_ffname = fname;
+ buf->b_sfname = sfname;
+ return FAIL;
+ }
+ buf->b_flags |= BF_NOTEDITED;
+ if (xfname != NULL && *xfname != NUL)
+ {
+ buf = buflist_new(fname, xfname, curwin->w_cursor.lnum, 0);
+ if (buf != NULL && !cmdmod.keepalt)
+ curwin->w_alt_fnum = buf->b_fnum;
+ }
+ vim_free(fname);
+ vim_free(sfname);
+ #ifdef FEAT_AUTOCMD
+ apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, FALSE, buf);
+ #endif
+ /* Change directories when the 'acd' option is set. */
+ DO_AUTOCHDIR
+ return OK;
+ }
+
/*
* ":file[!] [fname]".
*/
***************
*** 2421,2429 ****
ex_file(eap)
exarg_T *eap;
{
- char_u *fname, *sfname, *xfname;
- buf_T *buf;
-
/* ":0file" removes the file name. Check for illegal uses ":3file",
* "0file name", etc. */
if (eap->addr_count > 0
--- 2475,2480 ----
***************
*** 2437,2485 ****
if (*eap->arg != NUL || eap->addr_count == 1)
{
! #ifdef FEAT_AUTOCMD
! buf = curbuf;
! apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, FALSE, curbuf);
! /* buffer changed, don't change name now */
! if (buf != curbuf)
! return;
! # ifdef FEAT_EVAL
! if (aborting()) /* autocmds may abort script processing */
! return;
! # endif
! #endif
! /*
! * The name of the current buffer will be changed.
! * A new (unlisted) buffer entry needs to be made to hold the old file
! * name, which will become the alternate file name.
! * But don't set the alternate file name if the buffer didn't have a
! * name.
! */
! fname = curbuf->b_ffname;
! sfname = curbuf->b_sfname;
! xfname = curbuf->b_fname;
! curbuf->b_ffname = NULL;
! curbuf->b_sfname = NULL;
! if (setfname(curbuf, eap->arg, NULL, TRUE) == FAIL)
! {
! curbuf->b_ffname = fname;
! curbuf->b_sfname = sfname;
return;
- }
- curbuf->b_flags |= BF_NOTEDITED;
- if (xfname != NULL && *xfname != NUL)
- {
- buf = buflist_new(fname, xfname, curwin->w_cursor.lnum, 0);
- if (buf != NULL && !cmdmod.keepalt)
- curwin->w_alt_fnum = buf->b_fnum;
- }
- vim_free(fname);
- vim_free(sfname);
- #ifdef FEAT_AUTOCMD
- apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, FALSE, curbuf);
- #endif
- /* Change directories when the 'acd' option is set. */
- DO_AUTOCHDIR
}
/* print full file name if :cd used */
fileinfo(FALSE, FALSE, eap->forceit);
--- 2488,2495 ----
if (*eap->arg != NUL || eap->addr_count == 1)
{
! if (rename_buffer(eap->arg) == FAIL)
return;
}
/* print full file name if :cd used */
fileinfo(FALSE, FALSE, eap->forceit);
*** ../vim-7.3.1041/src/if_py_both.h 2013-05-29 21:37:29.000000000 +0200
--- src/if_py_both.h 2013-05-29 21:47:35.000000000 +0200
***************
*** 30,35 ****
--- 30,43 ----
#define INVALID_WINDOW_VALUE ((win_T *)(-1))
#define INVALID_TABPAGE_VALUE ((tabpage_T *)(-1))
+ #define DICTKEY_DECL \
+ PyObject *dictkey_todecref;
+ #define DICTKEY_GET(err) \
+ if (!(key = StringToChars(keyObject, &dictkey_todecref))) \
+ return err;
+ #define DICTKEY_UNREF \
+ Py_XDECREF(dictkey_todecref);
+
typedef void (*rangeinitializer)(void *);
typedef void (*runner)(const char *, void *
#ifdef PY_CAN_RECURSE
***************
*** 64,69 ****
--- 72,122 ----
{
}
+ /*
+ * The "todecref" argument holds a pointer to PyObject * that must be
+ * DECREF'ed after returned char_u * is no longer needed or NULL if all what
+ * was needed to generate returned value is object.
+ *
+ * Use Py_XDECREF to decrement reference count.
+ */
+ static char_u *
+ StringToChars(PyObject *object, PyObject **todecref)
+ {
+ char_u *p;
+ PyObject *bytes = NULL;
+
+ if (PyBytes_Check(object))
+ {
+
+ if (PyString_AsStringAndSize(object, (char **) &p, NULL) == -1)
+ return NULL;
+ if (p == NULL)
+ return NULL;
+
+ *todecref = NULL;
+ }
+ else if (PyUnicode_Check(object))
+ {
+ bytes = PyUnicode_AsEncodedString(object, (char *)ENC_OPT, NULL);
+ if (bytes == NULL)
+ return NULL;
+
+ if(PyString_AsStringAndSize(bytes, (char **) &p, NULL) == -1)
+ return NULL;
+ if (p == NULL)
+ return NULL;
+
+ *todecref = bytes;
+ }
+ else
+ {
+ PyErr_SetString(PyExc_TypeError, _("object must be string"));
+ return NULL;
+ }
+
+ return (char_u *) p;
+ }
+
/* Output buffer management
*/
***************
*** 1586,1591 ****
--- 1639,1656 ----
return VimTryEnd();
}
+ static void *
+ py_memsave(void *p, size_t len)
+ {
+ void *r;
+ if (!(r = PyMem_Malloc(len)))
+ return NULL;
+ mch_memmove(r, p, len);
+ return r;
+ }
+
+ #define PY_STRSAVE(s) ((char_u *) py_memsave(s, STRLEN(s) + 1))
+
static int
OptionsAssItem(OptionsObject *self, PyObject *keyObject, PyObject *valObject)
{
***************
*** 1670,1726 ****
else
{
char_u *val;
! if (PyBytes_Check(valObject))
! {
! if (PyString_AsStringAndSize(valObject, (char **) &val, NULL) == -1)
! {
! DICTKEY_UNREF
! return -1;
! }
! if (val == NULL)
! {
! DICTKEY_UNREF
! return -1;
! }
!
! val = vim_strsave(val);
! }
! else if (PyUnicode_Check(valObject))
{
! PyObject *bytes;
!
! bytes = PyUnicode_AsEncodedString(valObject, (char *)ENC_OPT, NULL);
! if (bytes == NULL)
! {
! DICTKEY_UNREF
! return -1;
! }
!
! if(PyString_AsStringAndSize(bytes, (char **) &val, NULL) == -1)
! {
! DICTKEY_UNREF
! return -1;
! }
! if (val == NULL)
! {
! DICTKEY_UNREF
! return -1;
! }
!
! val = vim_strsave(val);
! Py_XDECREF(bytes);
}
else
! {
! PyErr_SetString(PyExc_TypeError, _("object must be string"));
! DICTKEY_UNREF
! return -1;
! }
!
! r = set_option_value_for(key, 0, val, opt_flags,
! self->opt_type, self->from);
! vim_free(val);
}
DICTKEY_UNREF
--- 1735,1750 ----
else
{
char_u *val;
! PyObject *todecref;
! if ((val = StringToChars(valObject, &todecref)))
{
! r = set_option_value_for(key, 0, val, opt_flags,
! self->opt_type, self->from);
! Py_XDECREF(todecref);
}
else
! r = -1;
}
DICTKEY_UNREF
***************
*** 2541,2547 ****
array = NULL;
else
{
! array = (char **)alloc((unsigned)(new_len * sizeof(char *)));
if (array == NULL)
{
PyErr_NoMemory();
--- 2565,2571 ----
array = NULL;
else
{
! array = PyMem_New(char *, new_len);
if (array == NULL)
{
PyErr_NoMemory();
***************
*** 2558,2564 ****
{
while (i)
vim_free(array[--i]);
! vim_free(array);
return FAIL;
}
}
--- 2582,2588 ----
{
while (i)
vim_free(array[--i]);
! PyMem_Free(array);
return FAIL;
}
}
***************
*** 2635,2641 ****
* been dealt with (either freed, or the responsibility passed
* to vim.
*/
! vim_free(array);
/* Adjust marks. Invalidate any which lie in the
* changed range, and move any in the remainder of the buffer.
--- 2659,2665 ----
* been dealt with (either freed, or the responsibility passed
* to vim.
*/
! PyMem_Free(array);
/* Adjust marks. Invalidate any which lie in the
* changed range, and move any in the remainder of the buffer.
***************
*** 2717,2723 ****
char **array;
buf_T *savebuf;
! array = (char **)alloc((unsigned)(size * sizeof(char *)));
if (array == NULL)
{
PyErr_NoMemory();
--- 2741,2747 ----
char **array;
buf_T *savebuf;
! array = PyMem_New(char *, size);
if (array == NULL)
{
PyErr_NoMemory();
***************
*** 2733,2739 ****
{
while (i)
vim_free(array[--i]);
! vim_free(array);
return FAIL;
}
}
--- 2757,2763 ----
{
while (i)
vim_free(array[--i]);
! PyMem_Free(array);
return FAIL;
}
}
***************
*** 2768,2774 ****
/* Free the array of lines. All of its contents have now
* been freed.
*/
! vim_free(array);
restore_buffer(savebuf);
update_screen(VALID);
--- 2792,2798 ----
/* Free the array of lines. All of its contents have now
* been freed.
*/
! PyMem_Free(array);
restore_buffer(savebuf);
update_screen(VALID);
***************
*** 3179,3184 ****
--- 3203,3247 ----
return NULL;
}
+ static int
+ BufferSetattr(BufferObject *self, char *name, PyObject *valObject)
+ {
+ if (CheckBuffer(self))
+ return -1;
+
+ if (strcmp(name, "name") == 0)
+ {
+ char_u *val;
+ aco_save_T aco;
+ int r;
+ PyObject *todecref;
+
+ if (!(val = StringToChars(valObject, &todecref)))
+ return -1;
+
+ VimTryStart();
+ /* Using aucmd_*: autocommands will be executed by rename_buffer */
+ aucmd_prepbuf(&aco, self->buf);
+ r = rename_buffer(val);
+ aucmd_restbuf(&aco);
+ Py_XDECREF(todecref);
+ if (VimTryEnd())
+ return -1;
+
+ if (r == FAIL)
+ {
+ PyErr_SetVim(_("failed to rename buffer"));
+ return -1;
+ }
+ return 0;
+ }
+ else
+ {
+ PyErr_SetString(PyExc_AttributeError, name);
+ return -1;
+ }
+ }
+
static PyObject *
BufferAppend(BufferObject *self, PyObject *args)
{
***************
*** 4040,4046 ****
if (result == NULL)
return -1;
! if (set_string_copy(result, tv) == -1)
{
Py_XDECREF(bytes);
return -1;
--- 4103,4109 ----
if (result == NULL)
return -1;
! if (set_string_copy(result, tv))
{
Py_XDECREF(bytes);
return -1;
***************
*** 4169,4179 ****
--- 4232,4244 ----
BufferType.tp_methods = BufferMethods;
#if PY_MAJOR_VERSION >= 3
BufferType.tp_getattro = (getattrofunc)BufferGetattro;
+ BufferType.tp_setattro = (setattrofunc)BufferSetattro;
BufferType.tp_alloc = call_PyType_GenericAlloc;
BufferType.tp_new = call_PyType_GenericNew;
BufferType.tp_free = call_PyObject_Free;
#else
BufferType.tp_getattr = (getattrfunc)BufferGetattr;
+ BufferType.tp_setattr = (setattrfunc)BufferSetattr;
#endif
vim_memset(&WindowType, 0, sizeof(WindowType));
*** ../vim-7.3.1041/src/if_python3.c 2013-05-29 21:33:34.000000000 +0200
--- src/if_python3.c 2013-05-29 21:40:05.000000000 +0200
***************
*** 638,669 ****
#define PYINITIALISED py3initialised
- #define DICTKEY_DECL PyObject *bytes = NULL;
-
- #define DICTKEY_GET(err) \
- if (PyBytes_Check(keyObject)) \
- { \
- if (PyString_AsStringAndSize(keyObject, (char **) &key, NULL) == -1) \
- return err; \
- } \
- else if (PyUnicode_Check(keyObject)) \
- { \
- bytes = PyString_AsBytes(keyObject); \
- if (bytes == NULL) \
- return err; \
- if (PyString_AsStringAndSize(bytes, (char **) &key, NULL) == -1) \
- return err; \
- } \
- else \
- { \
- PyErr_SetString(PyExc_TypeError, _("only string keys are allowed")); \
- return err; \
- }
-
- #define DICTKEY_UNREF \
- if (bytes != NULL) \
- Py_XDECREF(bytes);
-
#define DESTRUCTOR_FINISH(self) Py_TYPE(self)->tp_free((PyObject*)self)
#define WIN_PYTHON_REF(win) win->w_python3_ref
--- 638,643 ----
***************
*** 696,701 ****
--- 670,676 ----
static PyObject *OutputGetattro(PyObject *, PyObject *);
static int OutputSetattro(PyObject *, PyObject *, PyObject *);
static PyObject *BufferGetattro(PyObject *, PyObject *);
+ static int BufferSetattro(PyObject *, PyObject *, PyObject *);
static PyObject *TabPageGetattro(PyObject *, PyObject *);
static PyObject *WindowGetattro(PyObject *, PyObject *);
static int WindowSetattro(PyObject *, PyObject *, PyObject *);
***************
*** 1108,1113 ****
--- 1083,1096 ----
return PyObject_GenericGetAttr(self, nameobj);
}
+ static int
+ BufferSetattro(PyObject *self, PyObject *nameobj, PyObject *val)
+ {
+ GET_ATTR_STRING(name, nameobj);
+
+ return BufferSetattr((BufferObject *)(self), name, val);
+ }
+
static PyObject *
BufferDir(PyObject *self UNUSED)
{
*** ../vim-7.3.1041/src/if_python.c 2013-05-29 21:33:34.000000000 +0200
--- src/if_python.c 2013-05-29 21:40:05.000000000 +0200
***************
*** 676,693 ****
static int initialised = 0;
#define PYINITIALISED initialised
- #define DICTKEY_GET(err) \
- if (!PyString_Check(keyObject)) \
- { \
- PyErr_SetString(PyExc_TypeError, _("only string keys are allowed")); \
- return err; \
- } \
- if (PyString_AsStringAndSize(keyObject, (char **) &key, NULL) == -1) \
- return err;
-
- #define DICTKEY_UNREF
- #define DICTKEY_DECL
-
#define DESTRUCTOR_FINISH(self) self->ob_type->tp_free((PyObject*)self);
#define WIN_PYTHON_REF(win) win->w_python_ref
--- 676,681 ----
***************
*** 926,932 ****
else
{
/* Need to make a copy, value may change when setting new locale. */
! saved_locale = (char *)vim_strsave((char_u *)saved_locale);
(void)setlocale(LC_NUMERIC, "C");
}
#endif
--- 914,920 ----
else
{
/* Need to make a copy, value may change when setting new locale. */
! saved_locale = (char *) PY_STRSAVE(saved_locale);
(void)setlocale(LC_NUMERIC, "C");
}
#endif
***************
*** 953,959 ****
if (saved_locale != NULL)
{
(void)setlocale(LC_NUMERIC, saved_locale);
! vim_free(saved_locale);
}
#endif
--- 941,947 ----
if (saved_locale != NULL)
{
(void)setlocale(LC_NUMERIC, saved_locale);
! PyMem_Free(saved_locale);
}
#endif
*** ../vim-7.3.1041/src/proto/ex_cmds.pro 2012-04-25 17:32:14.000000000 +0200
--- src/proto/ex_cmds.pro 2013-05-29 21:40:05.000000000 +0200
***************
*** 19,24 ****
--- 19,25 ----
void do_fixdel __ARGS((exarg_T *eap));
void print_line_no_prefix __ARGS((linenr_T lnum, int use_number, int list));
void print_line __ARGS((linenr_T lnum, int use_number, int list));
+ int rename_buffer __ARGS((char_u *new_fname));
void ex_file __ARGS((exarg_T *eap));
void ex_update __ARGS((exarg_T *eap));
void ex_write __ARGS((exarg_T *eap));
*** ../vim-7.3.1041/src/testdir/test86.in 2013-05-21 22:23:51.000000000 +0200
--- src/testdir/test86.in 2013-05-29 21:56:41.000000000 +0200
***************
*** 476,481 ****
--- 476,485 ----
:py b=vim.current.buffer
:wincmd w
:mark a
+ :augroup BUFS
+ : autocmd BufFilePost * python cb.append(vim.eval('expand("<abuf>")') + ':BufFilePost:' + vim.eval('bufnr("%")'))
+ : autocmd BufFilePre * python cb.append(vim.eval('expand("<abuf>")') + ':BufFilePre:' + vim.eval('bufnr("%")'))
+ :augroup END
py << EOF
cb = vim.current.buffer
# Tests BufferAppend and BufferItem
***************
*** 496,504 ****
b[0]='bar'
b[0:0]=['baz']
vim.command('call append("$", getbufline(%i, 1, "$"))' % b.number)
# Test CheckBuffer
! vim.command('bwipeout! ' + str(b.number))
! for expr in ('b[1]','b[:] = ["A", "B"]','b[:]','b.append("abc")'):
try:
exec(expr)
except vim.error:
--- 500,519 ----
b[0]='bar'
b[0:0]=['baz']
vim.command('call append("$", getbufline(%i, 1, "$"))' % b.number)
+ # Test assigning to name property
+ old_name = cb.name
+ cb.name = 'foo'
+ cb.append(cb.name[-11:])
+ b.name = 'bar'
+ cb.append(b.name[-11:])
+ cb.name = old_name
+ cb.append(cb.name[-17:])
# Test CheckBuffer
! for _b in vim.buffers:
! if _b is not cb:
! vim.command('bwipeout! ' + str(_b.number))
! del _b
! for expr in ('b[1]','b[:] = ["A", "B"]','b[:]','b.append("abc")', 'b.name = "!"'):
try:
exec(expr)
except vim.error:
***************
*** 507,513 ****
--- 522,533 ----
# Usually a SEGV here
# Should not happen in any case
cb.append('No exception for ' + expr)
+ vim.command('cd .')
EOF
+ :augroup BUFS
+ : autocmd!
+ :augroup END
+ :augroup! BUFS
:"
:" Test vim.buffers object
:set hidden
***************
*** 586,592 ****
else:
return repr(w)
! def Cursor(w, start=len(cb)):
if w.buffer is cb:
return repr((start - w.cursor[0], w.cursor[1]))
else:
--- 606,614 ----
else:
return repr(w)
! start = len(cb)
!
! def Cursor(w):
if w.buffer is cb:
return repr((start - w.cursor[0], w.cursor[1]))
else:
*** ../vim-7.3.1041/src/testdir/test86.ok 2013-05-21 22:38:14.000000000 +0200
--- src/testdir/test86.ok 2013-05-29 21:57:30.000000000 +0200
***************
*** 319,332 ****
Second line
Third line
foo
i:<buffer test86.in>
i2:<buffer test86.in>
i:<buffer a>
i3:<buffer test86.in>
1:<buffer test86.in>=<buffer test86.in>
! 6:<buffer a>=<buffer a>
! 7:<buffer b>=<buffer b>
! 8:<buffer c>=<buffer c>
4
i4:<buffer test86.in>
i4:<buffer test86.in>
--- 319,341 ----
Second line
Third line
foo
+ 1:BufFilePre:1
+ 6:BufFilePost:1
+ testdir/foo
+ 5:BufFilePre:5
+ 5:BufFilePost:5
+ testdir/bar
+ 1:BufFilePre:1
+ 7:BufFilePost:1
+ testdir/test86.in
i:<buffer test86.in>
i2:<buffer test86.in>
i:<buffer a>
i3:<buffer test86.in>
1:<buffer test86.in>=<buffer test86.in>
! 8:<buffer a>=<buffer a>
! 9:<buffer b>=<buffer b>
! 10:<buffer c>=<buffer c>
4
i4:<buffer test86.in>
i4:<buffer test86.in>
***************
*** 335,341 ****
Current tab pages:
<tabpage 0>(1): 1 windows, current is <window object (unknown)>
Windows:
! <window object (unknown)>(1): displays buffer <buffer test86.in>; cursor is at (27, 0)
<tabpage 1>(2): 1 windows, current is <window object (unknown)>
Windows:
<window object (unknown)>(1): displays buffer <buffer 0>; cursor is at (1, 0)
--- 344,350 ----
Current tab pages:
<tabpage 0>(1): 1 windows, current is <window object (unknown)>
Windows:
! <window object (unknown)>(1): displays buffer <buffer test86.in>; cursor is at (36, 0)
<tabpage 1>(2): 1 windows, current is <window object (unknown)>
Windows:
<window object (unknown)>(1): displays buffer <buffer 0>; cursor is at (1, 0)
*** ../vim-7.3.1041/src/testdir/test87.in 2013-05-21 22:23:51.000000000 +0200
--- src/testdir/test87.in 2013-05-29 21:58:50.000000000 +0200
***************
*** 463,468 ****
--- 463,472 ----
:py3 b=vim.current.buffer
:wincmd w
:mark a
+ :augroup BUFS
+ : autocmd BufFilePost * python3 cb.append(vim.eval('expand("<abuf>")') + ':BufFilePost:' + vim.eval('bufnr("%")'))
+ : autocmd BufFilePre * python3 cb.append(vim.eval('expand("<abuf>")') + ':BufFilePre:' + vim.eval('bufnr("%")'))
+ :augroup END
py3 << EOF
cb = vim.current.buffer
# Tests BufferAppend and BufferItem
***************
*** 483,490 ****
b[0]='bar'
b[0:0]=['baz']
vim.command('call append("$", getbufline(%i, 1, "$"))' % b.number)
# Test CheckBuffer
! vim.command('bwipeout! ' + str(b.number))
for expr in ('b[1]','b[:] = ["A", "B"]','b[:]','b.append("abc")'):
try:
exec(expr)
--- 487,505 ----
b[0]='bar'
b[0:0]=['baz']
vim.command('call append("$", getbufline(%i, 1, "$"))' % b.number)
+ # Test assigning to name property
+ old_name = cb.name
+ cb.name = 'foo'
+ cb.append(cb.name[-11:])
+ b.name = 'bar'
+ cb.append(b.name[-11:])
+ cb.name = old_name
+ cb.append(cb.name[-17:])
# Test CheckBuffer
! for _b in vim.buffers:
! if _b is not cb:
! vim.command('bwipeout! ' + str(_b.number))
! del _b
for expr in ('b[1]','b[:] = ["A", "B"]','b[:]','b.append("abc")'):
try:
exec(expr)
***************
*** 494,499 ****
--- 509,515 ----
# Usually a SEGV here
# Should not happen in any case
cb.append('No exception for ' + expr)
+ vim.command('cd .')
EOF
:"
:" Test vim.buffers object
*** ../vim-7.3.1041/src/testdir/test87.ok 2013-05-21 22:38:14.000000000 +0200
--- src/testdir/test87.ok 2013-05-29 21:59:04.000000000 +0200
***************
*** 308,321 ****
Second line
Third line
foo
i:<buffer test87.in>
i2:<buffer test87.in>
i:<buffer a>
i3:<buffer test87.in>
1:<buffer test87.in>=<buffer test87.in>
! 6:<buffer a>=<buffer a>
! 7:<buffer b>=<buffer b>
! 8:<buffer c>=<buffer c>
4
i4:<buffer test87.in>
i4:<buffer test87.in>
--- 308,330 ----
Second line
Third line
foo
+ 1:BufFilePre:1
+ 6:BufFilePost:1
+ testdir/foo
+ 5:BufFilePre:5
+ 5:BufFilePost:5
+ testdir/bar
+ 1:BufFilePre:1
+ 7:BufFilePost:1
+ testdir/test87.in
i:<buffer test87.in>
i2:<buffer test87.in>
i:<buffer a>
i3:<buffer test87.in>
1:<buffer test87.in>=<buffer test87.in>
! 8:<buffer a>=<buffer a>
! 9:<buffer b>=<buffer b>
! 10:<buffer c>=<buffer c>
4
i4:<buffer test87.in>
i4:<buffer test87.in>
***************
*** 324,330 ****
Current tab pages:
<tabpage 0>(1): 1 windows, current is <window object (unknown)>
Windows:
! <window object (unknown)>(1): displays buffer <buffer test87.in>; cursor is at (27, 0)
<tabpage 1>(2): 1 windows, current is <window object (unknown)>
Windows:
<window object (unknown)>(1): displays buffer <buffer 0>; cursor is at (1, 0)
--- 333,339 ----
Current tab pages:
<tabpage 0>(1): 1 windows, current is <window object (unknown)>
Windows:
! <window object (unknown)>(1): displays buffer <buffer test87.in>; cursor is at (36, 0)
<tabpage 1>(2): 1 windows, current is <window object (unknown)>
Windows:
<window object (unknown)>(1): displays buffer <buffer 0>; cursor is at (1, 0)
*** ../vim-7.3.1041/src/version.c 2013-05-29 21:37:29.000000000 +0200
--- src/version.c 2013-05-29 22:01:11.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1042,
/**/
--
hundred-and-one symptoms of being an internet addict:
19. All of your friends have an @ in their names.
/// 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 ///

240
7.3.1043 Normal file
View File

@ -0,0 +1,240 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1043
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1043
Problem: Python: Dynamic compilation with 2.3 fails.
Solution: Python patch 4. (ZyX)
Files: src/if_python.c
*** ../vim-7.3.1042/src/if_python.c 2013-05-29 22:02:18.000000000 +0200
--- src/if_python.c 2013-05-29 22:04:43.000000000 +0200
***************
*** 194,199 ****
--- 194,200 ----
# define PyDict_New dll_PyDict_New
# define PyDict_GetItemString dll_PyDict_GetItemString
# define PyDict_Next dll_PyDict_Next
+ # define PyDict_Type (*dll_PyDict_Type)
# ifdef PyMapping_Items
# define PY_NO_MAPPING_ITEMS
# else
***************
*** 234,241 ****
# define Py_IsInitialized dll_Py_IsInitialized
# define _PyObject_New dll__PyObject_New
# define _PyObject_GC_New dll__PyObject_GC_New
! # define PyObject_GC_Del dll_PyObject_GC_Del
! # define PyObject_GC_UnTrack dll_PyObject_GC_UnTrack
# if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02070000
# define _PyObject_NextNotImplemented (*dll__PyObject_NextNotImplemented)
# endif
--- 235,248 ----
# define Py_IsInitialized dll_Py_IsInitialized
# define _PyObject_New dll__PyObject_New
# define _PyObject_GC_New dll__PyObject_GC_New
! # ifdef PyObject_GC_Del
! # define Py_underscore_GC
! # define _PyObject_GC_Del dll__PyObject_GC_Del
! # define _PyObject_GC_UnTrack dll__PyObject_GC_UnTrack
! # else
! # define PyObject_GC_Del dll_PyObject_GC_Del
! # define PyObject_GC_UnTrack dll_PyObject_GC_UnTrack
! # endif
# if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02070000
# define _PyObject_NextNotImplemented (*dll__PyObject_NextNotImplemented)
# endif
***************
*** 247,259 ****
# define PyObject_IsTrue dll_PyObject_IsTrue
# if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02020000
# define PyType_IsSubtype dll_PyType_IsSubtype
- # endif
- # if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02030000
# ifdef Py_DEBUG
# define _Py_NegativeRefcount dll__Py_NegativeRefcount
# define _Py_RefTotal (*dll__Py_RefTotal)
# define _Py_Dealloc dll__Py_Dealloc
# endif
# if defined(Py_DEBUG) && !defined(Py_DEBUG_NO_PYMALLOC)
# define _PyObject_DebugMalloc dll__PyObject_DebugMalloc
# define _PyObject_DebugFree dll__PyObject_DebugFree
--- 254,266 ----
# define PyObject_IsTrue dll_PyObject_IsTrue
# if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02020000
# define PyType_IsSubtype dll_PyType_IsSubtype
# ifdef Py_DEBUG
# define _Py_NegativeRefcount dll__Py_NegativeRefcount
# define _Py_RefTotal (*dll__Py_RefTotal)
# define _Py_Dealloc dll__Py_Dealloc
# endif
+ # endif
+ # if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02030000
# if defined(Py_DEBUG) && !defined(Py_DEBUG_NO_PYMALLOC)
# define _PyObject_DebugMalloc dll__PyObject_DebugMalloc
# define _PyObject_DebugFree dll__PyObject_DebugFree
***************
*** 316,322 ****
static PyObject*(*dll_PyImport_ImportModule)(const char *);
static PyObject*(*dll_PyDict_New)(void);
static PyObject*(*dll_PyDict_GetItemString)(PyObject *, const char *);
! static int (*dll_PyDict_Next)(PyObject *, Py_ssize_t *, PyObject **, PyObject **);
# ifndef PY_NO_MAPPING_ITEMS
static PyObject* (*dll_PyMapping_Items)(PyObject *);
# endif
--- 323,330 ----
static PyObject*(*dll_PyImport_ImportModule)(const char *);
static PyObject*(*dll_PyDict_New)(void);
static PyObject*(*dll_PyDict_GetItemString)(PyObject *, const char *);
! static int (*dll_PyDict_Next)(PyObject *, PyInt *, PyObject **, PyObject **);
! static PyTypeObject* dll_PyDict_Type;
# ifndef PY_NO_MAPPING_ITEMS
static PyObject* (*dll_PyMapping_Items)(PyObject *);
# endif
***************
*** 354,361 ****
--- 362,374 ----
static int(*dll_Py_IsInitialized)(void);
static PyObject*(*dll__PyObject_New)(PyTypeObject *, PyObject *);
static PyObject*(*dll__PyObject_GC_New)(PyTypeObject *);
+ # ifdef Py_underscore_GC
+ static void(*dll__PyObject_GC_Del)(void *);
+ static void(*dll__PyObject_GC_UnTrack)(void *);
+ # else
static void(*dll_PyObject_GC_Del)(void *);
static void(*dll_PyObject_GC_UnTrack)(void *);
+ # endif
static PyObject*(*dll__PyObject_Init)(PyObject *, PyTypeObject *);
static PyObject* (*dll_PyObject_GetIter)(PyObject *);
static int (*dll_PyObject_IsTrue)(PyObject *);
***************
*** 367,379 ****
static PyObject* dll__Py_TrueStruct;
# if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02020000
static int (*dll_PyType_IsSubtype)(PyTypeObject *, PyTypeObject *);
- # endif
- # if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02030000
# ifdef Py_DEBUG
static void (*dll__Py_NegativeRefcount)(const char *fname, int lineno, PyObject *op);
! static Py_ssize_t* dll__Py_RefTotal;
static void (*dll__Py_Dealloc)(PyObject *obj);
# endif
# if defined(Py_DEBUG) && !defined(Py_DEBUG_NO_PYMALLOC)
static void (*dll__PyObject_DebugFree)(void*);
static void* (*dll__PyObject_DebugMalloc)(size_t);
--- 380,392 ----
static PyObject* dll__Py_TrueStruct;
# if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02020000
static int (*dll_PyType_IsSubtype)(PyTypeObject *, PyTypeObject *);
# ifdef Py_DEBUG
static void (*dll__Py_NegativeRefcount)(const char *fname, int lineno, PyObject *op);
! static PyInt* dll__Py_RefTotal;
static void (*dll__Py_Dealloc)(PyObject *obj);
# endif
+ # endif
+ # if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02030000
# if defined(Py_DEBUG) && !defined(Py_DEBUG_NO_PYMALLOC)
static void (*dll__PyObject_DebugFree)(void*);
static void* (*dll__PyObject_DebugMalloc)(size_t);
***************
*** 470,475 ****
--- 483,489 ----
{"PyDict_GetItemString", (PYTHON_PROC*)&dll_PyDict_GetItemString},
{"PyDict_Next", (PYTHON_PROC*)&dll_PyDict_Next},
{"PyDict_New", (PYTHON_PROC*)&dll_PyDict_New},
+ {"PyDict_Type", (PYTHON_PROC*)&dll_PyDict_Type},
# ifndef PY_NO_MAPPING_ITEMS
{"PyMapping_Items", (PYTHON_PROC*)&dll_PyMapping_Items},
# endif
***************
*** 504,511 ****
--- 518,530 ----
{"Py_IsInitialized", (PYTHON_PROC*)&dll_Py_IsInitialized},
{"_PyObject_New", (PYTHON_PROC*)&dll__PyObject_New},
{"_PyObject_GC_New", (PYTHON_PROC*)&dll__PyObject_GC_New},
+ # ifdef Py_underscore_GC
+ {"_PyObject_GC_Del", (PYTHON_PROC*)&dll__PyObject_GC_Del},
+ {"_PyObject_GC_UnTrack", (PYTHON_PROC*)&dll__PyObject_GC_UnTrack},
+ # else
{"PyObject_GC_Del", (PYTHON_PROC*)&dll_PyObject_GC_Del},
{"PyObject_GC_UnTrack", (PYTHON_PROC*)&dll_PyObject_GC_UnTrack},
+ # endif
{"PyObject_Init", (PYTHON_PROC*)&dll__PyObject_Init},
{"PyObject_GetIter", (PYTHON_PROC*)&dll_PyObject_GetIter},
{"PyObject_IsTrue", (PYTHON_PROC*)&dll_PyObject_IsTrue},
***************
*** 516,529 ****
{"_Py_ZeroStruct", (PYTHON_PROC*)&dll__Py_ZeroStruct},
{"_Py_TrueStruct", (PYTHON_PROC*)&dll__Py_TrueStruct},
# if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02020000
- {"PyType_IsSubtype", (PYTHON_PROC*)&dll_PyType_IsSubtype},
- # endif
- # if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02030000
# ifdef Py_DEBUG
{"_Py_NegativeRefcount", (PYTHON_PROC*)&dll__Py_NegativeRefcount},
{"_Py_RefTotal", (PYTHON_PROC*)&dll__Py_RefTotal},
{"_Py_Dealloc", (PYTHON_PROC*)&dll__Py_Dealloc},
# endif
# if defined(Py_DEBUG) && !defined(Py_DEBUG_NO_PYMALLOC)
{"_PyObject_DebugFree", (PYTHON_PROC*)&dll__PyObject_DebugFree},
{"_PyObject_DebugMalloc", (PYTHON_PROC*)&dll__PyObject_DebugMalloc},
--- 535,548 ----
{"_Py_ZeroStruct", (PYTHON_PROC*)&dll__Py_ZeroStruct},
{"_Py_TrueStruct", (PYTHON_PROC*)&dll__Py_TrueStruct},
# if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02020000
# ifdef Py_DEBUG
{"_Py_NegativeRefcount", (PYTHON_PROC*)&dll__Py_NegativeRefcount},
{"_Py_RefTotal", (PYTHON_PROC*)&dll__Py_RefTotal},
{"_Py_Dealloc", (PYTHON_PROC*)&dll__Py_Dealloc},
# endif
+ {"PyType_IsSubtype", (PYTHON_PROC*)&dll_PyType_IsSubtype},
+ # endif
+ # if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02030000
# if defined(Py_DEBUG) && !defined(Py_DEBUG_NO_PYMALLOC)
{"_PyObject_DebugFree", (PYTHON_PROC*)&dll__PyObject_DebugFree},
{"_PyObject_DebugMalloc", (PYTHON_PROC*)&dll__PyObject_DebugMalloc},
***************
*** 696,703 ****
#endif
#ifndef Py_CLEAR
# define Py_CLEAR(obj) \
! Py_XDECREF(obj); \
! obj = NULL;
#endif
/*
--- 715,724 ----
#endif
#ifndef Py_CLEAR
# define Py_CLEAR(obj) \
! { \
! Py_XDECREF(obj); \
! obj = NULL; \
! }
#endif
/*
*** ../vim-7.3.1042/src/version.c 2013-05-29 22:02:18.000000000 +0200
--- src/version.c 2013-05-29 22:04:56.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1043,
/**/
--
When a fly lands on the ceiling, does it do a half roll or
a half loop?
/// 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 ///

391
7.3.1044 Normal file
View File

@ -0,0 +1,391 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1044
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1044
Problem: Python: No {Buffer,TabPage,Window}.valid attributes.
Solution: Python patch 5: add .valid (ZyX)
Files: src/if_py_both.h, src/if_python3.c, src/if_python.c,
src/testdir/test86.in, src/testdir/test86.ok,
src/testdir/test87.in, src/testdir/test87.ok
*** ../vim-7.3.1043/src/if_py_both.h 2013-05-29 22:02:18.000000000 +0200
--- src/if_py_both.h 2013-05-29 22:08:36.000000000 +0200
***************
*** 1815,1820 ****
--- 1815,1833 ----
}
static PyObject *
+ TabPageAttrValid(TabPageObject *self, char *name)
+ {
+ PyObject *r;
+
+ if (strcmp(name, "valid") != 0)
+ return NULL;
+
+ r = ((self->tab == INVALID_TABPAGE_VALUE) ? Py_False : Py_True);
+ Py_INCREF(r);
+ return r;
+ }
+
+ static PyObject *
TabPageAttr(TabPageObject *self, char *name)
{
if (strcmp(name, "windows") == 0)
***************
*** 2010,2015 ****
--- 2023,2041 ----
}
static PyObject *
+ WindowAttrValid(WindowObject *self, char *name)
+ {
+ PyObject *r;
+
+ if (strcmp(name, "valid") != 0)
+ return NULL;
+
+ r = ((self->win == INVALID_WINDOW_VALUE) ? Py_False : Py_True);
+ Py_INCREF(r);
+ return r;
+ }
+
+ static PyObject *
WindowAttr(WindowObject *self, char *name)
{
if (strcmp(name, "buffer") == 0)
***************
*** 2050,2057 ****
return (PyObject *)(self->tabObject);
}
else if (strcmp(name,"__members__") == 0)
! return Py_BuildValue("[sssssssss]", "buffer", "cursor", "height",
! "vars", "options", "number", "row", "col", "tabpage");
else
return NULL;
}
--- 2076,2083 ----
return (PyObject *)(self->tabObject);
}
else if (strcmp(name,"__members__") == 0)
! return Py_BuildValue("[ssssssssss]", "buffer", "cursor", "height",
! "vars", "options", "number", "row", "col", "tabpage", "valid");
else
return NULL;
}
***************
*** 3186,3191 ****
--- 3212,3230 ----
}
static PyObject *
+ BufferAttrValid(BufferObject *self, char *name)
+ {
+ PyObject *r;
+
+ if (strcmp(name, "valid") != 0)
+ return NULL;
+
+ r = ((self->buf == INVALID_BUFFER_VALUE) ? Py_False : Py_True);
+ Py_INCREF(r);
+ return r;
+ }
+
+ static PyObject *
BufferAttr(BufferObject *self, char *name)
{
if (strcmp(name, "name") == 0)
***************
*** 3198,3204 ****
return OptionsNew(SREQ_BUF, self->buf, (checkfun) CheckBuffer,
(PyObject *) self);
else if (strcmp(name,"__members__") == 0)
! return Py_BuildValue("[ssss]", "name", "number", "vars", "options");
else
return NULL;
}
--- 3237,3244 ----
return OptionsNew(SREQ_BUF, self->buf, (checkfun) CheckBuffer,
(PyObject *) self);
else if (strcmp(name,"__members__") == 0)
! return Py_BuildValue("[sssss]", "name", "number", "vars", "options",
! "valid");
else
return NULL;
}
*** ../vim-7.3.1043/src/if_python3.c 2013-05-29 22:02:18.000000000 +0200
--- src/if_python3.c 2013-05-29 22:08:36.000000000 +0200
***************
*** 1067,1078 ****
*/
static PyObject *
! BufferGetattro(PyObject *self, PyObject*nameobj)
{
PyObject *r;
GET_ATTR_STRING(name, nameobj);
if (CheckBuffer((BufferObject *)(self)))
return NULL;
--- 1067,1081 ----
*/
static PyObject *
! BufferGetattro(PyObject *self, PyObject *nameobj)
{
PyObject *r;
GET_ATTR_STRING(name, nameobj);
+ if ((r = BufferAttrValid((BufferObject *)(self), name)))
+ return r;
+
if (CheckBuffer((BufferObject *)(self)))
return NULL;
***************
*** 1094,1101 ****
static PyObject *
BufferDir(PyObject *self UNUSED)
{
! return Py_BuildValue("[sssss]", "name", "number",
! "append", "mark", "range");
}
/******************/
--- 1097,1105 ----
static PyObject *
BufferDir(PyObject *self UNUSED)
{
! return Py_BuildValue("[ssssssss]",
! "name", "number", "vars", "options", "valid",
! "append", "mark", "range");
}
/******************/
***************
*** 1283,1288 ****
--- 1287,1295 ----
GET_ATTR_STRING(name, nameobj);
+ if ((r = TabPageAttrValid((TabPageObject *)(self), name)))
+ return r;
+
if (CheckTabPage((TabPageObject *)(self)))
return NULL;
***************
*** 1303,1308 ****
--- 1310,1318 ----
GET_ATTR_STRING(name, nameobj);
+ if ((r = WindowAttrValid((WindowObject *)(self), name)))
+ return r;
+
if (CheckWindow((WindowObject *)(self)))
return NULL;
*** ../vim-7.3.1043/src/if_python.c 2013-05-29 22:05:51.000000000 +0200
--- src/if_python.c 2013-05-29 22:08:36.000000000 +0200
***************
*** 1125,1130 ****
--- 1125,1133 ----
{
PyObject *r;
+ if ((r = BufferAttrValid((BufferObject *)(self), name)))
+ return r;
+
if (CheckBuffer((BufferObject *)(self)))
return NULL;
***************
*** 1206,1211 ****
--- 1209,1217 ----
{
PyObject *r;
+ if ((r = TabPageAttrValid((TabPageObject *)(self), name)))
+ return r;
+
if (CheckTabPage((TabPageObject *)(self)))
return NULL;
***************
*** 1224,1229 ****
--- 1230,1238 ----
{
PyObject *r;
+ if ((r = WindowAttrValid((WindowObject *)(self), name)))
+ return r;
+
if (CheckWindow((WindowObject *)(self)))
return NULL;
*** ../vim-7.3.1043/src/testdir/test86.in 2013-05-29 22:02:18.000000000 +0200
--- src/testdir/test86.in 2013-05-29 22:08:36.000000000 +0200
***************
*** 513,518 ****
--- 513,519 ----
if _b is not cb:
vim.command('bwipeout! ' + str(_b.number))
del _b
+ cb.append('valid: b:%s, cb:%s' % (repr(b.valid), repr(cb.valid)))
for expr in ('b[1]','b[:] = ["A", "B"]','b[:]','b.append("abc")', 'b.name = "!"'):
try:
exec(expr)
***************
*** 663,671 ****
--- 664,676 ----
cb.append('Current window: ' + repr(vim.current.window))
cb.append('Current buffer: ' + repr(vim.current.buffer))
cb.append('Current line: ' + repr(vim.current.line))
+ ws = list(vim.windows)
+ ts = list(vim.tabpages)
for b in vim.buffers:
if b is not cb:
vim.command('bwipeout! ' + str(b.number))
+ cb.append('w.valid: ' + repr([w.valid for w in ws]))
+ cb.append('t.valid: ' + repr([t.valid for t in ts]))
EOF
:tabonly!
:only!
*** ../vim-7.3.1043/src/testdir/test86.ok 2013-05-29 22:02:18.000000000 +0200
--- src/testdir/test86.ok 2013-05-29 22:09:47.000000000 +0200
***************
*** 328,333 ****
--- 328,334 ----
1:BufFilePre:1
7:BufFilePost:1
testdir/test86.in
+ valid: b:False, cb:True
i:<buffer test86.in>
i2:<buffer test86.in>
i:<buffer a>
***************
*** 344,350 ****
Current tab pages:
<tabpage 0>(1): 1 windows, current is <window object (unknown)>
Windows:
! <window object (unknown)>(1): displays buffer <buffer test86.in>; cursor is at (36, 0)
<tabpage 1>(2): 1 windows, current is <window object (unknown)>
Windows:
<window object (unknown)>(1): displays buffer <buffer 0>; cursor is at (1, 0)
--- 345,351 ----
Current tab pages:
<tabpage 0>(1): 1 windows, current is <window object (unknown)>
Windows:
! <window object (unknown)>(1): displays buffer <buffer test86.in>; cursor is at (37, 0)
<tabpage 1>(2): 1 windows, current is <window object (unknown)>
Windows:
<window object (unknown)>(1): displays buffer <buffer 0>; cursor is at (1, 0)
***************
*** 370,375 ****
--- 371,378 ----
Current window: <window 0>
Current buffer: <buffer test86.in>
Current line: 'Type error at assigning None to vim.current.buffer'
+ w.valid: [True, False]
+ t.valid: [True, False, True, False]
vim.vars:Dictionary:True
vim.options:Options:True
vim.bindeval("{}"):Dictionary:True
*** ../vim-7.3.1043/src/testdir/test87.in 2013-05-29 22:02:18.000000000 +0200
--- src/testdir/test87.in 2013-05-29 22:08:36.000000000 +0200
***************
*** 500,505 ****
--- 500,506 ----
if _b is not cb:
vim.command('bwipeout! ' + str(_b.number))
del _b
+ cb.append('valid: b:%s, cb:%s' % (repr(b.valid), repr(cb.valid)))
for expr in ('b[1]','b[:] = ["A", "B"]','b[:]','b.append("abc")'):
try:
exec(expr)
***************
*** 641,649 ****
--- 642,654 ----
cb.append('Current window: ' + repr(vim.current.window))
cb.append('Current buffer: ' + repr(vim.current.buffer))
cb.append('Current line: ' + repr(vim.current.line))
+ ws = list(vim.windows)
+ ts = list(vim.tabpages)
for b in vim.buffers:
if b is not cb:
vim.command('bwipeout! ' + str(b.number))
+ cb.append('w.valid: ' + repr([w.valid for w in ws]))
+ cb.append('t.valid: ' + repr([t.valid for t in ts]))
EOF
:tabonly!
:only!
*** ../vim-7.3.1043/src/testdir/test87.ok 2013-05-29 22:02:18.000000000 +0200
--- src/testdir/test87.ok 2013-05-29 22:10:11.000000000 +0200
***************
*** 317,322 ****
--- 317,323 ----
1:BufFilePre:1
7:BufFilePost:1
testdir/test87.in
+ valid: b:False, cb:True
i:<buffer test87.in>
i2:<buffer test87.in>
i:<buffer a>
***************
*** 333,339 ****
Current tab pages:
<tabpage 0>(1): 1 windows, current is <window object (unknown)>
Windows:
! <window object (unknown)>(1): displays buffer <buffer test87.in>; cursor is at (36, 0)
<tabpage 1>(2): 1 windows, current is <window object (unknown)>
Windows:
<window object (unknown)>(1): displays buffer <buffer 0>; cursor is at (1, 0)
--- 334,340 ----
Current tab pages:
<tabpage 0>(1): 1 windows, current is <window object (unknown)>
Windows:
! <window object (unknown)>(1): displays buffer <buffer test87.in>; cursor is at (37, 0)
<tabpage 1>(2): 1 windows, current is <window object (unknown)>
Windows:
<window object (unknown)>(1): displays buffer <buffer 0>; cursor is at (1, 0)
***************
*** 359,364 ****
--- 360,367 ----
Current window: <window 0>
Current buffer: <buffer test87.in>
Current line: 'Type error at assigning None to vim.current.buffer'
+ w.valid: [True, False]
+ t.valid: [True, False, True, False]
vim.vars:Dictionary:True
vim.options:Options:True
vim.bindeval("{}"):Dictionary:True
*** ../vim-7.3.1043/src/version.c 2013-05-29 22:05:51.000000000 +0200
--- src/version.c 2013-05-29 22:10:45.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1044,
/**/
--
hundred-and-one symptoms of being an internet addict:
20. When looking at a pageful of someone else's links, you notice all of them
are already highlighted in purple.
/// 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 ///

173
7.3.1045 Normal file
View File

@ -0,0 +1,173 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1045
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1045
Problem: Python: No error handling for VimToPython function.
Solution: Python patch 6. (ZyX)
Files: src/if_py_both.h
*** ../vim-7.3.1044/src/if_py_both.h 2013-05-29 22:15:26.000000000 +0200
--- src/if_py_both.h 2013-05-29 22:17:56.000000000 +0200
***************
*** 432,439 ****
sprintf(ptrBuf, "%p",
our_tv->v_type == VAR_LIST ? (void *)our_tv->vval.v_list
: (void *)our_tv->vval.v_dict);
! result = PyDict_GetItemString(lookupDict, ptrBuf);
! if (result != NULL)
{
Py_INCREF(result);
return result;
--- 432,439 ----
sprintf(ptrBuf, "%p",
our_tv->v_type == VAR_LIST ? (void *)our_tv->vval.v_list
: (void *)our_tv->vval.v_dict);
!
! if ((result = PyDict_GetItemString(lookupDict, ptrBuf)))
{
Py_INCREF(result);
return result;
***************
*** 467,510 ****
list_T *list = our_tv->vval.v_list;
listitem_T *curr;
! result = PyList_New(0);
! if (list != NULL)
{
! PyDict_SetItemString(lookupDict, ptrBuf, result);
! for (curr = list->lv_first; curr != NULL; curr = curr->li_next)
{
- newObj = VimToPython(&curr->li_tv, depth + 1, lookupDict);
- PyList_Append(result, newObj);
Py_DECREF(newObj);
}
}
}
else if (our_tv->v_type == VAR_DICT)
{
- result = PyDict_New();
! if (our_tv->vval.v_dict != NULL)
! {
! hashtab_T *ht = &our_tv->vval.v_dict->dv_hashtab;
! long_u todo = ht->ht_used;
! hashitem_T *hi;
! dictitem_T *di;
! PyDict_SetItemString(lookupDict, ptrBuf, result);
! for (hi = ht->ht_array; todo > 0; ++hi)
{
! if (!HASHITEM_EMPTY(hi))
! {
! --todo;
! di = dict_lookup(hi);
! newObj = VimToPython(&di->di_tv, depth + 1, lookupDict);
! PyDict_SetItemString(result, (char *)hi->hi_key, newObj);
Py_DECREF(newObj);
}
}
}
}
--- 467,538 ----
list_T *list = our_tv->vval.v_list;
listitem_T *curr;
! if (list == NULL)
! return NULL;
!
! if (!(result = PyList_New(0)))
! return NULL;
! if (PyDict_SetItemString(lookupDict, ptrBuf, result))
{
! Py_DECREF(result);
! return NULL;
! }
! for (curr = list->lv_first; curr != NULL; curr = curr->li_next)
! {
! if (!(newObj = VimToPython(&curr->li_tv, depth + 1, lookupDict)))
! {
! Py_DECREF(result);
! return NULL;
! }
! if (PyList_Append(result, newObj))
{
Py_DECREF(newObj);
+ Py_DECREF(result);
+ return NULL;
}
+ Py_DECREF(newObj);
}
}
else if (our_tv->v_type == VAR_DICT)
{
! hashtab_T *ht = &our_tv->vval.v_dict->dv_hashtab;
! long_u todo = ht->ht_used;
! hashitem_T *hi;
! dictitem_T *di;
! if (our_tv->vval.v_dict == NULL)
! return NULL;
!
! if (!(result = PyDict_New()))
! return NULL;
! if (PyDict_SetItemString(lookupDict, ptrBuf, result))
! {
! Py_DECREF(result);
! return NULL;
! }
! for (hi = ht->ht_array; todo > 0; ++hi)
! {
! if (!HASHITEM_EMPTY(hi))
{
! --todo;
! di = dict_lookup(hi);
! if (!(newObj = VimToPython(&di->di_tv, depth + 1, lookupDict)))
! {
! Py_DECREF(result);
! return NULL;
! }
! if (PyDict_SetItemString(result, (char *)hi->hi_key, newObj))
! {
! Py_DECREF(result);
Py_DECREF(newObj);
+ return NULL;
}
+ Py_DECREF(newObj);
}
}
}
*** ../vim-7.3.1044/src/version.c 2013-05-29 22:15:26.000000000 +0200
--- src/version.c 2013-05-29 22:17:30.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1045,
/**/
--
Shift happens.
-- Doppler
/// 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 ///

105
7.3.1046 Normal file
View File

@ -0,0 +1,105 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1046
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1046
Problem: Python: Using Py_BuildValue for building strings.
Solution: Python patch 7 and 7.5: Replace Py_BuildValue with
PyString_FromString. (ZyX)
Files: src/if_py_both.h
*** ../vim-7.3.1045/src/if_py_both.h 2013-05-29 22:19:57.000000000 +0200
--- src/if_py_both.h 2013-05-29 22:24:52.000000000 +0200
***************
*** 442,448 ****
if (our_tv->v_type == VAR_STRING)
{
! result = Py_BuildValue("s", our_tv->vval.v_string == NULL
? "" : (char *)our_tv->vval.v_string);
}
else if (our_tv->v_type == VAR_NUMBER)
--- 442,448 ----
if (our_tv->v_type == VAR_STRING)
{
! result = PyString_FromString(our_tv->vval.v_string == NULL
? "" : (char *)our_tv->vval.v_string);
}
else if (our_tv->v_type == VAR_NUMBER)
***************
*** 451,457 ****
/* For backwards compatibility numbers are stored as strings. */
sprintf(buf, "%ld", (long)our_tv->vval.v_number);
! result = Py_BuildValue("s", buf);
}
# ifdef FEAT_FLOAT
else if (our_tv->v_type == VAR_FLOAT)
--- 451,457 ----
/* For backwards compatibility numbers are stored as strings. */
sprintf(buf, "%ld", (long)our_tv->vval.v_number);
! result = PyString_FromString((char *) buf);
}
# ifdef FEAT_FLOAT
else if (our_tv->v_type == VAR_FLOAT)
***************
*** 459,465 ****
char buf[NUMBUFLEN];
sprintf(buf, "%f", our_tv->vval.v_float);
! result = Py_BuildValue("s", buf);
}
# endif
else if (our_tv->v_type == VAR_LIST)
--- 459,465 ----
char buf[NUMBUFLEN];
sprintf(buf, "%f", our_tv->vval.v_float);
! result = PyString_FromString((char *) buf);
}
# endif
else if (our_tv->v_type == VAR_LIST)
***************
*** 3256,3262 ****
BufferAttr(BufferObject *self, char *name)
{
if (strcmp(name, "name") == 0)
! return Py_BuildValue("s", self->buf->b_ffname);
else if (strcmp(name, "number") == 0)
return Py_BuildValue(Py_ssize_t_fmt, self->buf->b_fnum);
else if (strcmp(name, "vars") == 0)
--- 3256,3263 ----
BufferAttr(BufferObject *self, char *name)
{
if (strcmp(name, "name") == 0)
! return PyString_FromString((self->buf->b_ffname == NULL
! ? "" : (char *) self->buf->b_ffname));
else if (strcmp(name, "number") == 0)
return Py_BuildValue(Py_ssize_t_fmt, self->buf->b_fnum);
else if (strcmp(name, "vars") == 0)
*** ../vim-7.3.1045/src/version.c 2013-05-29 22:19:57.000000000 +0200
--- src/version.c 2013-05-29 22:25:14.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1046,
/**/
--
hundred-and-one symptoms of being an internet addict:
21. Your dog has its own home page.
/// 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 ///

743
7.3.1047 Normal file
View File

@ -0,0 +1,743 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1047
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1047
Problem: Python: dir() does not work properly.
Solution: Python patch 8. Add __dir__ method to all objects with custom
tp_getattr supplemented by __members__ attribute for at least
python-2* versions. __members__ is not mentioned in python-3*
dir() output even if it is accessible. (ZyX)
Files: src/if_py_both.h, src/if_python3.c, src/if_python.c,
src/testdir/test86.in, src/testdir/test86.ok,
src/testdir/test87.in, src/testdir/test87.ok
*** ../vim-7.3.1046/src/if_py_both.h 2013-05-29 22:26:15.000000000 +0200
--- src/if_py_both.h 2013-05-29 22:29:26.000000000 +0200
***************
*** 117,122 ****
--- 117,175 ----
return (char_u *) p;
}
+ static int
+ add_string(PyObject *list, char *s)
+ {
+ PyObject *string;
+
+ if (!(string = PyString_FromString(s)))
+ return -1;
+ if (PyList_Append(list, string))
+ {
+ Py_DECREF(string);
+ return -1;
+ }
+
+ Py_DECREF(string);
+ return 0;
+ }
+
+ static PyObject *
+ ObjectDir(PyObject *self, char **attributes)
+ {
+ PyMethodDef *method;
+ char **attr;
+ PyObject *r;
+
+ if (!(r = PyList_New(0)))
+ return NULL;
+
+ if (self)
+ for (method = self->ob_type->tp_methods ; method->ml_name != NULL ; ++method)
+ if (add_string(r, (char *) method->ml_name))
+ {
+ Py_DECREF(r);
+ return NULL;
+ }
+
+ for (attr = attributes ; *attr ; ++attr)
+ if (add_string(r, *attr))
+ {
+ Py_DECREF(r);
+ return NULL;
+ }
+
+ #if PY_MAJOR_VERSION < 3
+ if (add_string(r, "__members__"))
+ {
+ Py_DECREF(r);
+ return NULL;
+ }
+ #endif
+
+ return r;
+ }
+
/* Output buffer management
*/
***************
*** 132,137 ****
--- 185,201 ----
long error;
} OutputObject;
+ static char *OutputAttrs[] = {
+ "softspace",
+ NULL
+ };
+
+ static PyObject *
+ OutputDir(PyObject *self)
+ {
+ return ObjectDir(self, OutputAttrs);
+ }
+
static int
OutputSetattr(OutputObject *self, char *name, PyObject *val)
{
***************
*** 291,296 ****
--- 355,361 ----
{"write", (PyCFunction)OutputWrite, METH_VARARGS, ""},
{"writelines", (PyCFunction)OutputWritelines, METH_VARARGS, ""},
{"flush", (PyCFunction)OutputFlush, METH_NOARGS, ""},
+ {"__dir__", (PyCFunction)OutputDir, METH_NOARGS, ""},
{ NULL, NULL, 0, NULL}
};
***************
*** 826,831 ****
--- 891,907 ----
DESTRUCTOR_FINISH(self);
}
+ static char *DictionaryAttrs[] = {
+ "locked", "scope",
+ NULL
+ };
+
+ static PyObject *
+ DictionaryDir(PyObject *self)
+ {
+ return ObjectDir(self, DictionaryAttrs);
+ }
+
static int
DictionarySetattr(DictionaryObject *self, char *name, PyObject *val)
{
***************
*** 985,991 ****
static struct PyMethodDef DictionaryMethods[] = {
{"keys", (PyCFunction)DictionaryListKeys, METH_NOARGS, ""},
! { NULL, NULL, 0, NULL }
};
static PyTypeObject ListType;
--- 1061,1068 ----
static struct PyMethodDef DictionaryMethods[] = {
{"keys", (PyCFunction)DictionaryListKeys, METH_NOARGS, ""},
! {"__dir__", (PyCFunction)DictionaryDir, METH_NOARGS, ""},
! { NULL, NULL, 0, NULL}
};
static PyTypeObject ListType;
***************
*** 1331,1336 ****
--- 1408,1424 ----
return (PyObject *)(self);
}
+ static char *ListAttrs[] = {
+ "locked",
+ NULL
+ };
+
+ static PyObject *
+ ListDir(PyObject *self)
+ {
+ return ObjectDir(self, ListAttrs);
+ }
+
static int
ListSetattr(ListObject *self, char *name, PyObject *val)
{
***************
*** 1368,1375 ****
}
static struct PyMethodDef ListMethods[] = {
! {"extend", (PyCFunction)ListConcatInPlace, METH_O, ""},
! { NULL, NULL, 0, NULL }
};
typedef struct
--- 1456,1464 ----
}
static struct PyMethodDef ListMethods[] = {
! {"extend", (PyCFunction)ListConcatInPlace, METH_O, ""},
! {"__dir__", (PyCFunction)ListDir, METH_NOARGS, ""},
! { NULL, NULL, 0, NULL}
};
typedef struct
***************
*** 1408,1413 ****
--- 1497,1513 ----
DESTRUCTOR_FINISH(self);
}
+ static char *FunctionAttrs[] = {
+ "softspace",
+ NULL
+ };
+
+ static PyObject *
+ FunctionDir(PyObject *self)
+ {
+ return ObjectDir(self, FunctionAttrs);
+ }
+
static PyObject *
FunctionCall(FunctionObject *self, PyObject *argsObject, PyObject *kwargs)
{
***************
*** 1472,1479 ****
}
static struct PyMethodDef FunctionMethods[] = {
! {"__call__", (PyCFunction)FunctionCall, METH_VARARGS|METH_KEYWORDS, ""},
! { NULL, NULL, 0, NULL}
};
/*
--- 1572,1580 ----
}
static struct PyMethodDef FunctionMethods[] = {
! {"__call__",(PyCFunction)FunctionCall, METH_VARARGS|METH_KEYWORDS, ""},
! {"__dir__", (PyCFunction)FunctionDir, METH_NOARGS, ""},
! { NULL, NULL, 0, NULL}
};
/*
***************
*** 1842,1847 ****
--- 1943,1959 ----
DESTRUCTOR_FINISH(self);
}
+ static char *TabPageAttrs[] = {
+ "windows", "number", "vars", "window", "valid",
+ NULL
+ };
+
+ static PyObject *
+ TabPageDir(PyObject *self)
+ {
+ return ObjectDir(self, TabPageAttrs);
+ }
+
static PyObject *
TabPageAttrValid(TabPageObject *self, char *name)
{
***************
*** 1873,1878 ****
--- 1985,1992 ----
else
return WindowNew(self->tab->tp_curwin, self->tab);
}
+ else if (strcmp(name, "__members__") == 0)
+ return ObjectDir(NULL, TabPageAttrs);
return NULL;
}
***************
*** 1901,1908 ****
}
static struct PyMethodDef TabPageMethods[] = {
! /* name, function, calling, documentation */
! { NULL, NULL, 0, NULL }
};
/*
--- 2015,2023 ----
}
static struct PyMethodDef TabPageMethods[] = {
! /* name, function, calling, documentation */
! {"__dir__", (PyCFunction)TabPageDir, METH_NOARGS, ""},
! { NULL, NULL, 0, NULL}
};
/*
***************
*** 2049,2054 ****
--- 2164,2180 ----
else
return firstwin;
}
+ static char *WindowAttrs[] = {
+ "buffer", "cursor", "height", "vars", "options", "number", "row", "col",
+ "tabpage", "valid",
+ NULL
+ };
+
+ static PyObject *
+ WindowDir(PyObject *self)
+ {
+ return ObjectDir(self, WindowAttrs);
+ }
static PyObject *
WindowAttrValid(WindowObject *self, char *name)
***************
*** 2103,2111 ****
Py_INCREF(self->tabObject);
return (PyObject *)(self->tabObject);
}
! else if (strcmp(name,"__members__") == 0)
! return Py_BuildValue("[ssssssssss]", "buffer", "cursor", "height",
! "vars", "options", "number", "row", "col", "tabpage", "valid");
else
return NULL;
}
--- 2229,2236 ----
Py_INCREF(self->tabObject);
return (PyObject *)(self->tabObject);
}
! else if (strcmp(name, "__members__") == 0)
! return ObjectDir(NULL, WindowAttrs);
else
return NULL;
}
***************
*** 2228,2235 ****
}
static struct PyMethodDef WindowMethods[] = {
! /* name, function, calling, documentation */
! { NULL, NULL, 0, NULL }
};
/*
--- 2353,2361 ----
}
static struct PyMethodDef WindowMethods[] = {
! /* name, function, calling, documentation */
! {"__dir__", (PyCFunction)WindowDir, METH_NOARGS, ""},
! { NULL, NULL, 0, NULL}
};
/*
***************
*** 3122,3127 ****
--- 3248,3264 ----
return RBSlice(self->buf, lo, hi, self->start, self->end);
}
+ static char *RangeAttrs[] = {
+ "start", "end",
+ NULL
+ };
+
+ static PyObject *
+ RangeDir(PyObject *self)
+ {
+ return ObjectDir(self, RangeAttrs);
+ }
+
static PyObject *
RangeAppend(RangeObject *self, PyObject *args)
{
***************
*** 3162,3168 ****
static struct PyMethodDef RangeMethods[] = {
/* name, function, calling, documentation */
{"append", (PyCFunction)RangeAppend, METH_VARARGS, "Append data to the Vim range" },
! { NULL, NULL, 0, NULL }
};
static PyTypeObject BufferType;
--- 3299,3306 ----
static struct PyMethodDef RangeMethods[] = {
/* name, function, calling, documentation */
{"append", (PyCFunction)RangeAppend, METH_VARARGS, "Append data to the Vim range" },
! {"__dir__", (PyCFunction)RangeDir, METH_NOARGS, ""},
! { NULL, NULL, 0, NULL}
};
static PyTypeObject BufferType;
***************
*** 3239,3244 ****
--- 3377,3393 ----
return RBSlice(self, lo, hi, 1, -1);
}
+ static char *BufferAttrs[] = {
+ "name", "number", "vars", "options", "valid",
+ NULL
+ };
+
+ static PyObject *
+ BufferDir(PyObject *self)
+ {
+ return ObjectDir(self, BufferAttrs);
+ }
+
static PyObject *
BufferAttrValid(BufferObject *self, char *name)
{
***************
*** 3265,3273 ****
else if (strcmp(name, "options") == 0)
return OptionsNew(SREQ_BUF, self->buf, (checkfun) CheckBuffer,
(PyObject *) self);
! else if (strcmp(name,"__members__") == 0)
! return Py_BuildValue("[sssss]", "name", "number", "vars", "options",
! "valid");
else
return NULL;
}
--- 3414,3421 ----
else if (strcmp(name, "options") == 0)
return OptionsNew(SREQ_BUF, self->buf, (checkfun) CheckBuffer,
(PyObject *) self);
! else if (strcmp(name, "__members__") == 0)
! return ObjectDir(NULL, BufferAttrs);
else
return NULL;
}
***************
*** 3403,3412 ****
{"append", (PyCFunction)BufferAppend, METH_VARARGS, "Append data to Vim buffer" },
{"mark", (PyCFunction)BufferMark, METH_VARARGS, "Return (row,col) representing position of named mark" },
{"range", (PyCFunction)BufferRange, METH_VARARGS, "Return a range object which represents the part of the given buffer between line numbers s and e" },
! #if PY_VERSION_HEX >= 0x03000000
! {"__dir__", (PyCFunction)BufferDir, METH_NOARGS, "List buffer attributes" },
! #endif
! { NULL, NULL, 0, NULL }
};
/*
--- 3551,3558 ----
{"append", (PyCFunction)BufferAppend, METH_VARARGS, "Append data to Vim buffer" },
{"mark", (PyCFunction)BufferMark, METH_VARARGS, "Return (row,col) representing position of named mark" },
{"range", (PyCFunction)BufferRange, METH_VARARGS, "Return a range object which represents the part of the given buffer between line numbers s and e" },
! {"__dir__", (PyCFunction)BufferDir, METH_NOARGS, ""},
! { NULL, NULL, 0, NULL}
};
/*
***************
*** 3538,3543 ****
--- 3684,3700 ----
/* Current items object
*/
+ static char *CurrentAttrs[] = {
+ "buffer", "window", "line", "range", "tabpage",
+ NULL
+ };
+
+ static PyObject *
+ CurrentDir(PyObject *self)
+ {
+ return ObjectDir(self, CurrentAttrs);
+ }
+
static PyObject *
CurrentGetattr(PyObject *self UNUSED, char *name)
{
***************
*** 3551,3564 ****
return GetBufferLine(curbuf, (PyInt)curwin->w_cursor.lnum);
else if (strcmp(name, "range") == 0)
return RangeNew(curbuf, RangeStart, RangeEnd);
! else if (strcmp(name,"__members__") == 0)
! return Py_BuildValue("[sssss]", "buffer", "window", "line", "range",
! "tabpage");
else
! {
! PyErr_SetString(PyExc_AttributeError, name);
return NULL;
! }
}
static int
--- 3708,3721 ----
return GetBufferLine(curbuf, (PyInt)curwin->w_cursor.lnum);
else if (strcmp(name, "range") == 0)
return RangeNew(curbuf, RangeStart, RangeEnd);
! else if (strcmp(name, "__members__") == 0)
! return ObjectDir(NULL, CurrentAttrs);
else
! #if PY_MAJOR_VERSION < 3
! return Py_FindMethod(WindowMethods, self, name);
! #else
return NULL;
! #endif
}
static int
***************
*** 3661,3666 ****
--- 3818,3829 ----
}
}
+ static struct PyMethodDef CurrentMethods[] = {
+ /* name, function, calling, documentation */
+ {"__dir__", (PyCFunction)CurrentDir, METH_NOARGS, ""},
+ { NULL, NULL, 0, NULL}
+ };
+
static void
init_range_cmd(exarg_T *eap)
{
***************
*** 4397,4402 ****
--- 4560,4566 ----
CurrentType.tp_basicsize = sizeof(CurrentObject);
CurrentType.tp_flags = Py_TPFLAGS_DEFAULT;
CurrentType.tp_doc = "vim current object";
+ CurrentType.tp_methods = CurrentMethods;
#if PY_MAJOR_VERSION >= 3
CurrentType.tp_getattro = (getattrofunc)CurrentGetattro;
CurrentType.tp_setattro = (setattrofunc)CurrentSetattro;
*** ../vim-7.3.1046/src/if_python3.c 2013-05-29 22:15:26.000000000 +0200
--- src/if_python3.c 2013-05-29 22:29:26.000000000 +0200
***************
*** 666,672 ****
return PyType_GenericAlloc(type,nitems);
}
- static PyObject *BufferDir(PyObject *);
static PyObject *OutputGetattro(PyObject *, PyObject *);
static int OutputSetattro(PyObject *, PyObject *, PyObject *);
static PyObject *BufferGetattro(PyObject *, PyObject *);
--- 666,671 ----
***************
*** 1094,1107 ****
return BufferSetattr((BufferObject *)(self), name, val);
}
- static PyObject *
- BufferDir(PyObject *self UNUSED)
- {
- return Py_BuildValue("[ssssssss]",
- "name", "number", "vars", "options", "valid",
- "append", "mark", "range");
- }
-
/******************/
static PyObject *
--- 1093,1098 ----
***************
*** 1368,1375 ****
static PyObject *
CurrentGetattro(PyObject *self, PyObject *nameobj)
{
GET_ATTR_STRING(name, nameobj);
! return CurrentGetattr(self, name);
}
static int
--- 1359,1369 ----
static PyObject *
CurrentGetattro(PyObject *self, PyObject *nameobj)
{
+ PyObject *r;
GET_ATTR_STRING(name, nameobj);
! if (!(r = CurrentGetattr(self, name)))
! return PyObject_GenericGetAttr(self, nameobj);
! return r;
}
static int
*** ../vim-7.3.1046/src/if_python.c 2013-05-29 22:15:26.000000000 +0200
--- src/if_python.c 2013-05-29 22:29:26.000000000 +0200
***************
*** 1066,1071 ****
--- 1066,1073 ----
{
if (strcmp(name, "softspace") == 0)
return PyInt_FromLong(((OutputObject *)(self))->softspace);
+ else if (strcmp(name, "__members__") == 0)
+ return ObjectDir(NULL, OutputAttrs);
return Py_FindMethod(OutputMethods, self, name);
}
***************
*** 1177,1182 ****
--- 1179,1186 ----
return Py_BuildValue(Py_ssize_t_fmt, ((RangeObject *)(self))->start - 1);
else if (strcmp(name, "end") == 0)
return Py_BuildValue(Py_ssize_t_fmt, ((RangeObject *)(self))->end - 1);
+ else if (strcmp(name, "__members__") == 0)
+ return ObjectDir(NULL, RangeAttrs);
else
return Py_FindMethod(RangeMethods, self, name);
}
***************
*** 1396,1401 ****
--- 1400,1407 ----
return PyInt_FromLong(this->dict->dv_lock);
else if (strcmp(name, "scope") == 0)
return PyInt_FromLong(this->dict->dv_scope);
+ else if (strcmp(name, "__members__") == 0)
+ return ObjectDir(NULL, DictionaryAttrs);
return Py_FindMethod(DictionaryMethods, self, name);
}
***************
*** 1420,1425 ****
--- 1426,1433 ----
{
if (strcmp(name, "locked") == 0)
return PyInt_FromLong(((ListObject *)(self))->list->lv_lock);
+ else if (strcmp(name, "__members__") == 0)
+ return ObjectDir(NULL, ListAttrs);
return Py_FindMethod(ListMethods, self, name);
}
***************
*** 1431,1436 ****
--- 1439,1446 ----
if (strcmp(name, "name") == 0)
return PyString_FromString((char *)(this->name));
+ else if (strcmp(name, "__members__") == 0)
+ return ObjectDir(NULL, FunctionAttrs);
else
return Py_FindMethod(FunctionMethods, self, name);
}
*** ../vim-7.3.1046/src/testdir/test86.in 2013-05-29 22:15:26.000000000 +0200
--- src/testdir/test86.in 2013-05-29 22:29:26.000000000 +0200
***************
*** 691,696 ****
--- 691,714 ----
cb.append(expr + ':' + attr + ':' + repr(type(eval(expr)) is getattr(vim, attr)))
EOF
:"
+ :" Test __dir__() method
+ py << EOF
+ for name, o in (
+ ('current', vim.current),
+ ('buffer', vim.current.buffer),
+ ('window', vim.current.window),
+ ('tabpage', vim.current.tabpage),
+ ('range', vim.current.range),
+ ('dictionary', vim.bindeval('{}')),
+ ('list', vim.bindeval('[]')),
+ ('function', vim.bindeval('function("tr")')),
+ ('output', sys.stdout),
+ ):
+ cb.append(name + ':' + ','.join(dir(o)))
+ del name
+ del o
+ EOF
+ :"
:" Test exceptions
:fun Exe(e)
: execute a:e
*** ../vim-7.3.1046/src/testdir/test86.ok 2013-05-29 22:15:26.000000000 +0200
--- src/testdir/test86.ok 2013-05-29 22:29:26.000000000 +0200
***************
*** 382,387 ****
--- 382,396 ----
vim.current.range:Range:True
vim.current.window:Window:True
vim.current.tabpage:TabPage:True
+ current:__dir__,__members__,buffer,line,range,tabpage,window
+ buffer:__dir__,__members__,append,mark,name,number,options,range,valid,vars
+ window:__dir__,__members__,buffer,col,cursor,height,number,options,row,tabpage,valid,vars
+ tabpage:__dir__,__members__,number,valid,vars,window,windows
+ range:__dir__,__members__,append,end,start
+ dictionary:__dir__,__members__,keys,locked,scope
+ list:__dir__,__members__,extend,locked
+ function:__call__,__dir__,__members__,softspace
+ output:__dir__,__members__,flush,softspace,write,writelines
(<class 'vim.error'>, error('abc',))
(<class 'vim.error'>, error('def',))
(<class 'vim.error'>, error('ghi',))
*** ../vim-7.3.1046/src/testdir/test87.in 2013-05-29 22:15:26.000000000 +0200
--- src/testdir/test87.in 2013-05-29 22:29:26.000000000 +0200
***************
*** 669,674 ****
--- 669,692 ----
cb.append(expr + ':' + attr + ':' + repr(type(eval(expr)) is getattr(vim, attr)))
EOF
:"
+ :" Test __dir__() method
+ py3 << EOF
+ for name, o in (
+ ('current', vim.current),
+ ('buffer', vim.current.buffer),
+ ('window', vim.current.window),
+ ('tabpage', vim.current.tabpage),
+ ('range', vim.current.range),
+ ('dictionary', vim.bindeval('{}')),
+ ('list', vim.bindeval('[]')),
+ ('function', vim.bindeval('function("tr")')),
+ ('output', sys.stdout),
+ ):
+ cb.append(name + ':' + ','.join(dir(o)))
+ del name
+ del o
+ EOF
+ :"
:" Test exceptions
:fun Exe(e)
: execute a:e
*** ../vim-7.3.1046/src/testdir/test87.ok 2013-05-29 22:15:26.000000000 +0200
--- src/testdir/test87.ok 2013-05-29 22:29:26.000000000 +0200
***************
*** 371,376 ****
--- 371,385 ----
vim.current.range:Range:True
vim.current.window:Window:True
vim.current.tabpage:TabPage:True
+ current:__dir__,buffer,line,range,tabpage,window
+ buffer:__dir__,append,mark,name,number,options,range,valid,vars
+ window:__dir__,buffer,col,cursor,height,number,options,row,tabpage,valid,vars
+ tabpage:__dir__,number,valid,vars,window,windows
+ range:__dir__,append,end,start
+ dictionary:__dir__,keys,locked,scope
+ list:__dir__,extend,locked
+ function:__call__,__dir__,softspace
+ output:__dir__,flush,softspace,write,writelines
(<class 'vim.error'>, error('abc',))
(<class 'vim.error'>, error('def',))
(<class 'vim.error'>, error('ghi',))
*** ../vim-7.3.1046/src/version.c 2013-05-29 22:26:15.000000000 +0200
--- src/version.c 2013-05-29 22:35:24.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1047,
/**/
--
hundred-and-one symptoms of being an internet addict:
22. You've already visited all the links at Yahoo and you're halfway through
Lycos.
/// 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 ///

614
7.3.1048 Normal file
View File

@ -0,0 +1,614 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1048
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1048
Problem: Python: no consistent naming.
Solution: Python patch 9: Rename d to dict and lookupDict to lookup_dict.
(ZyX)
Files: src/if_py_both.h
*** ../vim-7.3.1047/src/if_py_both.h 2013-05-29 22:36:06.000000000 +0200
--- src/if_py_both.h 2013-05-29 22:39:16.000000000 +0200
***************
*** 475,481 ****
* you call VimToPython.
*/
static PyObject *
! VimToPython(typval_T *our_tv, int depth, PyObject *lookupDict)
{
PyObject *result;
PyObject *newObj;
--- 475,481 ----
* you call VimToPython.
*/
static PyObject *
! VimToPython(typval_T *our_tv, int depth, PyObject *lookup_dict)
{
PyObject *result;
PyObject *newObj;
***************
*** 489,495 ****
return result;
}
! /* Check if we run into a recursive loop. The item must be in lookupDict
* then and we can use it again. */
if ((our_tv->v_type == VAR_LIST && our_tv->vval.v_list != NULL)
|| (our_tv->v_type == VAR_DICT && our_tv->vval.v_dict != NULL))
--- 489,495 ----
return result;
}
! /* Check if we run into a recursive loop. The item must be in lookup_dict
* then and we can use it again. */
if ((our_tv->v_type == VAR_LIST && our_tv->vval.v_list != NULL)
|| (our_tv->v_type == VAR_DICT && our_tv->vval.v_dict != NULL))
***************
*** 498,504 ****
our_tv->v_type == VAR_LIST ? (void *)our_tv->vval.v_list
: (void *)our_tv->vval.v_dict);
! if ((result = PyDict_GetItemString(lookupDict, ptrBuf)))
{
Py_INCREF(result);
return result;
--- 498,504 ----
our_tv->v_type == VAR_LIST ? (void *)our_tv->vval.v_list
: (void *)our_tv->vval.v_dict);
! if ((result = PyDict_GetItemString(lookup_dict, ptrBuf)))
{
Py_INCREF(result);
return result;
***************
*** 538,544 ****
if (!(result = PyList_New(0)))
return NULL;
! if (PyDict_SetItemString(lookupDict, ptrBuf, result))
{
Py_DECREF(result);
return NULL;
--- 538,544 ----
if (!(result = PyList_New(0)))
return NULL;
! if (PyDict_SetItemString(lookup_dict, ptrBuf, result))
{
Py_DECREF(result);
return NULL;
***************
*** 546,552 ****
for (curr = list->lv_first; curr != NULL; curr = curr->li_next)
{
! if (!(newObj = VimToPython(&curr->li_tv, depth + 1, lookupDict)))
{
Py_DECREF(result);
return NULL;
--- 546,552 ----
for (curr = list->lv_first; curr != NULL; curr = curr->li_next)
{
! if (!(newObj = VimToPython(&curr->li_tv, depth + 1, lookup_dict)))
{
Py_DECREF(result);
return NULL;
***************
*** 573,579 ****
if (!(result = PyDict_New()))
return NULL;
! if (PyDict_SetItemString(lookupDict, ptrBuf, result))
{
Py_DECREF(result);
return NULL;
--- 573,579 ----
if (!(result = PyDict_New()))
return NULL;
! if (PyDict_SetItemString(lookup_dict, ptrBuf, result))
{
Py_DECREF(result);
return NULL;
***************
*** 586,592 ****
--todo;
di = dict_lookup(hi);
! if (!(newObj = VimToPython(&di->di_tv, depth + 1, lookupDict)))
{
Py_DECREF(result);
return NULL;
--- 586,592 ----
--todo;
di = dict_lookup(hi);
! if (!(newObj = VimToPython(&di->di_tv, depth + 1, lookup_dict)))
{
Py_DECREF(result);
return NULL;
***************
*** 970,980 ****
{
char_u *key;
typval_T tv;
! dict_T *d = self->dict;
dictitem_T *di;
DICTKEY_DECL
! if (d->dv_lock)
{
PyErr_SetVim(_("dict is locked"));
return -1;
--- 970,980 ----
{
char_u *key;
typval_T tv;
! dict_T *dict = self->dict;
dictitem_T *di;
DICTKEY_DECL
! if (dict->dv_lock)
{
PyErr_SetVim(_("dict is locked"));
return -1;
***************
*** 982,988 ****
DICTKEY_GET_NOTEMPTY(-1)
! di = dict_find(d, key, -1);
if (valObject == NULL)
{
--- 982,988 ----
DICTKEY_GET_NOTEMPTY(-1)
! di = dict_find(dict, key, -1);
if (valObject == NULL)
{
***************
*** 994,1001 ****
PyErr_SetObject(PyExc_KeyError, keyObject);
return -1;
}
! hi = hash_find(&d->dv_hashtab, di->di_key);
! hash_remove(&d->dv_hashtab, hi);
dictitem_free(di);
return 0;
}
--- 994,1001 ----
PyErr_SetObject(PyExc_KeyError, keyObject);
return -1;
}
! hi = hash_find(&dict->dv_hashtab, di->di_key);
! hash_remove(&dict->dv_hashtab, hi);
dictitem_free(di);
return 0;
}
***************
*** 1013,1019 ****
}
di->di_tv.v_lock = 0;
! if (dict_add(d, di) == FAIL)
{
DICTKEY_UNREF
vim_free(di);
--- 1013,1019 ----
}
di->di_tv.v_lock = 0;
! if (dict_add(dict, di) == FAIL)
{
DICTKEY_UNREF
vim_free(di);
***************
*** 1102,1108 ****
}
static int
! list_py_concat(list_T *l, PyObject *obj, PyObject *lookupDict)
{
Py_ssize_t i;
Py_ssize_t lsize = PySequence_Size(obj);
--- 1102,1108 ----
}
static int
! list_py_concat(list_T *l, PyObject *obj, PyObject *lookup_dict)
{
Py_ssize_t i;
Py_ssize_t lsize = PySequence_Size(obj);
***************
*** 1122,1128 ****
litem = PySequence_GetItem(obj, i);
if (litem == NULL)
return -1;
! if (_ConvertFromPyObject(litem, &li->li_tv, lookupDict) == -1)
return -1;
list_append(l, li);
--- 1122,1128 ----
litem = PySequence_GetItem(obj, i);
if (litem == NULL)
return -1;
! if (_ConvertFromPyObject(litem, &li->li_tv, lookup_dict) == -1)
return -1;
list_append(l, li);
***************
*** 4009,4032 ****
}
static int
! pydict_to_tv(PyObject *obj, typval_T *tv, PyObject *lookupDict)
{
! dict_T *d;
char_u *key;
dictitem_T *di;
PyObject *keyObject;
PyObject *valObject;
Py_ssize_t iter = 0;
! d = dict_alloc();
! if (d == NULL)
{
PyErr_NoMemory();
return -1;
}
tv->v_type = VAR_DICT;
! tv->vval.v_dict = d;
while (PyDict_Next(obj, &iter, &keyObject, &valObject))
{
--- 4009,4032 ----
}
static int
! pydict_to_tv(PyObject *obj, typval_T *tv, PyObject *lookup_dict)
{
! dict_T *dict;
char_u *key;
dictitem_T *di;
PyObject *keyObject;
PyObject *valObject;
Py_ssize_t iter = 0;
! dict = dict_alloc();
! if (dict == NULL)
{
PyErr_NoMemory();
return -1;
}
tv->v_type = VAR_DICT;
! tv->vval.v_dict = dict;
while (PyDict_Next(obj, &iter, &keyObject, &valObject))
{
***************
*** 4050,4061 ****
}
di->di_tv.v_lock = 0;
! if (_ConvertFromPyObject(valObject, &di->di_tv, lookupDict) == -1)
{
vim_free(di);
return -1;
}
! if (dict_add(d, di) == FAIL)
{
vim_free(di);
PyErr_SetVim(_("failed to add key to dictionary"));
--- 4050,4062 ----
}
di->di_tv.v_lock = 0;
! if (_ConvertFromPyObject(valObject, &di->di_tv, lookup_dict) == -1)
{
vim_free(di);
return -1;
}
!
! if (dict_add(dict, di) == FAIL)
{
vim_free(di);
PyErr_SetVim(_("failed to add key to dictionary"));
***************
*** 4066,4074 ****
}
static int
! pymap_to_tv(PyObject *obj, typval_T *tv, PyObject *lookupDict)
{
! dict_T *d;
char_u *key;
dictitem_T *di;
PyObject *list;
--- 4067,4075 ----
}
static int
! pymap_to_tv(PyObject *obj, typval_T *tv, PyObject *lookup_dict)
{
! dict_T *dict;
char_u *key;
dictitem_T *di;
PyObject *list;
***************
*** 4077,4091 ****
PyObject *valObject;
Py_ssize_t lsize;
! d = dict_alloc();
! if (d == NULL)
{
PyErr_NoMemory();
return -1;
}
tv->v_type = VAR_DICT;
! tv->vval.v_dict = d;
list = PyMapping_Items(obj);
if (list == NULL)
--- 4078,4092 ----
PyObject *valObject;
Py_ssize_t lsize;
! dict = dict_alloc();
! if (dict == NULL)
{
PyErr_NoMemory();
return -1;
}
tv->v_type = VAR_DICT;
! tv->vval.v_dict = dict;
list = PyMapping_Items(obj);
if (list == NULL)
***************
*** 4133,4146 ****
}
di->di_tv.v_lock = 0;
! if (_ConvertFromPyObject(valObject, &di->di_tv, lookupDict) == -1)
{
vim_free(di);
Py_DECREF(list);
Py_DECREF(litem);
return -1;
}
! if (dict_add(d, di) == FAIL)
{
vim_free(di);
Py_DECREF(list);
--- 4134,4147 ----
}
di->di_tv.v_lock = 0;
! if (_ConvertFromPyObject(valObject, &di->di_tv, lookup_dict) == -1)
{
vim_free(di);
Py_DECREF(list);
Py_DECREF(litem);
return -1;
}
! if (dict_add(dict, di) == FAIL)
{
vim_free(di);
Py_DECREF(list);
***************
*** 4155,4161 ****
}
static int
! pyseq_to_tv(PyObject *obj, typval_T *tv, PyObject *lookupDict)
{
list_T *l;
--- 4156,4162 ----
}
static int
! pyseq_to_tv(PyObject *obj, typval_T *tv, PyObject *lookup_dict)
{
list_T *l;
***************
*** 4169,4182 ****
tv->v_type = VAR_LIST;
tv->vval.v_list = l;
! if (list_py_concat(l, obj, lookupDict) == -1)
return -1;
return 0;
}
static int
! pyiter_to_tv(PyObject *obj, typval_T *tv, PyObject *lookupDict)
{
PyObject *iterator = PyObject_GetIter(obj);
PyObject *item;
--- 4170,4183 ----
tv->v_type = VAR_LIST;
tv->vval.v_list = l;
! if (list_py_concat(l, obj, lookup_dict) == -1)
return -1;
return 0;
}
static int
! pyiter_to_tv(PyObject *obj, typval_T *tv, PyObject *lookup_dict)
{
PyObject *iterator = PyObject_GetIter(obj);
PyObject *item;
***************
*** 4208,4214 ****
}
li->li_tv.v_lock = 0;
! if (_ConvertFromPyObject(item, &li->li_tv, lookupDict) == -1)
return -1;
list_append(l, li);
--- 4209,4215 ----
}
li->li_tv.v_lock = 0;
! if (_ConvertFromPyObject(item, &li->li_tv, lookup_dict) == -1)
return -1;
list_append(l, li);
***************
*** 4224,4230 ****
static int
convert_dl(PyObject *obj, typval_T *tv,
! pytotvfunc py_to_tv, PyObject *lookupDict)
{
PyObject *capsule;
char hexBuf[sizeof(void *) * 2 + 3];
--- 4225,4231 ----
static int
convert_dl(PyObject *obj, typval_T *tv,
! pytotvfunc py_to_tv, PyObject *lookup_dict)
{
PyObject *capsule;
char hexBuf[sizeof(void *) * 2 + 3];
***************
*** 4232,4240 ****
sprintf(hexBuf, "%p", obj);
# ifdef PY_USE_CAPSULE
! capsule = PyDict_GetItemString(lookupDict, hexBuf);
# else
! capsule = (PyObject *)PyDict_GetItemString(lookupDict, hexBuf);
# endif
if (capsule == NULL)
{
--- 4233,4241 ----
sprintf(hexBuf, "%p", obj);
# ifdef PY_USE_CAPSULE
! capsule = PyDict_GetItemString(lookup_dict, hexBuf);
# else
! capsule = (PyObject *)PyDict_GetItemString(lookup_dict, hexBuf);
# endif
if (capsule == NULL)
{
***************
*** 4243,4251 ****
# else
capsule = PyCObject_FromVoidPtr(tv, NULL);
# endif
! PyDict_SetItemString(lookupDict, hexBuf, capsule);
Py_DECREF(capsule);
! if (py_to_tv(obj, tv, lookupDict) == -1)
{
tv->v_type = VAR_UNKNOWN;
return -1;
--- 4244,4252 ----
# else
capsule = PyCObject_FromVoidPtr(tv, NULL);
# endif
! PyDict_SetItemString(lookup_dict, hexBuf, capsule);
Py_DECREF(capsule);
! if (py_to_tv(obj, tv, lookup_dict) == -1)
{
tv->v_type = VAR_UNKNOWN;
return -1;
***************
*** 4285,4291 ****
}
static int
! _ConvertFromPyObject(PyObject *obj, typval_T *tv, PyObject *lookupDict)
{
if (obj->ob_type == &DictionaryType)
{
--- 4286,4292 ----
}
static int
! _ConvertFromPyObject(PyObject *obj, typval_T *tv, PyObject *lookup_dict)
{
if (obj->ob_type == &DictionaryType)
{
***************
*** 4357,4363 ****
tv->vval.v_number = (varnumber_T) PyLong_AsLong(obj);
}
else if (PyDict_Check(obj))
! return convert_dl(obj, tv, pydict_to_tv, lookupDict);
#ifdef FEAT_FLOAT
else if (PyFloat_Check(obj))
{
--- 4358,4364 ----
tv->vval.v_number = (varnumber_T) PyLong_AsLong(obj);
}
else if (PyDict_Check(obj))
! return convert_dl(obj, tv, pydict_to_tv, lookup_dict);
#ifdef FEAT_FLOAT
else if (PyFloat_Check(obj))
{
***************
*** 4366,4376 ****
}
#endif
else if (PyIter_Check(obj))
! return convert_dl(obj, tv, pyiter_to_tv, lookupDict);
else if (PySequence_Check(obj))
! return convert_dl(obj, tv, pyseq_to_tv, lookupDict);
else if (PyMapping_Check(obj))
! return convert_dl(obj, tv, pymap_to_tv, lookupDict);
else
{
PyErr_SetString(PyExc_TypeError,
--- 4367,4377 ----
}
#endif
else if (PyIter_Check(obj))
! return convert_dl(obj, tv, pyiter_to_tv, lookup_dict);
else if (PySequence_Check(obj))
! return convert_dl(obj, tv, pyseq_to_tv, lookup_dict);
else if (PyMapping_Check(obj))
! return convert_dl(obj, tv, pymap_to_tv, lookup_dict);
else
{
PyErr_SetString(PyExc_TypeError,
*** ../vim-7.3.1047/src/version.c 2013-05-29 22:36:06.000000000 +0200
--- src/version.c 2013-05-29 22:38:23.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1048,
/**/
--
hundred-and-one symptoms of being an internet addict:
23. You can't call your mother...she doesn't have a modem.
/// 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 ///

177
7.3.1049 Normal file
View File

@ -0,0 +1,177 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1049
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1049
Problem: Python: no consistent naming
Solution: Python patch 10: Rename DICTKEY_GET_NOTEMPTY to DICTKEY_GET. (ZyX)
Files: src/if_py_both.h
*** ../vim-7.3.1048/src/if_py_both.h 2013-05-29 22:39:46.000000000 +0200
--- src/if_py_both.h 2013-05-29 22:42:26.000000000 +0200
***************
*** 34,40 ****
PyObject *dictkey_todecref;
#define DICTKEY_GET(err) \
if (!(key = StringToChars(keyObject, &dictkey_todecref))) \
! return err;
#define DICTKEY_UNREF \
Py_XDECREF(dictkey_todecref);
--- 34,45 ----
PyObject *dictkey_todecref;
#define DICTKEY_GET(err) \
if (!(key = StringToChars(keyObject, &dictkey_todecref))) \
! return err; \
! if (*key == NUL) \
! { \
! PyErr_SetString(PyExc_ValueError, _("empty keys are not allowed")); \
! return err; \
! }
#define DICTKEY_UNREF \
Py_XDECREF(dictkey_todecref);
***************
*** 851,864 ****
static PyTypeObject DictionaryType;
- #define DICTKEY_GET_NOTEMPTY(err) \
- DICTKEY_GET(err) \
- if (*key == NUL) \
- { \
- PyErr_SetString(PyExc_ValueError, _("empty keys are not allowed")); \
- return err; \
- }
-
typedef struct
{
PyObject_HEAD
--- 856,861 ----
***************
*** 950,956 ****
dictitem_T *di;
DICTKEY_DECL
! DICTKEY_GET_NOTEMPTY(NULL)
di = dict_find(self->dict, key, -1);
--- 947,953 ----
dictitem_T *di;
DICTKEY_DECL
! DICTKEY_GET(NULL)
di = dict_find(self->dict, key, -1);
***************
*** 980,986 ****
return -1;
}
! DICTKEY_GET_NOTEMPTY(-1)
di = dict_find(dict, key, -1);
--- 977,983 ----
return -1;
}
! DICTKEY_GET(-1)
di = dict_find(dict, key, -1);
***************
*** 1653,1659 ****
if (self->Check(self->from))
return NULL;
! DICTKEY_GET_NOTEMPTY(NULL)
flags = get_option_value_strict(key, &numval, &stringval,
self->opt_type, self->from);
--- 1650,1656 ----
if (self->Check(self->from))
return NULL;
! DICTKEY_GET(NULL)
flags = get_option_value_strict(key, &numval, &stringval,
self->opt_type, self->from);
***************
*** 1792,1798 ****
if (self->Check(self->from))
return -1;
! DICTKEY_GET_NOTEMPTY(-1)
flags = get_option_value_strict(key, NULL, NULL,
self->opt_type, self->from);
--- 1789,1795 ----
if (self->Check(self->from))
return -1;
! DICTKEY_GET(-1)
flags = get_option_value_strict(key, NULL, NULL,
self->opt_type, self->from);
***************
*** 4037,4043 ****
if (valObject == NULL)
return -1;
! DICTKEY_GET_NOTEMPTY(-1)
di = dictitem_alloc(key);
--- 4034,4040 ----
if (valObject == NULL)
return -1;
! DICTKEY_GET(-1)
di = dictitem_alloc(key);
***************
*** 4111,4117 ****
return -1;
}
! DICTKEY_GET_NOTEMPTY(-1)
valObject = PyTuple_GetItem(litem, 1);
if (valObject == NULL)
--- 4108,4114 ----
return -1;
}
! DICTKEY_GET(-1)
valObject = PyTuple_GetItem(litem, 1);
if (valObject == NULL)
*** ../vim-7.3.1048/src/version.c 2013-05-29 22:39:46.000000000 +0200
--- src/version.c 2013-05-29 22:42:23.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1049,
/**/
--
hundred-and-one symptoms of being an internet addict:
24. You realize there is not a sound in the house and you have no idea where
your children are.
/// 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 ///

52
7.3.1050 Normal file
View File

@ -0,0 +1,52 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1050
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1050
Problem: Python: Typo in pyiter_to_tv.
Solution: Python patch 11. (ZyX)
Files: src/if_py_both.h
*** ../vim-7.3.1049/src/if_py_both.h 2013-05-29 22:43:32.000000000 +0200
--- src/if_py_both.h 2013-05-29 22:45:42.000000000 +0200
***************
*** 4196,4202 ****
if (iterator == NULL)
return -1;
! while ((item = PyIter_Next(obj)))
{
li = listitem_alloc();
if (li == NULL)
--- 4196,4202 ----
if (iterator == NULL)
return -1;
! while ((item = PyIter_Next(iterator)))
{
li = listitem_alloc();
if (li == NULL)
*** ../vim-7.3.1049/src/version.c 2013-05-29 22:43:32.000000000 +0200
--- src/version.c 2013-05-29 22:45:58.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1050,
/**/
--
Computers are useless. They can only give you answers.
-- Pablo Picasso
/// 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 ///

332
7.3.1051 Normal file
View File

@ -0,0 +1,332 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1051
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1051
Problem: Python: possible memory leaks.
Solution: Python patch 12: fix the leaks (ZyX)
Files: src/if_py_both.h
*** ../vim-7.3.1050/src/if_py_both.h 2013-05-29 22:46:22.000000000 +0200
--- src/if_py_both.h 2013-05-29 22:48:45.000000000 +0200
***************
*** 32,40 ****
#define DICTKEY_DECL \
PyObject *dictkey_todecref;
! #define DICTKEY_GET(err) \
if (!(key = StringToChars(keyObject, &dictkey_todecref))) \
return err; \
if (*key == NUL) \
{ \
PyErr_SetString(PyExc_ValueError, _("empty keys are not allowed")); \
--- 32,48 ----
#define DICTKEY_DECL \
PyObject *dictkey_todecref;
! #define DICTKEY_GET(err, decref) \
if (!(key = StringToChars(keyObject, &dictkey_todecref))) \
+ { \
+ if (decref) \
+ { \
+ Py_DECREF(keyObject); \
+ } \
return err; \
+ } \
+ if (decref && !dictkey_todecref) \
+ dictkey_todecref = keyObject; \
if (*key == NUL) \
{ \
PyErr_SetString(PyExc_ValueError, _("empty keys are not allowed")); \
***************
*** 602,608 ****
Py_DECREF(newObj);
return NULL;
}
- Py_DECREF(newObj);
}
}
}
--- 610,615 ----
***************
*** 947,953 ****
dictitem_T *di;
DICTKEY_DECL
! DICTKEY_GET(NULL)
di = dict_find(self->dict, key, -1);
--- 954,960 ----
dictitem_T *di;
DICTKEY_DECL
! DICTKEY_GET(NULL, 0)
di = dict_find(self->dict, key, -1);
***************
*** 977,983 ****
return -1;
}
! DICTKEY_GET(-1)
di = dict_find(dict, key, -1);
--- 984,990 ----
return -1;
}
! DICTKEY_GET(-1, 0)
di = dict_find(dict, key, -1);
***************
*** 1650,1656 ****
if (self->Check(self->from))
return NULL;
! DICTKEY_GET(NULL)
flags = get_option_value_strict(key, &numval, &stringval,
self->opt_type, self->from);
--- 1657,1663 ----
if (self->Check(self->from))
return NULL;
! DICTKEY_GET(NULL, 0)
flags = get_option_value_strict(key, &numval, &stringval,
self->opt_type, self->from);
***************
*** 1789,1795 ****
if (self->Check(self->from))
return -1;
! DICTKEY_GET(-1)
flags = get_option_value_strict(key, NULL, NULL,
self->opt_type, self->from);
--- 1796,1802 ----
if (self->Check(self->from))
return -1;
! DICTKEY_GET(-1, 0)
flags = get_option_value_strict(key, NULL, NULL,
self->opt_type, self->from);
***************
*** 4029,4040 ****
{
DICTKEY_DECL
! if (keyObject == NULL)
! return -1;
! if (valObject == NULL)
return -1;
! DICTKEY_GET(-1)
di = dictitem_alloc(key);
--- 4036,4045 ----
{
DICTKEY_DECL
! if (keyObject == NULL || valObject == NULL)
return -1;
! DICTKEY_GET(-1, 0)
di = dictitem_alloc(key);
***************
*** 4055,4060 ****
--- 4060,4066 ----
if (dict_add(dict, di) == FAIL)
{
+ clear_tv(&di->di_tv);
vim_free(di);
PyErr_SetVim(_("failed to add key to dictionary"));
return -1;
***************
*** 4100,4123 ****
return -1;
}
! keyObject = PyTuple_GetItem(litem, 0);
! if (keyObject == NULL)
{
Py_DECREF(list);
Py_DECREF(litem);
return -1;
}
! DICTKEY_GET(-1)
! valObject = PyTuple_GetItem(litem, 1);
! if (valObject == NULL)
{
Py_DECREF(list);
Py_DECREF(litem);
return -1;
}
di = dictitem_alloc(key);
DICTKEY_UNREF
--- 4106,4130 ----
return -1;
}
! if (!(keyObject = PyTuple_GetItem(litem, 0)))
{
Py_DECREF(list);
Py_DECREF(litem);
return -1;
}
! DICTKEY_GET(-1, 1)
! if (!(valObject = PyTuple_GetItem(litem, 1)))
{
Py_DECREF(list);
Py_DECREF(litem);
+ DICTKEY_UNREF
return -1;
}
+ Py_DECREF(litem);
+
di = dictitem_alloc(key);
DICTKEY_UNREF
***************
*** 4125,4131 ****
if (di == NULL)
{
Py_DECREF(list);
! Py_DECREF(litem);
PyErr_NoMemory();
return -1;
}
--- 4132,4138 ----
if (di == NULL)
{
Py_DECREF(list);
! Py_DECREF(valObject);
PyErr_NoMemory();
return -1;
}
***************
*** 4135,4152 ****
{
vim_free(di);
Py_DECREF(list);
! Py_DECREF(litem);
return -1;
}
if (dict_add(dict, di) == FAIL)
{
vim_free(di);
Py_DECREF(list);
- Py_DECREF(litem);
PyErr_SetVim(_("failed to add key to dictionary"));
return -1;
}
- Py_DECREF(litem);
}
Py_DECREF(list);
return 0;
--- 4142,4161 ----
{
vim_free(di);
Py_DECREF(list);
! Py_DECREF(valObject);
return -1;
}
+
+ Py_DECREF(valObject);
+
if (dict_add(dict, di) == FAIL)
{
+ clear_tv(&di->di_tv);
vim_free(di);
Py_DECREF(list);
PyErr_SetVim(_("failed to add key to dictionary"));
return -1;
}
}
Py_DECREF(list);
return 0;
***************
*** 4201,4213 ****
--- 4210,4227 ----
li = listitem_alloc();
if (li == NULL)
{
+ Py_DECREF(iterator);
PyErr_NoMemory();
return -1;
}
li->li_tv.v_lock = 0;
if (_ConvertFromPyObject(item, &li->li_tv, lookup_dict) == -1)
+ {
+ Py_DECREF(item);
+ Py_DECREF(iterator);
return -1;
+ }
list_append(l, li);
***************
*** 4241,4248 ****
# else
capsule = PyCObject_FromVoidPtr(tv, NULL);
# endif
! PyDict_SetItemString(lookup_dict, hexBuf, capsule);
! Py_DECREF(capsule);
if (py_to_tv(obj, tv, lookup_dict) == -1)
{
tv->v_type = VAR_UNKNOWN;
--- 4255,4266 ----
# else
capsule = PyCObject_FromVoidPtr(tv, NULL);
# endif
! if (PyDict_SetItemString(lookup_dict, hexBuf, capsule))
! {
! Py_DECREF(capsule);
! tv->v_type = VAR_UNKNOWN;
! return -1;
! }
if (py_to_tv(obj, tv, lookup_dict) == -1)
{
tv->v_type = VAR_UNKNOWN;
*** ../vim-7.3.1050/src/version.c 2013-05-29 22:46:22.000000000 +0200
--- src/version.c 2013-05-29 22:48:31.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1051,
/**/
--
hundred-and-one symptoms of being an internet addict:
25. You believe nothing looks sexier than a man in boxer shorts illuminated
only by a 17" inch svga monitor.
/// 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 ///

48
7.3.1052 Normal file
View File

@ -0,0 +1,48 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1052
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1052
Problem: Python: possible SEGV and negative refcount.
Solution: Python patch 13: Fix IterIter function. (ZyX)
Files: src/if_py_both.h
*** ../vim-7.3.1051/src/if_py_both.h 2013-05-29 22:49:21.000000000 +0200
--- src/if_py_both.h 2013-05-29 22:51:59.000000000 +0200
***************
*** 814,819 ****
--- 814,820 ----
static PyObject *
IterIter(PyObject *self)
{
+ Py_INCREF(self);
return self;
}
*** ../vim-7.3.1051/src/version.c 2013-05-29 22:49:21.000000000 +0200
--- src/version.c 2013-05-29 22:51:45.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1052,
/**/
--
Q: What is the difference betwee open-source and commercial software?
A: If you have a problem with commercial software you can call a phone
number and they will tell you it might be solved in a future version.
For open-source software there isn't a phone number to call, but you
get the solution within a day.
/// 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 ///

103
7.3.1053 Normal file
View File

@ -0,0 +1,103 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1053
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1053
Problem: Python: no flag for types with tp_traverse+tp_clear.
Solution: Python patch 14: Add Py_TPFLAGS_HAVE_GC. (ZyX)
Files: src/if_py_both.h
*** ../vim-7.3.1052/src/if_py_both.h 2013-05-29 22:52:29.000000000 +0200
--- src/if_py_both.h 2013-05-29 22:55:08.000000000 +0200
***************
*** 4461,4467 ****
vim_memset(&IterType, 0, sizeof(IterType));
IterType.tp_name = "vim.iter";
IterType.tp_basicsize = sizeof(IterObject);
! IterType.tp_flags = Py_TPFLAGS_DEFAULT;
IterType.tp_doc = "generic iterator object";
IterType.tp_iter = (getiterfunc)IterIter;
IterType.tp_iternext = (iternextfunc)IterNext;
--- 4461,4467 ----
vim_memset(&IterType, 0, sizeof(IterType));
IterType.tp_name = "vim.iter";
IterType.tp_basicsize = sizeof(IterObject);
! IterType.tp_flags = Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC;
IterType.tp_doc = "generic iterator object";
IterType.tp_iter = (getiterfunc)IterIter;
IterType.tp_iternext = (iternextfunc)IterNext;
***************
*** 4495,4501 ****
WindowType.tp_basicsize = sizeof(WindowObject);
WindowType.tp_dealloc = (destructor)WindowDestructor;
WindowType.tp_repr = (reprfunc)WindowRepr;
! WindowType.tp_flags = Py_TPFLAGS_DEFAULT;
WindowType.tp_doc = "vim Window object";
WindowType.tp_methods = WindowMethods;
WindowType.tp_traverse = (traverseproc)WindowTraverse;
--- 4495,4501 ----
WindowType.tp_basicsize = sizeof(WindowObject);
WindowType.tp_dealloc = (destructor)WindowDestructor;
WindowType.tp_repr = (reprfunc)WindowRepr;
! WindowType.tp_flags = Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC;
WindowType.tp_doc = "vim Window object";
WindowType.tp_methods = WindowMethods;
WindowType.tp_traverse = (traverseproc)WindowTraverse;
***************
*** 4558,4564 ****
RangeType.tp_repr = (reprfunc)RangeRepr;
RangeType.tp_as_sequence = &RangeAsSeq;
RangeType.tp_as_mapping = &RangeAsMapping;
! RangeType.tp_flags = Py_TPFLAGS_DEFAULT;
RangeType.tp_doc = "vim Range object";
RangeType.tp_methods = RangeMethods;
RangeType.tp_traverse = (traverseproc)RangeTraverse;
--- 4558,4564 ----
RangeType.tp_repr = (reprfunc)RangeRepr;
RangeType.tp_as_sequence = &RangeAsSeq;
RangeType.tp_as_mapping = &RangeAsMapping;
! RangeType.tp_flags = Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC;
RangeType.tp_doc = "vim Range object";
RangeType.tp_methods = RangeMethods;
RangeType.tp_traverse = (traverseproc)RangeTraverse;
***************
*** 4637,4643 ****
vim_memset(&OptionsType, 0, sizeof(OptionsType));
OptionsType.tp_name = "vim.options";
OptionsType.tp_basicsize = sizeof(OptionsObject);
! OptionsType.tp_flags = Py_TPFLAGS_DEFAULT;
OptionsType.tp_doc = "object for manipulating options";
OptionsType.tp_as_mapping = &OptionsAsMapping;
OptionsType.tp_dealloc = (destructor)OptionsDestructor;
--- 4637,4643 ----
vim_memset(&OptionsType, 0, sizeof(OptionsType));
OptionsType.tp_name = "vim.options";
OptionsType.tp_basicsize = sizeof(OptionsObject);
! OptionsType.tp_flags = Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC;
OptionsType.tp_doc = "object for manipulating options";
OptionsType.tp_as_mapping = &OptionsAsMapping;
OptionsType.tp_dealloc = (destructor)OptionsDestructor;
*** ../vim-7.3.1052/src/version.c 2013-05-29 22:52:29.000000000 +0200
--- src/version.c 2013-05-29 22:54:46.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1053,
/**/
--
hundred-and-one symptoms of being an internet addict:
26. You check your mail. It says "no new messages." So you check it again.
/// 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 ///

178
7.3.1054 Normal file
View File

@ -0,0 +1,178 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1054
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1054 (after 7.3.1042)
Problem: Can't build without the +autocmd feature. (Elimar Riesebieter)
Solution: Fix use of buf and curbuf.
Files: src/ex_cmds.c, src/testdir/test86.ok, src/testdir/test87.ok
*** ../vim-7.3.1053/src/ex_cmds.c 2013-05-29 22:02:18.000000000 +0200
--- src/ex_cmds.c 2013-05-30 11:24:41.000000000 +0200
***************
*** 2421,2430 ****
char_u *new_fname;
{
char_u *fname, *sfname, *xfname;
! #ifdef FEAT_AUTOCMD
! buf_T *buf = curbuf;
! apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, FALSE, buf);
/* buffer changed, don't change name now */
if (buf != curbuf)
return FAIL;
--- 2421,2431 ----
char_u *new_fname;
{
char_u *fname, *sfname, *xfname;
! buf_T *buf;
! #ifdef FEAT_AUTOCMD
! buf = curbuf;
! apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, FALSE, curbuf);
/* buffer changed, don't change name now */
if (buf != curbuf)
return FAIL;
***************
*** 2440,2457 ****
* But don't set the alternate file name if the buffer didn't have a
* name.
*/
! fname = buf->b_ffname;
! sfname = buf->b_sfname;
! xfname = buf->b_fname;
! buf->b_ffname = NULL;
! buf->b_sfname = NULL;
! if (setfname(buf, new_fname, NULL, TRUE) == FAIL)
{
! buf->b_ffname = fname;
! buf->b_sfname = sfname;
return FAIL;
}
! buf->b_flags |= BF_NOTEDITED;
if (xfname != NULL && *xfname != NUL)
{
buf = buflist_new(fname, xfname, curwin->w_cursor.lnum, 0);
--- 2441,2458 ----
* But don't set the alternate file name if the buffer didn't have a
* name.
*/
! fname = curbuf->b_ffname;
! sfname = curbuf->b_sfname;
! xfname = curbuf->b_fname;
! curbuf->b_ffname = NULL;
! curbuf->b_sfname = NULL;
! if (setfname(curbuf, new_fname, NULL, TRUE) == FAIL)
{
! curbuf->b_ffname = fname;
! curbuf->b_sfname = sfname;
return FAIL;
}
! curbuf->b_flags |= BF_NOTEDITED;
if (xfname != NULL && *xfname != NUL)
{
buf = buflist_new(fname, xfname, curwin->w_cursor.lnum, 0);
***************
*** 2461,2467 ****
vim_free(fname);
vim_free(sfname);
#ifdef FEAT_AUTOCMD
! apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, FALSE, buf);
#endif
/* Change directories when the 'acd' option is set. */
DO_AUTOCHDIR
--- 2462,2468 ----
vim_free(fname);
vim_free(sfname);
#ifdef FEAT_AUTOCMD
! apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, FALSE, curbuf);
#endif
/* Change directories when the 'acd' option is set. */
DO_AUTOCHDIR
*** ../vim-7.3.1053/src/testdir/test86.ok 2013-05-29 22:36:06.000000000 +0200
--- src/testdir/test86.ok 2013-05-30 11:34:12.000000000 +0200
***************
*** 320,332 ****
Third line
foo
1:BufFilePre:1
! 6:BufFilePost:1
testdir/foo
5:BufFilePre:5
5:BufFilePost:5
testdir/bar
1:BufFilePre:1
! 7:BufFilePost:1
testdir/test86.in
valid: b:False, cb:True
i:<buffer test86.in>
--- 320,332 ----
Third line
foo
1:BufFilePre:1
! 1:BufFilePost:1
testdir/foo
5:BufFilePre:5
5:BufFilePost:5
testdir/bar
1:BufFilePre:1
! 1:BufFilePost:1
testdir/test86.in
valid: b:False, cb:True
i:<buffer test86.in>
*** ../vim-7.3.1053/src/testdir/test87.ok 2013-05-29 22:36:06.000000000 +0200
--- src/testdir/test87.ok 2013-05-30 11:34:26.000000000 +0200
***************
*** 309,321 ****
Third line
foo
1:BufFilePre:1
! 6:BufFilePost:1
testdir/foo
5:BufFilePre:5
5:BufFilePost:5
testdir/bar
1:BufFilePre:1
! 7:BufFilePost:1
testdir/test87.in
valid: b:False, cb:True
i:<buffer test87.in>
--- 309,321 ----
Third line
foo
1:BufFilePre:1
! 1:BufFilePost:1
testdir/foo
5:BufFilePre:5
5:BufFilePost:5
testdir/bar
1:BufFilePre:1
! 1:BufFilePost:1
testdir/test87.in
valid: b:False, cb:True
i:<buffer test87.in>
*** ../vim-7.3.1053/src/version.c 2013-05-29 22:58:28.000000000 +0200
--- src/version.c 2013-05-30 11:40:54.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1054,
/**/
--
For a moment, nothing happened.
Then, after a second or so, nothing continued to happen.
-- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"
/// 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 ///

112
7.3.1055 Normal file
View File

@ -0,0 +1,112 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1055
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1055
Problem: Negated collection does not match newline.
Solution: Handle newline differently. (Hiroshi Shirosaki)
Files: src/regexp_nfa.c, src/testdir/test64.ok, src/testdir/test64.in
*** ../vim-7.3.1054/src/regexp_nfa.c 2013-05-29 21:14:37.000000000 +0200
--- src/regexp_nfa.c 2013-05-30 11:47:40.000000000 +0200
***************
*** 1203,1215 ****
}
mb_ptr_adv(regparse);
- if (extra == ADD_NL) /* \_[] also matches \n */
- {
- EMIT(reg_string ? NL : NFA_NEWL);
- TRY_NEG();
- EMIT_GLUE();
- }
-
/* skip the trailing ] */
regparse = endp;
mb_ptr_adv(regparse);
--- 1203,1208 ----
***************
*** 1219,1224 ****
--- 1212,1225 ----
EMIT(NFA_END_NEG_RANGE);
EMIT(NFA_CONCAT);
}
+
+ /* \_[] also matches \n but it's not negated */
+ if (extra == ADD_NL)
+ {
+ EMIT(reg_string ? NL : NFA_NEWL);
+ EMIT(NFA_OR);
+ }
+
return OK;
} /* if exists closing ] */
*** ../vim-7.3.1054/src/testdir/test64.ok 2013-05-29 21:14:37.000000000 +0200
--- src/testdir/test64.ok 2013-05-30 11:48:31.000000000 +0200
***************
*** 731,736 ****
--- 731,742 ----
OK 1 - \(<<\)\@1<=span.
OK 0 - \(<<\)\@2<=span.
OK 1 - \(<<\)\@2<=span.
+ OK 0 - \_[^8-9]\+
+ OK 1 - \_[^8-9]\+
+ OK 2 - \_[^8-9]\+
+ OK 0 - \_[^a]\+
+ OK 1 - \_[^a]\+
+ OK 2 - \_[^a]\+
192.168.0.1
192.168.0.1
192.168.0.1
*** ../vim-7.3.1054/src/testdir/test64.in 2013-05-29 21:14:37.000000000 +0200
--- src/testdir/test64.in 2013-05-30 11:45:59.000000000 +0200
***************
*** 344,351 ****
:call add(tl, [0, '\(<<\)\@1<=span.', 'xxspanxxxx<spanxx<<spanyyy'])
:call add(tl, [0, '\(<<\)\@2<=span.', 'xxspanxxxx<spanxx<<spanyyy', 'spany', '<<'])
:"
! :"""" Run the tests
:"
:"
:for t in tl
: let re = t[0]
--- 344,355 ----
:call add(tl, [0, '\(<<\)\@1<=span.', 'xxspanxxxx<spanxx<<spanyyy'])
:call add(tl, [0, '\(<<\)\@2<=span.', 'xxspanxxxx<spanxx<<spanyyy', 'spany', '<<'])
:"
! :"""" "\_" prepended negated collection matches EOL
! :call add(tl, [2, '\_[^8-9]\+', "asfi\n9888", "asfi\n"])
! :call add(tl, [2, '\_[^a]\+', "asfi\n9888", "sfi\n9888"])
! :"
:"
+ :"""" Run the tests
:"
:for t in tl
: let re = t[0]
*** ../vim-7.3.1054/src/version.c 2013-05-30 11:43:11.000000000 +0200
--- src/version.c 2013-05-30 11:49:51.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1055,
/**/
--
"Making it up? Why should I want to make anything up? Life's bad enough
as it is without wanting to invent any more of it."
-- Marvin, the Paranoid Android in Douglas Adams'
"The Hitchhiker's Guide to the Galaxy"
/// 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 ///

630
7.3.1056 Normal file
View File

@ -0,0 +1,630 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1056
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1056
Problem: Python: possible memory leaks.
Solution: Python patch 15. (ZyX) Fix will follow later.
Files: src/eval.c, src/if_py_both.h, src/proto/eval.pro
*** ../vim-7.3.1055/src/eval.c 2013-05-17 16:03:53.000000000 +0200
--- src/eval.c 2013-05-30 12:11:40.000000000 +0200
***************
*** 412,418 ****
static int get_lit_string_tv __ARGS((char_u **arg, typval_T *rettv, int evaluate));
static int get_list_tv __ARGS((char_u **arg, typval_T *rettv, int evaluate));
static int rettv_list_alloc __ARGS((typval_T *rettv));
- static void listitem_free __ARGS((listitem_T *item));
static long list_len __ARGS((list_T *l));
static int list_equal __ARGS((list_T *l1, list_T *l2, int ic, int recursive));
static int dict_equal __ARGS((dict_T *d1, dict_T *d2, int ic, int recursive));
--- 412,417 ----
***************
*** 428,434 ****
static int list_join __ARGS((garray_T *gap, list_T *l, char_u *sep, int echo, int copyID));
static int free_unref_items __ARGS((int copyID));
static int rettv_dict_alloc __ARGS((typval_T *rettv));
- static void dict_free __ARGS((dict_T *d, int recurse));
static dictitem_T *dictitem_copy __ARGS((dictitem_T *org));
static void dictitem_remove __ARGS((dict_T *dict, dictitem_T *item));
static dict_T *dict_copy __ARGS((dict_T *orig, int deep, int copyID));
--- 427,432 ----
***************
*** 5955,5961 ****
/*
* Free a list item. Also clears the value. Does not notify watchers.
*/
! static void
listitem_free(item)
listitem_T *item;
{
--- 5953,5959 ----
/*
* Free a list item. Also clears the value. Does not notify watchers.
*/
! void
listitem_free(item)
listitem_T *item;
{
***************
*** 7031,7037 ****
* Free a Dictionary, including all items it contains.
* Ignores the reference count.
*/
! static void
dict_free(d, recurse)
dict_T *d;
int recurse; /* Free Lists and Dictionaries recursively. */
--- 7029,7035 ----
* Free a Dictionary, including all items it contains.
* Ignores the reference count.
*/
! void
dict_free(d, recurse)
dict_T *d;
int recurse; /* Free Lists and Dictionaries recursively. */
***************
*** 8353,8359 ****
/*
* Call a function with its resolved parameters
! * Return OK when the function can't be called, FAIL otherwise.
* Also returns OK when an error was encountered while executing the function.
*/
static int
--- 8351,8357 ----
/*
* Call a function with its resolved parameters
! * Return FAIL when the function can't be called, OK otherwise.
* Also returns OK when an error was encountered while executing the function.
*/
static int
*** ../vim-7.3.1055/src/if_py_both.h 2013-05-29 22:58:28.000000000 +0200
--- src/if_py_both.h 2013-05-30 12:13:37.000000000 +0200
***************
*** 32,39 ****
#define DICTKEY_DECL \
PyObject *dictkey_todecref;
#define DICTKEY_GET(err, decref) \
! if (!(key = StringToChars(keyObject, &dictkey_todecref))) \
{ \
if (decref) \
{ \
--- 32,46 ----
#define DICTKEY_DECL \
PyObject *dictkey_todecref;
+ #define DICTKEY_CHECK_EMPTY(err) \
+ if (*key == NUL) \
+ { \
+ PyErr_SetString(PyExc_ValueError, _("empty keys are not allowed")); \
+ return err; \
+ }
+ #define DICTKEY_SET_KEY (key = StringToChars(keyObject, &dictkey_todecref))
#define DICTKEY_GET(err, decref) \
! if (!DICTKEY_SET_KEY) \
{ \
if (decref) \
{ \
***************
*** 43,53 ****
} \
if (decref && !dictkey_todecref) \
dictkey_todecref = keyObject; \
! if (*key == NUL) \
! { \
! PyErr_SetString(PyExc_ValueError, _("empty keys are not allowed")); \
! return err; \
! }
#define DICTKEY_UNREF \
Py_XDECREF(dictkey_todecref);
--- 50,56 ----
} \
if (decref && !dictkey_todecref) \
dictkey_todecref = keyObject; \
! DICTKEY_CHECK_EMPTY(err)
#define DICTKEY_UNREF \
Py_XDECREF(dictkey_todecref);
***************
*** 651,659 ****
/* Convert the Vim type into a Python type. Create a dictionary that's
* used to check for recursive loops. */
! lookup_dict = PyDict_New();
! result = VimToPython(our_tv, 1, lookup_dict);
! Py_DECREF(lookup_dict);
Py_BEGIN_ALLOW_THREADS
--- 654,666 ----
/* Convert the Vim type into a Python type. Create a dictionary that's
* used to check for recursive loops. */
! if (!(lookup_dict = PyDict_New()))
! result = NULL;
! else
! {
! result = VimToPython(our_tv, 1, lookup_dict);
! Py_DECREF(lookup_dict);
! }
Py_BEGIN_ALLOW_THREADS
***************
*** 1401,1407 ****
return NULL;
}
! lookup_dict = PyDict_New();
if (list_py_concat(l, obj, lookup_dict) == -1)
{
Py_DECREF(lookup_dict);
--- 1408,1416 ----
return NULL;
}
! if (!(lookup_dict = PyDict_New()))
! return NULL;
!
if (list_py_concat(l, obj, lookup_dict) == -1)
{
Py_DECREF(lookup_dict);
***************
*** 4023,4034 ****
PyObject *valObject;
Py_ssize_t iter = 0;
! dict = dict_alloc();
! if (dict == NULL)
! {
! PyErr_NoMemory();
return -1;
- }
tv->v_type = VAR_DICT;
tv->vval.v_dict = dict;
--- 4032,4039 ----
PyObject *valObject;
Py_ssize_t iter = 0;
! if (!(dict = dict_alloc()))
return -1;
tv->v_type = VAR_DICT;
tv->vval.v_dict = dict;
***************
*** 4038,4046 ****
DICTKEY_DECL
if (keyObject == NULL || valObject == NULL)
return -1;
! DICTKEY_GET(-1, 0)
di = dictitem_alloc(key);
--- 4043,4059 ----
DICTKEY_DECL
if (keyObject == NULL || valObject == NULL)
+ {
+ dict_unref(dict);
return -1;
+ }
! if (!DICTKEY_SET_KEY)
! {
! dict_unref(dict);
! return -1;
! }
! DICTKEY_CHECK_EMPTY(-1)
di = dictitem_alloc(key);
***************
*** 4049,4054 ****
--- 4062,4068 ----
if (di == NULL)
{
PyErr_NoMemory();
+ dict_unref(dict);
return -1;
}
di->di_tv.v_lock = 0;
***************
*** 4056,4061 ****
--- 4070,4076 ----
if (_ConvertFromPyObject(valObject, &di->di_tv, lookup_dict) == -1)
{
vim_free(di);
+ dict_unref(dict);
return -1;
}
***************
*** 4063,4072 ****
--- 4078,4090 ----
{
clear_tv(&di->di_tv);
vim_free(di);
+ dict_unref(dict);
PyErr_SetVim(_("failed to add key to dictionary"));
return -1;
}
}
+
+ --dict->dv_refcount;
return 0;
}
***************
*** 4082,4100 ****
PyObject *valObject;
Py_ssize_t lsize;
! dict = dict_alloc();
! if (dict == NULL)
! {
! PyErr_NoMemory();
return -1;
- }
tv->v_type = VAR_DICT;
tv->vval.v_dict = dict;
list = PyMapping_Items(obj);
if (list == NULL)
return -1;
lsize = PyList_Size(list);
while (lsize--)
{
--- 4100,4117 ----
PyObject *valObject;
Py_ssize_t lsize;
! if (!(dict = dict_alloc()))
return -1;
tv->v_type = VAR_DICT;
tv->vval.v_dict = dict;
list = PyMapping_Items(obj);
if (list == NULL)
+ {
+ dict_unref(dict);
return -1;
+ }
lsize = PyList_Size(list);
while (lsize--)
{
***************
*** 4104,4109 ****
--- 4121,4127 ----
if (litem == NULL)
{
Py_DECREF(list);
+ dict_unref(dict);
return -1;
}
***************
*** 4111,4125 ****
{
Py_DECREF(list);
Py_DECREF(litem);
return -1;
}
! DICTKEY_GET(-1, 1)
if (!(valObject = PyTuple_GetItem(litem, 1)))
{
Py_DECREF(list);
Py_DECREF(litem);
DICTKEY_UNREF
return -1;
}
--- 4129,4153 ----
{
Py_DECREF(list);
Py_DECREF(litem);
+ dict_unref(dict);
return -1;
}
! if (!DICTKEY_SET_KEY)
! {
! dict_unref(dict);
! Py_DECREF(list);
! Py_DECREF(litem);
! DICTKEY_UNREF
! return -1;
! }
! DICTKEY_CHECK_EMPTY(-1)
if (!(valObject = PyTuple_GetItem(litem, 1)))
{
Py_DECREF(list);
Py_DECREF(litem);
+ dict_unref(dict);
DICTKEY_UNREF
return -1;
}
***************
*** 4133,4139 ****
if (di == NULL)
{
Py_DECREF(list);
! Py_DECREF(valObject);
PyErr_NoMemory();
return -1;
}
--- 4161,4167 ----
if (di == NULL)
{
Py_DECREF(list);
! dict_unref(dict);
PyErr_NoMemory();
return -1;
}
***************
*** 4142,4216 ****
if (_ConvertFromPyObject(valObject, &di->di_tv, lookup_dict) == -1)
{
vim_free(di);
Py_DECREF(list);
- Py_DECREF(valObject);
return -1;
}
- Py_DECREF(valObject);
-
if (dict_add(dict, di) == FAIL)
{
! clear_tv(&di->di_tv);
! vim_free(di);
Py_DECREF(list);
PyErr_SetVim(_("failed to add key to dictionary"));
return -1;
}
}
Py_DECREF(list);
return 0;
}
static int
pyseq_to_tv(PyObject *obj, typval_T *tv, PyObject *lookup_dict)
{
list_T *l;
! l = list_alloc();
! if (l == NULL)
! {
! PyErr_NoMemory();
return -1;
- }
tv->v_type = VAR_LIST;
tv->vval.v_list = l;
if (list_py_concat(l, obj, lookup_dict) == -1)
return -1;
return 0;
}
static int
pyiter_to_tv(PyObject *obj, typval_T *tv, PyObject *lookup_dict)
{
! PyObject *iterator = PyObject_GetIter(obj);
PyObject *item;
list_T *l;
listitem_T *li;
! l = list_alloc();
!
! if (l == NULL)
! {
! PyErr_NoMemory();
return -1;
- }
tv->vval.v_list = l;
tv->v_type = VAR_LIST;
!
! if (iterator == NULL)
return -1;
while ((item = PyIter_Next(iterator)))
{
li = listitem_alloc();
if (li == NULL)
{
Py_DECREF(iterator);
PyErr_NoMemory();
return -1;
--- 4170,4256 ----
if (_ConvertFromPyObject(valObject, &di->di_tv, lookup_dict) == -1)
{
vim_free(di);
+ dict_unref(dict);
Py_DECREF(list);
return -1;
}
if (dict_add(dict, di) == FAIL)
{
! dictitem_free(di);
! dict_unref(dict);
Py_DECREF(list);
PyErr_SetVim(_("failed to add key to dictionary"));
return -1;
}
}
+ --dict->dv_refcount;
Py_DECREF(list);
return 0;
}
+ static list_T *
+ py_list_alloc()
+ {
+ list_T *r;
+
+ if (!(r = list_alloc()))
+ {
+ PyErr_NoMemory();
+ return NULL;
+ }
+ ++r->lv_refcount;
+
+ return r;
+ }
+
static int
pyseq_to_tv(PyObject *obj, typval_T *tv, PyObject *lookup_dict)
{
list_T *l;
! if (!(l = py_list_alloc()))
return -1;
tv->v_type = VAR_LIST;
tv->vval.v_list = l;
if (list_py_concat(l, obj, lookup_dict) == -1)
+ {
+ list_unref(l);
return -1;
+ }
+ --l->lv_refcount;
return 0;
}
static int
pyiter_to_tv(PyObject *obj, typval_T *tv, PyObject *lookup_dict)
{
! PyObject *iterator;
PyObject *item;
list_T *l;
listitem_T *li;
! if (!(l = py_list_alloc()))
return -1;
tv->vval.v_list = l;
tv->v_type = VAR_LIST;
! if (!(iterator = PyObject_GetIter(obj)))
! {
! list_unref(l);
return -1;
+ }
while ((item = PyIter_Next(iterator)))
{
li = listitem_alloc();
if (li == NULL)
{
+ list_unref(l);
Py_DECREF(iterator);
PyErr_NoMemory();
return -1;
***************
*** 4219,4224 ****
--- 4259,4266 ----
if (_ConvertFromPyObject(item, &li->li_tv, lookup_dict) == -1)
{
+ list_unref(l);
+ listitem_free(li);
Py_DECREF(item);
Py_DECREF(iterator);
return -1;
***************
*** 4230,4235 ****
--- 4272,4286 ----
}
Py_DECREF(iterator);
+
+ /* Iterator may have finished due to an exception */
+ if (PyErr_Occurred())
+ {
+ list_unref(l);
+ return -1;
+ }
+
+ --l->lv_refcount;
return 0;
}
***************
*** 4295,4301 ****
PyObject *lookup_dict;
int r;
! lookup_dict = PyDict_New();
r = _ConvertFromPyObject(obj, tv, lookup_dict);
Py_DECREF(lookup_dict);
return r;
--- 4346,4353 ----
PyObject *lookup_dict;
int r;
! if (!(lookup_dict = PyDict_New()))
! return -1;
r = _ConvertFromPyObject(obj, tv, lookup_dict);
Py_DECREF(lookup_dict);
return r;
*** ../vim-7.3.1055/src/proto/eval.pro 2013-05-17 16:03:53.000000000 +0200
--- src/proto/eval.pro 2013-05-30 12:11:40.000000000 +0200
***************
*** 49,54 ****
--- 49,55 ----
void list_unref __ARGS((list_T *l));
void list_free __ARGS((list_T *l, int recurse));
listitem_T *listitem_alloc __ARGS((void));
+ void listitem_free __ARGS((listitem_T *item));
void listitem_remove __ARGS((list_T *l, listitem_T *item));
dictitem_T *dict_lookup __ARGS((hashitem_T *hi));
listitem_T *list_find __ARGS((list_T *l, long n));
***************
*** 65,70 ****
--- 66,72 ----
void set_ref_in_item __ARGS((typval_T *tv, int copyID));
dict_T *dict_alloc __ARGS((void));
void dict_unref __ARGS((dict_T *d));
+ void dict_free __ARGS((dict_T *d, int recurse));
dictitem_T *dictitem_alloc __ARGS((char_u *key));
void dictitem_free __ARGS((dictitem_T *item));
int dict_add __ARGS((dict_T *d, dictitem_T *item));
*** ../vim-7.3.1055/src/version.c 2013-05-30 11:51:04.000000000 +0200
--- src/version.c 2013-05-30 12:13:57.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1056,
/**/
--
I have a drinking problem -- I can't afford it.
/// 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 ///

205
7.3.1057 Normal file
View File

@ -0,0 +1,205 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1057
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1057
Problem: Python: not enough compatibilty.
Solution: Python patch 16: Make OutputWritelines support any sequence object
(ZyX) Note: tests fail
Files: src/if_py_both.h, src/testdir/test86.in, src/testdir/test86.ok,
src/testdir/test87.in, src/testdir/test87.ok
*** ../vim-7.3.1056/src/if_py_both.h 2013-05-30 12:14:44.000000000 +0200
--- src/if_py_both.h 2013-05-30 12:18:09.000000000 +0200
***************
*** 312,347 ****
static PyObject *
OutputWritelines(OutputObject *self, PyObject *args)
{
! PyInt n;
! PyInt i;
! PyObject *list;
int error = self->error;
! if (!PyArg_ParseTuple(args, "O", &list))
return NULL;
- Py_INCREF(list);
! if (!PyList_Check(list))
! {
! PyErr_SetString(PyExc_TypeError, _("writelines() requires list of strings"));
! Py_DECREF(list);
return NULL;
- }
-
- n = PyList_Size(list);
! for (i = 0; i < n; ++i)
{
- PyObject *line = PyList_GetItem(list, i);
char *str = NULL;
PyInt len;
! if (!PyArg_Parse(line, "et#", ENC_OPT, &str, &len))
{
PyErr_SetString(PyExc_TypeError, _("writelines() requires list of strings"));
! Py_DECREF(list);
return NULL;
}
Py_BEGIN_ALLOW_THREADS
Python_Lock_Vim();
--- 312,341 ----
static PyObject *
OutputWritelines(OutputObject *self, PyObject *args)
{
! PyObject *seq;
! PyObject *iterator;
! PyObject *item;
int error = self->error;
! if (!PyArg_ParseTuple(args, "O", &seq))
return NULL;
! if (!(iterator = PyObject_GetIter(seq)))
return NULL;
! while ((item = PyIter_Next(iterator)))
{
char *str = NULL;
PyInt len;
! if (!PyArg_Parse(item, "et#", ENC_OPT, &str, &len))
{
PyErr_SetString(PyExc_TypeError, _("writelines() requires list of strings"));
! Py_DECREF(iterator);
! Py_DECREF(item);
return NULL;
}
+ Py_DECREF(item);
Py_BEGIN_ALLOW_THREADS
Python_Lock_Vim();
***************
*** 351,357 ****
PyMem_Free(str);
}
! Py_DECREF(list);
Py_INCREF(Py_None);
return Py_None;
}
--- 345,356 ----
PyMem_Free(str);
}
! Py_DECREF(iterator);
!
! /* Iterator may have finished due to an exception */
! if (PyErr_Occurred())
! return NULL;
!
Py_INCREF(Py_None);
return Py_None;
}
*** ../vim-7.3.1056/src/testdir/test86.in 2013-05-29 22:36:06.000000000 +0200
--- src/testdir/test86.in 2013-05-30 12:18:09.000000000 +0200
***************
*** 709,714 ****
--- 709,724 ----
del o
EOF
:"
+ :"
+ :" Test stdout/stderr
+ :redir => messages
+ :py sys.stdout.write('abc') ; sys.stdout.write('def')
+ :py sys.stderr.write('abc') ; sys.stderr.write('def')
+ :py sys.stdout.writelines(iter('abc'))
+ :py sys.stderr.writelines(iter('abc'))
+ :redir END
+ :$put =string(substitute(messages, '\d\+', '', 'g'))
+ :"
:" Test exceptions
:fun Exe(e)
: execute a:e
*** ../vim-7.3.1056/src/testdir/test86.ok 2013-05-30 11:43:11.000000000 +0200
--- src/testdir/test86.ok 2013-05-30 12:18:09.000000000 +0200
***************
*** 391,396 ****
--- 391,403 ----
list:__dir__,__members__,extend,locked
function:__call__,__dir__,__members__,softspace
output:__dir__,__members__,flush,softspace,write,writelines
+ '
+ abcdef
+ line :
+ abcdef
+ abc
+ line :
+ abc'
(<class 'vim.error'>, error('abc',))
(<class 'vim.error'>, error('def',))
(<class 'vim.error'>, error('ghi',))
*** ../vim-7.3.1056/src/testdir/test87.in 2013-05-29 22:36:06.000000000 +0200
--- src/testdir/test87.in 2013-05-30 12:18:09.000000000 +0200
***************
*** 687,692 ****
--- 687,702 ----
del o
EOF
:"
+ :"
+ :" Test stdout/stderr
+ :redir => messages
+ :py sys.stdout.write('abc') ; sys.stdout.write('def')
+ :py sys.stderr.write('abc') ; sys.stderr.write('def')
+ :py sys.stdout.writelines(iter('abc'))
+ :py sys.stderr.writelines(iter('abc'))
+ :redir END
+ :$put =string(substitute(messages, '\d\+', '', 'g'))
+ :"
:" Test exceptions
:fun Exe(e)
: execute a:e
*** ../vim-7.3.1056/src/testdir/test87.ok 2013-05-30 11:43:11.000000000 +0200
--- src/testdir/test87.ok 2013-05-30 12:18:09.000000000 +0200
***************
*** 380,385 ****
--- 380,392 ----
list:__dir__,extend,locked
function:__call__,__dir__,softspace
output:__dir__,flush,softspace,write,writelines
+ '
+ abcdef
+ line :
+ abcdef
+ abc
+ line :
+ abc'
(<class 'vim.error'>, error('abc',))
(<class 'vim.error'>, error('def',))
(<class 'vim.error'>, error('ghi',))
*** ../vim-7.3.1056/src/version.c 2013-05-30 12:14:44.000000000 +0200
--- src/version.c 2013-05-30 12:20:02.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1057,
/**/
--
I have a drinking problem -- I don't have a drink!
/// 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 ///

163
7.3.1058 Normal file
View File

@ -0,0 +1,163 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1058
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1058
Problem: Call of funcref does not succeed in other script.
Solution: Python patch 17: add get_expanded_name(). (ZyX)
Files: src/eval.c, src/proto/eval.pro
*** ../vim-7.3.1057/src/eval.c 2013-05-30 12:14:44.000000000 +0200
--- src/eval.c 2013-05-30 12:31:55.000000000 +0200
***************
*** 810,816 ****
# endif
prof_self_cmp __ARGS((const void *s1, const void *s2));
#endif
- static int script_autoload __ARGS((char_u *name, int reload));
static char_u *autoload_name __ARGS((char_u *name));
static void cat_func_name __ARGS((char_u *buf, ufunc_T *fp));
static void func_free __ARGS((ufunc_T *fp));
--- 810,815 ----
***************
*** 10946,10961 ****
typval_T *rettv;
{
char_u *s;
s = get_tv_string(&argvars[0]);
if (s == NULL || *s == NUL || VIM_ISDIGIT(*s))
EMSG2(_(e_invarg2), s);
! /* Don't check an autoload name for existence here. */
! else if (vim_strchr(s, AUTOLOAD_CHAR) == NULL && !function_exists(s))
EMSG2(_("E700: Unknown function: %s"), s);
else
{
! rettv->vval.v_string = vim_strsave(s);
rettv->v_type = VAR_FUNC;
}
}
--- 10945,10969 ----
typval_T *rettv;
{
char_u *s;
+ char_u *name = NULL;
s = get_tv_string(&argvars[0]);
if (s == NULL || *s == NUL || VIM_ISDIGIT(*s))
EMSG2(_(e_invarg2), s);
! /* Don't check an autoload name for existence here, but still expand it
! * checking for validity */
! else if ((name = get_expanded_name(s, vim_strchr(s, AUTOLOAD_CHAR) == NULL))
! == NULL)
EMSG2(_("E700: Unknown function: %s"), s);
else
{
! if (name == NULL)
! /* Autoload function, need to copy string */
! rettv->vval.v_string = vim_strsave(s);
! else
! /* Function found by get_expanded_name, string allocated by
! * trans_function_name: no need to copy */
! rettv->vval.v_string = name;
rettv->v_type = VAR_FUNC;
}
}
***************
*** 21938,21943 ****
--- 21946,21978 ----
return n;
}
+ char_u *
+ get_expanded_name(name, check)
+ char_u *name;
+ int check;
+ {
+ char_u *nm = name;
+ char_u *p;
+
+ p = trans_function_name(&nm, FALSE, TFN_INT|TFN_QUIET, NULL);
+
+ if (p != NULL && *nm == NUL)
+ {
+ if (!check)
+ return p;
+ else if (builtin_function(p))
+ {
+ if (find_internal_func(p) >= 0)
+ return p;
+ }
+ else
+ if (find_func(p) != NULL)
+ return p;
+ }
+ vim_free(p);
+ return NULL;
+ }
+
/*
* Return TRUE if "name" looks like a builtin function name: starts with a
* lower case letter and doesn't contain a ':' or AUTOLOAD_CHAR.
***************
*** 22146,22152 ****
* If "name" has a package name try autoloading the script for it.
* Return TRUE if a package was loaded.
*/
! static int
script_autoload(name, reload)
char_u *name;
int reload; /* load script again when already loaded */
--- 22181,22187 ----
* If "name" has a package name try autoloading the script for it.
* Return TRUE if a package was loaded.
*/
! int
script_autoload(name, reload)
char_u *name;
int reload; /* load script again when already loaded */
*** ../vim-7.3.1057/src/proto/eval.pro 2013-05-30 12:14:44.000000000 +0200
--- src/proto/eval.pro 2013-05-30 12:31:55.000000000 +0200
***************
*** 77,82 ****
--- 77,83 ----
long get_dict_number __ARGS((dict_T *d, char_u *key));
char_u *get_function_name __ARGS((expand_T *xp, int idx));
char_u *get_expr_name __ARGS((expand_T *xp, int idx));
+ char_u *get_expanded_name __ARGS((char_u *name, int check));
int func_call __ARGS((char_u *name, typval_T *args, dict_T *selfdict, typval_T *rettv));
void mzscheme_call_vim __ARGS((char_u *name, typval_T *args, typval_T *rettv));
long do_searchpair __ARGS((char_u *spat, char_u *mpat, char_u *epat, int dir, char_u *skip, int flags, pos_T *match_pos, linenr_T lnum_stop, long time_limit));
***************
*** 129,132 ****
--- 130,134 ----
void ex_oldfiles __ARGS((exarg_T *eap));
int modify_fname __ARGS((char_u *src, int *usedlen, char_u **fnamep, char_u **bufp, int *fnamelen));
char_u *do_string_sub __ARGS((char_u *str, char_u *pat, char_u *sub, char_u *flags));
+ int script_autoload __ARGS((char_u *name, int reload));
/* vim: set ft=c : */
*** ../vim-7.3.1057/src/version.c 2013-05-30 12:26:52.000000000 +0200
--- src/version.c 2013-05-30 12:29:55.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1058,
/**/
--
How To Keep A Healthy Level Of Insanity:
1. At lunch time, sit in your parked car with sunglasses on and point
a hair dryer at passing cars. See if they slow down.
/// 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 ///

321
7.3.1059 Normal file
View File

@ -0,0 +1,321 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1059
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1059
Problem: Python: Using fixed size buffers.
Solution: Python patch 18: Use python's own formatter. (ZyX)
Files: src/if_py_both.h, src/if_python3.c, src/if_python.c
*** ../vim-7.3.1058/src/if_py_both.h 2013-05-30 12:26:52.000000000 +0200
--- src/if_py_both.h 2013-05-30 12:38:22.000000000 +0200
***************
*** 2006,2029 ****
static PyObject *
TabPageRepr(TabPageObject *self)
{
- static char repr[100];
-
if (self->tab == INVALID_TABPAGE_VALUE)
! {
! vim_snprintf(repr, 100, _("<tabpage object (deleted) at %p>"), (self));
! return PyString_FromString(repr);
! }
else
{
int t = get_tab_number(self->tab);
if (t == 0)
! vim_snprintf(repr, 100, _("<tabpage object (unknown) at %p>"),
! (self));
else
! vim_snprintf(repr, 100, _("<tabpage %d>"), t - 1);
!
! return PyString_FromString(repr);
}
}
--- 2006,2022 ----
static PyObject *
TabPageRepr(TabPageObject *self)
{
if (self->tab == INVALID_TABPAGE_VALUE)
! return PyString_FromFormat("<tabpage object (deleted) at %p>", (self));
else
{
int t = get_tab_number(self->tab);
if (t == 0)
! return PyString_FromFormat("<tabpage object (unknown) at %p>",
! (self));
else
! return PyString_FromFormat("<tabpage %d>", t - 1);
}
}
***************
*** 2344,2367 ****
static PyObject *
WindowRepr(WindowObject *self)
{
- static char repr[100];
-
if (self->win == INVALID_WINDOW_VALUE)
! {
! vim_snprintf(repr, 100, _("<window object (deleted) at %p>"), (self));
! return PyString_FromString(repr);
! }
else
{
int w = get_win_number(self->win, firstwin);
if (w == 0)
! vim_snprintf(repr, 100, _("<window object (unknown) at %p>"),
(self));
else
! vim_snprintf(repr, 100, _("<window %d>"), w - 1);
!
! return PyString_FromString(repr);
}
}
--- 2337,2353 ----
static PyObject *
WindowRepr(WindowObject *self)
{
if (self->win == INVALID_WINDOW_VALUE)
! return PyString_FromFormat("<window object (deleted) at %p>", (self));
else
{
int w = get_win_number(self->win, firstwin);
if (w == 0)
! return PyString_FromFormat("<window object (unknown) at %p>",
(self));
else
! return PyString_FromFormat("<window %d>", w - 1);
}
}
***************
*** 3281,3311 ****
static PyObject *
RangeRepr(RangeObject *self)
{
- static char repr[100];
-
if (self->buf->buf == INVALID_BUFFER_VALUE)
! {
! vim_snprintf(repr, 100, "<range object (for deleted buffer) at %p>",
! (self));
! return PyString_FromString(repr);
! }
else
{
char *name = (char *)self->buf->buf->b_fname;
- int len;
if (name == NULL)
name = "";
- len = (int)strlen(name);
-
- if (len > 45)
- name = name + (45 - len);
-
- vim_snprintf(repr, 100, "<range %s%s (%d:%d)>",
- len > 45 ? "..." : "", name,
- self->start, self->end);
! return PyString_FromString(repr);
}
}
--- 3267,3284 ----
static PyObject *
RangeRepr(RangeObject *self)
{
if (self->buf->buf == INVALID_BUFFER_VALUE)
! return PyString_FromFormat("<range object (for deleted buffer) at %p>",
! (self));
else
{
char *name = (char *)self->buf->buf->b_fname;
if (name == NULL)
name = "";
! return PyString_FromFormat("<range %s (%d:%d)>",
! name, self->start, self->end);
}
}
***************
*** 3534,3561 ****
static PyObject *
BufferRepr(BufferObject *self)
{
- static char repr[100];
-
if (self->buf == INVALID_BUFFER_VALUE)
! {
! vim_snprintf(repr, 100, _("<buffer object (deleted) at %p>"), (self));
! return PyString_FromString(repr);
! }
else
{
! char *name = (char *)self->buf->b_fname;
! PyInt len;
if (name == NULL)
name = "";
- len = strlen(name);
-
- if (len > 35)
- name = name + (35 - len);
-
- vim_snprintf(repr, 100, "<buffer %s%s>", len > 35 ? "..." : "", name);
! return PyString_FromString(repr);
}
}
--- 3507,3522 ----
static PyObject *
BufferRepr(BufferObject *self)
{
if (self->buf == INVALID_BUFFER_VALUE)
! return PyString_FromFormat("<buffer object (deleted) at %p>", self);
else
{
! char *name = (char *)self->buf->b_fname;
if (name == NULL)
name = "";
! return PyString_FromFormat("<buffer %s>", name);
}
}
*** ../vim-7.3.1058/src/if_python3.c 2013-05-29 22:36:06.000000000 +0200
--- src/if_python3.c 2013-05-30 12:39:25.000000000 +0200
***************
*** 90,95 ****
--- 90,96 ----
#define PyString_AsString(obj) PyBytes_AsString(obj)
#define PyString_Size(obj) PyBytes_GET_SIZE(bytes)
#define PyString_FromString(repr) PyUnicode_FromString(repr)
+ #define PyString_FromFormat PyUnicode_FromFormat
#define PyString_AsStringAndSize(obj, buffer, len) PyBytes_AsStringAndSize(obj, buffer, len)
#define PyInt_Check(obj) PyLong_Check(obj)
#define PyInt_FromLong(i) PyLong_FromLong(i)
***************
*** 230,235 ****
--- 231,246 ----
# define PyType_GenericNew py3_PyType_GenericNew
# undef PyUnicode_FromString
# define PyUnicode_FromString py3_PyUnicode_FromString
+ # ifndef PyUnicode_FromFormat
+ # define PyUnicode_FromFormat py3_PyUnicode_FromFormat
+ # else
+ # define Py_UNICODE_USE_UCS_FUNCTIONS
+ # ifdef Py_UNICODE_WIDE
+ # define PyUnicodeUCS4_FromFormat py3_PyUnicodeUCS4_FromFormat
+ # else
+ # define PyUnicodeUCS2_FromFormat py3_PyUnicodeUCS2_FromFormat
+ # endif
+ # endif
# undef PyUnicode_Decode
# define PyUnicode_Decode py3_PyUnicode_Decode
# define PyType_IsSubtype py3_PyType_IsSubtype
***************
*** 293,298 ****
--- 304,318 ----
static int (*py3_PyType_Ready)(PyTypeObject *type);
static int (*py3_PyDict_SetItemString)(PyObject *dp, char *key, PyObject *item);
static PyObject* (*py3_PyUnicode_FromString)(const char *u);
+ # ifndef Py_UNICODE_USE_UCS_FUNCTIONS
+ static PyObject* (*py3_PyUnicode_FromFormat)(const char *u, ...);
+ # else
+ # ifdef Py_UNICODE_WIDE
+ static PyObject* (*py3_PyUnicodeUCS4_FromFormat)(const char *u, ...);
+ # else
+ static PyObject* (*py3_PyUnicodeUCS2_FromFormat)(const char *u, ...);
+ # endif
+ # endif
static PyObject* (*py3_PyUnicode_Decode)(const char *u, Py_ssize_t size,
const char *encoding, const char *errors);
static long (*py3_PyLong_AsLong)(PyObject *);
***************
*** 458,463 ****
--- 478,492 ----
# else
{"_PyUnicode_AsString", (PYTHON_PROC*)&py3__PyUnicode_AsString},
# endif
+ # ifndef Py_UNICODE_USE_UCS_FUNCTIONS
+ {"PyUnicode_FromFormat", (PYTHON_PROC*)&py3_PyUnicode_FromFormat},
+ # else
+ # ifdef Py_UNICODE_WIDE
+ {"PyUnicodeUCS4_FromFormat", (PYTHON_PROC*)&py3_PyUnicodeUCS4_FromFormat},
+ # else
+ {"PyUnicodeUCS2_FromFormat", (PYTHON_PROC*)&py3_PyUnicodeUCS2_FromFormat},
+ # endif
+ # endif
{"PyBytes_AsString", (PYTHON_PROC*)&py3_PyBytes_AsString},
{"PyBytes_AsStringAndSize", (PYTHON_PROC*)&py3_PyBytes_AsStringAndSize},
{"PyBytes_FromString", (PYTHON_PROC*)&py3_PyBytes_FromString},
*** ../vim-7.3.1058/src/if_python.c 2013-05-29 22:36:06.000000000 +0200
--- src/if_python.c 2013-05-30 12:38:22.000000000 +0200
***************
*** 212,217 ****
--- 212,218 ----
# define PyString_AsString dll_PyString_AsString
# define PyString_AsStringAndSize dll_PyString_AsStringAndSize
# define PyString_FromString dll_PyString_FromString
+ # define PyString_FromFormat dll_PyString_FromFormat
# define PyString_FromStringAndSize dll_PyString_FromStringAndSize
# define PyString_Size dll_PyString_Size
# define PyString_Type (*dll_PyString_Type)
***************
*** 340,345 ****
--- 341,347 ----
static char*(*dll_PyString_AsString)(PyObject *);
static int(*dll_PyString_AsStringAndSize)(PyObject *, char **, int *);
static PyObject*(*dll_PyString_FromString)(const char *);
+ static PyObject*(*dll_PyString_FromFormat)(const char *, ...);
static PyObject*(*dll_PyString_FromStringAndSize)(const char *, PyInt);
static PyInt(*dll_PyString_Size)(PyObject *);
static PyTypeObject* dll_PyString_Type;
***************
*** 499,504 ****
--- 501,507 ----
{"PyString_AsString", (PYTHON_PROC*)&dll_PyString_AsString},
{"PyString_AsStringAndSize", (PYTHON_PROC*)&dll_PyString_AsStringAndSize},
{"PyString_FromString", (PYTHON_PROC*)&dll_PyString_FromString},
+ {"PyString_FromFormat", (PYTHON_PROC*)&dll_PyString_FromFormat},
{"PyString_FromStringAndSize", (PYTHON_PROC*)&dll_PyString_FromStringAndSize},
{"PyString_Size", (PYTHON_PROC*)&dll_PyString_Size},
{"PyString_Type", (PYTHON_PROC*)&dll_PyString_Type},
*** ../vim-7.3.1058/src/version.c 2013-05-30 12:35:48.000000000 +0200
--- src/version.c 2013-05-30 12:39:51.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1059,
/**/
--
How To Keep A Healthy Level Of Insanity:
2. Page yourself over the intercom. Don't disguise your voice.
/// 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 ///

61
7.3.1060 Normal file
View File

@ -0,0 +1,61 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1060
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1060
Problem: Python: can't repr() a function.
Solution: Python patch 19: add FunctionRepr(). (ZyX)
Files: src/if_py_both.h
*** ../vim-7.3.1059/src/if_py_both.h 2013-05-30 12:40:36.000000000 +0200
--- src/if_py_both.h 2013-05-30 12:43:16.000000000 +0200
***************
*** 1584,1589 ****
--- 1584,1595 ----
return result;
}
+ static PyObject *
+ FunctionRepr(FunctionObject *self)
+ {
+ return PyString_FromFormat("<vim.Function '%s'>", self->name);
+ }
+
static struct PyMethodDef FunctionMethods[] = {
{"__call__",(PyCFunction)FunctionCall, METH_VARARGS|METH_KEYWORDS, ""},
{"__dir__", (PyCFunction)FunctionDir, METH_NOARGS, ""},
***************
*** 4640,4645 ****
--- 4646,4652 ----
FunctionType.tp_flags = Py_TPFLAGS_DEFAULT;
FunctionType.tp_doc = "object that calls vim function";
FunctionType.tp_methods = FunctionMethods;
+ FunctionType.tp_repr = (reprfunc)FunctionRepr;
#if PY_MAJOR_VERSION >= 3
FunctionType.tp_getattro = (getattrofunc)FunctionGetattro;
#else
*** ../vim-7.3.1059/src/version.c 2013-05-30 12:40:36.000000000 +0200
--- src/version.c 2013-05-30 12:43:06.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1060,
/**/
--
How To Keep A Healthy Level Of Insanity:
3. Every time someone asks you to do something, ask if they want fries
with that.
/// 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 ///

1964
7.3.1061 Normal file

File diff suppressed because it is too large Load Diff

642
7.3.1062 Normal file
View File

@ -0,0 +1,642 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1062
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1062
Problem: Python: List is not standard.
Solution: Python patch 21: Add standard methods and fields. (ZyX)
Files: src/if_py_both.h, src/testdir/test86.in, src/testdir/test86.ok,
src/testdir/test87.in, src/testdir/test87.ok
*** ../vim-7.3.1061/src/if_py_both.h 2013-05-30 13:01:14.000000000 +0200
--- src/if_py_both.h 2013-05-30 13:03:54.000000000 +0200
***************
*** 1530,1541 ****
pylinkedlist_T ref;
} ListObject;
static PyObject *
! ListNew(list_T *list)
{
ListObject *self;
! self = PyObject_NEW(ListObject, &ListType);
if (self == NULL)
return NULL;
self->list = list;
--- 1530,1543 ----
pylinkedlist_T ref;
} ListObject;
+ #define NEW_LIST(list) ListNew(&ListType, list)
+
static PyObject *
! ListNew(PyTypeObject *subtype, list_T *list)
{
ListObject *self;
! self = (ListObject *) subtype->tp_alloc(subtype, 0);
if (self == NULL)
return NULL;
self->list = list;
***************
*** 1546,1589 ****
return (PyObject *)(self);
}
! static void
! ListDestructor(ListObject *self)
{
! pyll_remove(&self->ref, &lastlist);
! list_unref(self->list);
! DESTRUCTOR_FINISH(self);
}
static int
list_py_concat(list_T *l, PyObject *obj, PyObject *lookup_dict)
{
! Py_ssize_t i;
! Py_ssize_t lsize = PySequence_Size(obj);
! PyObject *litem;
listitem_T *li;
! for(i=0; i<lsize; i++)
{
! li = listitem_alloc();
! if (li == NULL)
{
PyErr_NoMemory();
return -1;
}
li->li_tv.v_lock = 0;
! litem = PySequence_GetItem(obj, i);
! if (litem == NULL)
! return -1;
! if (_ConvertFromPyObject(litem, &li->li_tv, lookup_dict) == -1)
return -1;
list_append(l, li);
}
return 0;
}
static PyInt
ListLength(ListObject *self)
{
--- 1548,1663 ----
return (PyObject *)(self);
}
! static list_T *
! py_list_alloc()
{
! list_T *r;
! if (!(r = list_alloc()))
! {
! PyErr_NoMemory();
! return NULL;
! }
! ++r->lv_refcount;
!
! return r;
}
static int
list_py_concat(list_T *l, PyObject *obj, PyObject *lookup_dict)
{
! PyObject *iterator;
! PyObject *item;
listitem_T *li;
! if (!(iterator = PyObject_GetIter(obj)))
! return -1;
!
! while ((item = PyIter_Next(iterator)))
{
! if (!(li = listitem_alloc()))
{
PyErr_NoMemory();
+ Py_DECREF(item);
+ Py_DECREF(iterator);
return -1;
}
li->li_tv.v_lock = 0;
+ li->li_tv.v_type = VAR_UNKNOWN;
! if (_ConvertFromPyObject(item, &li->li_tv, lookup_dict) == -1)
! {
! Py_DECREF(item);
! Py_DECREF(iterator);
! listitem_free(li);
return -1;
+ }
+
+ Py_DECREF(item);
list_append(l, li);
}
+
+ Py_DECREF(iterator);
+
+ /* Iterator may have finished due to an exception */
+ if (PyErr_Occurred())
+ return -1;
+
return 0;
}
+ static PyObject *
+ ListConstructor(PyTypeObject *subtype, PyObject *args, PyObject *kwargs)
+ {
+ list_T *list;
+ PyObject *obj = NULL;
+
+ if (kwargs)
+ {
+ PyErr_SetString(PyExc_TypeError,
+ _("list constructor does not accept keyword arguments"));
+ return NULL;
+ }
+
+ if (!PyArg_ParseTuple(args, "|O", &obj))
+ return NULL;
+
+ if (!(list = py_list_alloc()))
+ return NULL;
+
+ if (obj)
+ {
+ PyObject *lookup_dict;
+
+ if (!(lookup_dict = PyDict_New()))
+ {
+ list_unref(list);
+ return NULL;
+ }
+
+ if (list_py_concat(list, obj, lookup_dict) == -1)
+ {
+ Py_DECREF(lookup_dict);
+ list_unref(list);
+ return NULL;
+ }
+
+ Py_DECREF(lookup_dict);
+ }
+
+ return ListNew(subtype, list);
+ }
+
+ static void
+ ListDestructor(ListObject *self)
+ {
+ pyll_remove(&self->ref, &lastlist);
+ list_unref(self->list);
+
+ DESTRUCTOR_FINISH(self);
+ }
+
static PyInt
ListLength(ListObject *self)
{
***************
*** 1747,1753 ****
if (list_append_tv(l, &tv) == FAIL)
{
clear_tv(&tv);
! PyErr_SetVim(_("Failed to add item to list"));
return -1;
}
}
--- 1821,1827 ----
if (list_append_tv(l, &tv) == FAIL)
{
clear_tv(&tv);
! PyErr_SetVim(_("failed to add item to list"));
return -1;
}
}
***************
*** 1765,1777 ****
ListAssSlice(ListObject *self, Py_ssize_t first, Py_ssize_t last, PyObject *obj)
{
PyInt size = ListLength(self);
! Py_ssize_t i;
! Py_ssize_t lsize;
! PyObject *litem;
listitem_T *li;
listitem_T *next;
typval_T v;
list_T *l = self->list;
if (l->lv_lock)
{
--- 1839,1851 ----
ListAssSlice(ListObject *self, Py_ssize_t first, Py_ssize_t last, PyObject *obj)
{
PyInt size = ListLength(self);
! PyObject *iterator;
! PyObject *item;
listitem_T *li;
listitem_T *next;
typval_T v;
list_T *l = self->list;
+ PyInt i;
if (l->lv_lock)
{
***************
*** 1806,1826 ****
if (obj == NULL)
return 0;
! if (!PyList_Check(obj))
! {
! PyErr_SetString(PyExc_TypeError, _("can only assign lists to slice"));
return -1;
- }
-
- lsize = PyList_Size(obj);
! for(i=0; i<lsize; i++)
{
! litem = PyList_GetItem(obj, i);
! if (litem == NULL)
! return -1;
! if (ConvertFromPyObject(litem, &v) == -1)
return -1;
if (list_insert_tv(l, &v, li) == FAIL)
{
clear_tv(&v);
--- 1880,1897 ----
if (obj == NULL)
return 0;
! if (!(iterator = PyObject_GetIter(obj)))
return -1;
! while ((item = PyIter_Next(iterator)))
{
! if (ConvertFromPyObject(item, &v) == -1)
! {
! Py_DECREF(iterator);
! Py_DECREF(item);
return -1;
+ }
+ Py_DECREF(item);
if (list_insert_tv(l, &v, li) == FAIL)
{
clear_tv(&v);
***************
*** 1829,1834 ****
--- 1900,1906 ----
}
clear_tv(&v);
}
+ Py_DECREF(iterator);
return 0;
}
***************
*** 1844,1855 ****
return NULL;
}
- if (!PySequence_Check(obj))
- {
- PyErr_SetString(PyExc_TypeError, _("can only concatenate with lists"));
- return NULL;
- }
-
if (!(lookup_dict = PyDict_New()))
return NULL;
--- 1916,1921 ----
***************
*** 1881,1887 ****
if (val == NULL)
{
PyErr_SetString(PyExc_AttributeError,
! _("cannot delete vim.dictionary attributes"));
return -1;
}
--- 1947,1953 ----
if (val == NULL)
{
PyErr_SetString(PyExc_AttributeError,
! _("cannot delete vim.List attributes"));
return -1;
}
***************
*** 4591,4611 ****
return 0;
}
- static list_T *
- py_list_alloc()
- {
- list_T *r;
-
- if (!(r = list_alloc()))
- {
- PyErr_NoMemory();
- return NULL;
- }
- ++r->lv_refcount;
-
- return r;
- }
-
static int
pyseq_to_tv(PyObject *obj, typval_T *tv, PyObject *lookup_dict)
{
--- 4657,4662 ----
***************
*** 4627,4691 ****
return 0;
}
- static int
- pyiter_to_tv(PyObject *obj, typval_T *tv, PyObject *lookup_dict)
- {
- PyObject *iterator;
- PyObject *item;
- list_T *l;
- listitem_T *li;
-
- if (!(l = py_list_alloc()))
- return -1;
-
- tv->vval.v_list = l;
- tv->v_type = VAR_LIST;
-
- if (!(iterator = PyObject_GetIter(obj)))
- {
- list_unref(l);
- return -1;
- }
-
- while ((item = PyIter_Next(iterator)))
- {
- li = listitem_alloc();
- if (li == NULL)
- {
- list_unref(l);
- Py_DECREF(iterator);
- PyErr_NoMemory();
- return -1;
- }
- li->li_tv.v_lock = 0;
-
- if (_ConvertFromPyObject(item, &li->li_tv, lookup_dict) == -1)
- {
- list_unref(l);
- listitem_free(li);
- Py_DECREF(item);
- Py_DECREF(iterator);
- return -1;
- }
-
- list_append(l, li);
-
- Py_DECREF(item);
- }
-
- Py_DECREF(iterator);
-
- /* Iterator may have finished due to an exception */
- if (PyErr_Occurred())
- {
- list_unref(l);
- return -1;
- }
-
- --l->lv_refcount;
- return 0;
- }
-
typedef int (*pytotvfunc)(PyObject *, typval_T *, PyObject *);
static int
--- 4678,4683 ----
***************
*** 4866,4874 ****
tv->vval.v_float = (float_T) PyFloat_AsDouble(obj);
}
#endif
! else if (PyIter_Check(obj))
! return convert_dl(obj, tv, pyiter_to_tv, lookup_dict);
! else if (PySequence_Check(obj))
return convert_dl(obj, tv, pyseq_to_tv, lookup_dict);
else if (PyMapping_Check(obj))
return convert_dl(obj, tv, pymap_to_tv, lookup_dict);
--- 4858,4864 ----
tv->vval.v_float = (float_T) PyFloat_AsDouble(obj);
}
#endif
! else if (PyIter_Check(obj) || PySequence_Check(obj))
return convert_dl(obj, tv, pyseq_to_tv, lookup_dict);
else if (PyMapping_Check(obj))
return convert_dl(obj, tv, pymap_to_tv, lookup_dict);
***************
*** 4901,4907 ****
return PyFloat_FromDouble((double) tv->vval.v_float);
#endif
case VAR_LIST:
! return ListNew(tv->vval.v_list);
case VAR_DICT:
return NEW_DICTIONARY(tv->vval.v_dict);
case VAR_FUNC:
--- 4891,4897 ----
return PyFloat_FromDouble((double) tv->vval.v_float);
#endif
case VAR_LIST:
! return NEW_LIST(tv->vval.v_list);
case VAR_DICT:
return NEW_DICTIONARY(tv->vval.v_dict);
case VAR_FUNC:
***************
*** 5096,5105 ****
ListType.tp_basicsize = sizeof(ListObject);
ListType.tp_as_sequence = &ListAsSeq;
ListType.tp_as_mapping = &ListAsMapping;
! ListType.tp_flags = Py_TPFLAGS_DEFAULT;
ListType.tp_doc = "list pushing modifications to vim structure";
ListType.tp_methods = ListMethods;
ListType.tp_iter = (getiterfunc)ListIter;
#if PY_MAJOR_VERSION >= 3
ListType.tp_getattro = (getattrofunc)ListGetattro;
ListType.tp_setattro = (setattrofunc)ListSetattro;
--- 5086,5097 ----
ListType.tp_basicsize = sizeof(ListObject);
ListType.tp_as_sequence = &ListAsSeq;
ListType.tp_as_mapping = &ListAsMapping;
! ListType.tp_flags = Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE;
ListType.tp_doc = "list pushing modifications to vim structure";
ListType.tp_methods = ListMethods;
ListType.tp_iter = (getiterfunc)ListIter;
+ ListType.tp_new = (newfunc)ListConstructor;
+ ListType.tp_alloc = (allocfunc)PyType_GenericAlloc;
#if PY_MAJOR_VERSION >= 3
ListType.tp_getattro = (getattrofunc)ListGetattro;
ListType.tp_setattro = (setattrofunc)ListSetattro;
*** ../vim-7.3.1061/src/testdir/test86.in 2013-05-30 13:01:14.000000000 +0200
--- src/testdir/test86.in 2013-05-30 13:03:54.000000000 +0200
***************
*** 735,740 ****
--- 735,742 ----
:$put =string(pyeval('vim.Dictionary({})'))
:$put =string(pyeval('vim.Dictionary(a=1)'))
:$put =string(pyeval('vim.Dictionary(((''a'', 1),))'))
+ :$put =string(pyeval('vim.List()'))
+ :$put =string(pyeval('vim.List(iter(''abc''))'))
:"
:" Test stdout/stderr
:redir => messages
***************
*** 752,759 ****
--- 754,771 ----
super(DupDict, self).__setitem__('dup_' + key, value)
dd = DupDict()
dd['a'] = 'b'
+
+ class DupList(vim.List):
+ def __getitem__(self, idx):
+ return [super(DupList, self).__getitem__(idx)] * 2
+
+ dl = DupList()
+ dl2 = DupList(iter('abc'))
+ dl.extend(dl2[0])
EOF
:$put =string(sort(keys(pyeval('dd'))))
+ :$put =string(pyeval('dl'))
+ :$put =string(pyeval('dl2'))
:"
:" Test exceptions
:fun Exe(e)
*** ../vim-7.3.1061/src/testdir/test86.ok 2013-05-30 13:01:14.000000000 +0200
--- src/testdir/test86.ok 2013-05-30 13:03:54.000000000 +0200
***************
*** 412,417 ****
--- 412,419 ----
{}
{'a': 1}
{'a': 1}
+ []
+ ['a', 'b', 'c']
'
abcdef
line :
***************
*** 420,425 ****
--- 422,429 ----
line :
abc'
['a', 'dup_a']
+ ['a', 'a']
+ ['a', 'b', 'c']
(<class 'vim.error'>, error('abc',))
(<class 'vim.error'>, error('def',))
(<class 'vim.error'>, error('ghi',))
*** ../vim-7.3.1061/src/testdir/test87.in 2013-05-30 13:01:14.000000000 +0200
--- src/testdir/test87.in 2013-05-30 13:03:54.000000000 +0200
***************
*** 692,701 ****
del o
EOF
:"
! :" Test vim.Dictionary.__new__
:$put =string(py3eval('vim.Dictionary({})'))
:$put =string(py3eval('vim.Dictionary(a=1)'))
:$put =string(py3eval('vim.Dictionary(((''a'', 1),))'))
:"
:" Test stdout/stderr
:redir => messages
--- 692,703 ----
del o
EOF
:"
! :" Test vim.*.__new__
:$put =string(py3eval('vim.Dictionary({})'))
:$put =string(py3eval('vim.Dictionary(a=1)'))
:$put =string(py3eval('vim.Dictionary(((''a'', 1),))'))
+ :$put =string(py3eval('vim.List()'))
+ :$put =string(py3eval('vim.List(iter(''abc''))'))
:"
:" Test stdout/stderr
:redir => messages
***************
*** 713,720 ****
--- 715,732 ----
super(DupDict, self).__setitem__('dup_' + key, value)
dd = DupDict()
dd['a'] = 'b'
+
+ class DupList(vim.List):
+ def __getitem__(self, idx):
+ return [super(DupList, self).__getitem__(idx)] * 2
+
+ dl = DupList()
+ dl2 = DupList(iter('abc'))
+ dl.extend(dl2[0])
EOF
:$put =string(sort(keys(py3eval('dd'))))
+ :$put =string(py3eval('dl'))
+ :$put =string(py3eval('dl2'))
:"
:" Test exceptions
:fun Exe(e)
*** ../vim-7.3.1061/src/testdir/test87.ok 2013-05-30 13:01:14.000000000 +0200
--- src/testdir/test87.ok 2013-05-30 13:03:54.000000000 +0200
***************
*** 401,406 ****
--- 401,408 ----
{}
{'a': 1}
{'a': 1}
+ []
+ ['a', 'b', 'c']
'
abcdef
line :
***************
*** 409,414 ****
--- 411,418 ----
line :
abc'
['a', 'dup_a']
+ ['a', 'a']
+ ['a', 'b', 'c']
(<class 'vim.error'>, error('abc',))
(<class 'vim.error'>, error('def',))
(<class 'vim.error'>, error('ghi',))
*** ../vim-7.3.1061/src/version.c 2013-05-30 13:01:14.000000000 +0200
--- src/version.c 2013-05-30 13:02:28.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1062,
/**/
--
How To Keep A Healthy Level Of Insanity:
5. Put decaf in the coffee maker for 3 weeks. Once everyone has gotten
over their caffeine addictions, switch to espresso.
/// 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 ///

661
7.3.1063 Normal file
View File

@ -0,0 +1,661 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1063
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1063
Problem: Python: Function is not standard.
Solution: Python patch 22: make Function subclassable. (ZyX)
Files: src/eval.c, src/if_py_both.h, src/proto/eval.pro,
src/testdir/test86.in, src/testdir/test86.ok,
src/testdir/test87.in, src/testdir/test87.ok
*** ../vim-7.3.1062/src/eval.c 2013-05-30 13:01:14.000000000 +0200
--- src/eval.c 2013-05-30 13:13:53.000000000 +0200
***************
*** 21933,21938 ****
--- 21933,21947 ----
}
#endif
+ int
+ translated_function_exists(name)
+ char_u *name;
+ {
+ if (builtin_function(name))
+ return find_internal_func(name) >= 0;
+ return find_func(name) != NULL;
+ }
+
/*
* Return TRUE if a function "name" exists.
*/
***************
*** 21950,21961 ****
/* Only accept "funcname", "funcname ", "funcname (..." and
* "funcname(...", not "funcname!...". */
if (p != NULL && (*nm == NUL || *nm == '('))
! {
! if (builtin_function(p))
! n = (find_internal_func(p) >= 0);
! else
! n = (find_func(p) != NULL);
! }
vim_free(p);
return n;
}
--- 21959,21965 ----
/* Only accept "funcname", "funcname ", "funcname (..." and
* "funcname(...", not "funcname!...". */
if (p != NULL && (*nm == NUL || *nm == '('))
! n = translated_function_exists(p);
vim_free(p);
return n;
}
***************
*** 21971,21988 ****
p = trans_function_name(&nm, FALSE, TFN_INT|TFN_QUIET, NULL);
if (p != NULL && *nm == NUL)
! {
! if (!check)
return p;
! else if (builtin_function(p))
! {
! if (find_internal_func(p) >= 0)
! return p;
! }
! else
! if (find_func(p) != NULL)
! return p;
! }
vim_free(p);
return NULL;
}
--- 21975,21983 ----
p = trans_function_name(&nm, FALSE, TFN_INT|TFN_QUIET, NULL);
if (p != NULL && *nm == NUL)
! if (!check || translated_function_exists(p))
return p;
!
vim_free(p);
return NULL;
}
*** ../vim-7.3.1062/src/if_py_both.h 2013-05-30 13:05:55.000000000 +0200
--- src/if_py_both.h 2013-05-30 13:08:09.000000000 +0200
***************
*** 1991,2020 ****
static PyTypeObject FunctionType;
static PyObject *
! FunctionNew(char_u *name)
{
FunctionObject *self;
! self = PyObject_NEW(FunctionObject, &FunctionType);
if (self == NULL)
return NULL;
! self->name = PyMem_New(char_u, STRLEN(name) + 1);
! if (self->name == NULL)
{
! PyErr_NoMemory();
! return NULL;
}
! STRCPY(self->name, name);
! func_ref(name);
return (PyObject *)(self);
}
static void
FunctionDestructor(FunctionObject *self)
{
func_unref(self->name);
! PyMem_Free(self->name);
DESTRUCTOR_FINISH(self);
}
--- 1991,2063 ----
static PyTypeObject FunctionType;
+ #define NEW_FUNCTION(name) FunctionNew(&FunctionType, name)
+
static PyObject *
! FunctionNew(PyTypeObject *subtype, char_u *name)
{
FunctionObject *self;
! self = (FunctionObject *) subtype->tp_alloc(subtype, 0);
!
if (self == NULL)
return NULL;
!
! if (isdigit(*name))
{
! if (!translated_function_exists(name))
! {
! PyErr_SetString(PyExc_ValueError,
! _("unnamed function does not exist"));
! return NULL;
! }
! self->name = vim_strsave(name);
! func_ref(self->name);
}
! else
! {
! self->name = get_expanded_name(name, TRUE);
! if (self->name == NULL)
! {
! if (script_autoload(name, TRUE) && !aborting())
! self->name = get_expanded_name(name, TRUE);
! if (self->name == NULL)
! {
! PyErr_SetString(PyExc_ValueError, _("function does not exist"));
! return NULL;
! }
! }
! }
!
return (PyObject *)(self);
}
+ static PyObject *
+ FunctionConstructor(PyTypeObject *subtype, PyObject *args, PyObject *kwargs)
+ {
+ PyObject *self;
+ char_u *name;
+
+ if (kwargs)
+ {
+ PyErr_SetString(PyExc_TypeError,
+ _("function constructor does not accept keyword arguments"));
+ return NULL;
+ }
+
+ if (!PyArg_ParseTuple(args, "s", &name))
+ return NULL;
+
+ self = FunctionNew(subtype, name);
+
+ return self;
+ }
+
static void
FunctionDestructor(FunctionObject *self)
{
func_unref(self->name);
! vim_free(self->name);
DESTRUCTOR_FINISH(self);
}
***************
*** 2093,2099 ****
}
static struct PyMethodDef FunctionMethods[] = {
- {"__call__",(PyCFunction)FunctionCall, METH_VARARGS|METH_KEYWORDS, ""},
{"__dir__", (PyCFunction)FunctionDir, METH_NOARGS, ""},
{ NULL, NULL, 0, NULL}
};
--- 2136,2141 ----
***************
*** 4895,4901 ****
case VAR_DICT:
return NEW_DICTIONARY(tv->vval.v_dict);
case VAR_FUNC:
! return FunctionNew(tv->vval.v_string == NULL
? (char_u *)"" : tv->vval.v_string);
case VAR_UNKNOWN:
Py_INCREF(Py_None);
--- 4937,4943 ----
case VAR_DICT:
return NEW_DICTIONARY(tv->vval.v_dict);
case VAR_FUNC:
! return NEW_FUNCTION(tv->vval.v_string == NULL
? (char_u *)"" : tv->vval.v_string);
case VAR_UNKNOWN:
Py_INCREF(Py_None);
***************
*** 5105,5114 ****
FunctionType.tp_basicsize = sizeof(FunctionObject);
FunctionType.tp_dealloc = (destructor)FunctionDestructor;
FunctionType.tp_call = (ternaryfunc)FunctionCall;
! FunctionType.tp_flags = Py_TPFLAGS_DEFAULT;
FunctionType.tp_doc = "object that calls vim function";
FunctionType.tp_methods = FunctionMethods;
FunctionType.tp_repr = (reprfunc)FunctionRepr;
#if PY_MAJOR_VERSION >= 3
FunctionType.tp_getattro = (getattrofunc)FunctionGetattro;
#else
--- 5147,5158 ----
FunctionType.tp_basicsize = sizeof(FunctionObject);
FunctionType.tp_dealloc = (destructor)FunctionDestructor;
FunctionType.tp_call = (ternaryfunc)FunctionCall;
! FunctionType.tp_flags = Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE;
FunctionType.tp_doc = "object that calls vim function";
FunctionType.tp_methods = FunctionMethods;
FunctionType.tp_repr = (reprfunc)FunctionRepr;
+ FunctionType.tp_new = (newfunc)FunctionConstructor;
+ FunctionType.tp_alloc = (allocfunc)PyType_GenericAlloc;
#if PY_MAJOR_VERSION >= 3
FunctionType.tp_getattro = (getattrofunc)FunctionGetattro;
#else
*** ../vim-7.3.1062/src/proto/eval.pro 2013-05-30 13:01:14.000000000 +0200
--- src/proto/eval.pro 2013-05-30 13:08:09.000000000 +0200
***************
*** 79,84 ****
--- 79,85 ----
char_u *get_function_name __ARGS((expand_T *xp, int idx));
char_u *get_expr_name __ARGS((expand_T *xp, int idx));
char_u *get_expanded_name __ARGS((char_u *name, int check));
+ int translated_function_exists __ARGS((char_u *name));
int func_call __ARGS((char_u *name, typval_T *args, dict_T *selfdict, typval_T *rettv));
void mzscheme_call_vim __ARGS((char_u *name, typval_T *args, typval_T *rettv));
long do_searchpair __ARGS((char_u *spat, char_u *mpat, char_u *epat, int dir, char_u *skip, int flags, pos_T *match_pos, linenr_T lnum_stop, long time_limit));
*** ../vim-7.3.1062/src/testdir/test86.in 2013-05-30 13:05:55.000000000 +0200
--- src/testdir/test86.in 2013-05-30 13:08:09.000000000 +0200
***************
*** 31,36 ****
--- 31,39 ----
:"
:" Extending Dictionary directly with different types
:let d = {}
+ :fun d.f()
+ : return 1
+ :endfun
py << EOF
d=vim.bindeval('d')
d['1']='asd'
***************
*** 44,55 ****
dv.sort(key=repr)
di.sort(key=repr)
EOF
:$put =pyeval('repr(dk)')
:$put =substitute(pyeval('repr(dv)'),'0x\x\+','','g')
:$put =substitute(pyeval('repr(di)'),'0x\x\+','','g')
! :for [key, val] in sort(items(d))
! : $put =string(key) . ' : ' . string(val)
! : unlet key val
:endfor
:"
:" removing items with del
--- 47,59 ----
dv.sort(key=repr)
di.sort(key=repr)
EOF
+ :$put =pyeval('d[''f''](self={})')
:$put =pyeval('repr(dk)')
:$put =substitute(pyeval('repr(dv)'),'0x\x\+','','g')
:$put =substitute(pyeval('repr(di)'),'0x\x\+','','g')
! :for [key, Val] in sort(items(d))
! : $put =string(key) . ' : ' . string(Val)
! : unlet key Val
:endfor
:"
:" removing items with del
***************
*** 66,71 ****
--- 70,76 ----
:$put =string(l)
:"
:py del d['-1']
+ :py del d['f']
:$put =string(pyeval('d.get(''b'', 1)'))
:$put =string(pyeval('d.pop(''b'')'))
:$put =string(pyeval('d.get(''b'', 1)'))
***************
*** 187,195 ****
:catch
: $put =v:exception[:16]
:endtry
:delfunction New
:try
! : py l[0](1, 2, 3)
:catch
: $put =v:exception[:16]
:endtry
--- 192,201 ----
:catch
: $put =v:exception[:16]
:endtry
+ :py f=l[0]
:delfunction New
:try
! : py f(1, 2, 3)
:catch
: $put =v:exception[:16]
:endtry
***************
*** 737,742 ****
--- 743,749 ----
:$put =string(pyeval('vim.Dictionary(((''a'', 1),))'))
:$put =string(pyeval('vim.List()'))
:$put =string(pyeval('vim.List(iter(''abc''))'))
+ :$put =string(pyeval('vim.Function(''tr'')'))
:"
:" Test stdout/stderr
:redir => messages
***************
*** 747,752 ****
--- 754,763 ----
:redir END
:$put =string(substitute(messages, '\d\+', '', 'g'))
:" Test subclassing
+ :fun Put(...)
+ : $put =string(a:000)
+ : return a:000
+ :endfun
py << EOF
class DupDict(vim.Dictionary):
def __setitem__(self, key, value):
***************
*** 762,771 ****
--- 773,789 ----
dl = DupList()
dl2 = DupList(iter('abc'))
dl.extend(dl2[0])
+
+ class DupFun(vim.Function):
+ def __call__(self, arg):
+ return super(DupFun, self).__call__(arg, arg)
+
+ df = DupFun('Put')
EOF
:$put =string(sort(keys(pyeval('dd'))))
:$put =string(pyeval('dl'))
:$put =string(pyeval('dl2'))
+ :$put =string(pyeval('df(2)'))
:"
:" Test exceptions
:fun Exe(e)
*** ../vim-7.3.1062/src/testdir/test86.ok 2013-05-30 13:05:55.000000000 +0200
--- src/testdir/test86.ok 2013-05-30 13:08:09.000000000 +0200
***************
*** 4,16 ****
Vim(put):E684:
[0, 'as''d', [1, 2, function('strlen'), {'a': 1}]]
[0, function('strlen'), [1, 2, function('strlen'), {'a': 1}]]
! ['-1', '0', '1', 'b']
! ['asd', -1L, <vim.dictionary object at >, <vim.list object at >]
! [('-1', <vim.dictionary object at >), ('0', -1L), ('1', 'asd'), ('b', <vim.list object at >)]
'-1' : {'a': 1}
'0' : -1
'1' : 'asd'
'b' : [1, 2, function('strlen')]
[0, function('strlen')]
[3]
[1, 2, function('strlen')]
--- 4,18 ----
Vim(put):E684:
[0, 'as''d', [1, 2, function('strlen'), {'a': 1}]]
[0, function('strlen'), [1, 2, function('strlen'), {'a': 1}]]
! 1
! ['-1', '0', '1', 'b', 'f']
! ['asd', -1L, <vim.Function '1'>, <vim.dictionary object at >, <vim.list object at >]
! [('-1', <vim.dictionary object at >), ('0', -1L), ('1', 'asd'), ('b', <vim.list object at >), ('f', <vim.Function '1'>)]
'-1' : {'a': 1}
'0' : -1
'1' : 'asd'
'b' : [1, 2, function('strlen')]
+ 'f' : function('1')
[0, function('strlen')]
[3]
[1, 2, function('strlen')]
***************
*** 407,419 ****
range:__dir__,__members__,append,end,start
dictionary:__dir__,__members__,get,has_key,items,keys,locked,pop,popitem,scope,update,values
list:__dir__,__members__,extend,locked
! function:__call__,__dir__,__members__,softspace
output:__dir__,__members__,flush,softspace,write,writelines
{}
{'a': 1}
{'a': 1}
[]
['a', 'b', 'c']
'
abcdef
line :
--- 409,422 ----
range:__dir__,__members__,append,end,start
dictionary:__dir__,__members__,get,has_key,items,keys,locked,pop,popitem,scope,update,values
list:__dir__,__members__,extend,locked
! function:__dir__,__members__,softspace
output:__dir__,__members__,flush,softspace,write,writelines
{}
{'a': 1}
{'a': 1}
[]
['a', 'b', 'c']
+ function('tr')
'
abcdef
line :
***************
*** 424,429 ****
--- 427,434 ----
['a', 'dup_a']
['a', 'a']
['a', 'b', 'c']
+ [2, 2]
+ [2, 2]
(<class 'vim.error'>, error('abc',))
(<class 'vim.error'>, error('def',))
(<class 'vim.error'>, error('ghi',))
*** ../vim-7.3.1062/src/testdir/test87.in 2013-05-30 13:05:55.000000000 +0200
--- src/testdir/test87.in 2013-05-30 13:08:09.000000000 +0200
***************
*** 26,31 ****
--- 26,34 ----
:"
:" Extending Dictionary directly with different types
:let d = {}
+ :fun d.f()
+ : return 1
+ :endfun
py3 << EOF
d=vim.bindeval('d')
d['1']='asd'
***************
*** 39,50 ****
dv.sort(key=repr)
di.sort(key=repr)
EOF
:$put =py3eval('repr(dk)')
:$put =substitute(py3eval('repr(dv)'),'0x\x\+','','g')
:$put =substitute(py3eval('repr(di)'),'0x\x\+','','g')
! :for [key, val] in sort(items(d))
! : $put =string(key) . ' : ' . string(val)
! : unlet key val
:endfor
:"
:" removing items with del
--- 42,54 ----
dv.sort(key=repr)
di.sort(key=repr)
EOF
+ :$put =py3eval('d[''f''](self={})')
:$put =py3eval('repr(dk)')
:$put =substitute(py3eval('repr(dv)'),'0x\x\+','','g')
:$put =substitute(py3eval('repr(di)'),'0x\x\+','','g')
! :for [key, Val] in sort(items(d))
! : $put =string(key) . ' : ' . string(Val)
! : unlet key Val
:endfor
:"
:" removing items with del
***************
*** 61,66 ****
--- 65,71 ----
:$put =string(l)
:"
:py3 del d['-1']
+ :py3 del d['f']
:$put =string(py3eval('d.get(''b'', 1)'))
:$put =string(py3eval('d.pop(''b'')'))
:$put =string(py3eval('d.get(''b'', 1)'))
***************
*** 182,190 ****
:catch
: $put =v:exception[:13]
:endtry
:delfunction New
:try
! : py3 l[0](1, 2, 3)
:catch
: $put =v:exception[:13]
:endtry
--- 187,196 ----
:catch
: $put =v:exception[:13]
:endtry
+ :py3 f=l[0]
:delfunction New
:try
! : py3 f(1, 2, 3)
:catch
: $put =v:exception[:13]
:endtry
***************
*** 698,703 ****
--- 704,710 ----
:$put =string(py3eval('vim.Dictionary(((''a'', 1),))'))
:$put =string(py3eval('vim.List()'))
:$put =string(py3eval('vim.List(iter(''abc''))'))
+ :$put =string(py3eval('vim.Function(''tr'')'))
:"
:" Test stdout/stderr
:redir => messages
***************
*** 708,713 ****
--- 715,724 ----
:redir END
:$put =string(substitute(messages, '\d\+', '', 'g'))
:" Test subclassing
+ :fun Put(...)
+ : $put =string(a:000)
+ : return a:000
+ :endfun
py3 << EOF
class DupDict(vim.Dictionary):
def __setitem__(self, key, value):
***************
*** 723,732 ****
--- 734,750 ----
dl = DupList()
dl2 = DupList(iter('abc'))
dl.extend(dl2[0])
+
+ class DupFun(vim.Function):
+ def __call__(self, arg):
+ return super(DupFun, self).__call__(arg, arg)
+
+ df = DupFun('Put')
EOF
:$put =string(sort(keys(py3eval('dd'))))
:$put =string(py3eval('dl'))
:$put =string(py3eval('dl2'))
+ :$put =string(py3eval('df(2)'))
:"
:" Test exceptions
:fun Exe(e)
*** ../vim-7.3.1062/src/testdir/test87.ok 2013-05-30 13:05:55.000000000 +0200
--- src/testdir/test87.ok 2013-05-30 13:08:09.000000000 +0200
***************
*** 4,16 ****
Vim(put):E684:
[0, 'as''d', [1, 2, function('strlen'), {'a': 1}]]
[0, function('strlen'), [1, 2, function('strlen'), {'a': 1}]]
! [b'-1', b'0', b'1', b'b']
! [-1, <vim.dictionary object at >, <vim.list object at >, b'asd']
! [(b'-1', <vim.dictionary object at >), (b'0', -1), (b'1', b'asd'), (b'b', <vim.list object at >)]
'-1' : {'a': 1}
'0' : -1
'1' : 'asd'
'b' : [1, 2, function('strlen')]
[0, function('strlen')]
[3]
[1, 2, function('strlen')]
--- 4,18 ----
Vim(put):E684:
[0, 'as''d', [1, 2, function('strlen'), {'a': 1}]]
[0, function('strlen'), [1, 2, function('strlen'), {'a': 1}]]
! 1
! [b'-1', b'0', b'1', b'b', b'f']
! [-1, <vim.Function '1'>, <vim.dictionary object at >, <vim.list object at >, b'asd']
! [(b'-1', <vim.dictionary object at >), (b'0', -1), (b'1', b'asd'), (b'b', <vim.list object at >), (b'f', <vim.Function '1'>)]
'-1' : {'a': 1}
'0' : -1
'1' : 'asd'
'b' : [1, 2, function('strlen')]
+ 'f' : function('1')
[0, function('strlen')]
[3]
[1, 2, function('strlen')]
***************
*** 396,408 ****
range:__dir__,append,end,start
dictionary:__dir__,get,has_key,items,keys,locked,pop,popitem,scope,update,values
list:__dir__,extend,locked
! function:__call__,__dir__,softspace
output:__dir__,flush,softspace,write,writelines
{}
{'a': 1}
{'a': 1}
[]
['a', 'b', 'c']
'
abcdef
line :
--- 398,411 ----
range:__dir__,append,end,start
dictionary:__dir__,get,has_key,items,keys,locked,pop,popitem,scope,update,values
list:__dir__,extend,locked
! function:__dir__,softspace
output:__dir__,flush,softspace,write,writelines
{}
{'a': 1}
{'a': 1}
[]
['a', 'b', 'c']
+ function('tr')
'
abcdef
line :
***************
*** 413,418 ****
--- 416,423 ----
['a', 'dup_a']
['a', 'a']
['a', 'b', 'c']
+ [2, 2]
+ [2, 2]
(<class 'vim.error'>, error('abc',))
(<class 'vim.error'>, error('def',))
(<class 'vim.error'>, error('ghi',))
*** ../vim-7.3.1062/src/version.c 2013-05-30 13:05:55.000000000 +0200
--- src/version.c 2013-05-30 13:07:47.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1063,
/**/
--
How To Keep A Healthy Level Of Insanity:
6. In the memo field of all your checks, write "for sexual favors".
/// 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 ///

192
7.3.1064 Normal file
View File

@ -0,0 +1,192 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1064
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1064
Problem: Python: insufficient error checking.
Solution: Python patch 23. (ZyX)
Files: src/if_py_both.h
*** ../vim-7.3.1063/src/if_py_both.h 2013-05-30 13:14:06.000000000 +0200
--- src/if_py_both.h 2013-05-30 13:16:23.000000000 +0200
***************
*** 3304,3313 ****
for (i = 0; i < new_len; ++i)
{
! PyObject *line = PyList_GetItem(list, i);
! array[i] = StringToLine(line);
! if (array[i] == NULL)
{
while (i)
vim_free(array[--i]);
--- 3304,3313 ----
for (i = 0; i < new_len; ++i)
{
! PyObject *line;
! if (!(line = PyList_GetItem(list, i)) ||
! !(array[i] = StringToLine(line)))
{
while (i)
vim_free(array[--i]);
***************
*** 3319,3325 ****
VimTryStart();
PyErr_Clear();
! // START of region without "return". Must call restore_buffer()!
switch_buffer(&savebuf, buf);
if (u_save((linenr_T)(lo-1), (linenr_T)hi) == FAIL)
--- 3319,3325 ----
VimTryStart();
PyErr_Clear();
! /* START of region without "return". Must call restore_buffer()! */
switch_buffer(&savebuf, buf);
if (u_save((linenr_T)(lo-1), (linenr_T)hi) == FAIL)
***************
*** 3400,3406 ****
if (buf == savebuf)
py_fix_cursor((linenr_T)lo, (linenr_T)hi, (linenr_T)extra);
! // END of region without "return".
restore_buffer(savebuf);
if (VimTryEnd())
--- 3400,3406 ----
if (buf == savebuf)
py_fix_cursor((linenr_T)lo, (linenr_T)hi, (linenr_T)extra);
! /* END of region without "return". */
restore_buffer(savebuf);
if (VimTryEnd())
***************
*** 3479,3488 ****
for (i = 0; i < size; ++i)
{
! PyObject *line = PyList_GetItem(lines, i);
! array[i] = StringToLine(line);
! if (array[i] == NULL)
{
while (i)
vim_free(array[--i]);
--- 3479,3488 ----
for (i = 0; i < size; ++i)
{
! PyObject *line;
! if (!(line = PyList_GetItem(lines, i)) ||
! !(array[i] = StringToLine(line)))
{
while (i)
vim_free(array[--i]);
***************
*** 4014,4021 ****
if (!PyArg_ParseTuple(args, "s", &pmark))
return NULL;
- mark = *pmark;
VimTryStart();
switch_buffer(&savebuf, self->buf);
posp = getmark(mark, FALSE);
--- 4014,4028 ----
if (!PyArg_ParseTuple(args, "s", &pmark))
return NULL;
+ if (STRLEN(pmark) != 1)
+ {
+ PyErr_SetString(PyExc_ValueError,
+ _("mark name must be a single character"));
+ return NULL;
+ }
+
+ mark = *pmark;
VimTryStart();
switch_buffer(&savebuf, self->buf);
posp = getmark(mark, FALSE);
***************
*** 4258,4264 ****
if (value->ob_type != &BufferType)
{
! PyErr_SetString(PyExc_TypeError, _("expected vim.buffer object"));
return -1;
}
--- 4265,4271 ----
if (value->ob_type != &BufferType)
{
! PyErr_SetString(PyExc_TypeError, _("expected vim.Buffer object"));
return -1;
}
***************
*** 4283,4289 ****
if (value->ob_type != &WindowType)
{
! PyErr_SetString(PyExc_TypeError, _("expected vim.window object"));
return -1;
}
--- 4290,4296 ----
if (value->ob_type != &WindowType)
{
! PyErr_SetString(PyExc_TypeError, _("expected vim.Window object"));
return -1;
}
***************
*** 4315,4321 ****
{
if (value->ob_type != &TabPageType)
{
! PyErr_SetString(PyExc_TypeError, _("expected vim.tabpage object"));
return -1;
}
--- 4322,4328 ----
{
if (value->ob_type != &TabPageType)
{
! PyErr_SetString(PyExc_TypeError, _("expected vim.TabPage object"));
return -1;
}
*** ../vim-7.3.1063/src/version.c 2013-05-30 13:14:06.000000000 +0200
--- src/version.c 2013-05-30 13:15:32.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1064,
/**/
--
How To Keep A Healthy Level Of Insanity:
7. Finish all your sentences with "in accordance with the prophecy".
/// 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 ///

381
7.3.1065 Normal file
View File

@ -0,0 +1,381 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1065
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1065
Problem: Python: key mapping is not standard.
Solution: Puthon patch 24: use PyMapping_Keys. (ZyX)
Files: src/if_py_both.h, src/if_python3.c, src/if_python.c
*** ../vim-7.3.1064/src/if_py_both.h 2013-05-30 13:17:13.000000000 +0200
--- src/if_py_both.h 2013-05-30 13:19:50.000000000 +0200
***************
*** 4612,4621 ****
char_u *key;
dictitem_T *di;
PyObject *list;
! PyObject *litem;
PyObject *keyObject;
PyObject *valObject;
- Py_ssize_t lsize;
if (!(dict = dict_alloc()))
return -1;
--- 4612,4620 ----
char_u *key;
dictitem_T *di;
PyObject *list;
! PyObject *iterator;
PyObject *keyObject;
PyObject *valObject;
if (!(dict = dict_alloc()))
return -1;
***************
*** 4623,4683 ****
tv->v_type = VAR_DICT;
tv->vval.v_dict = dict;
! list = PyMapping_Items(obj);
! if (list == NULL)
{
dict_unref(dict);
return -1;
}
- lsize = PyList_Size(list);
- while (lsize--)
- {
- DICTKEY_DECL
! litem = PyList_GetItem(list, lsize);
! if (litem == NULL)
! {
! Py_DECREF(list);
! dict_unref(dict);
! return -1;
! }
! if (!(keyObject = PyTuple_GetItem(litem, 0)))
! {
! Py_DECREF(list);
! Py_DECREF(litem);
! dict_unref(dict);
! return -1;
! }
if (!DICTKEY_SET_KEY)
{
dict_unref(dict);
- Py_DECREF(list);
- Py_DECREF(litem);
DICTKEY_UNREF
return -1;
}
DICTKEY_CHECK_EMPTY(-1)
! if (!(valObject = PyTuple_GetItem(litem, 1)))
{
! Py_DECREF(list);
! Py_DECREF(litem);
dict_unref(dict);
DICTKEY_UNREF
return -1;
}
- Py_DECREF(litem);
-
di = dictitem_alloc(key);
DICTKEY_UNREF
if (di == NULL)
{
! Py_DECREF(list);
dict_unref(dict);
PyErr_NoMemory();
return -1;
--- 4622,4673 ----
tv->v_type = VAR_DICT;
tv->vval.v_dict = dict;
! if (!(list = PyMapping_Keys(obj)))
{
dict_unref(dict);
return -1;
}
! if (!(iterator = PyObject_GetIter(list)))
! {
! dict_unref(dict);
! Py_DECREF(list);
! return -1;
! }
! Py_DECREF(list);
! while ((keyObject = PyIter_Next(iterator)))
! {
! DICTKEY_DECL
if (!DICTKEY_SET_KEY)
{
+ Py_DECREF(iterator);
dict_unref(dict);
DICTKEY_UNREF
return -1;
}
DICTKEY_CHECK_EMPTY(-1)
! if (!(valObject = PyObject_GetItem(obj, keyObject)))
{
! Py_DECREF(keyObject);
! Py_DECREF(iterator);
dict_unref(dict);
DICTKEY_UNREF
return -1;
}
di = dictitem_alloc(key);
DICTKEY_UNREF
+ Py_DECREF(keyObject);
+
if (di == NULL)
{
! Py_DECREF(iterator);
! Py_DECREF(valObject);
dict_unref(dict);
PyErr_NoMemory();
return -1;
***************
*** 4686,4708 ****
if (_ConvertFromPyObject(valObject, &di->di_tv, lookup_dict) == -1)
{
vim_free(di);
dict_unref(dict);
- Py_DECREF(list);
return -1;
}
if (dict_add(dict, di) == FAIL)
{
dictitem_free(di);
dict_unref(dict);
- Py_DECREF(list);
PyErr_SetVim(_("failed to add key to dictionary"));
return -1;
}
}
--dict->dv_refcount;
- Py_DECREF(list);
return 0;
}
--- 4676,4701 ----
if (_ConvertFromPyObject(valObject, &di->di_tv, lookup_dict) == -1)
{
+ Py_DECREF(iterator);
+ Py_DECREF(valObject);
vim_free(di);
dict_unref(dict);
return -1;
}
+ Py_DECREF(valObject);
+
if (dict_add(dict, di) == FAIL)
{
+ Py_DECREF(iterator);
dictitem_free(di);
dict_unref(dict);
PyErr_SetVim(_("failed to add key to dictionary"));
return -1;
}
}
+ Py_DECREF(iterator);
--dict->dv_refcount;
return 0;
}
***************
*** 4907,4912 ****
--- 4900,4907 ----
tv->vval.v_float = (float_T) PyFloat_AsDouble(obj);
}
#endif
+ else if (PyObject_HasAttrString(obj, "keys"))
+ return convert_dl(obj, tv, pymap_to_tv, lookup_dict);
else if (PyIter_Check(obj) || PySequence_Check(obj))
return convert_dl(obj, tv, pyseq_to_tv, lookup_dict);
else if (PyMapping_Check(obj))
*** ../vim-7.3.1064/src/if_python3.c 2013-05-30 13:01:14.000000000 +0200
--- src/if_python3.c 2013-05-30 13:19:50.000000000 +0200
***************
*** 160,168 ****
# define PyDict_GetItemString py3_PyDict_GetItemString
# define PyDict_Next py3_PyDict_Next
# define PyMapping_Check py3_PyMapping_Check
! # define PyMapping_Items py3_PyMapping_Items
# define PyIter_Next py3_PyIter_Next
# define PyObject_GetIter py3_PyObject_GetIter
# define PyObject_IsTrue py3_PyObject_IsTrue
# define PyModule_GetDict py3_PyModule_GetDict
#undef PyRun_SimpleString
--- 160,169 ----
# define PyDict_GetItemString py3_PyDict_GetItemString
# define PyDict_Next py3_PyDict_Next
# define PyMapping_Check py3_PyMapping_Check
! # define PyMapping_Keys py3_PyMapping_Keys
# define PyIter_Next py3_PyIter_Next
# define PyObject_GetIter py3_PyObject_GetIter
+ # define PyObject_GetItem py3_PyObject_GetItem
# define PyObject_IsTrue py3_PyObject_IsTrue
# define PyModule_GetDict py3_PyModule_GetDict
#undef PyRun_SimpleString
***************
*** 276,282 ****
static Py_ssize_t (*py3_PyTuple_Size)(PyObject *);
static PyObject* (*py3_PyTuple_GetItem)(PyObject *, Py_ssize_t);
static int (*py3_PyMapping_Check)(PyObject *);
! static PyObject* (*py3_PyMapping_Items)(PyObject *);
static int (*py3_PySlice_GetIndicesEx)(PyObject *r, Py_ssize_t length,
Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step, Py_ssize_t *slicelength);
static PyObject* (*py3_PyErr_NoMemory)(void);
--- 277,283 ----
static Py_ssize_t (*py3_PyTuple_Size)(PyObject *);
static PyObject* (*py3_PyTuple_GetItem)(PyObject *, Py_ssize_t);
static int (*py3_PyMapping_Check)(PyObject *);
! static PyObject* (*py3_PyMapping_Keys)(PyObject *);
static int (*py3_PySlice_GetIndicesEx)(PyObject *r, Py_ssize_t length,
Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step, Py_ssize_t *slicelength);
static PyObject* (*py3_PyErr_NoMemory)(void);
***************
*** 304,309 ****
--- 305,311 ----
static PyObject* (*py3_PyDict_New)(void);
static PyObject* (*py3_PyIter_Next)(PyObject *);
static PyObject* (*py3_PyObject_GetIter)(PyObject *);
+ static PyObject* (*py3_PyObject_GetItem)(PyObject *, PyObject *);
static int (*py3_PyObject_IsTrue)(PyObject *);
static PyObject* (*py3_Py_BuildValue)(char *, ...);
static int (*py3_PyType_Ready)(PyTypeObject *type);
***************
*** 456,464 ****
{"PyDict_GetItemString", (PYTHON_PROC*)&py3_PyDict_GetItemString},
{"PyDict_Next", (PYTHON_PROC*)&py3_PyDict_Next},
{"PyMapping_Check", (PYTHON_PROC*)&py3_PyMapping_Check},
! {"PyMapping_Items", (PYTHON_PROC*)&py3_PyMapping_Items},
{"PyIter_Next", (PYTHON_PROC*)&py3_PyIter_Next},
{"PyObject_GetIter", (PYTHON_PROC*)&py3_PyObject_GetIter},
{"PyObject_IsTrue", (PYTHON_PROC*)&py3_PyObject_IsTrue},
{"PyLong_FromLong", (PYTHON_PROC*)&py3_PyLong_FromLong},
{"PyDict_New", (PYTHON_PROC*)&py3_PyDict_New},
--- 458,467 ----
{"PyDict_GetItemString", (PYTHON_PROC*)&py3_PyDict_GetItemString},
{"PyDict_Next", (PYTHON_PROC*)&py3_PyDict_Next},
{"PyMapping_Check", (PYTHON_PROC*)&py3_PyMapping_Check},
! {"PyMapping_Keys", (PYTHON_PROC*)&py3_PyMapping_Keys},
{"PyIter_Next", (PYTHON_PROC*)&py3_PyIter_Next},
{"PyObject_GetIter", (PYTHON_PROC*)&py3_PyObject_GetIter},
+ {"PyObject_GetItem", (PYTHON_PROC*)&py3_PyObject_GetItem},
{"PyObject_IsTrue", (PYTHON_PROC*)&py3_PyObject_IsTrue},
{"PyLong_FromLong", (PYTHON_PROC*)&py3_PyLong_FromLong},
{"PyDict_New", (PYTHON_PROC*)&py3_PyDict_New},
*** ../vim-7.3.1064/src/if_python.c 2013-05-30 13:01:14.000000000 +0200
--- src/if_python.c 2013-05-30 13:19:50.000000000 +0200
***************
*** 197,207 ****
# define PyDict_GetItemString dll_PyDict_GetItemString
# define PyDict_Next dll_PyDict_Next
# define PyDict_Type (*dll_PyDict_Type)
! # ifdef PyMapping_Items
! # define PY_NO_MAPPING_ITEMS
# else
! # define PyMapping_Items dll_PyMapping_Items
# endif
# define PyObject_CallMethod dll_PyObject_CallMethod
# define PyMapping_Check dll_PyMapping_Check
# define PyIter_Next dll_PyIter_Next
--- 197,208 ----
# define PyDict_GetItemString dll_PyDict_GetItemString
# define PyDict_Next dll_PyDict_Next
# define PyDict_Type (*dll_PyDict_Type)
! # ifdef PyMapping_Keys
! # define PY_NO_MAPPING_KEYS
# else
! # define PyMapping_Keys dll_PyMapping_Keys
# endif
+ # define PyObject_GetItem dll_PyObject_GetItem
# define PyObject_CallMethod dll_PyObject_CallMethod
# define PyMapping_Check dll_PyMapping_Check
# define PyIter_Next dll_PyIter_Next
***************
*** 331,339 ****
static PyObject*(*dll_PyDict_GetItemString)(PyObject *, const char *);
static int (*dll_PyDict_Next)(PyObject *, PyInt *, PyObject **, PyObject **);
static PyTypeObject* dll_PyDict_Type;
! # ifndef PY_NO_MAPPING_ITEMS
! static PyObject* (*dll_PyMapping_Items)(PyObject *);
# endif
static PyObject* (*dll_PyObject_CallMethod)(PyObject *, char *, PyObject *);
static int (*dll_PyMapping_Check)(PyObject *);
static PyObject* (*dll_PyIter_Next)(PyObject *);
--- 332,341 ----
static PyObject*(*dll_PyDict_GetItemString)(PyObject *, const char *);
static int (*dll_PyDict_Next)(PyObject *, PyInt *, PyObject **, PyObject **);
static PyTypeObject* dll_PyDict_Type;
! # ifndef PY_NO_MAPPING_KEYS
! static PyObject* (*dll_PyMapping_Keys)(PyObject *);
# endif
+ static PyObject* (*dll_PyObject_GetItem)(PyObject *, PyObject *);
static PyObject* (*dll_PyObject_CallMethod)(PyObject *, char *, PyObject *);
static int (*dll_PyMapping_Check)(PyObject *);
static PyObject* (*dll_PyIter_Next)(PyObject *);
***************
*** 494,502 ****
{"PyDict_Next", (PYTHON_PROC*)&dll_PyDict_Next},
{"PyDict_New", (PYTHON_PROC*)&dll_PyDict_New},
{"PyDict_Type", (PYTHON_PROC*)&dll_PyDict_Type},
! # ifndef PY_NO_MAPPING_ITEMS
! {"PyMapping_Items", (PYTHON_PROC*)&dll_PyMapping_Items},
# endif
{"PyObject_CallMethod", (PYTHON_PROC*)&dll_PyObject_CallMethod},
{"PyMapping_Check", (PYTHON_PROC*)&dll_PyMapping_Check},
{"PyIter_Next", (PYTHON_PROC*)&dll_PyIter_Next},
--- 496,505 ----
{"PyDict_Next", (PYTHON_PROC*)&dll_PyDict_Next},
{"PyDict_New", (PYTHON_PROC*)&dll_PyDict_New},
{"PyDict_Type", (PYTHON_PROC*)&dll_PyDict_Type},
! # ifndef PY_NO_MAPPING_KEYS
! {"PyMapping_Keys", (PYTHON_PROC*)&dll_PyMapping_Keys},
# endif
+ {"PyObject_GetItem", (PYTHON_PROC*)&dll_PyObject_GetItem},
{"PyObject_CallMethod", (PYTHON_PROC*)&dll_PyObject_CallMethod},
{"PyMapping_Check", (PYTHON_PROC*)&dll_PyMapping_Check},
{"PyIter_Next", (PYTHON_PROC*)&dll_PyIter_Next},
*** ../vim-7.3.1064/src/version.c 2013-05-30 13:17:13.000000000 +0200
--- src/version.c 2013-05-30 13:19:32.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1065,
/**/
--
How To Keep A Healthy Level Of Insanity:
8. Don't use any punctuation marks.
/// 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 ///

1979
7.3.1066 Normal file

File diff suppressed because it is too large Load Diff

158
7.3.1067 Normal file
View File

@ -0,0 +1,158 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1067
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1067
Problem: Python: documentation lags behind.
Solution: Python patch 26. (ZyX)
Files: runtime/doc/if_pyth.txt
*** ../vim-7.3.1066/runtime/doc/if_pyth.txt 2013-05-30 13:01:14.000000000 +0200
--- runtime/doc/if_pyth.txt 2013-05-30 13:31:16.000000000 +0200
***************
*** 480,496 ****
vim.VAR_DEF_SCOPE |g:| or |l:| dictionary
vim.VAR_SCOPE Other scope dictionary,
see |internal-variables|
! Methods:
Method Description ~
keys() Returns a list with dictionary keys.
values() Returns a list with dictionary values.
items() Returns a list of 2-tuples with dictionary contents.
! update(iterable)
! update(dictionary)
! update(**kwargs)
Adds keys to dictionary.
Examples: >
! py d = vim.bindeval('{}')
d['a'] = 'b' # Item assignment
print d['a'] # getting item
d.update({'c': 'd'}) # .update(dictionary)
--- 480,515 ----
vim.VAR_DEF_SCOPE |g:| or |l:| dictionary
vim.VAR_SCOPE Other scope dictionary,
see |internal-variables|
! Methods (note: methods do not support keyword arguments):
Method Description ~
keys() Returns a list with dictionary keys.
values() Returns a list with dictionary values.
items() Returns a list of 2-tuples with dictionary contents.
! update(iterable), update(dictionary), update(**kwargs)
Adds keys to dictionary.
+ get(key[, default=None])
+ Obtain key from dictionary, returning the default if it is
+ not present.
+ pop(key[, default])
+ Remove specified key from dictionary and return
+ corresponding value. If key is not found and default is
+ given returns the default, otherwise raises KeyError.
+ popitem(key)
+ Remove specified key from dictionary and return a pair
+ with it and the corresponding value. Returned key is a new
+ object.
+ has_key(key)
+ Check whether dictionary contains specified key, similar
+ to `key in dict`.
+
+ __new__(), __new__(iterable), __new__(dictionary), __new__(update)
+ You can use `vim.Dictionary()` to create new vim
+ dictionaries. `d=vim.Dictionary(arg)` is the same as
+ `d=vim.bindeval('{}');d.update(arg)`. Without arguments
+ constructs empty dictionary.
+
Examples: >
! d = vim.Dictionary(food="bar") # Constructor
d['a'] = 'b' # Item assignment
print d['a'] # getting item
d.update({'c': 'd'}) # .update(dictionary)
***************
*** 501,506 ****
--- 520,526 ----
for key, val in d.items(): # .items()
print isinstance(d, vim.Dictionary) # True
for key in d: # Iteration over keys
+ class Dict(vim.Dictionary): # Subclassing
<
Note: when iterating over keys you should not modify dictionary.
***************
*** 510,517 ****
following methods:
Method Description ~
extend(item) Add items to the list.
Examples: >
! l = vim.bindeval('[]')
l.extend(['abc', 'def']) # .extend() method
print l[1:] # slicing
l[:0] = ['ghi', 'jkl'] # slice assignment
--- 530,543 ----
following methods:
Method Description ~
extend(item) Add items to the list.
+
+ __new__(), __new__(iterable)
+ You can use `vim.List()` to create new vim lists.
+ `l=vim.List(iterable)` is the same as
+ `l=vim.bindeval('[]');l.extend(iterable)`. Without
+ arguments constructs empty list.
Examples: >
! l = vim.List("abc") # Constructor, result: ['a', 'b', 'c']
l.extend(['abc', 'def']) # .extend() method
print l[1:] # slicing
l[:0] = ['ghi', 'jkl'] # slice assignment
***************
*** 519,531 ****
l[0] = 'mno' # assignment
for i in l: # iteration
print isinstance(l, vim.List) # True
vim.Function object *python-Function*
Function-like object, acting like vim |Funcref| object. Supports `.name`
attribute and is callable. Accepts special keyword argument `self`, see
! |Dictionary-function|.
Examples: >
! f = vim.bindeval('function("tr")')
print f('abc', 'a', 'b') # Calls tr('abc', 'a', 'b')
vim.command('''
function DictFun() dict
--- 545,560 ----
l[0] = 'mno' # assignment
for i in l: # iteration
print isinstance(l, vim.List) # True
+ class List(vim.List): # Subclassing
vim.Function object *python-Function*
Function-like object, acting like vim |Funcref| object. Supports `.name`
attribute and is callable. Accepts special keyword argument `self`, see
! |Dictionary-function|. You can also use `vim.Function(name)` constructor,
! it is the same as `vim.bindeval('function(%s)'%json.dumps(name))`.
!
Examples: >
! f = vim.Function('tr') # Constructor
print f('abc', 'a', 'b') # Calls tr('abc', 'a', 'b')
vim.command('''
function DictFun() dict
*** ../vim-7.3.1066/src/version.c 2013-05-30 13:28:37.000000000 +0200
--- src/version.c 2013-05-30 13:31:42.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1067,
/**/
--
How To Keep A Healthy Level Of Insanity:
9. As often as possible, skip rather than walk.
/// 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 ///

173
7.3.1068 Normal file
View File

@ -0,0 +1,173 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1068
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1068
Problem: Python: Script is auto-loaded on function creation.
Solution: Python patch 27. (ZyX)
Files: src/eval.c, src/if_py_both.h, src/proto/eval.pro,
src/testdir/test86.ok, src/testdir/test87.ok, src/vim.h
*** ../vim-7.3.1067/src/eval.c 2013-05-30 13:14:06.000000000 +0200
--- src/eval.c 2013-05-30 13:35:15.000000000 +0200
***************
*** 810,815 ****
--- 810,816 ----
# endif
prof_self_cmp __ARGS((const void *s1, const void *s2));
#endif
+ static int script_autoload __ARGS((char_u *name, int reload));
static char_u *autoload_name __ARGS((char_u *name));
static void cat_func_name __ARGS((char_u *buf, ufunc_T *fp));
static void func_free __ARGS((ufunc_T *fp));
***************
*** 829,838 ****
static void sortFunctions __ARGS(());
#endif
-
- /* Character used as separated in autoload function/variable names. */
- #define AUTOLOAD_CHAR '#'
-
/*
* Initialize the global and v: variables.
*/
--- 830,835 ----
***************
*** 22190,22196 ****
* If "name" has a package name try autoloading the script for it.
* Return TRUE if a package was loaded.
*/
! int
script_autoload(name, reload)
char_u *name;
int reload; /* load script again when already loaded */
--- 22187,22193 ----
* If "name" has a package name try autoloading the script for it.
* Return TRUE if a package was loaded.
*/
! static int
script_autoload(name, reload)
char_u *name;
int reload; /* load script again when already loaded */
*** ../vim-7.3.1067/src/if_py_both.h 2013-05-30 13:22:07.000000000 +0200
--- src/if_py_both.h 2013-05-30 13:35:15.000000000 +0200
***************
*** 2015,2033 ****
func_ref(self->name);
}
else
! {
! self->name = get_expanded_name(name, TRUE);
! if (self->name == NULL)
{
! if (script_autoload(name, TRUE) && !aborting())
! self->name = get_expanded_name(name, TRUE);
! if (self->name == NULL)
! {
! PyErr_SetString(PyExc_ValueError, _("function does not exist"));
! return NULL;
! }
}
- }
return (PyObject *)(self);
}
--- 2015,2027 ----
func_ref(self->name);
}
else
! if ((self->name = get_expanded_name(name,
! vim_strchr(name, AUTOLOAD_CHAR) == NULL))
! == NULL)
{
! PyErr_SetString(PyExc_ValueError, _("function does not exist"));
! return NULL;
}
return (PyObject *)(self);
}
*** ../vim-7.3.1067/src/proto/eval.pro 2013-05-30 13:14:06.000000000 +0200
--- src/proto/eval.pro 2013-05-30 13:35:15.000000000 +0200
***************
*** 132,136 ****
void ex_oldfiles __ARGS((exarg_T *eap));
int modify_fname __ARGS((char_u *src, int *usedlen, char_u **fnamep, char_u **bufp, int *fnamelen));
char_u *do_string_sub __ARGS((char_u *str, char_u *pat, char_u *sub, char_u *flags));
- int script_autoload __ARGS((char_u *name, int reload));
/* vim: set ft=c : */
--- 132,135 ----
*** ../vim-7.3.1067/src/testdir/test86.ok 2013-05-30 13:28:37.000000000 +0200
--- src/testdir/test86.ok 2013-05-30 13:35:15.000000000 +0200
***************
*** 889,895 ****
>> FunctionConstructor
vim.Function("123"):(<type 'exceptions.ValueError'>, ValueError('unnamed function does not exist',))
vim.Function("xxx_non_existent_function_xxx"):(<type 'exceptions.ValueError'>, ValueError('function does not exist',))
! vim.Function("xxx#non#existent#function#xxx"):(<type 'exceptions.ValueError'>, ValueError('function does not exist',))
>> FunctionCall
>>> Testing StringToChars using f({%s : 1})
f({1 : 1}):(<type 'exceptions.TypeError'>, TypeError('object must be string',))
--- 889,895 ----
>> FunctionConstructor
vim.Function("123"):(<type 'exceptions.ValueError'>, ValueError('unnamed function does not exist',))
vim.Function("xxx_non_existent_function_xxx"):(<type 'exceptions.ValueError'>, ValueError('function does not exist',))
! vim.Function("xxx#non#existent#function#xxx"):NOT FAILED
>> FunctionCall
>>> Testing StringToChars using f({%s : 1})
f({1 : 1}):(<type 'exceptions.TypeError'>, TypeError('object must be string',))
*** ../vim-7.3.1067/src/testdir/test87.ok 2013-05-30 13:28:37.000000000 +0200
--- src/testdir/test87.ok 2013-05-30 13:35:15.000000000 +0200
***************
*** 878,884 ****
>> FunctionConstructor
vim.Function("123"):(<class 'ValueError'>, ValueError('unnamed function does not exist',))
vim.Function("xxx_non_existent_function_xxx"):(<class 'ValueError'>, ValueError('function does not exist',))
! vim.Function("xxx#non#existent#function#xxx"):(<class 'ValueError'>, ValueError('function does not exist',))
>> FunctionCall
>>> Testing StringToChars using f({%s : 1})
f({1 : 1}):(<class 'TypeError'>, TypeError('object must be string',))
--- 878,884 ----
>> FunctionConstructor
vim.Function("123"):(<class 'ValueError'>, ValueError('unnamed function does not exist',))
vim.Function("xxx_non_existent_function_xxx"):(<class 'ValueError'>, ValueError('function does not exist',))
! vim.Function("xxx#non#existent#function#xxx"):NOT FAILED
>> FunctionCall
>>> Testing StringToChars using f({%s : 1})
f({1 : 1}):(<class 'TypeError'>, TypeError('object must be string',))
*** ../vim-7.3.1067/src/vim.h 2013-05-06 03:52:44.000000000 +0200
--- src/vim.h 2013-05-30 13:35:15.000000000 +0200
***************
*** 2243,2246 ****
--- 2243,2249 ----
#define SREQ_WIN 1 /* Request window-local option */
#define SREQ_BUF 2 /* Request buffer-local option */
+ /* Character used as separated in autoload function/variable names. */
+ #define AUTOLOAD_CHAR '#'
+
#endif /* VIM__H */
*** ../vim-7.3.1067/src/version.c 2013-05-30 13:32:26.000000000 +0200
--- src/version.c 2013-05-30 13:34:44.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1068,
/**/
--
How To Keep A Healthy Level Of Insanity:
10. Ask people what sex they are. Laugh hysterically after they answer.
/// 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 ///

210
7.3.1069 Normal file
View File

@ -0,0 +1,210 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1069
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1069
Problem: Python: memory leaks.
Solution: Python patch 28: Purge out DICTKEY_CHECK_EMPTY macros. (ZyX)
Files: src/if_py_both.h
*** ../vim-7.3.1068/src/if_py_both.h 2013-05-30 13:37:23.000000000 +0200
--- src/if_py_both.h 2013-05-30 14:50:11.000000000 +0200
***************
*** 32,46 ****
#define DICTKEY_DECL \
PyObject *dictkey_todecref = NULL;
- #define DICTKEY_CHECK_EMPTY(err) \
- if (*key == NUL) \
- { \
- PyErr_SetString(PyExc_ValueError, _("empty keys are not allowed")); \
- return err; \
- }
- #define DICTKEY_SET_KEY (key = StringToChars(keyObject, &dictkey_todecref))
#define DICTKEY_GET(err, decref) \
! if (!DICTKEY_SET_KEY) \
{ \
if (decref) \
{ \
--- 32,39 ----
#define DICTKEY_DECL \
PyObject *dictkey_todecref = NULL;
#define DICTKEY_GET(err, decref) \
! if (!(key = StringToChars(keyObject, &dictkey_todecref))) \
{ \
if (decref) \
{ \
***************
*** 50,56 ****
} \
if (decref && !dictkey_todecref) \
dictkey_todecref = keyObject; \
! DICTKEY_CHECK_EMPTY(err)
#define DICTKEY_UNREF \
Py_XDECREF(dictkey_todecref);
--- 43,53 ----
} \
if (decref && !dictkey_todecref) \
dictkey_todecref = keyObject; \
! if (*key == NUL) \
! { \
! PyErr_SetString(PyExc_ValueError, _("empty keys are not allowed")); \
! return err; \
! }
#define DICTKEY_UNREF \
Py_XDECREF(dictkey_todecref);
***************
*** 4551,4557 ****
while (PyDict_Next(obj, &iter, &keyObject, &valObject))
{
! DICTKEY_DECL
if (keyObject == NULL || valObject == NULL)
{
--- 4548,4554 ----
while (PyDict_Next(obj, &iter, &keyObject, &valObject))
{
! PyObject *todecref = NULL;
if (keyObject == NULL || valObject == NULL)
{
***************
*** 4559,4574 ****
return -1;
}
! if (!DICTKEY_SET_KEY)
{
dict_unref(dict);
return -1;
}
- DICTKEY_CHECK_EMPTY(-1)
di = dictitem_alloc(key);
! DICTKEY_UNREF
if (di == NULL)
{
--- 4556,4576 ----
return -1;
}
! if (!(key = StringToChars(keyObject, &todecref)))
! {
! dict_unref(dict);
! return -1;
! }
! if (*key == NUL)
{
dict_unref(dict);
+ Py_XDECREF(todecref);
return -1;
}
di = dictitem_alloc(key);
! Py_XDECREF(todecref);
if (di == NULL)
{
***************
*** 4632,4662 ****
while ((keyObject = PyIter_Next(iterator)))
{
! DICTKEY_DECL
! if (!DICTKEY_SET_KEY)
{
Py_DECREF(iterator);
dict_unref(dict);
- DICTKEY_UNREF
return -1;
}
! DICTKEY_CHECK_EMPTY(-1)
if (!(valObject = PyObject_GetItem(obj, keyObject)))
{
Py_DECREF(keyObject);
Py_DECREF(iterator);
dict_unref(dict);
- DICTKEY_UNREF
return -1;
}
di = dictitem_alloc(key);
- DICTKEY_UNREF
-
Py_DECREF(keyObject);
if (di == NULL)
{
--- 4634,4670 ----
while ((keyObject = PyIter_Next(iterator)))
{
! PyObject *todecref;
! if (!(key = StringToChars(keyObject, &todecref)))
{
+ Py_DECREF(keyObject);
Py_DECREF(iterator);
dict_unref(dict);
return -1;
}
! if (*key == NUL)
! {
! Py_DECREF(keyObject);
! Py_DECREF(iterator);
! Py_XDECREF(todecref);
! dict_unref(dict);
! return -1;
! }
if (!(valObject = PyObject_GetItem(obj, keyObject)))
{
Py_DECREF(keyObject);
Py_DECREF(iterator);
+ Py_XDECREF(todecref);
dict_unref(dict);
return -1;
}
di = dictitem_alloc(key);
Py_DECREF(keyObject);
+ Py_XDECREF(todecref);
if (di == NULL)
{
*** ../vim-7.3.1068/src/version.c 2013-05-30 13:37:23.000000000 +0200
--- src/version.c 2013-05-30 13:38:46.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1069,
/**/
--
How To Keep A Healthy Level Of Insanity:
11. Specify that your drive-through order is "to go".
/// 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 ///

109
7.3.1070 Normal file
View File

@ -0,0 +1,109 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1070
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1070
Problem: Vim crashes in Python tests. Compiler warning for unused function.
Solution: Disable the tests for now. Move the function.
Files: src/if_py_both.h, src/if_python.c, src/testdir/test86.in,
src/testdir/test87.in
*** ../vim-7.3.1069/src/if_py_both.h 2013-05-30 14:52:32.000000000 +0200
--- src/if_py_both.h 2013-05-30 15:09:46.000000000 +0200
***************
*** 2322,2339 ****
return VimTryEnd();
}
- static void *
- py_memsave(void *p, size_t len)
- {
- void *r;
- if (!(r = PyMem_Malloc(len)))
- return NULL;
- mch_memmove(r, p, len);
- return r;
- }
-
- #define PY_STRSAVE(s) ((char_u *) py_memsave(s, STRLEN(s) + 1))
-
static int
OptionsAssItem(OptionsObject *self, PyObject *keyObject, PyObject *valObject)
{
--- 2322,2327 ----
*** ../vim-7.3.1069/src/if_python.c 2013-05-30 13:22:07.000000000 +0200
--- src/if_python.c 2013-05-30 15:12:08.000000000 +0200
***************
*** 737,742 ****
--- 737,757 ----
}
#endif
+ #if defined(HAVE_LOCALE_H) || defined(X_LOCALE)
+ static void *
+ py_memsave(void *p, size_t len)
+ {
+ void *r;
+
+ if (!(r = PyMem_Malloc(len)))
+ return NULL;
+ mch_memmove(r, p, len);
+ return r;
+ }
+
+ # define PY_STRSAVE(s) ((char_u *) py_memsave(s, STRLEN(s) + 1))
+ #endif
+
/*
* Include the code shared with if_python3.c
*/
*** ../vim-7.3.1069/src/testdir/test86.in 2013-05-30 13:28:37.000000000 +0200
--- src/testdir/test86.in 2013-05-30 15:13:46.000000000 +0200
***************
*** 8,13 ****
--- 8,15 ----
STARTTEST
:so small.vim
:set encoding=latin1
+ :" HACK: currently crashes, skip the test
+ :e! test.ok | wq! test.out
:if !has('python') | e! test.ok | wq! test.out | endif
:lang C
:py import vim
*** ../vim-7.3.1069/src/testdir/test87.in 2013-05-30 13:28:37.000000000 +0200
--- src/testdir/test87.in 2013-05-30 15:13:55.000000000 +0200
***************
*** 2,7 ****
--- 2,9 ----
STARTTEST
:so small.vim
+ :" HACK: currently crashes, skip the test
+ :e! test.ok | wq! test.out
:if !has('python3') | e! test.ok | wq! test.out | endif
:lang C
:py3 import vim
*** ../vim-7.3.1069/src/version.c 2013-05-30 14:52:32.000000000 +0200
--- src/version.c 2013-05-30 15:36:00.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1070,
/**/
--
How To Keep A Healthy Level Of Insanity:
13. Go to a poetry recital and ask why the poems don't rhyme.
/// 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 ///

437
7.3.1071 Normal file
View File

@ -0,0 +1,437 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1071
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1071
Problem: New regexp engine: backreferences don't work correctly.
Solution: Add every possible start/end position on the state stack.
Files: src/regexp_nfa.c, src/regexp.h, src/testdir/test64.in,
src/testdir/test64.ok
*** ../vim-7.3.1070/src/regexp_nfa.c 2013-05-30 11:51:04.000000000 +0200
--- src/regexp_nfa.c 2013-05-30 16:43:43.000000000 +0200
***************
*** 184,189 ****
--- 184,192 ----
/* NFA regexp \ze operator encountered. */
static int nfa_has_zend;
+ /* NFA regexp \1 .. \9 encountered. */
+ static int nfa_has_backref;
+
/* Number of sub expressions actually being used during execution. 1 if only
* the whole match (subexpr 0) is used. */
static int nfa_nsubexpr;
***************
*** 266,271 ****
--- 269,275 ----
post_ptr = post_start;
post_end = post_start + nstate_max;
nfa_has_zend = FALSE;
+ nfa_has_backref = FALSE;
regcomp_start(expr, re_flags);
***************
*** 750,764 ****
/* TODO: Not supported yet */
return FAIL;
! case Magic('1'): EMIT(NFA_BACKREF1); break;
! case Magic('2'): EMIT(NFA_BACKREF2); break;
! case Magic('3'): EMIT(NFA_BACKREF3); break;
! case Magic('4'): EMIT(NFA_BACKREF4); break;
! case Magic('5'): EMIT(NFA_BACKREF5); break;
! case Magic('6'): EMIT(NFA_BACKREF6); break;
! case Magic('7'): EMIT(NFA_BACKREF7); break;
! case Magic('8'): EMIT(NFA_BACKREF8); break;
! case Magic('9'): EMIT(NFA_BACKREF9); break;
case Magic('z'):
c = no_Magic(getchr());
--- 754,771 ----
/* TODO: Not supported yet */
return FAIL;
! case Magic('1'):
! case Magic('2'):
! case Magic('3'):
! case Magic('4'):
! case Magic('5'):
! case Magic('6'):
! case Magic('7'):
! case Magic('8'):
! case Magic('9'):
! EMIT(NFA_BACKREF1 + (no_Magic(c) - '1'));
! nfa_has_backref = TRUE;
! break;
case Magic('z'):
c = no_Magic(getchr());
***************
*** 2581,2587 ****
typedef struct
{
nfa_thread_T *t; /* allocated array of states */
! int n; /* nr of states in "t" */
int id; /* ID of the list */
} nfa_list_T;
--- 2588,2595 ----
typedef struct
{
nfa_thread_T *t; /* allocated array of states */
! int n; /* nr of states currently in "t" */
! int len; /* max nr of states in "t" */
int id; /* ID of the list */
} nfa_list_T;
***************
*** 2612,2620 ****
--- 2620,2711 ----
/* Used during execution: whether a match has been found. */
static int nfa_match;
+ static int sub_equal __ARGS((regsub_T *sub1, regsub_T *sub2));
static void addstate __ARGS((nfa_list_T *l, nfa_state_T *state, regsub_T *sub, int off));
static void addstate_here __ARGS((nfa_list_T *l, nfa_state_T *state, regsub_T *sub, int *ip));
+ /*
+ * Return TRUE if "sub1" and "sub2" have the same positions.
+ */
+ static int
+ sub_equal(sub1, sub2)
+ regsub_T *sub1;
+ regsub_T *sub2;
+ {
+ int i;
+ int todo;
+ linenr_T s1, e1;
+ linenr_T s2, e2;
+ char_u *sp1, *ep1;
+ char_u *sp2, *ep2;
+
+ todo = sub1->in_use > sub2->in_use ? sub1->in_use : sub2->in_use;
+ if (REG_MULTI)
+ {
+ for (i = 0; i < todo; ++i)
+ {
+ if (i < sub1->in_use)
+ {
+ s1 = sub1->list.multi[i].start.lnum;
+ e1 = sub1->list.multi[i].end.lnum;
+ }
+ else
+ {
+ s1 = 0;
+ e1 = 0;
+ }
+ if (i < sub2->in_use)
+ {
+ s2 = sub2->list.multi[i].start.lnum;
+ e2 = sub2->list.multi[i].end.lnum;
+ }
+ else
+ {
+ s2 = 0;
+ e2 = 0;
+ }
+ if (s1 != s2 || e1 != e2)
+ return FALSE;
+ if (s1 != 0 && sub1->list.multi[i].start.col
+ != sub2->list.multi[i].start.col)
+ return FALSE;
+ if (e1 != 0 && sub1->list.multi[i].end.col
+ != sub2->list.multi[i].end.col)
+ return FALSE;
+ }
+ }
+ else
+ {
+ for (i = 0; i < todo; ++i)
+ {
+ if (i < sub1->in_use)
+ {
+ sp1 = sub1->list.line[i].start;
+ ep1 = sub1->list.line[i].end;
+ }
+ else
+ {
+ sp1 = NULL;
+ ep1 = NULL;
+ }
+ if (i < sub2->in_use)
+ {
+ sp2 = sub2->list.line[i].start;
+ ep2 = sub2->list.line[i].end;
+ }
+ else
+ {
+ sp2 = NULL;
+ ep2 = NULL;
+ }
+ if (sp1 != sp2 || ep1 != ep2)
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+ }
+
static void
addstate(l, state, sub, off)
nfa_list_T *l; /* runtime state list */
***************
*** 2623,2629 ****
int off; /* byte offset, when -1 go to next line */
{
int subidx;
! nfa_thread_T *lastthread;
lpos_T save_lpos;
int save_in_use;
char_u *save_ptr;
--- 2714,2720 ----
int off; /* byte offset, when -1 go to next line */
{
int subidx;
! nfa_thread_T *thread;
lpos_T save_lpos;
int save_in_use;
char_u *save_ptr;
***************
*** 2674,2696 ****
{
/* This state is already in the list, don't add it again,
* unless it is an MOPEN that is used for a backreference. */
! return;
}
/* add the state to the list */
state->lastlist = l->id;
! lastthread = &l->t[l->n++];
! lastthread->state = state;
! lastthread->sub.in_use = sub->in_use;
if (sub->in_use > 0)
{
/* Copy the match start and end positions. */
if (REG_MULTI)
! mch_memmove(&lastthread->sub.list.multi[0],
&sub->list.multi[0],
sizeof(struct multipos) * sub->in_use);
else
! mch_memmove(&lastthread->sub.list.line[0],
&sub->list.line[0],
sizeof(struct linepos) * sub->in_use);
}
--- 2765,2808 ----
{
/* This state is already in the list, don't add it again,
* unless it is an MOPEN that is used for a backreference. */
! if (!nfa_has_backref)
! return;
!
! /* See if the same state is already in the list with the same
! * positions. */
! for (i = 0; i < l->n; ++i)
! {
! thread = &l->t[i];
! if (thread->state->id == state->id
! && sub_equal(&thread->sub, sub))
! return;
! }
! }
!
! /* when there are backreferences the number of states may be (a
! * lot) bigger */
! if (nfa_has_backref && l->n == l->len)
! {
! int newlen = l->len * 3 / 2 + 50;
!
! l->t = vim_realloc(l->t, newlen * sizeof(nfa_thread_T));
! l->len = newlen;
}
/* add the state to the list */
state->lastlist = l->id;
! thread = &l->t[l->n++];
! thread->state = state;
! thread->sub.in_use = sub->in_use;
if (sub->in_use > 0)
{
/* Copy the match start and end positions. */
if (REG_MULTI)
! mch_memmove(&thread->sub.list.multi[0],
&sub->list.multi[0],
sizeof(struct multipos) * sub->in_use);
else
! mch_memmove(&thread->sub.list.line[0],
&sub->list.line[0],
sizeof(struct linepos) * sub->in_use);
}
***************
*** 2909,2915 ****
/* re-order to put the new state at the current position */
count = l->n - tlen;
! if (count > 1)
{
/* make space for new states, then move them from the
* end to the current position */
--- 3021,3032 ----
/* re-order to put the new state at the current position */
count = l->n - tlen;
! if (count == 1)
! {
! /* overwrite the current state */
! l->t[i] = l->t[l->n - 1];
! }
! else if (count > 1)
{
/* make space for new states, then move them from the
* end to the current position */
***************
*** 2920,2930 ****
&(l->t[l->n - 1]),
sizeof(nfa_thread_T) * count);
}
- else
- {
- /* overwrite the current state */
- l->t[i] = l->t[l->n - 1];
- }
--l->n;
*ip = i - 1;
}
--- 3037,3042 ----
***************
*** 3183,3196 ****
/* Allocate memory for the lists of nodes. */
size = (nstate + 1) * sizeof(nfa_thread_T);
! list[0].t = (nfa_thread_T *)lalloc(size, TRUE);
! list[1].t = (nfa_thread_T *)lalloc(size, TRUE);
! list[2].t = (nfa_thread_T *)lalloc(size, TRUE);
if (list[0].t == NULL || list[1].t == NULL || list[2].t == NULL)
goto theend;
- vim_memset(list[0].t, 0, size);
- vim_memset(list[1].t, 0, size);
- vim_memset(list[2].t, 0, size);
#ifdef ENABLE_LOG
log_fd = fopen(NFA_REGEXP_RUN_LOG, "a");
--- 3295,3308 ----
/* Allocate memory for the lists of nodes. */
size = (nstate + 1) * sizeof(nfa_thread_T);
! list[0].t = (nfa_thread_T *)lalloc_clear(size, TRUE);
! list[0].len = nstate + 1;
! list[1].t = (nfa_thread_T *)lalloc_clear(size, TRUE);
! list[1].len = nstate + 1;
! list[2].t = (nfa_thread_T *)lalloc_clear(size, TRUE);
! list[2].len = nstate + 1;
if (list[0].t == NULL || list[1].t == NULL || list[2].t == NULL)
goto theend;
#ifdef ENABLE_LOG
log_fd = fopen(NFA_REGEXP_RUN_LOG, "a");
***************
*** 3970,3976 ****
vim_free(list[0].t);
vim_free(list[1].t);
vim_free(list[2].t);
- list[0].t = list[1].t = list[2].t = NULL;
vim_free(listids);
#undef ADD_POS_NEG_STATE
#ifdef NFA_REGEXP_DEBUG_LOG
--- 4082,4087 ----
***************
*** 4131,4136 ****
--- 4242,4248 ----
reglnum = 0; /* relative to line */
nfa_has_zend = prog->has_zend;
+ nfa_has_backref = prog->has_backref;
nfa_nsubexpr = prog->nsubexp;
nstate = prog->nstate;
***************
*** 4225,4230 ****
--- 4337,4343 ----
prog->engine = &nfa_regengine;
prog->nstate = nstate;
prog->has_zend = nfa_has_zend;
+ prog->has_backref = nfa_has_backref;
prog->nsubexp = regnpar;
#ifdef ENABLE_LOG
nfa_postfix_dump(expr, OK);
*** ../vim-7.3.1070/src/regexp.h 2013-05-29 21:14:37.000000000 +0200
--- src/regexp.h 2013-05-30 15:54:53.000000000 +0200
***************
*** 87,92 ****
--- 87,93 ----
regprog_T regprog;
nfa_state_T *start;
int has_zend; /* pattern contains \ze */
+ int has_backref; /* pattern contains \1 .. \9 */
int nsubexp; /* number of () */
int nstate;
nfa_state_T state[0]; /* actually longer.. */
*** ../vim-7.3.1070/src/testdir/test64.in 2013-05-30 11:51:04.000000000 +0200
--- src/testdir/test64.in 2013-05-30 16:47:29.000000000 +0200
***************
*** 333,339 ****
:"
:"""" Back references
:call add(tl, [2, '\(\i\+\) \1', ' abc abc', 'abc abc', 'abc'])
! :"call add(tl, [2, '\(\i\+\) \1', 'xgoo goox', 'goo goo', 'goo'])
:call add(tl, [2, '\(a\)\(b\)\(c\)\(dd\)\(e\)\(f\)\(g\)\(h\)\(i\)\1\2\3\4\5\6\7\8\9', 'xabcddefghiabcddefghix', 'abcddefghiabcddefghi', 'a', 'b', 'c', 'dd', 'e', 'f', 'g', 'h', 'i'])
:"
:"""" Look-behind with limit
--- 333,339 ----
:"
:"""" Back references
:call add(tl, [2, '\(\i\+\) \1', ' abc abc', 'abc abc', 'abc'])
! :call add(tl, [2, '\(\i\+\) \1', 'xgoo goox', 'goo goo', 'goo'])
:call add(tl, [2, '\(a\)\(b\)\(c\)\(dd\)\(e\)\(f\)\(g\)\(h\)\(i\)\1\2\3\4\5\6\7\8\9', 'xabcddefghiabcddefghix', 'abcddefghiabcddefghi', 'a', 'b', 'c', 'dd', 'e', 'f', 'g', 'h', 'i'])
:"
:"""" Look-behind with limit
*** ../vim-7.3.1070/src/testdir/test64.ok 2013-05-30 11:51:04.000000000 +0200
--- src/testdir/test64.ok 2013-05-30 17:00:27.000000000 +0200
***************
*** 716,721 ****
--- 716,724 ----
OK 0 - \(\i\+\) \1
OK 1 - \(\i\+\) \1
OK 2 - \(\i\+\) \1
+ OK 0 - \(\i\+\) \1
+ OK 1 - \(\i\+\) \1
+ OK 2 - \(\i\+\) \1
OK 0 - \(a\)\(b\)\(c\)\(dd\)\(e\)\(f\)\(g\)\(h\)\(i\)\1\2\3\4\5\6\7\8\9
OK 1 - \(a\)\(b\)\(c\)\(dd\)\(e\)\(f\)\(g\)\(h\)\(i\)\1\2\3\4\5\6\7\8\9
OK 2 - \(a\)\(b\)\(c\)\(dd\)\(e\)\(f\)\(g\)\(h\)\(i\)\1\2\3\4\5\6\7\8\9
*** ../vim-7.3.1070/src/version.c 2013-05-30 15:38:20.000000000 +0200
--- src/version.c 2013-05-30 17:02:40.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1071,
/**/
--
How To Keep A Healthy Level Of Insanity:
14. Put mosquito netting around your work area. Play a tape of jungle
sounds all day.
/// 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 ///

45
7.3.1072 Normal file
View File

@ -0,0 +1,45 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1072
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1072
Problem: Compiler warning for unitialized variable.
Solution: Initialize it.
Files: src/regexp_nfa.c
*** ../vim-7.3.1071/src/regexp_nfa.c 2013-05-30 17:05:34.000000000 +0200
--- src/regexp_nfa.c 2013-05-30 17:37:48.000000000 +0200
***************
*** 2873,2878 ****
--- 2873,2879 ----
/* Set the position (with "off") in the subexpression. Save and
* restore it when it was in use. Otherwise fill any gap. */
+ save_ptr = NULL;
if (REG_MULTI)
{
if (subidx < sub->in_use)
*** ../vim-7.3.1071/src/version.c 2013-05-30 17:05:34.000000000 +0200
--- src/version.c 2013-05-30 17:48:42.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1072,
/**/
--
How To Keep A Healthy Level Of Insanity:
16. Have your coworkers address you by your wrestling name, Rock Hard Kim.
/// 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 ///

339
7.3.1073 Normal file
View File

@ -0,0 +1,339 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1073
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1073
Problem: New regexp engine may run out of states.
Solution: Allocate states dynamically. Also make the test report errors.
Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok,
src/testdir/test95.in
*** ../vim-7.3.1072/src/regexp_nfa.c 2013-05-30 17:49:19.000000000 +0200
--- src/regexp_nfa.c 2013-05-30 18:36:12.000000000 +0200
***************
*** 233,239 ****
/* helper functions used when doing re2post() ... regatom() parsing */
#define EMIT(c) do { \
! if (post_ptr >= post_end) \
return FAIL; \
*post_ptr++ = c; \
} while (0)
--- 233,239 ----
/* helper functions used when doing re2post() ... regatom() parsing */
#define EMIT(c) do { \
! if (post_ptr >= post_end && realloc_post_list() == FAIL) \
return FAIL; \
*post_ptr++ = c; \
} while (0)
***************
*** 256,266 ****
nstate_max = (int)(STRLEN(expr) + 1) * NFA_POSTFIX_MULTIPLIER;
/* Some items blow up in size, such as [A-z]. Add more space for that.
! * TODO: some patterns may still fail. */
nstate_max += 1000;
/* Size for postfix representation of expr. */
! postfix_size = sizeof(*post_start) * nstate_max;
post_start = (int *)lalloc(postfix_size, TRUE);
if (post_start == NULL)
--- 256,266 ----
nstate_max = (int)(STRLEN(expr) + 1) * NFA_POSTFIX_MULTIPLIER;
/* Some items blow up in size, such as [A-z]. Add more space for that.
! * When it is still not enough realloc_post_list() will be used. */
nstate_max += 1000;
/* Size for postfix representation of expr. */
! postfix_size = sizeof(int) * nstate_max;
post_start = (int *)lalloc(postfix_size, TRUE);
if (post_start == NULL)
***************
*** 277,282 ****
--- 277,307 ----
}
/*
+ * Allocate more space for post_start. Called when
+ * running above the estimated number of states.
+ */
+ static int
+ realloc_post_list()
+ {
+ int nstate_max = post_end - post_start;
+ int new_max = nstate_max + 1000;
+ int *new_start;
+ int *old_start;
+
+ new_start = (int *)lalloc(new_max * sizeof(int), TRUE);
+ if (new_start == NULL)
+ return FAIL;
+ mch_memmove(new_start, post_start, nstate_max * sizeof(int));
+ vim_memset(new_start + nstate_max, 0, 1000 * sizeof(int));
+ old_start = post_start;
+ post_start = new_start;
+ post_ptr = new_start + (post_ptr - old_start);
+ post_end = post_start + new_max;
+ vim_free(old_start);
+ return OK;
+ }
+
+ /*
* Search between "start" and "end" and try to recognize a
* character class in expanded form. For example [0-9].
* On success, return the id the character class to be emitted.
***************
*** 1306,1312 ****
int greedy = TRUE; /* Braces are prefixed with '-' ? */
char_u *old_regparse, *new_regparse;
int c2;
! int *old_post_ptr, *my_post_start;
int old_regnpar;
int quest;
--- 1331,1338 ----
int greedy = TRUE; /* Braces are prefixed with '-' ? */
char_u *old_regparse, *new_regparse;
int c2;
! int old_post_pos;
! int my_post_start;
int old_regnpar;
int quest;
***************
*** 1317,1323 ****
* <atom>{m,n} is next */
old_regnpar = regnpar;
/* store current pos in the postfix form, for \{m,n} involving 0s */
! my_post_start = post_ptr;
ret = nfa_regatom();
if (ret == FAIL)
--- 1343,1349 ----
* <atom>{m,n} is next */
old_regnpar = regnpar;
/* store current pos in the postfix form, for \{m,n} involving 0s */
! my_post_start = (int)(post_ptr - post_start);
ret = nfa_regatom();
if (ret == FAIL)
***************
*** 1430,1443 ****
if (maxval == 0)
{
/* Ignore result of previous call to nfa_regatom() */
! post_ptr = my_post_start;
/* NFA_SKIP_CHAR has 0-length and works everywhere */
EMIT(NFA_SKIP_CHAR);
return OK;
}
/* Ignore previous call to nfa_regatom() */
! post_ptr = my_post_start;
/* Save pos after the repeated atom and the \{} */
new_regparse = regparse;
--- 1456,1469 ----
if (maxval == 0)
{
/* Ignore result of previous call to nfa_regatom() */
! post_ptr = post_start + my_post_start;
/* NFA_SKIP_CHAR has 0-length and works everywhere */
EMIT(NFA_SKIP_CHAR);
return OK;
}
/* Ignore previous call to nfa_regatom() */
! post_ptr = post_start + my_post_start;
/* Save pos after the repeated atom and the \{} */
new_regparse = regparse;
***************
*** 1449,1461 ****
curchr = -1;
/* Restore count of parenthesis */
regnpar = old_regnpar;
! old_post_ptr = post_ptr;
if (nfa_regatom() == FAIL)
return FAIL;
/* after "minval" times, atoms are optional */
if (i + 1 > minval)
EMIT(quest);
! if (old_post_ptr != my_post_start)
EMIT(NFA_CONCAT);
}
--- 1475,1487 ----
curchr = -1;
/* Restore count of parenthesis */
regnpar = old_regnpar;
! old_post_pos = (int)(post_ptr - post_start);
if (nfa_regatom() == FAIL)
return FAIL;
/* after "minval" times, atoms are optional */
if (i + 1 > minval)
EMIT(quest);
! if (old_post_pos != my_post_start)
EMIT(NFA_CONCAT);
}
***************
*** 1572,1580 ****
nfa_regbranch()
{
int ch;
! int *old_post_ptr;
! old_post_ptr = post_ptr;
/* First branch, possibly the only one */
if (nfa_regconcat() == FAIL)
--- 1598,1606 ----
nfa_regbranch()
{
int ch;
! int old_post_pos;
! old_post_pos = (int)(post_ptr - post_start);
/* First branch, possibly the only one */
if (nfa_regconcat() == FAIL)
***************
*** 1587,1604 ****
skipchr();
EMIT(NFA_NOPEN);
EMIT(NFA_PREV_ATOM_NO_WIDTH);
! old_post_ptr = post_ptr;
if (nfa_regconcat() == FAIL)
return FAIL;
/* if concat is empty, skip a input char. But do emit a node */
! if (old_post_ptr == post_ptr)
EMIT(NFA_SKIP_CHAR);
EMIT(NFA_CONCAT);
ch = peekchr();
}
/* Even if a branch is empty, emit one node for it */
! if (old_post_ptr == post_ptr)
EMIT(NFA_SKIP_CHAR);
return OK;
--- 1613,1630 ----
skipchr();
EMIT(NFA_NOPEN);
EMIT(NFA_PREV_ATOM_NO_WIDTH);
! old_post_pos = (int)(post_ptr - post_start);
if (nfa_regconcat() == FAIL)
return FAIL;
/* if concat is empty, skip a input char. But do emit a node */
! if (old_post_pos == (int)(post_ptr - post_start))
EMIT(NFA_SKIP_CHAR);
EMIT(NFA_CONCAT);
ch = peekchr();
}
/* Even if a branch is empty, emit one node for it */
! if (old_post_pos == (int)(post_ptr - post_start))
EMIT(NFA_SKIP_CHAR);
return OK;
*** ../vim-7.3.1072/src/testdir/test64.in 2013-05-30 17:05:34.000000000 +0200
--- src/testdir/test64.in 2013-05-30 18:38:49.000000000 +0200
***************
*** 348,353 ****
--- 348,356 ----
:call add(tl, [2, '\_[^8-9]\+', "asfi\n9888", "asfi\n"])
:call add(tl, [2, '\_[^a]\+', "asfi\n9888", "sfi\n9888"])
:"
+ :"""" Requiring lots of states.
+ :call add(tl, [0, '[0-9a-zA-Z]\{8}-\([0-9a-zA-Z]\{4}-\)\{3}[0-9a-zA-Z]\{12}', " 12345678-1234-1234-1234-123456789012 ", "12345678-1234-1234-1234-123456789012", "1234-"])
+ :"
:"
:"""" Run the tests
:"
***************
*** 361,367 ****
: continue
: endif
: let &regexpengine = engine
! : let l = matchlist(text, pat)
:" check the match itself
: if len(l) == 0 && len(t) > matchidx
: $put ='ERROR: pat: \"' . pat . '\", text: \"' . text . '\", did not match, expected: \"' . t[matchidx] . '\"'
--- 364,374 ----
: continue
: endif
: let &regexpengine = engine
! : try
! : let l = matchlist(text, pat)
! : catch
! : $put ='ERROR: pat: \"' . pat . '\", text: \"' . text . '\", caused an exception: \"' . v:exception . '\"'
! : endtry
:" check the match itself
: if len(l) == 0 && len(t) > matchidx
: $put ='ERROR: pat: \"' . pat . '\", text: \"' . text . '\", did not match, expected: \"' . t[matchidx] . '\"'
*** ../vim-7.3.1072/src/testdir/test64.ok 2013-05-30 17:05:34.000000000 +0200
--- src/testdir/test64.ok 2013-05-30 18:42:43.000000000 +0200
***************
*** 740,745 ****
--- 740,747 ----
OK 0 - \_[^a]\+
OK 1 - \_[^a]\+
OK 2 - \_[^a]\+
+ OK 0 - [0-9a-zA-Z]\{8}-\([0-9a-zA-Z]\{4}-\)\{3}[0-9a-zA-Z]\{12}
+ OK 1 - [0-9a-zA-Z]\{8}-\([0-9a-zA-Z]\{4}-\)\{3}[0-9a-zA-Z]\{12}
192.168.0.1
192.168.0.1
192.168.0.1
*** ../vim-7.3.1072/src/testdir/test95.in 2013-05-26 15:14:49.000000000 +0200
--- src/testdir/test95.in 2013-05-30 18:13:59.000000000 +0200
***************
*** 85,91 ****
: continue
: endif
: let &regexpengine = engine
! : let l = matchlist(text, pat)
:" check the match itself
: if len(l) == 0 && len(t) > matchidx
: $put ='ERROR: pat: \"' . pat . '\", text: \"' . text . '\", did not match, expected: \"' . t[matchidx] . '\"'
--- 85,95 ----
: continue
: endif
: let &regexpengine = engine
! : try
! : let l = matchlist(text, pat)
! : catch
! : $put ='ERROR: pat: \"' . pat . '\", text: \"' . text . '\", caused an exception: \"' . v:exception . '\"'
! : endtry
:" check the match itself
: if len(l) == 0 && len(t) > matchidx
: $put ='ERROR: pat: \"' . pat . '\", text: \"' . text . '\", did not match, expected: \"' . t[matchidx] . '\"'
*** ../vim-7.3.1072/src/version.c 2013-05-30 17:49:19.000000000 +0200
--- src/version.c 2013-05-30 18:43:08.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1073,
/**/
--
How To Keep A Healthy Level Of Insanity:
17. When the money comes out the ATM, scream "I won!, I won! 3rd
time this week!!!!!"
/// 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 ///

59
7.3.1074 Normal file
View File

@ -0,0 +1,59 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1074
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1074
Problem: Compiler warning for printf format. (Manuel Ortega)
Solution: Add type casts.
Files: src/if_py_both.h
*** ../vim-7.3.1073/src/if_py_both.h 2013-05-30 15:38:20.000000000 +0200
--- src/if_py_both.h 2013-05-30 18:58:57.000000000 +0200
***************
*** 3807,3813 ****
name = "";
return PyString_FromFormat("<range %s (%d:%d)>",
! name, self->start, self->end);
}
}
--- 3807,3813 ----
name = "";
return PyString_FromFormat("<range %s (%d:%d)>",
! name, (int)self->start, (int)self->end);
}
}
*** ../vim-7.3.1073/src/version.c 2013-05-30 18:45:20.000000000 +0200
--- src/version.c 2013-05-30 18:59:37.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1074,
/**/
--
In many of the more relaxed civilizations on the Outer Eastern Rim of the
Galaxy, "The Hitchhiker's Guide to the Galaxy" has already supplanted the
great "Encyclopedia Galactica" as the standard repository of all knowledge
and wisdom, for though it has many omissions and contains much that is
apocryphal, or at least wildly inaccurate, it scores over the older, more
pedestrian work in two important respects.
First, it is slightly cheaper; and second, it has the words "DON'T PANIC"
inscribed in large friendly letters on its cover.
-- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"
/// 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 ///

52
7.3.1075 Normal file
View File

@ -0,0 +1,52 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1075
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1075
Problem: Compiler warning for storing a long_u in an int.
Solution: Declare the number as an int. (Mike Williams)
Files: src/regexp_nfa.c
*** ../vim-7.3.1074/src/regexp_nfa.c 2013-05-30 18:45:20.000000000 +0200
--- src/regexp_nfa.c 2013-05-30 19:15:50.000000000 +0200
***************
*** 890,896 ****
default:
{
! long_u n = 0;
int cmp = c;
if (c == '<' || c == '>')
--- 890,896 ----
default:
{
! int n = 0;
int cmp = c;
if (c == '<' || c == '>')
*** ../vim-7.3.1074/src/version.c 2013-05-30 19:01:20.000000000 +0200
--- src/version.c 2013-05-30 19:16:36.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1075,
/**/
--
One difference between a man and a machine is that a machine is quiet
when well oiled.
/// 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 ///

397
7.3.1076 Normal file
View File

@ -0,0 +1,397 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1076
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1076
Problem: New regexp engine: \@= and \& don't work.
Solution: Make these items work. Add column info to logging.
Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok
*** ../vim-7.3.1075/src/regexp_nfa.c 2013-05-30 19:18:27.000000000 +0200
--- src/regexp_nfa.c 2013-05-30 21:41:51.000000000 +0200
***************
*** 1740,1747 ****
STRCPY(code, "NFA_PREV_ATOM_NO_WIDTH"); break;
case NFA_PREV_ATOM_NO_WIDTH_NEG:
STRCPY(code, "NFA_PREV_ATOM_NO_WIDTH_NEG"); break;
! case NFA_NOPEN: STRCPY(code, "NFA_MOPEN_INVISIBLE"); break;
! case NFA_NCLOSE: STRCPY(code, "NFA_MCLOSE_INVISIBLE"); break;
case NFA_START_INVISIBLE: STRCPY(code, "NFA_START_INVISIBLE"); break;
case NFA_END_INVISIBLE: STRCPY(code, "NFA_END_INVISIBLE"); break;
--- 1740,1747 ----
STRCPY(code, "NFA_PREV_ATOM_NO_WIDTH"); break;
case NFA_PREV_ATOM_NO_WIDTH_NEG:
STRCPY(code, "NFA_PREV_ATOM_NO_WIDTH_NEG"); break;
! case NFA_NOPEN: STRCPY(code, "NFA_NOPEN"); break;
! case NFA_NCLOSE: STRCPY(code, "NFA_NCLOSE"); break;
case NFA_START_INVISIBLE: STRCPY(code, "NFA_START_INVISIBLE"); break;
case NFA_END_INVISIBLE: STRCPY(code, "NFA_END_INVISIBLE"); break;
***************
*** 2373,2384 ****
break;
case NFA_PREV_ATOM_NO_WIDTH:
! /* The \@= operator: match the preceding atom with 0 width.
* Surrounds the preceding atom with START_INVISIBLE and
! * END_INVISIBLE, similarly to MOPEN.
! */
! /* TODO: Maybe this drops the speed? */
! goto theend;
if (nfa_calc_size == TRUE)
{
--- 2373,2381 ----
break;
case NFA_PREV_ATOM_NO_WIDTH:
! /* The \@= operator: match the preceding atom with zero width.
* Surrounds the preceding atom with START_INVISIBLE and
! * END_INVISIBLE, similarly to MOPEN. */
if (nfa_calc_size == TRUE)
{
***************
*** 2745,2750 ****
--- 2742,2750 ----
int save_in_use;
char_u *save_ptr;
int i;
+ #ifdef ENABLE_LOG
+ int did_print = FALSE;
+ #endif
if (l == NULL || state == NULL)
return;
***************
*** 2782,2788 ****
/* These nodes do not need to be added, but we need to bail out
* when it was tried to be added to this list before. */
if (state->lastlist == l->id)
! return;
state->lastlist = l->id;
break;
--- 2782,2788 ----
/* These nodes do not need to be added, but we need to bail out
* when it was tried to be added to this list before. */
if (state->lastlist == l->id)
! goto skip_add;
state->lastlist = l->id;
break;
***************
*** 2792,2798 ****
--- 2792,2806 ----
/* This state is already in the list, don't add it again,
* unless it is an MOPEN that is used for a backreference. */
if (!nfa_has_backref)
+ {
+ skip_add:
+ #ifdef ENABLE_LOG
+ nfa_set_code(state->c);
+ fprintf(log_fd, "> Not adding state %d to list %d. char %d: %s\n",
+ abs(state->id), l->id, state->c, code);
+ #endif
return;
+ }
/* See if the same state is already in the list with the same
* positions. */
***************
*** 2801,2807 ****
thread = &l->t[i];
if (thread->state->id == state->id
&& sub_equal(&thread->sub, sub))
! return;
}
}
--- 2809,2815 ----
thread = &l->t[i];
if (thread->state->id == state->id
&& sub_equal(&thread->sub, sub))
! goto skip_add;
}
}
***************
*** 2832,2843 ****
&sub->list.line[0],
sizeof(struct linepos) * sub->in_use);
}
}
#ifdef ENABLE_LOG
! nfa_set_code(state->c);
! fprintf(log_fd, "> Adding state %d to list. Character %d: %s\n",
! abs(state->id), state->c, code);
#endif
switch (state->c)
{
--- 2840,2878 ----
&sub->list.line[0],
sizeof(struct linepos) * sub->in_use);
}
+ #ifdef ENABLE_LOG
+ {
+ int col;
+
+ if (thread->sub.in_use <= 0)
+ col = -1;
+ else if (REG_MULTI)
+ col = thread->sub.list.multi[0].start.col;
+ else
+ col = (int)(thread->sub.list.line[0].start - regline);
+ nfa_set_code(state->c);
+ fprintf(log_fd, "> Adding state %d to list %d. char %d: %s (start col %d)\n",
+ abs(state->id), l->id, state->c, code, col);
+ did_print = TRUE;
+ }
+ #endif
}
#ifdef ENABLE_LOG
! if (!did_print)
! {
! int col;
!
! if (sub->in_use <= 0)
! col = -1;
! else if (REG_MULTI)
! col = sub->list.multi[0].start.col;
! else
! col = (int)(sub->list.line[0].start - regline);
! nfa_set_code(state->c);
! fprintf(log_fd, "> Processing state %d for list %d. char %d: %s (start col %d)\n",
! abs(state->id), l->id, state->c, code, col);
! }
#endif
switch (state->c)
{
***************
*** 2873,2886 ****
addstate(l, state->out, sub, off);
break;
- /* If this state is reached, then a recursive call of nfa_regmatch()
- * succeeded. the next call saves the found submatches in the
- * first state after the "invisible" branch. */
- #if 0
- case NFA_END_INVISIBLE:
- break;
- #endif
-
case NFA_MOPEN + 0:
case NFA_MOPEN + 1:
case NFA_MOPEN + 2:
--- 2908,2913 ----
***************
*** 3450,3458 ****
fprintf(debug, "%s, ", code);
#endif
#ifdef ENABLE_LOG
! nfa_set_code(t->state->c);
! fprintf(log_fd, "(%d) %s, code %d ... \n", abs(t->state->id),
! code, (int)t->state->c);
#endif
/*
--- 3477,3495 ----
fprintf(debug, "%s, ", code);
#endif
#ifdef ENABLE_LOG
! {
! int col;
!
! if (t->sub.in_use <= 0)
! col = -1;
! else if (REG_MULTI)
! col = t->sub.list.multi[0].start.col;
! else
! col = (int)(t->sub.list.line[0].start - regline);
! nfa_set_code(t->state->c);
! fprintf(log_fd, "(%d) char %d %s (start col %d) ... \n",
! abs(t->state->id), (int)t->state->c, code, col);
! }
#endif
/*
***************
*** 3504,3509 ****
--- 3541,3547 ----
addstate_here(thislist, t->state->out, &t->sub, &listidx);
else
{
+ /* TODO: only copy positions in use. */
*m = t->sub;
nfa_match = TRUE;
}
***************
*** 3538,3543 ****
--- 3576,3582 ----
result = nfa_regmatch(t->state->out, submatch, m);
nfa_set_neg_listids(start);
nfa_restore_listids(start, listids);
+ nfa_match = FALSE;
#ifdef ENABLE_LOG
log_fd = fopen(NFA_REGEXP_RUN_LOG, "a");
***************
*** 3575,3583 ****
t->sub.list.line[j].start = m->list.line[j].start;
t->sub.list.line[j].end = m->list.line[j].end;
}
! t->sub.in_use = m->in_use;
! /* t->state->out1 is the corresponding END_INVISIBLE node */
addstate_here(thislist, t->state->out1->out, &t->sub,
&listidx);
}
--- 3614,3624 ----
t->sub.list.line[j].start = m->list.line[j].start;
t->sub.list.line[j].end = m->list.line[j].end;
}
! if (m->in_use > t->sub.in_use)
! t->sub.in_use = m->in_use;
! /* t->state->out1 is the corresponding END_INVISIBLE node;
! * Add it to the current list (zero-width match). */
addstate_here(thislist, t->state->out1->out, &t->sub,
&listidx);
}
***************
*** 4146,4152 ****
fprintf(f, "\tRegexp is \"%s\"\n", nfa_regengine.expr);
#endif
fprintf(f, "\tInput text is \"%s\" \n", reginput);
! fprintf(f, " =======================================================\n\n\n\n\n\n\n");
nfa_print_state(f, start);
fprintf(f, "\n\n");
fclose(f);
--- 4187,4193 ----
fprintf(f, "\tRegexp is \"%s\"\n", nfa_regengine.expr);
#endif
fprintf(f, "\tInput text is \"%s\" \n", reginput);
! fprintf(f, " =======================================================\n\n");
nfa_print_state(f, start);
fprintf(f, "\n\n");
fclose(f);
*** ../vim-7.3.1075/src/testdir/test64.in 2013-05-30 18:45:20.000000000 +0200
--- src/testdir/test64.in 2013-05-30 21:28:06.000000000 +0200
***************
*** 294,315 ****
:call add(tl, [2, '\v(a \zsif .*){2}', 'a if then a if last', 'if last', 'a if last'])
:call add(tl, [2, '\>\zs.', 'aword. ', '.'])
:"
! :"""" Tests for \@ features
! :call add(tl, [0, 'abc\@=', 'abc', 'ab'])
! :call add(tl, [0, 'abc\@=cd', 'abcd', 'abcd'])
! :call add(tl, [0, 'abc\@=', 'ababc', 'ab'])
:" will never match, no matter the input text
:call add(tl, [2, 'abcd\@=e', 'abcd'])
:" will never match
:call add(tl, [2, 'abcd\@=e', 'any text in here ... '])
! :call add(tl, [0, '\v(abc)@=..', 'xabcd', 'ab', 'abc'])
:" no match
:call add(tl, [2, '\(.*John\)\@=.*Bob', 'here is John, and here is B'])
! :call add(tl, [0, '\(John.*\)\@=.*Bob', 'John is Bobs friend', 'John is Bob', 'John is Bobs friend'])
:" no match
:call add(tl, [2, '.*John\&.*Bob', 'here is John, and here is B'])
! :call add(tl, [0, '.*John\&.*Bob', 'John is Bobs friend', 'John is Bob'])
! :call add(tl, [0, '\v(test1)@=.*yep', 'this is a test1, yep it is', 'test1, yep', 'test1'])
:"
:"""" Combining different tests and features
:call add(tl, [2, '[[:alpha:]]\{-2,6}', '787abcdiuhsasiuhb4', 'ab'])
--- 294,315 ----
:call add(tl, [2, '\v(a \zsif .*){2}', 'a if then a if last', 'if last', 'a if last'])
:call add(tl, [2, '\>\zs.', 'aword. ', '.'])
:"
! :"""" Tests for \@= and \& features
! :call add(tl, [2, 'abc\@=', 'abc', 'ab'])
! :call add(tl, [2, 'abc\@=cd', 'abcd', 'abcd'])
! :call add(tl, [2, 'abc\@=', 'ababc', 'ab'])
:" will never match, no matter the input text
:call add(tl, [2, 'abcd\@=e', 'abcd'])
:" will never match
:call add(tl, [2, 'abcd\@=e', 'any text in here ... '])
! :call add(tl, [2, '\v(abc)@=..', 'xabcd', 'ab', 'abc'])
:" no match
:call add(tl, [2, '\(.*John\)\@=.*Bob', 'here is John, and here is B'])
! :call add(tl, [2, '\(John.*\)\@=.*Bob', 'John is Bobs friend', 'John is Bob', 'John is Bobs friend'])
:" no match
:call add(tl, [2, '.*John\&.*Bob', 'here is John, and here is B'])
! :call add(tl, [2, '.*John\&.*Bob', 'John is Bobs friend', 'John is Bob'])
! :call add(tl, [2, '\v(test1)@=.*yep', 'this is a test1, yep it is', 'test1, yep', 'test1'])
:"
:"""" Combining different tests and features
:call add(tl, [2, '[[:alpha:]]\{-2,6}', '787abcdiuhsasiuhb4', 'ab'])
*** ../vim-7.3.1075/src/testdir/test64.ok 2013-05-30 18:45:20.000000000 +0200
--- src/testdir/test64.ok 2013-05-30 21:29:06.000000000 +0200
***************
*** 647,656 ****
--- 647,659 ----
OK 2 - \>\zs.
OK 0 - abc\@=
OK 1 - abc\@=
+ OK 2 - abc\@=
OK 0 - abc\@=cd
OK 1 - abc\@=cd
+ OK 2 - abc\@=cd
OK 0 - abc\@=
OK 1 - abc\@=
+ OK 2 - abc\@=
OK 0 - abcd\@=e
OK 1 - abcd\@=e
OK 2 - abcd\@=e
***************
*** 659,676 ****
--- 662,683 ----
OK 2 - abcd\@=e
OK 0 - \v(abc)@=..
OK 1 - \v(abc)@=..
+ OK 2 - \v(abc)@=..
OK 0 - \(.*John\)\@=.*Bob
OK 1 - \(.*John\)\@=.*Bob
OK 2 - \(.*John\)\@=.*Bob
OK 0 - \(John.*\)\@=.*Bob
OK 1 - \(John.*\)\@=.*Bob
+ OK 2 - \(John.*\)\@=.*Bob
OK 0 - .*John\&.*Bob
OK 1 - .*John\&.*Bob
OK 2 - .*John\&.*Bob
OK 0 - .*John\&.*Bob
OK 1 - .*John\&.*Bob
+ OK 2 - .*John\&.*Bob
OK 0 - \v(test1)@=.*yep
OK 1 - \v(test1)@=.*yep
+ OK 2 - \v(test1)@=.*yep
OK 0 - [[:alpha:]]\{-2,6}
OK 1 - [[:alpha:]]\{-2,6}
OK 2 - [[:alpha:]]\{-2,6}
*** ../vim-7.3.1075/src/version.c 2013-05-30 19:18:27.000000000 +0200
--- src/version.c 2013-05-30 21:34:53.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1076,
/**/
--
I'm not familiar with this proof, but I'm aware of a significant
following of toddlers who believe that peanut butter is the solution
to all of life's problems... -- Tim Hammerquist
/// 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 ///

462
7.3.1077 Normal file
View File

@ -0,0 +1,462 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1077
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1077
Problem: Python: Allocating dict the wrong way, causing a crash.
Solution: Use py_dict_alloc(). Fix some exception problems. (ZyX)
Files: src/if_py_both.h
*** ../vim-7.3.1076/src/if_py_both.h 2013-05-30 19:01:20.000000000 +0200
--- src/if_py_both.h 2013-05-30 21:53:00.000000000 +0200
***************
*** 26,56 ****
#define PyErr_SetVim(str) PyErr_SetString(VimError, str)
#define INVALID_BUFFER_VALUE ((buf_T *)(-1))
#define INVALID_WINDOW_VALUE ((win_T *)(-1))
#define INVALID_TABPAGE_VALUE ((tabpage_T *)(-1))
- #define DICTKEY_DECL \
- PyObject *dictkey_todecref = NULL;
- #define DICTKEY_GET(err, decref) \
- if (!(key = StringToChars(keyObject, &dictkey_todecref))) \
- { \
- if (decref) \
- { \
- Py_DECREF(keyObject); \
- } \
- return err; \
- } \
- if (decref && !dictkey_todecref) \
- dictkey_todecref = keyObject; \
- if (*key == NUL) \
- { \
- PyErr_SetString(PyExc_ValueError, _("empty keys are not allowed")); \
- return err; \
- }
- #define DICTKEY_UNREF \
- Py_XDECREF(dictkey_todecref);
-
typedef void (*rangeinitializer)(void *);
typedef void (*runner)(const char *, void *
#ifdef PY_CAN_RECURSE
--- 26,38 ----
#define PyErr_SetVim(str) PyErr_SetString(VimError, str)
+ #define RAISE_NO_EMPTY_KEYS PyErr_SetString(PyExc_ValueError, \
+ _("empty keys are not allowed"))
+
#define INVALID_BUFFER_VALUE ((buf_T *)(-1))
#define INVALID_WINDOW_VALUE ((win_T *)(-1))
#define INVALID_TABPAGE_VALUE ((tabpage_T *)(-1))
typedef void (*rangeinitializer)(void *);
typedef void (*runner)(const char *, void *
#ifdef PY_CAN_RECURSE
***************
*** 1016,1023 ****
dictitem_T *di;
dict_T *dict = self->dict;
hashitem_T *hi;
!
! DICTKEY_DECL
if (flags & DICT_FLAG_HAS_DEFAULT)
{
--- 998,1004 ----
dictitem_T *di;
dict_T *dict = self->dict;
hashitem_T *hi;
! PyObject *todecref;
if (flags & DICT_FLAG_HAS_DEFAULT)
{
***************
*** 1030,1040 ****
if (flags & DICT_FLAG_RETURN_BOOL)
defObject = Py_False;
! DICTKEY_GET(NULL, 0)
hi = hash_find(&dict->dv_hashtab, key);
! DICTKEY_UNREF
if (HASHITEM_EMPTY(hi))
{
--- 1011,1028 ----
if (flags & DICT_FLAG_RETURN_BOOL)
defObject = Py_False;
! if (!(key = StringToChars(keyObject, &todecref)))
! return NULL;
!
! if (*key == NUL)
! {
! RAISE_NO_EMPTY_KEYS;
! return NULL;
! }
hi = hash_find(&dict->dv_hashtab, key);
! Py_XDECREF(todecref);
if (HASHITEM_EMPTY(hi))
{
***************
*** 1173,1179 ****
typval_T tv;
dict_T *dict = self->dict;
dictitem_T *di;
! DICTKEY_DECL
if (dict->dv_lock)
{
--- 1161,1167 ----
typval_T tv;
dict_T *dict = self->dict;
dictitem_T *di;
! PyObject *todecref;
if (dict->dv_lock)
{
***************
*** 1181,1187 ****
return -1;
}
! DICTKEY_GET(-1, 0)
di = dict_find(dict, key, -1);
--- 1169,1181 ----
return -1;
}
! if (!(key = StringToChars(keyObject, &todecref)))
! return -1;
! if (*key == NUL)
! {
! RAISE_NO_EMPTY_KEYS;
! return -1;
! }
di = dict_find(dict, key, -1);
***************
*** 1191,1197 ****
if (di == NULL)
{
! DICTKEY_UNREF
PyErr_SetObject(PyExc_KeyError, keyObject);
return -1;
}
--- 1185,1191 ----
if (di == NULL)
{
! Py_XDECREF(todecref);
PyErr_SetObject(PyExc_KeyError, keyObject);
return -1;
}
***************
*** 1208,1213 ****
--- 1202,1208 ----
{
if (!(di = dictitem_alloc(key)))
{
+ Py_XDECREF(todecref);
PyErr_NoMemory();
return -1;
}
***************
*** 1216,1222 ****
if (dict_add(dict, di) == FAIL)
{
! DICTKEY_UNREF
vim_free(di);
dictitem_free(di);
PyErr_SetVim(_("failed to add key to dictionary"));
--- 1211,1217 ----
if (dict_add(dict, di) == FAIL)
{
! Py_XDECREF(todecref);
vim_free(di);
dictitem_free(di);
PyErr_SetVim(_("failed to add key to dictionary"));
***************
*** 1226,1232 ****
else
clear_tv(&di->di_tv);
! DICTKEY_UNREF
copy_tv(&tv, &di->di_tv);
clear_tv(&tv);
--- 1221,1227 ----
else
clear_tv(&di->di_tv);
! Py_XDECREF(todecref);
copy_tv(&tv, &di->di_tv);
clear_tv(&tv);
***************
*** 2202,2218 ****
int flags;
long numval;
char_u *stringval;
! DICTKEY_DECL
if (self->Check(self->from))
return NULL;
! DICTKEY_GET(NULL, 0)
flags = get_option_value_strict(key, &numval, &stringval,
self->opt_type, self->from);
! DICTKEY_UNREF
if (flags == 0)
{
--- 2197,2219 ----
int flags;
long numval;
char_u *stringval;
! PyObject *todecref;
if (self->Check(self->from))
return NULL;
! if (!(key = StringToChars(keyObject, &todecref)))
! return NULL;
! if (*key == NUL)
! {
! RAISE_NO_EMPTY_KEYS;
! return NULL;
! }
flags = get_option_value_strict(key, &numval, &stringval,
self->opt_type, self->from);
! Py_XDECREF(todecref);
if (flags == 0)
{
***************
*** 2329,2340 ****
int flags;
int opt_flags;
int r = 0;
! DICTKEY_DECL
if (self->Check(self->from))
return -1;
! DICTKEY_GET(-1, 0)
flags = get_option_value_strict(key, NULL, NULL,
self->opt_type, self->from);
--- 2330,2347 ----
int flags;
int opt_flags;
int r = 0;
! PyObject *todecref;
if (self->Check(self->from))
return -1;
! if (!(key = StringToChars(keyObject, &todecref)))
! return -1;
! if (*key == NUL)
! {
! RAISE_NO_EMPTY_KEYS;
! return -1;
! }
flags = get_option_value_strict(key, NULL, NULL,
self->opt_type, self->from);
***************
*** 2342,2348 ****
if (flags == 0)
{
PyErr_SetObject(PyExc_KeyError, keyObject);
! DICTKEY_UNREF
return -1;
}
--- 2349,2355 ----
if (flags == 0)
{
PyErr_SetObject(PyExc_KeyError, keyObject);
! Py_XDECREF(todecref);
return -1;
}
***************
*** 2352,2371 ****
{
PyErr_SetString(PyExc_ValueError,
_("unable to unset global option"));
! DICTKEY_UNREF
return -1;
}
else if (!(flags & SOPT_GLOBAL))
{
PyErr_SetString(PyExc_ValueError, _("unable to unset option "
"without global value"));
! DICTKEY_UNREF
return -1;
}
else
{
unset_global_local_option(key, self->from);
! DICTKEY_UNREF
return 0;
}
}
--- 2359,2378 ----
{
PyErr_SetString(PyExc_ValueError,
_("unable to unset global option"));
! Py_XDECREF(todecref);
return -1;
}
else if (!(flags & SOPT_GLOBAL))
{
PyErr_SetString(PyExc_ValueError, _("unable to unset option "
"without global value"));
! Py_XDECREF(todecref);
return -1;
}
else
{
unset_global_local_option(key, self->from);
! Py_XDECREF(todecref);
return 0;
}
}
***************
*** 2396,2402 ****
else
{
PyErr_SetString(PyExc_TypeError, _("object must be integer"));
! DICTKEY_UNREF
return -1;
}
--- 2403,2409 ----
else
{
PyErr_SetString(PyExc_TypeError, _("object must be integer"));
! Py_XDECREF(todecref);
return -1;
}
***************
*** 2418,2424 ****
r = -1;
}
! DICTKEY_UNREF
return r;
}
--- 2425,2431 ----
r = -1;
}
! Py_XDECREF(todecref);
return r;
}
***************
*** 4528,4534 ****
PyObject *valObject;
Py_ssize_t iter = 0;
! if (!(dict = dict_alloc()))
return -1;
tv->v_type = VAR_DICT;
--- 4535,4541 ----
PyObject *valObject;
Py_ssize_t iter = 0;
! if (!(dict = py_dict_alloc()))
return -1;
tv->v_type = VAR_DICT;
***************
*** 4553,4558 ****
--- 4560,4566 ----
{
dict_unref(dict);
Py_XDECREF(todecref);
+ RAISE_NO_EMPTY_KEYS;
return -1;
}
***************
*** 4600,4606 ****
PyObject *keyObject;
PyObject *valObject;
! if (!(dict = dict_alloc()))
return -1;
tv->v_type = VAR_DICT;
--- 4608,4614 ----
PyObject *keyObject;
PyObject *valObject;
! if (!(dict = py_dict_alloc()))
return -1;
tv->v_type = VAR_DICT;
***************
*** 4637,4642 ****
--- 4645,4651 ----
Py_DECREF(iterator);
Py_XDECREF(todecref);
dict_unref(dict);
+ RAISE_NO_EMPTY_KEYS;
return -1;
}
*** ../vim-7.3.1076/src/version.c 2013-05-30 21:42:09.000000000 +0200
--- src/version.c 2013-05-30 21:49:50.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1077,
/**/
--
The History of every major Galactic Civilization tends to pass through
three distinct and recognizable phases, those of Survival, Inquiry and
Sophistication, otherwise known as the How, Why and Where phases.
For instance, the first phase is characterized by the question 'How can
we eat?' the second by the question 'Why do we eat?' and the third by
the question 'Where shall we have lunch?'
-- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"
/// 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 ///

205
7.3.1078 Normal file
View File

@ -0,0 +1,205 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1078
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1078
Problem: New regexp engine: \@! doesn't work.
Solution: Implement the negated version of \@=.
Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok
*** ../vim-7.3.1077/src/regexp_nfa.c 2013-05-30 21:42:09.000000000 +0200
--- src/regexp_nfa.c 2013-05-30 22:39:40.000000000 +0200
***************
*** 1390,1395 ****
--- 1390,1398 ----
case '=':
EMIT(NFA_PREV_ATOM_NO_WIDTH);
break;
+ case '!':
+ EMIT(NFA_PREV_ATOM_NO_WIDTH_NEG);
+ break;
case '0':
case '1':
case '2':
***************
*** 1400,1406 ****
case '7':
case '8':
case '9':
- case '!':
case '<':
case '>':
/* Not supported yet */
--- 1403,1408 ----
***************
*** 2373,2379 ****
--- 2375,2383 ----
break;
case NFA_PREV_ATOM_NO_WIDTH:
+ case NFA_PREV_ATOM_NO_WIDTH_NEG:
/* The \@= operator: match the preceding atom with zero width.
+ * The \@! operator: no match for the preceding atom.
* Surrounds the preceding atom with START_INVISIBLE and
* END_INVISIBLE, similarly to MOPEN. */
***************
*** 2391,2396 ****
--- 2395,2406 ----
s = new_state(NFA_START_INVISIBLE, e.start, s1);
if (s == NULL)
goto theend;
+ if (*p == NFA_PREV_ATOM_NO_WIDTH_NEG)
+ {
+ s->negated = TRUE;
+ s1->negated = TRUE;
+ }
+
PUSH(frag(s, list1(&s1->out)));
break;
***************
*** 3541,3548 ****
addstate_here(thislist, t->state->out, &t->sub, &listidx);
else
{
! /* TODO: only copy positions in use. */
! *m = t->sub;
nfa_match = TRUE;
}
break;
--- 3551,3560 ----
addstate_here(thislist, t->state->out, &t->sub, &listidx);
else
{
! /* do not set submatches for \@! */
! if (!t->state->negated)
! /* TODO: only copy positions in use. */
! *m = t->sub;
nfa_match = TRUE;
}
break;
***************
*** 3593,3599 ****
log_fd = stderr;
}
#endif
! if (result == TRUE)
{
int j;
--- 3605,3612 ----
log_fd = stderr;
}
#endif
! /* for \@! it is a match when result is FALSE */
! if (result != t->state->negated)
{
int j;
*** ../vim-7.3.1077/src/testdir/test64.in 2013-05-30 21:42:09.000000000 +0200
--- src/testdir/test64.in 2013-05-30 22:41:38.000000000 +0200
***************
*** 303,315 ****
:" will never match
:call add(tl, [2, 'abcd\@=e', 'any text in here ... '])
:call add(tl, [2, '\v(abc)@=..', 'xabcd', 'ab', 'abc'])
- :" no match
:call add(tl, [2, '\(.*John\)\@=.*Bob', 'here is John, and here is B'])
:call add(tl, [2, '\(John.*\)\@=.*Bob', 'John is Bobs friend', 'John is Bob', 'John is Bobs friend'])
- :" no match
:call add(tl, [2, '.*John\&.*Bob', 'here is John, and here is B'])
:call add(tl, [2, '.*John\&.*Bob', 'John is Bobs friend', 'John is Bob'])
:call add(tl, [2, '\v(test1)@=.*yep', 'this is a test1, yep it is', 'test1, yep', 'test1'])
:"
:"""" Combining different tests and features
:call add(tl, [2, '[[:alpha:]]\{-2,6}', '787abcdiuhsasiuhb4', 'ab'])
--- 303,322 ----
:" will never match
:call add(tl, [2, 'abcd\@=e', 'any text in here ... '])
:call add(tl, [2, '\v(abc)@=..', 'xabcd', 'ab', 'abc'])
:call add(tl, [2, '\(.*John\)\@=.*Bob', 'here is John, and here is B'])
:call add(tl, [2, '\(John.*\)\@=.*Bob', 'John is Bobs friend', 'John is Bob', 'John is Bobs friend'])
:call add(tl, [2, '.*John\&.*Bob', 'here is John, and here is B'])
:call add(tl, [2, '.*John\&.*Bob', 'John is Bobs friend', 'John is Bob'])
:call add(tl, [2, '\v(test1)@=.*yep', 'this is a test1, yep it is', 'test1, yep', 'test1'])
+ :call add(tl, [2, 'foo\(bar\)\@!', 'foobar'])
+ :call add(tl, [2, 'foo\(bar\)\@!', 'foo bar', 'foo'])
+ :call add(tl, [2, 'if \(\(then\)\@!.\)*$', ' if then else'])
+ :call add(tl, [2, 'if \(\(then\)\@!.\)*$', ' if else ', 'if else ', ' '])
+ :call add(tl, [2, '\(foo\)\@!bar', 'foobar', 'bar'])
+ :call add(tl, [2, '\(foo\)\@!...bar', 'foobar'])
+ :call add(tl, [2, '^\%(.*bar\)\@!.*\zsfoo', ' bar foo '])
+ :call add(tl, [2, '^\%(.*bar\)\@!.*\zsfoo', ' foo bar '])
+ :call add(tl, [2, '^\%(.*bar\)\@!.*\zsfoo', ' foo xxx ', 'foo'])
:"
:"""" Combining different tests and features
:call add(tl, [2, '[[:alpha:]]\{-2,6}', '787abcdiuhsasiuhb4', 'ab'])
*** ../vim-7.3.1077/src/testdir/test64.ok 2013-05-30 21:42:09.000000000 +0200
--- src/testdir/test64.ok 2013-05-30 22:42:02.000000000 +0200
***************
*** 678,683 ****
--- 678,710 ----
OK 0 - \v(test1)@=.*yep
OK 1 - \v(test1)@=.*yep
OK 2 - \v(test1)@=.*yep
+ OK 0 - foo\(bar\)\@!
+ OK 1 - foo\(bar\)\@!
+ OK 2 - foo\(bar\)\@!
+ OK 0 - foo\(bar\)\@!
+ OK 1 - foo\(bar\)\@!
+ OK 2 - foo\(bar\)\@!
+ OK 0 - if \(\(then\)\@!.\)*$
+ OK 1 - if \(\(then\)\@!.\)*$
+ OK 2 - if \(\(then\)\@!.\)*$
+ OK 0 - if \(\(then\)\@!.\)*$
+ OK 1 - if \(\(then\)\@!.\)*$
+ OK 2 - if \(\(then\)\@!.\)*$
+ OK 0 - \(foo\)\@!bar
+ OK 1 - \(foo\)\@!bar
+ OK 2 - \(foo\)\@!bar
+ OK 0 - \(foo\)\@!...bar
+ OK 1 - \(foo\)\@!...bar
+ OK 2 - \(foo\)\@!...bar
+ OK 0 - ^\%(.*bar\)\@!.*\zsfoo
+ OK 1 - ^\%(.*bar\)\@!.*\zsfoo
+ OK 2 - ^\%(.*bar\)\@!.*\zsfoo
+ OK 0 - ^\%(.*bar\)\@!.*\zsfoo
+ OK 1 - ^\%(.*bar\)\@!.*\zsfoo
+ OK 2 - ^\%(.*bar\)\@!.*\zsfoo
+ OK 0 - ^\%(.*bar\)\@!.*\zsfoo
+ OK 1 - ^\%(.*bar\)\@!.*\zsfoo
+ OK 2 - ^\%(.*bar\)\@!.*\zsfoo
OK 0 - [[:alpha:]]\{-2,6}
OK 1 - [[:alpha:]]\{-2,6}
OK 2 - [[:alpha:]]\{-2,6}
*** ../vim-7.3.1077/src/version.c 2013-05-30 22:06:28.000000000 +0200
--- src/version.c 2013-05-30 22:42:59.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1078,
/**/
--
The startling truth finally became apparent, and it was this: Numbers
written on restaurant checks within the confines of restaurants do not follow
the same mathematical laws as numbers written on any other pieces of paper in
any other parts of the Universe. This single statement took the scientific
world by storm. So many mathematical conferences got held in such good
restaurants that many of the finest minds of a generation died of obesity and
heart failure, and the science of mathematics was put back by years.
-- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"
/// 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 ///

832
7.3.1079 Normal file
View File

@ -0,0 +1,832 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1079
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1079
Problem: Test 87 fails.
Solution: Fix the test for Python 3.3. (ZyX) Make it pass on 32 bit systems.
Files: src/testdir/test87.in, src/testdir/test87.ok
*** ../vim-7.3.1078/src/testdir/test87.in 2013-05-30 15:38:20.000000000 +0200
--- src/testdir/test87.in 2013-05-31 18:40:40.000000000 +0200
***************
*** 2,9 ****
STARTTEST
:so small.vim
- :" HACK: currently crashes, skip the test
- :e! test.ok | wq! test.out
:if !has('python3') | e! test.ok | wq! test.out | endif
:lang C
:py3 import vim
--- 2,7 ----
***************
*** 710,719 ****
:"
:" Test stdout/stderr
:redir => messages
! :py sys.stdout.write('abc') ; sys.stdout.write('def')
! :py sys.stderr.write('abc') ; sys.stderr.write('def')
! :py sys.stdout.writelines(iter('abc'))
! :py sys.stderr.writelines(iter('abc'))
:redir END
:$put =string(substitute(messages, '\d\+', '', 'g'))
:" Test subclassing
--- 708,717 ----
:"
:" Test stdout/stderr
:redir => messages
! :py3 sys.stdout.write('abc') ; sys.stdout.write('def')
! :py3 sys.stderr.write('abc') ; sys.stderr.write('def')
! :py3 sys.stdout.writelines(iter('abc'))
! :py3 sys.stderr.writelines(iter('abc'))
:redir END
:$put =string(substitute(messages, '\d\+', '', 'g'))
:" Test subclassing
***************
*** 759,765 ****
try:
exec(expr, g, l)
except Exception as e:
! cb.append(expr + ':' + repr((e.__class__, e)))
else:
cb.append(expr + ':NOT FAILED')
except Exception as e:
--- 757,766 ----
try:
exec(expr, g, l)
except Exception as e:
! if sys.version_info >= (3, 3) and e.__class__ is AttributeError and str(e).find('has no attribute')>=0 and not str(e).startswith("'vim."):
! cb.append(expr + ':' + repr((e.__class__, AttributeError(str(e)[str(e).rfind(" '") + 2:-1]))))
! else:
! cb.append(expr + ':' + repr((e.__class__, e)))
else:
cb.append(expr + ':NOT FAILED')
except Exception as e:
***************
*** 786,793 ****
def stringtochars_test(expr):
return subexpr_test(expr, 'StringToChars', (
'1', # Fail type checks
! 'u"\\0"', # Fail PyString_AsStringAndSize(bytes, , NULL) check
! '"\\0"', # Fail PyString_AsStringAndSize(object, , NULL) check
))
class Mapping(object):
--- 787,794 ----
def stringtochars_test(expr):
return subexpr_test(expr, 'StringToChars', (
'1', # Fail type checks
! 'b"\\0"', # Fail PyString_AsStringAndSize(object, , NULL) check
! '"\\0"', # Fail PyString_AsStringAndSize(bytes, , NULL) check
))
class Mapping(object):
***************
*** 968,974 ****
ee('vim.current.window.xxx')
cb.append(">> WindowSetattr")
ee('vim.current.window.buffer = 0')
! ee('vim.current.window.cursor = (10000000000, 100000000)')
ee('vim.current.window.cursor = True')
ee('vim.current.window.height = "abc"')
ee('vim.current.window.width = "abc"')
--- 969,975 ----
ee('vim.current.window.xxx')
cb.append(">> WindowSetattr")
ee('vim.current.window.buffer = 0')
! ee('vim.current.window.cursor = (100000000, 100000000)')
ee('vim.current.window.cursor = True')
ee('vim.current.window.height = "abc"')
ee('vim.current.window.width = "abc"')
***************
*** 989,997 ****
ee('vim.current.buffer.append(["\\na", "bc"])')
ee('vim.current.buffer.append("\\nbc")')
cb.append(">> RBItem")
! ee('vim.current.buffer[10000000000]')
cb.append(">> RBAsItem")
! ee('vim.current.buffer[10000000000] = ""')
cb.append(">> BufferAttr")
ee('vim.current.buffer.xxx')
cb.append(">> BufferSetattr")
--- 990,998 ----
ee('vim.current.buffer.append(["\\na", "bc"])')
ee('vim.current.buffer.append("\\nbc")')
cb.append(">> RBItem")
! ee('vim.current.buffer[100000000]')
cb.append(">> RBAsItem")
! ee('vim.current.buffer[100000000] = ""')
cb.append(">> BufferAttr")
ee('vim.current.buffer.xxx')
cb.append(">> BufferSetattr")
*** ../vim-7.3.1078/src/testdir/test87.ok 2013-05-30 13:37:23.000000000 +0200
--- src/testdir/test87.ok 2013-05-31 18:41:15.000000000 +0200
***************
*** 454,460 ****
d.get("a", 2, 3):(<class 'TypeError'>, TypeError('function takes at most 2 arguments (3 given)',))
>>> Testing StringToChars using d.get(%s)
d.get(1):(<class 'TypeError'>, TypeError('object must be string',))
! d.get(u"\0"):(<class 'TypeError'>, TypeError('expected bytes with no null',))
d.get("\0"):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
d.pop("a"):(<class 'KeyError'>, KeyError('a',))
--- 454,460 ----
d.get("a", 2, 3):(<class 'TypeError'>, TypeError('function takes at most 2 arguments (3 given)',))
>>> Testing StringToChars using d.get(%s)
d.get(1):(<class 'TypeError'>, TypeError('object must be string',))
! d.get(b"\0"):(<class 'TypeError'>, TypeError('expected bytes with no null',))
d.get("\0"):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
d.pop("a"):(<class 'KeyError'>, KeyError('a',))
***************
*** 465,486 ****
dl["b"] = 1:(<class 'vim.error'>, error('dict is locked',))
>>> Testing StringToChars using d[%s] = 1
d[1] = 1:(<class 'TypeError'>, TypeError('object must be string',))
! d[u"\0"] = 1:(<class 'TypeError'>, TypeError('expected bytes with no null',))
d["\0"] = 1:(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using d["a"] = {%s : 1}
d["a"] = {1 : 1}:(<class 'TypeError'>, TypeError('object must be string',))
! d["a"] = {u"\0" : 1}:(<class 'TypeError'>, TypeError('expected bytes with no null',))
d["a"] = {"\0" : 1}:(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using d["a"] = {"abc" : {%s : 1}}
d["a"] = {"abc" : {1 : 1}}:(<class 'TypeError'>, TypeError('object must be string',))
! d["a"] = {"abc" : {u"\0" : 1}}:(<class 'TypeError'>, TypeError('expected bytes with no null',))
d["a"] = {"abc" : {"\0" : 1}}:(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using d["a"] = {"abc" : Mapping({%s : 1})}
d["a"] = {"abc" : Mapping({1 : 1})}:(<class 'TypeError'>, TypeError('object must be string',))
! d["a"] = {"abc" : Mapping({u"\0" : 1})}:(<class 'TypeError'>, TypeError('expected bytes with no null',))
d["a"] = {"abc" : Mapping({"\0" : 1})}:(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing *Iter* using d["a"] = {"abc" : %s}
--- 465,486 ----
dl["b"] = 1:(<class 'vim.error'>, error('dict is locked',))
>>> Testing StringToChars using d[%s] = 1
d[1] = 1:(<class 'TypeError'>, TypeError('object must be string',))
! d[b"\0"] = 1:(<class 'TypeError'>, TypeError('expected bytes with no null',))
d["\0"] = 1:(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using d["a"] = {%s : 1}
d["a"] = {1 : 1}:(<class 'TypeError'>, TypeError('object must be string',))
! d["a"] = {b"\0" : 1}:(<class 'TypeError'>, TypeError('expected bytes with no null',))
d["a"] = {"\0" : 1}:(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using d["a"] = {"abc" : {%s : 1}}
d["a"] = {"abc" : {1 : 1}}:(<class 'TypeError'>, TypeError('object must be string',))
! d["a"] = {"abc" : {b"\0" : 1}}:(<class 'TypeError'>, TypeError('expected bytes with no null',))
d["a"] = {"abc" : {"\0" : 1}}:(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using d["a"] = {"abc" : Mapping({%s : 1})}
d["a"] = {"abc" : Mapping({1 : 1})}:(<class 'TypeError'>, TypeError('object must be string',))
! d["a"] = {"abc" : Mapping({b"\0" : 1})}:(<class 'TypeError'>, TypeError('expected bytes with no null',))
d["a"] = {"abc" : Mapping({"\0" : 1})}:(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing *Iter* using d["a"] = {"abc" : %s}
***************
*** 495,511 ****
<<< Finished
>>> Testing StringToChars using d["a"] = Mapping({%s : 1})
d["a"] = Mapping({1 : 1}):(<class 'TypeError'>, TypeError('object must be string',))
! d["a"] = Mapping({u"\0" : 1}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
d["a"] = Mapping({"\0" : 1}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using d["a"] = Mapping({"abc" : {%s : 1}})
d["a"] = Mapping({"abc" : {1 : 1}}):(<class 'TypeError'>, TypeError('object must be string',))
! d["a"] = Mapping({"abc" : {u"\0" : 1}}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
d["a"] = Mapping({"abc" : {"\0" : 1}}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using d["a"] = Mapping({"abc" : Mapping({%s : 1})})
d["a"] = Mapping({"abc" : Mapping({1 : 1})}):(<class 'TypeError'>, TypeError('object must be string',))
! d["a"] = Mapping({"abc" : Mapping({u"\0" : 1})}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
d["a"] = Mapping({"abc" : Mapping({"\0" : 1})}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing *Iter* using d["a"] = Mapping({"abc" : %s})
--- 495,511 ----
<<< Finished
>>> Testing StringToChars using d["a"] = Mapping({%s : 1})
d["a"] = Mapping({1 : 1}):(<class 'TypeError'>, TypeError('object must be string',))
! d["a"] = Mapping({b"\0" : 1}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
d["a"] = Mapping({"\0" : 1}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using d["a"] = Mapping({"abc" : {%s : 1}})
d["a"] = Mapping({"abc" : {1 : 1}}):(<class 'TypeError'>, TypeError('object must be string',))
! d["a"] = Mapping({"abc" : {b"\0" : 1}}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
d["a"] = Mapping({"abc" : {"\0" : 1}}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using d["a"] = Mapping({"abc" : Mapping({%s : 1})})
d["a"] = Mapping({"abc" : Mapping({1 : 1})}):(<class 'TypeError'>, TypeError('object must be string',))
! d["a"] = Mapping({"abc" : Mapping({b"\0" : 1})}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
d["a"] = Mapping({"abc" : Mapping({"\0" : 1})}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing *Iter* using d["a"] = Mapping({"abc" : %s})
***************
*** 539,555 ****
<<< Finished
>>> Testing StringToChars using d.update({%s : 1})
d.update({1 : 1}):(<class 'TypeError'>, TypeError('object must be string',))
! d.update({u"\0" : 1}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
d.update({"\0" : 1}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using d.update({"abc" : {%s : 1}})
d.update({"abc" : {1 : 1}}):(<class 'TypeError'>, TypeError('object must be string',))
! d.update({"abc" : {u"\0" : 1}}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
d.update({"abc" : {"\0" : 1}}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using d.update({"abc" : Mapping({%s : 1})})
d.update({"abc" : Mapping({1 : 1})}):(<class 'TypeError'>, TypeError('object must be string',))
! d.update({"abc" : Mapping({u"\0" : 1})}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
d.update({"abc" : Mapping({"\0" : 1})}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing *Iter* using d.update({"abc" : %s})
--- 539,555 ----
<<< Finished
>>> Testing StringToChars using d.update({%s : 1})
d.update({1 : 1}):(<class 'TypeError'>, TypeError('object must be string',))
! d.update({b"\0" : 1}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
d.update({"\0" : 1}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using d.update({"abc" : {%s : 1}})
d.update({"abc" : {1 : 1}}):(<class 'TypeError'>, TypeError('object must be string',))
! d.update({"abc" : {b"\0" : 1}}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
d.update({"abc" : {"\0" : 1}}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using d.update({"abc" : Mapping({%s : 1})})
d.update({"abc" : Mapping({1 : 1})}):(<class 'TypeError'>, TypeError('object must be string',))
! d.update({"abc" : Mapping({b"\0" : 1})}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
d.update({"abc" : Mapping({"\0" : 1})}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing *Iter* using d.update({"abc" : %s})
***************
*** 564,580 ****
<<< Finished
>>> Testing StringToChars using d.update(Mapping({%s : 1}))
d.update(Mapping({1 : 1})):(<class 'TypeError'>, TypeError('object must be string',))
! d.update(Mapping({u"\0" : 1})):(<class 'TypeError'>, TypeError('expected bytes with no null',))
d.update(Mapping({"\0" : 1})):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using d.update(Mapping({"abc" : {%s : 1}}))
d.update(Mapping({"abc" : {1 : 1}})):(<class 'TypeError'>, TypeError('object must be string',))
! d.update(Mapping({"abc" : {u"\0" : 1}})):(<class 'TypeError'>, TypeError('expected bytes with no null',))
d.update(Mapping({"abc" : {"\0" : 1}})):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using d.update(Mapping({"abc" : Mapping({%s : 1})}))
d.update(Mapping({"abc" : Mapping({1 : 1})})):(<class 'TypeError'>, TypeError('object must be string',))
! d.update(Mapping({"abc" : Mapping({u"\0" : 1})})):(<class 'TypeError'>, TypeError('expected bytes with no null',))
d.update(Mapping({"abc" : Mapping({"\0" : 1})})):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing *Iter* using d.update(Mapping({"abc" : %s}))
--- 564,580 ----
<<< Finished
>>> Testing StringToChars using d.update(Mapping({%s : 1}))
d.update(Mapping({1 : 1})):(<class 'TypeError'>, TypeError('object must be string',))
! d.update(Mapping({b"\0" : 1})):(<class 'TypeError'>, TypeError('expected bytes with no null',))
d.update(Mapping({"\0" : 1})):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using d.update(Mapping({"abc" : {%s : 1}}))
d.update(Mapping({"abc" : {1 : 1}})):(<class 'TypeError'>, TypeError('object must be string',))
! d.update(Mapping({"abc" : {b"\0" : 1}})):(<class 'TypeError'>, TypeError('expected bytes with no null',))
d.update(Mapping({"abc" : {"\0" : 1}})):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using d.update(Mapping({"abc" : Mapping({%s : 1})}))
d.update(Mapping({"abc" : Mapping({1 : 1})})):(<class 'TypeError'>, TypeError('object must be string',))
! d.update(Mapping({"abc" : Mapping({b"\0" : 1})})):(<class 'TypeError'>, TypeError('expected bytes with no null',))
d.update(Mapping({"abc" : Mapping({"\0" : 1})})):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing *Iter* using d.update(Mapping({"abc" : %s}))
***************
*** 599,620 ****
<<< Finished
>>> Testing StringToChars using d.update(((%s, 0),))
d.update(((1, 0),)):(<class 'TypeError'>, TypeError('object must be string',))
! d.update(((u"\0", 0),)):(<class 'TypeError'>, TypeError('expected bytes with no null',))
d.update((("\0", 0),)):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using d.update((("a", {%s : 1}),))
d.update((("a", {1 : 1}),)):(<class 'TypeError'>, TypeError('object must be string',))
! d.update((("a", {u"\0" : 1}),)):(<class 'TypeError'>, TypeError('expected bytes with no null',))
d.update((("a", {"\0" : 1}),)):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using d.update((("a", {"abc" : {%s : 1}}),))
d.update((("a", {"abc" : {1 : 1}}),)):(<class 'TypeError'>, TypeError('object must be string',))
! d.update((("a", {"abc" : {u"\0" : 1}}),)):(<class 'TypeError'>, TypeError('expected bytes with no null',))
d.update((("a", {"abc" : {"\0" : 1}}),)):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using d.update((("a", {"abc" : Mapping({%s : 1})}),))
d.update((("a", {"abc" : Mapping({1 : 1})}),)):(<class 'TypeError'>, TypeError('object must be string',))
! d.update((("a", {"abc" : Mapping({u"\0" : 1})}),)):(<class 'TypeError'>, TypeError('expected bytes with no null',))
d.update((("a", {"abc" : Mapping({"\0" : 1})}),)):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing *Iter* using d.update((("a", {"abc" : %s}),))
--- 599,620 ----
<<< Finished
>>> Testing StringToChars using d.update(((%s, 0),))
d.update(((1, 0),)):(<class 'TypeError'>, TypeError('object must be string',))
! d.update(((b"\0", 0),)):(<class 'TypeError'>, TypeError('expected bytes with no null',))
d.update((("\0", 0),)):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using d.update((("a", {%s : 1}),))
d.update((("a", {1 : 1}),)):(<class 'TypeError'>, TypeError('object must be string',))
! d.update((("a", {b"\0" : 1}),)):(<class 'TypeError'>, TypeError('expected bytes with no null',))
d.update((("a", {"\0" : 1}),)):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using d.update((("a", {"abc" : {%s : 1}}),))
d.update((("a", {"abc" : {1 : 1}}),)):(<class 'TypeError'>, TypeError('object must be string',))
! d.update((("a", {"abc" : {b"\0" : 1}}),)):(<class 'TypeError'>, TypeError('expected bytes with no null',))
d.update((("a", {"abc" : {"\0" : 1}}),)):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using d.update((("a", {"abc" : Mapping({%s : 1})}),))
d.update((("a", {"abc" : Mapping({1 : 1})}),)):(<class 'TypeError'>, TypeError('object must be string',))
! d.update((("a", {"abc" : Mapping({b"\0" : 1})}),)):(<class 'TypeError'>, TypeError('expected bytes with no null',))
d.update((("a", {"abc" : Mapping({"\0" : 1})}),)):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing *Iter* using d.update((("a", {"abc" : %s}),))
***************
*** 629,645 ****
<<< Finished
>>> Testing StringToChars using d.update((("a", Mapping({%s : 1})),))
d.update((("a", Mapping({1 : 1})),)):(<class 'TypeError'>, TypeError('object must be string',))
! d.update((("a", Mapping({u"\0" : 1})),)):(<class 'TypeError'>, TypeError('expected bytes with no null',))
d.update((("a", Mapping({"\0" : 1})),)):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using d.update((("a", Mapping({"abc" : {%s : 1}})),))
d.update((("a", Mapping({"abc" : {1 : 1}})),)):(<class 'TypeError'>, TypeError('object must be string',))
! d.update((("a", Mapping({"abc" : {u"\0" : 1}})),)):(<class 'TypeError'>, TypeError('expected bytes with no null',))
d.update((("a", Mapping({"abc" : {"\0" : 1}})),)):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using d.update((("a", Mapping({"abc" : Mapping({%s : 1})})),))
d.update((("a", Mapping({"abc" : Mapping({1 : 1})})),)):(<class 'TypeError'>, TypeError('object must be string',))
! d.update((("a", Mapping({"abc" : Mapping({u"\0" : 1})})),)):(<class 'TypeError'>, TypeError('expected bytes with no null',))
d.update((("a", Mapping({"abc" : Mapping({"\0" : 1})})),)):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing *Iter* using d.update((("a", Mapping({"abc" : %s})),))
--- 629,645 ----
<<< Finished
>>> Testing StringToChars using d.update((("a", Mapping({%s : 1})),))
d.update((("a", Mapping({1 : 1})),)):(<class 'TypeError'>, TypeError('object must be string',))
! d.update((("a", Mapping({b"\0" : 1})),)):(<class 'TypeError'>, TypeError('expected bytes with no null',))
d.update((("a", Mapping({"\0" : 1})),)):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using d.update((("a", Mapping({"abc" : {%s : 1}})),))
d.update((("a", Mapping({"abc" : {1 : 1}})),)):(<class 'TypeError'>, TypeError('object must be string',))
! d.update((("a", Mapping({"abc" : {b"\0" : 1}})),)):(<class 'TypeError'>, TypeError('expected bytes with no null',))
d.update((("a", Mapping({"abc" : {"\0" : 1}})),)):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using d.update((("a", Mapping({"abc" : Mapping({%s : 1})})),))
d.update((("a", Mapping({"abc" : Mapping({1 : 1})})),)):(<class 'TypeError'>, TypeError('object must be string',))
! d.update((("a", Mapping({"abc" : Mapping({b"\0" : 1})})),)):(<class 'TypeError'>, TypeError('expected bytes with no null',))
d.update((("a", Mapping({"abc" : Mapping({"\0" : 1})})),)):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing *Iter* using d.update((("a", Mapping({"abc" : %s})),))
***************
*** 676,692 ****
<<< Finished
>>> Testing StringToChars using vim.List([{%s : 1}])
vim.List([{1 : 1}]):(<class 'TypeError'>, TypeError('object must be string',))
! vim.List([{u"\0" : 1}]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
vim.List([{"\0" : 1}]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using vim.List([{"abc" : {%s : 1}}])
vim.List([{"abc" : {1 : 1}}]):(<class 'TypeError'>, TypeError('object must be string',))
! vim.List([{"abc" : {u"\0" : 1}}]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
vim.List([{"abc" : {"\0" : 1}}]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using vim.List([{"abc" : Mapping({%s : 1})}])
vim.List([{"abc" : Mapping({1 : 1})}]):(<class 'TypeError'>, TypeError('object must be string',))
! vim.List([{"abc" : Mapping({u"\0" : 1})}]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
vim.List([{"abc" : Mapping({"\0" : 1})}]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing *Iter* using vim.List([{"abc" : %s}])
--- 676,692 ----
<<< Finished
>>> Testing StringToChars using vim.List([{%s : 1}])
vim.List([{1 : 1}]):(<class 'TypeError'>, TypeError('object must be string',))
! vim.List([{b"\0" : 1}]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
vim.List([{"\0" : 1}]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using vim.List([{"abc" : {%s : 1}}])
vim.List([{"abc" : {1 : 1}}]):(<class 'TypeError'>, TypeError('object must be string',))
! vim.List([{"abc" : {b"\0" : 1}}]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
vim.List([{"abc" : {"\0" : 1}}]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using vim.List([{"abc" : Mapping({%s : 1})}])
vim.List([{"abc" : Mapping({1 : 1})}]):(<class 'TypeError'>, TypeError('object must be string',))
! vim.List([{"abc" : Mapping({b"\0" : 1})}]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
vim.List([{"abc" : Mapping({"\0" : 1})}]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing *Iter* using vim.List([{"abc" : %s}])
***************
*** 701,717 ****
<<< Finished
>>> Testing StringToChars using vim.List([Mapping({%s : 1})])
vim.List([Mapping({1 : 1})]):(<class 'TypeError'>, TypeError('object must be string',))
! vim.List([Mapping({u"\0" : 1})]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
vim.List([Mapping({"\0" : 1})]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using vim.List([Mapping({"abc" : {%s : 1}})])
vim.List([Mapping({"abc" : {1 : 1}})]):(<class 'TypeError'>, TypeError('object must be string',))
! vim.List([Mapping({"abc" : {u"\0" : 1}})]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
vim.List([Mapping({"abc" : {"\0" : 1}})]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using vim.List([Mapping({"abc" : Mapping({%s : 1})})])
vim.List([Mapping({"abc" : Mapping({1 : 1})})]):(<class 'TypeError'>, TypeError('object must be string',))
! vim.List([Mapping({"abc" : Mapping({u"\0" : 1})})]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
vim.List([Mapping({"abc" : Mapping({"\0" : 1})})]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing *Iter* using vim.List([Mapping({"abc" : %s})])
--- 701,717 ----
<<< Finished
>>> Testing StringToChars using vim.List([Mapping({%s : 1})])
vim.List([Mapping({1 : 1})]):(<class 'TypeError'>, TypeError('object must be string',))
! vim.List([Mapping({b"\0" : 1})]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
vim.List([Mapping({"\0" : 1})]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using vim.List([Mapping({"abc" : {%s : 1}})])
vim.List([Mapping({"abc" : {1 : 1}})]):(<class 'TypeError'>, TypeError('object must be string',))
! vim.List([Mapping({"abc" : {b"\0" : 1}})]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
vim.List([Mapping({"abc" : {"\0" : 1}})]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using vim.List([Mapping({"abc" : Mapping({%s : 1})})])
vim.List([Mapping({"abc" : Mapping({1 : 1})})]):(<class 'TypeError'>, TypeError('object must be string',))
! vim.List([Mapping({"abc" : Mapping({b"\0" : 1})})]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
vim.List([Mapping({"abc" : Mapping({"\0" : 1})})]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing *Iter* using vim.List([Mapping({"abc" : %s})])
***************
*** 747,763 ****
<<< Finished
>>> Testing StringToChars using l[:] = [{%s : 1}]
l[:] = [{1 : 1}]:(<class 'TypeError'>, TypeError('object must be string',))
! l[:] = [{u"\0" : 1}]:(<class 'TypeError'>, TypeError('expected bytes with no null',))
l[:] = [{"\0" : 1}]:(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using l[:] = [{"abc" : {%s : 1}}]
l[:] = [{"abc" : {1 : 1}}]:(<class 'TypeError'>, TypeError('object must be string',))
! l[:] = [{"abc" : {u"\0" : 1}}]:(<class 'TypeError'>, TypeError('expected bytes with no null',))
l[:] = [{"abc" : {"\0" : 1}}]:(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using l[:] = [{"abc" : Mapping({%s : 1})}]
l[:] = [{"abc" : Mapping({1 : 1})}]:(<class 'TypeError'>, TypeError('object must be string',))
! l[:] = [{"abc" : Mapping({u"\0" : 1})}]:(<class 'TypeError'>, TypeError('expected bytes with no null',))
l[:] = [{"abc" : Mapping({"\0" : 1})}]:(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing *Iter* using l[:] = [{"abc" : %s}]
--- 747,763 ----
<<< Finished
>>> Testing StringToChars using l[:] = [{%s : 1}]
l[:] = [{1 : 1}]:(<class 'TypeError'>, TypeError('object must be string',))
! l[:] = [{b"\0" : 1}]:(<class 'TypeError'>, TypeError('expected bytes with no null',))
l[:] = [{"\0" : 1}]:(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using l[:] = [{"abc" : {%s : 1}}]
l[:] = [{"abc" : {1 : 1}}]:(<class 'TypeError'>, TypeError('object must be string',))
! l[:] = [{"abc" : {b"\0" : 1}}]:(<class 'TypeError'>, TypeError('expected bytes with no null',))
l[:] = [{"abc" : {"\0" : 1}}]:(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using l[:] = [{"abc" : Mapping({%s : 1})}]
l[:] = [{"abc" : Mapping({1 : 1})}]:(<class 'TypeError'>, TypeError('object must be string',))
! l[:] = [{"abc" : Mapping({b"\0" : 1})}]:(<class 'TypeError'>, TypeError('expected bytes with no null',))
l[:] = [{"abc" : Mapping({"\0" : 1})}]:(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing *Iter* using l[:] = [{"abc" : %s}]
***************
*** 772,788 ****
<<< Finished
>>> Testing StringToChars using l[:] = [Mapping({%s : 1})]
l[:] = [Mapping({1 : 1})]:(<class 'TypeError'>, TypeError('object must be string',))
! l[:] = [Mapping({u"\0" : 1})]:(<class 'TypeError'>, TypeError('expected bytes with no null',))
l[:] = [Mapping({"\0" : 1})]:(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using l[:] = [Mapping({"abc" : {%s : 1}})]
l[:] = [Mapping({"abc" : {1 : 1}})]:(<class 'TypeError'>, TypeError('object must be string',))
! l[:] = [Mapping({"abc" : {u"\0" : 1}})]:(<class 'TypeError'>, TypeError('expected bytes with no null',))
l[:] = [Mapping({"abc" : {"\0" : 1}})]:(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using l[:] = [Mapping({"abc" : Mapping({%s : 1})})]
l[:] = [Mapping({"abc" : Mapping({1 : 1})})]:(<class 'TypeError'>, TypeError('object must be string',))
! l[:] = [Mapping({"abc" : Mapping({u"\0" : 1})})]:(<class 'TypeError'>, TypeError('expected bytes with no null',))
l[:] = [Mapping({"abc" : Mapping({"\0" : 1})})]:(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing *Iter* using l[:] = [Mapping({"abc" : %s})]
--- 772,788 ----
<<< Finished
>>> Testing StringToChars using l[:] = [Mapping({%s : 1})]
l[:] = [Mapping({1 : 1})]:(<class 'TypeError'>, TypeError('object must be string',))
! l[:] = [Mapping({b"\0" : 1})]:(<class 'TypeError'>, TypeError('expected bytes with no null',))
l[:] = [Mapping({"\0" : 1})]:(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using l[:] = [Mapping({"abc" : {%s : 1}})]
l[:] = [Mapping({"abc" : {1 : 1}})]:(<class 'TypeError'>, TypeError('object must be string',))
! l[:] = [Mapping({"abc" : {b"\0" : 1}})]:(<class 'TypeError'>, TypeError('expected bytes with no null',))
l[:] = [Mapping({"abc" : {"\0" : 1}})]:(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using l[:] = [Mapping({"abc" : Mapping({%s : 1})})]
l[:] = [Mapping({"abc" : Mapping({1 : 1})})]:(<class 'TypeError'>, TypeError('object must be string',))
! l[:] = [Mapping({"abc" : Mapping({b"\0" : 1})})]:(<class 'TypeError'>, TypeError('expected bytes with no null',))
l[:] = [Mapping({"abc" : Mapping({"\0" : 1})})]:(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing *Iter* using l[:] = [Mapping({"abc" : %s})]
***************
*** 812,828 ****
<<< Finished
>>> Testing StringToChars using l.extend([{%s : 1}])
l.extend([{1 : 1}]):(<class 'TypeError'>, TypeError('object must be string',))
! l.extend([{u"\0" : 1}]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
l.extend([{"\0" : 1}]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using l.extend([{"abc" : {%s : 1}}])
l.extend([{"abc" : {1 : 1}}]):(<class 'TypeError'>, TypeError('object must be string',))
! l.extend([{"abc" : {u"\0" : 1}}]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
l.extend([{"abc" : {"\0" : 1}}]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using l.extend([{"abc" : Mapping({%s : 1})}])
l.extend([{"abc" : Mapping({1 : 1})}]):(<class 'TypeError'>, TypeError('object must be string',))
! l.extend([{"abc" : Mapping({u"\0" : 1})}]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
l.extend([{"abc" : Mapping({"\0" : 1})}]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing *Iter* using l.extend([{"abc" : %s}])
--- 812,828 ----
<<< Finished
>>> Testing StringToChars using l.extend([{%s : 1}])
l.extend([{1 : 1}]):(<class 'TypeError'>, TypeError('object must be string',))
! l.extend([{b"\0" : 1}]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
l.extend([{"\0" : 1}]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using l.extend([{"abc" : {%s : 1}}])
l.extend([{"abc" : {1 : 1}}]):(<class 'TypeError'>, TypeError('object must be string',))
! l.extend([{"abc" : {b"\0" : 1}}]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
l.extend([{"abc" : {"\0" : 1}}]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using l.extend([{"abc" : Mapping({%s : 1})}])
l.extend([{"abc" : Mapping({1 : 1})}]):(<class 'TypeError'>, TypeError('object must be string',))
! l.extend([{"abc" : Mapping({b"\0" : 1})}]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
l.extend([{"abc" : Mapping({"\0" : 1})}]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing *Iter* using l.extend([{"abc" : %s}])
***************
*** 837,853 ****
<<< Finished
>>> Testing StringToChars using l.extend([Mapping({%s : 1})])
l.extend([Mapping({1 : 1})]):(<class 'TypeError'>, TypeError('object must be string',))
! l.extend([Mapping({u"\0" : 1})]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
l.extend([Mapping({"\0" : 1})]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using l.extend([Mapping({"abc" : {%s : 1}})])
l.extend([Mapping({"abc" : {1 : 1}})]):(<class 'TypeError'>, TypeError('object must be string',))
! l.extend([Mapping({"abc" : {u"\0" : 1}})]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
l.extend([Mapping({"abc" : {"\0" : 1}})]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using l.extend([Mapping({"abc" : Mapping({%s : 1})})])
l.extend([Mapping({"abc" : Mapping({1 : 1})})]):(<class 'TypeError'>, TypeError('object must be string',))
! l.extend([Mapping({"abc" : Mapping({u"\0" : 1})})]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
l.extend([Mapping({"abc" : Mapping({"\0" : 1})})]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing *Iter* using l.extend([Mapping({"abc" : %s})])
--- 837,853 ----
<<< Finished
>>> Testing StringToChars using l.extend([Mapping({%s : 1})])
l.extend([Mapping({1 : 1})]):(<class 'TypeError'>, TypeError('object must be string',))
! l.extend([Mapping({b"\0" : 1})]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
l.extend([Mapping({"\0" : 1})]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using l.extend([Mapping({"abc" : {%s : 1}})])
l.extend([Mapping({"abc" : {1 : 1}})]):(<class 'TypeError'>, TypeError('object must be string',))
! l.extend([Mapping({"abc" : {b"\0" : 1}})]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
l.extend([Mapping({"abc" : {"\0" : 1}})]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using l.extend([Mapping({"abc" : Mapping({%s : 1})})])
l.extend([Mapping({"abc" : Mapping({1 : 1})})]):(<class 'TypeError'>, TypeError('object must be string',))
! l.extend([Mapping({"abc" : Mapping({b"\0" : 1})})]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
l.extend([Mapping({"abc" : Mapping({"\0" : 1})})]):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing *Iter* using l.extend([Mapping({"abc" : %s})])
***************
*** 882,898 ****
>> FunctionCall
>>> Testing StringToChars using f({%s : 1})
f({1 : 1}):(<class 'TypeError'>, TypeError('object must be string',))
! f({u"\0" : 1}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
f({"\0" : 1}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using f({"abc" : {%s : 1}})
f({"abc" : {1 : 1}}):(<class 'TypeError'>, TypeError('object must be string',))
! f({"abc" : {u"\0" : 1}}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
f({"abc" : {"\0" : 1}}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using f({"abc" : Mapping({%s : 1})})
f({"abc" : Mapping({1 : 1})}):(<class 'TypeError'>, TypeError('object must be string',))
! f({"abc" : Mapping({u"\0" : 1})}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
f({"abc" : Mapping({"\0" : 1})}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing *Iter* using f({"abc" : %s})
--- 882,898 ----
>> FunctionCall
>>> Testing StringToChars using f({%s : 1})
f({1 : 1}):(<class 'TypeError'>, TypeError('object must be string',))
! f({b"\0" : 1}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
f({"\0" : 1}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using f({"abc" : {%s : 1}})
f({"abc" : {1 : 1}}):(<class 'TypeError'>, TypeError('object must be string',))
! f({"abc" : {b"\0" : 1}}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
f({"abc" : {"\0" : 1}}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using f({"abc" : Mapping({%s : 1})})
f({"abc" : Mapping({1 : 1})}):(<class 'TypeError'>, TypeError('object must be string',))
! f({"abc" : Mapping({b"\0" : 1})}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
f({"abc" : Mapping({"\0" : 1})}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing *Iter* using f({"abc" : %s})
***************
*** 907,923 ****
<<< Finished
>>> Testing StringToChars using f(Mapping({%s : 1}))
f(Mapping({1 : 1})):(<class 'TypeError'>, TypeError('object must be string',))
! f(Mapping({u"\0" : 1})):(<class 'TypeError'>, TypeError('expected bytes with no null',))
f(Mapping({"\0" : 1})):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using f(Mapping({"abc" : {%s : 1}}))
f(Mapping({"abc" : {1 : 1}})):(<class 'TypeError'>, TypeError('object must be string',))
! f(Mapping({"abc" : {u"\0" : 1}})):(<class 'TypeError'>, TypeError('expected bytes with no null',))
f(Mapping({"abc" : {"\0" : 1}})):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using f(Mapping({"abc" : Mapping({%s : 1})}))
f(Mapping({"abc" : Mapping({1 : 1})})):(<class 'TypeError'>, TypeError('object must be string',))
! f(Mapping({"abc" : Mapping({u"\0" : 1})})):(<class 'TypeError'>, TypeError('expected bytes with no null',))
f(Mapping({"abc" : Mapping({"\0" : 1})})):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing *Iter* using f(Mapping({"abc" : %s}))
--- 907,923 ----
<<< Finished
>>> Testing StringToChars using f(Mapping({%s : 1}))
f(Mapping({1 : 1})):(<class 'TypeError'>, TypeError('object must be string',))
! f(Mapping({b"\0" : 1})):(<class 'TypeError'>, TypeError('expected bytes with no null',))
f(Mapping({"\0" : 1})):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using f(Mapping({"abc" : {%s : 1}}))
f(Mapping({"abc" : {1 : 1}})):(<class 'TypeError'>, TypeError('object must be string',))
! f(Mapping({"abc" : {b"\0" : 1}})):(<class 'TypeError'>, TypeError('expected bytes with no null',))
f(Mapping({"abc" : {"\0" : 1}})):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using f(Mapping({"abc" : Mapping({%s : 1})}))
f(Mapping({"abc" : Mapping({1 : 1})})):(<class 'TypeError'>, TypeError('object must be string',))
! f(Mapping({"abc" : Mapping({b"\0" : 1})})):(<class 'TypeError'>, TypeError('expected bytes with no null',))
f(Mapping({"abc" : Mapping({"\0" : 1})})):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing *Iter* using f(Mapping({"abc" : %s}))
***************
*** 942,958 ****
<<< Finished
>>> Testing StringToChars using fd(self={%s : 1})
fd(self={1 : 1}):(<class 'TypeError'>, TypeError('object must be string',))
! fd(self={u"\0" : 1}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
fd(self={"\0" : 1}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using fd(self={"abc" : {%s : 1}})
fd(self={"abc" : {1 : 1}}):(<class 'TypeError'>, TypeError('object must be string',))
! fd(self={"abc" : {u"\0" : 1}}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
fd(self={"abc" : {"\0" : 1}}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using fd(self={"abc" : Mapping({%s : 1})})
fd(self={"abc" : Mapping({1 : 1})}):(<class 'TypeError'>, TypeError('object must be string',))
! fd(self={"abc" : Mapping({u"\0" : 1})}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
fd(self={"abc" : Mapping({"\0" : 1})}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing *Iter* using fd(self={"abc" : %s})
--- 942,958 ----
<<< Finished
>>> Testing StringToChars using fd(self={%s : 1})
fd(self={1 : 1}):(<class 'TypeError'>, TypeError('object must be string',))
! fd(self={b"\0" : 1}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
fd(self={"\0" : 1}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using fd(self={"abc" : {%s : 1}})
fd(self={"abc" : {1 : 1}}):(<class 'TypeError'>, TypeError('object must be string',))
! fd(self={"abc" : {b"\0" : 1}}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
fd(self={"abc" : {"\0" : 1}}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using fd(self={"abc" : Mapping({%s : 1})})
fd(self={"abc" : Mapping({1 : 1})}):(<class 'TypeError'>, TypeError('object must be string',))
! fd(self={"abc" : Mapping({b"\0" : 1})}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
fd(self={"abc" : Mapping({"\0" : 1})}):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing *Iter* using fd(self={"abc" : %s})
***************
*** 967,983 ****
<<< Finished
>>> Testing StringToChars using fd(self=Mapping({%s : 1}))
fd(self=Mapping({1 : 1})):(<class 'TypeError'>, TypeError('object must be string',))
! fd(self=Mapping({u"\0" : 1})):(<class 'TypeError'>, TypeError('expected bytes with no null',))
fd(self=Mapping({"\0" : 1})):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using fd(self=Mapping({"abc" : {%s : 1}}))
fd(self=Mapping({"abc" : {1 : 1}})):(<class 'TypeError'>, TypeError('object must be string',))
! fd(self=Mapping({"abc" : {u"\0" : 1}})):(<class 'TypeError'>, TypeError('expected bytes with no null',))
fd(self=Mapping({"abc" : {"\0" : 1}})):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using fd(self=Mapping({"abc" : Mapping({%s : 1})}))
fd(self=Mapping({"abc" : Mapping({1 : 1})})):(<class 'TypeError'>, TypeError('object must be string',))
! fd(self=Mapping({"abc" : Mapping({u"\0" : 1})})):(<class 'TypeError'>, TypeError('expected bytes with no null',))
fd(self=Mapping({"abc" : Mapping({"\0" : 1})})):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing *Iter* using fd(self=Mapping({"abc" : %s}))
--- 967,983 ----
<<< Finished
>>> Testing StringToChars using fd(self=Mapping({%s : 1}))
fd(self=Mapping({1 : 1})):(<class 'TypeError'>, TypeError('object must be string',))
! fd(self=Mapping({b"\0" : 1})):(<class 'TypeError'>, TypeError('expected bytes with no null',))
fd(self=Mapping({"\0" : 1})):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using fd(self=Mapping({"abc" : {%s : 1}}))
fd(self=Mapping({"abc" : {1 : 1}})):(<class 'TypeError'>, TypeError('object must be string',))
! fd(self=Mapping({"abc" : {b"\0" : 1}})):(<class 'TypeError'>, TypeError('expected bytes with no null',))
fd(self=Mapping({"abc" : {"\0" : 1}})):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing StringToChars using fd(self=Mapping({"abc" : Mapping({%s : 1})}))
fd(self=Mapping({"abc" : Mapping({1 : 1})})):(<class 'TypeError'>, TypeError('object must be string',))
! fd(self=Mapping({"abc" : Mapping({b"\0" : 1})})):(<class 'TypeError'>, TypeError('expected bytes with no null',))
fd(self=Mapping({"abc" : Mapping({"\0" : 1})})):(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>>> Testing *Iter* using fd(self=Mapping({"abc" : %s}))
***************
*** 1001,1007 ****
fd(self=FailingMappingKey()):(<class 'NotImplementedError'>, NotImplementedError())
<<< Finished
>>> Testing ConvertFromPyMapping using fd(self=%s)
! fd(self=[]):(<class 'AttributeError'>, AttributeError("'list' object has no attribute 'keys'",))
<<< Finished
> TabPage
>> TabPageAttr
--- 1001,1007 ----
fd(self=FailingMappingKey()):(<class 'NotImplementedError'>, NotImplementedError())
<<< Finished
>>> Testing ConvertFromPyMapping using fd(self=%s)
! fd(self=[]):(<class 'AttributeError'>, AttributeError('keys',))
<<< Finished
> TabPage
>> TabPageAttr
***************
*** 1014,1020 ****
vim.current.window.xxx:(<class 'AttributeError'>, AttributeError("'vim.window' object has no attribute 'xxx'",))
>> WindowSetattr
vim.current.window.buffer = 0:(<class 'TypeError'>, TypeError('readonly attribute',))
! vim.current.window.cursor = (10000000000, 100000000):(<class 'vim.error'>, error('cursor position outside buffer',))
vim.current.window.cursor = True:(<class 'TypeError'>, TypeError('argument must be 2-item sequence, not bool',))
vim.current.window.height = "abc":(<class 'TypeError'>, TypeError('an integer is required',))
vim.current.window.width = "abc":(<class 'TypeError'>, TypeError('an integer is required',))
--- 1014,1020 ----
vim.current.window.xxx:(<class 'AttributeError'>, AttributeError("'vim.window' object has no attribute 'xxx'",))
>> WindowSetattr
vim.current.window.buffer = 0:(<class 'TypeError'>, TypeError('readonly attribute',))
! vim.current.window.cursor = (100000000, 100000000):(<class 'vim.error'>, error('cursor position outside buffer',))
vim.current.window.cursor = True:(<class 'TypeError'>, TypeError('argument must be 2-item sequence, not bool',))
vim.current.window.height = "abc":(<class 'TypeError'>, TypeError('an integer is required',))
vim.current.window.width = "abc":(<class 'TypeError'>, TypeError('an integer is required',))
***************
*** 1035,1043 ****
vim.current.buffer.append(["\na", "bc"]):(<class 'vim.error'>, error('string cannot contain newlines',))
vim.current.buffer.append("\nbc"):(<class 'vim.error'>, error('string cannot contain newlines',))
>> RBItem
! vim.current.buffer[10000000000]:(<class 'IndexError'>, IndexError('line number out of range',))
>> RBAsItem
! vim.current.buffer[10000000000] = "":(<class 'IndexError'>, IndexError('line number out of range',))
>> BufferAttr
vim.current.buffer.xxx:(<class 'AttributeError'>, AttributeError("'vim.buffer' object has no attribute 'xxx'",))
>> BufferSetattr
--- 1035,1043 ----
vim.current.buffer.append(["\na", "bc"]):(<class 'vim.error'>, error('string cannot contain newlines',))
vim.current.buffer.append("\nbc"):(<class 'vim.error'>, error('string cannot contain newlines',))
>> RBItem
! vim.current.buffer[100000000]:(<class 'IndexError'>, IndexError('line number out of range',))
>> RBAsItem
! vim.current.buffer[100000000] = "":(<class 'IndexError'>, IndexError('line number out of range',))
>> BufferAttr
vim.current.buffer.xxx:(<class 'AttributeError'>, AttributeError("'vim.buffer' object has no attribute 'xxx'",))
>> BufferSetattr
*** ../vim-7.3.1078/src/version.c 2013-05-30 22:43:57.000000000 +0200
--- src/version.c 2013-05-31 18:41:58.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1079,
/**/
--
hundred-and-one symptoms of being an internet addict:
29. Your phone bill comes to your doorstep in a box.
/// 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 ///

265
7.3.1080 Normal file
View File

@ -0,0 +1,265 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1080
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1080
Problem: Test 86 fails.
Solution: Comment out the parts that don't work. Make it pass on 32 bit
systems.
Files: src/testdir/test86.in, src/testdir/test86.ok
*** ../vim-7.3.1079/src/testdir/test86.in 2013-05-30 15:38:20.000000000 +0200
--- src/testdir/test86.in 2013-05-31 18:59:05.000000000 +0200
***************
*** 8,15 ****
STARTTEST
:so small.vim
:set encoding=latin1
- :" HACK: currently crashes, skip the test
- :e! test.ok | wq! test.out
:if !has('python') | e! test.ok | wq! test.out | endif
:lang C
:py import vim
--- 8,13 ----
***************
*** 915,921 ****
cb.append(">> OutputWriteLines")
ee('sys.stdout.writelines(None)')
ee('sys.stdout.writelines([1])')
! iter_test('sys.stdout.writelines(%s)')
cb.append("> VimCommand")
ee('vim.command(1)')
#! Not checked: vim->python exceptions translating: checked later
--- 913,919 ----
cb.append(">> OutputWriteLines")
ee('sys.stdout.writelines(None)')
ee('sys.stdout.writelines([1])')
! #iter_test('sys.stdout.writelines(%s)')
cb.append("> VimCommand")
ee('vim.command(1)')
#! Not checked: vim->python exceptions translating: checked later
***************
*** 955,961 ****
cb.append(">>> iter")
ee('d.update(FailingMapping())')
ee('d.update([FailingIterNext()])')
! iter_test('d.update(%s)')
convertfrompyobject_test('d.update(%s)')
stringtochars_test('d.update(((%s, 0),))')
convertfrompyobject_test('d.update((("a", %s),))')
--- 953,959 ----
cb.append(">>> iter")
ee('d.update(FailingMapping())')
ee('d.update([FailingIterNext()])')
! #iter_test('d.update(%s)')
convertfrompyobject_test('d.update(%s)')
stringtochars_test('d.update(((%s, 0),))')
convertfrompyobject_test('d.update((("a", %s),))')
***************
*** 967,973 ****
cb.append(">> ListConstructor")
ee('vim.List(1, 2)')
ee('vim.List(a=1)')
! iter_test('vim.List(%s)')
convertfrompyobject_test('vim.List([%s])')
cb.append(">> ListItem")
ee('l[1000]')
--- 965,971 ----
cb.append(">> ListConstructor")
ee('vim.List(1, 2)')
ee('vim.List(a=1)')
! #iter_test('vim.List(%s)')
convertfrompyobject_test('vim.List([%s])')
cb.append(">> ListItem")
ee('l[1000]')
***************
*** 976,985 ****
ee('l[1000] = 3')
cb.append(">> ListAssSlice")
ee('ll[1:100] = "abc"')
! iter_test('l[:] = %s')
convertfrompyobject_test('l[:] = [%s]')
cb.append(">> ListConcatInPlace")
! iter_test('l.extend(%s)')
convertfrompyobject_test('l.extend([%s])')
cb.append(">> ListSetattr")
ee('del l.locked')
--- 974,983 ----
ee('l[1000] = 3')
cb.append(">> ListAssSlice")
ee('ll[1:100] = "abc"')
! #iter_test('l[:] = %s')
convertfrompyobject_test('l[:] = [%s]')
cb.append(">> ListConcatInPlace")
! #iter_test('l.extend(%s)')
convertfrompyobject_test('l.extend([%s])')
cb.append(">> ListSetattr")
ee('del l.locked')
***************
*** 1004,1010 ****
ee('vim.current.window.xxx')
cb.append(">> WindowSetattr")
ee('vim.current.window.buffer = 0')
! ee('vim.current.window.cursor = (10000000000, 100000000)')
ee('vim.current.window.cursor = True')
ee('vim.current.window.height = "abc"')
ee('vim.current.window.width = "abc"')
--- 1002,1008 ----
ee('vim.current.window.xxx')
cb.append(">> WindowSetattr")
ee('vim.current.window.buffer = 0')
! ee('vim.current.window.cursor = (100000000, 100000000)')
ee('vim.current.window.cursor = True')
ee('vim.current.window.height = "abc"')
ee('vim.current.window.width = "abc"')
***************
*** 1025,1033 ****
ee('vim.current.buffer.append(["\\na", "bc"])')
ee('vim.current.buffer.append("\\nbc")')
cb.append(">> RBItem")
! ee('vim.current.buffer[10000000000]')
cb.append(">> RBAsItem")
! ee('vim.current.buffer[10000000000] = ""')
cb.append(">> BufferAttr")
ee('vim.current.buffer.xxx')
cb.append(">> BufferSetattr")
--- 1023,1031 ----
ee('vim.current.buffer.append(["\\na", "bc"])')
ee('vim.current.buffer.append("\\nbc")')
cb.append(">> RBItem")
! ee('vim.current.buffer[100000000]')
cb.append(">> RBAsItem")
! ee('vim.current.buffer[100000000] = ""')
cb.append(">> BufferAttr")
ee('vim.current.buffer.xxx')
cb.append(">> BufferSetattr")
*** ../vim-7.3.1079/src/testdir/test86.ok 2013-05-30 13:37:23.000000000 +0200
--- src/testdir/test86.ok 2013-05-31 18:59:34.000000000 +0200
***************
*** 439,448 ****
>> OutputWriteLines
sys.stdout.writelines(None):(<type 'exceptions.TypeError'>, TypeError("'NoneType' object is not iterable",))
sys.stdout.writelines([1]):(<type 'exceptions.TypeError'>, TypeError('writelines() requires list of strings',))
- >>> Testing *Iter* using sys.stdout.writelines(%s)
- sys.stdout.writelines(FailingIter()):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
- sys.stdout.writelines(FailingIterNext()):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
- <<< Finished
> VimCommand
vim.command(1):(<type 'exceptions.TypeError'>, TypeError('must be string, not int',))
> VimToPython
--- 439,444 ----
***************
*** 544,553 ****
>>> iter
d.update(FailingMapping()):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
d.update([FailingIterNext()]):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
- >>> Testing *Iter* using d.update(%s)
- d.update(FailingIter()):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
- d.update(FailingIterNext()):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
- <<< Finished
>>> Testing StringToChars using d.update({%s : 1})
d.update({1 : 1}):(<type 'exceptions.TypeError'>, TypeError('object must be string',))
d.update({u"\0" : 1}):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
--- 540,545 ----
***************
*** 681,690 ****
>> ListConstructor
vim.List(1, 2):(<type 'exceptions.TypeError'>, TypeError('function takes at most 1 argument (2 given)',))
vim.List(a=1):(<type 'exceptions.TypeError'>, TypeError('list constructor does not accept keyword arguments',))
- >>> Testing *Iter* using vim.List(%s)
- vim.List(FailingIter()):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
- vim.List(FailingIterNext()):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
- <<< Finished
>>> Testing StringToChars using vim.List([{%s : 1}])
vim.List([{1 : 1}]):(<type 'exceptions.TypeError'>, TypeError('object must be string',))
vim.List([{u"\0" : 1}]):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
--- 673,678 ----
***************
*** 752,761 ****
l[1000] = 3:(<type 'exceptions.IndexError'>, IndexError('list index out of range',))
>> ListAssSlice
ll[1:100] = "abc":(<class 'vim.error'>, error('list is locked',))
- >>> Testing *Iter* using l[:] = %s
- l[:] = FailingIter():(<type 'exceptions.NotImplementedError'>, NotImplementedError())
- l[:] = FailingIterNext():(<type 'exceptions.NotImplementedError'>, NotImplementedError())
- <<< Finished
>>> Testing StringToChars using l[:] = [{%s : 1}]
l[:] = [{1 : 1}]:(<type 'exceptions.TypeError'>, TypeError('object must be string',))
l[:] = [{u"\0" : 1}]:(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
--- 740,745 ----
***************
*** 817,826 ****
l[:] = [FailingMappingKey()]:(<type 'exceptions.NotImplementedError'>, NotImplementedError())
<<< Finished
>> ListConcatInPlace
- >>> Testing *Iter* using l.extend(%s)
- l.extend(FailingIter()):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
- l.extend(FailingIterNext()):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
- <<< Finished
>>> Testing StringToChars using l.extend([{%s : 1}])
l.extend([{1 : 1}]):(<type 'exceptions.TypeError'>, TypeError('object must be string',))
l.extend([{u"\0" : 1}]):(<type 'exceptions.TypeError'>, TypeError('expected string without null bytes',))
--- 801,806 ----
***************
*** 1025,1031 ****
vim.current.window.xxx:(<type 'exceptions.AttributeError'>, AttributeError('xxx',))
>> WindowSetattr
vim.current.window.buffer = 0:(<type 'exceptions.TypeError'>, TypeError('readonly attribute',))
! vim.current.window.cursor = (10000000000, 100000000):(<class 'vim.error'>, error('cursor position outside buffer',))
vim.current.window.cursor = True:(<type 'exceptions.TypeError'>, TypeError('argument must be 2-item sequence, not bool',))
vim.current.window.height = "abc":(<type 'exceptions.TypeError'>, TypeError('an integer is required',))
vim.current.window.width = "abc":(<type 'exceptions.TypeError'>, TypeError('an integer is required',))
--- 1005,1011 ----
vim.current.window.xxx:(<type 'exceptions.AttributeError'>, AttributeError('xxx',))
>> WindowSetattr
vim.current.window.buffer = 0:(<type 'exceptions.TypeError'>, TypeError('readonly attribute',))
! vim.current.window.cursor = (100000000, 100000000):(<class 'vim.error'>, error('cursor position outside buffer',))
vim.current.window.cursor = True:(<type 'exceptions.TypeError'>, TypeError('argument must be 2-item sequence, not bool',))
vim.current.window.height = "abc":(<type 'exceptions.TypeError'>, TypeError('an integer is required',))
vim.current.window.width = "abc":(<type 'exceptions.TypeError'>, TypeError('an integer is required',))
***************
*** 1046,1054 ****
vim.current.buffer.append(["\na", "bc"]):(<class 'vim.error'>, error('string cannot contain newlines',))
vim.current.buffer.append("\nbc"):(<class 'vim.error'>, error('string cannot contain newlines',))
>> RBItem
! vim.current.buffer[10000000000]:(<type 'exceptions.IndexError'>, IndexError('line number out of range',))
>> RBAsItem
! vim.current.buffer[10000000000] = "":(<type 'exceptions.IndexError'>, IndexError('line number out of range',))
>> BufferAttr
vim.current.buffer.xxx:(<type 'exceptions.AttributeError'>, AttributeError('xxx',))
>> BufferSetattr
--- 1026,1034 ----
vim.current.buffer.append(["\na", "bc"]):(<class 'vim.error'>, error('string cannot contain newlines',))
vim.current.buffer.append("\nbc"):(<class 'vim.error'>, error('string cannot contain newlines',))
>> RBItem
! vim.current.buffer[100000000]:(<type 'exceptions.IndexError'>, IndexError('line number out of range',))
>> RBAsItem
! vim.current.buffer[100000000] = "":(<type 'exceptions.IndexError'>, IndexError('line number out of range',))
>> BufferAttr
vim.current.buffer.xxx:(<type 'exceptions.AttributeError'>, AttributeError('xxx',))
>> BufferSetattr
*** ../vim-7.3.1079/src/version.c 2013-05-31 18:46:06.000000000 +0200
--- src/version.c 2013-05-31 19:00:29.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1080,
/**/
--
If you put 7 of the most talented OSS developers in a room for a week
and asked them to fix a bug in a spreadsheet program, in 1 week
you'd have 2 new mail readers and a text-based web browser.
/// 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 ///

73
7.3.1081 Normal file
View File

@ -0,0 +1,73 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.10
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1081
Problem: Compiler warnings on 64-bit Windows.
Solution: Change variable types. (Mike Williams)
Files: src/if_py_both.h, src/regexp_nfa.c
*** ../vim-7.3.1080/src/if_py_both.h 2013-05-30 22:06:28.000000000 +0200
--- src/if_py_both.h 2013-05-31 20:39:37.000000000 +0200
***************
*** 1100,1106 ****
long_u ht_used;
hashtab_T *ht;
hashitem_T *hi;
! int todo;
} dictiterinfo_T;
static PyObject *
--- 1100,1106 ----
long_u ht_used;
hashtab_T *ht;
hashitem_T *hi;
! long_u todo;
} dictiterinfo_T;
static PyObject *
*** ../vim-7.3.1080/src/regexp_nfa.c 2013-05-30 22:43:57.000000000 +0200
--- src/regexp_nfa.c 2013-05-31 20:45:03.000000000 +0200
***************
*** 283,289 ****
static int
realloc_post_list()
{
! int nstate_max = post_end - post_start;
int new_max = nstate_max + 1000;
int *new_start;
int *old_start;
--- 283,289 ----
static int
realloc_post_list()
{
! int nstate_max = (int)(post_end - post_start);
int new_max = nstate_max + 1000;
int *new_start;
int *old_start;
*** ../vim-7.3.1080/src/version.c 2013-05-31 19:01:13.000000000 +0200
--- src/version.c 2013-05-31 20:40:19.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1081,
/**/
--
hundred-and-one symptoms of being an internet addict:
32. You don't know what sex three of your closest friends are, because they
have neutral nicknames and you never bothered to ask.
normal GA<CR><Esc>
/// 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 ///

168
7.3.1082 Normal file
View File

@ -0,0 +1,168 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1082
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1082
Problem: New regexp engine: Problem with \@= matching.
Solution: Save and restore nfa_match.
Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok
*** ../vim-7.3.1081/src/regexp_nfa.c 2013-05-31 20:49:27.000000000 +0200
--- src/regexp_nfa.c 2013-05-31 21:19:15.000000000 +0200
***************
*** 3332,3342 ****
int result;
int size = 0;
int flag = 0;
- int old_reglnum = -1;
int go_to_nextline = FALSE;
nfa_thread_T *t;
- char_u *old_reginput = NULL;
- char_u *old_regline = NULL;
nfa_list_T list[3];
nfa_list_T *listtbl[2][2];
nfa_list_T *ll;
--- 3332,3339 ----
***************
*** 3560,3574 ****
break;
case NFA_START_INVISIBLE:
! /* Save global variables, and call nfa_regmatch() to check if
! * the current concat matches at this position. The concat
! * ends with the node NFA_END_INVISIBLE */
! old_reginput = reginput;
! old_regline = regline;
! old_reglnum = reglnum;
if (listids == NULL)
{
! listids = (int *) lalloc(sizeof(int) * nstate, TRUE);
if (listids == NULL)
{
EMSG(_("E878: (NFA) Could not allocate memory for branch traversal!"));
--- 3557,3574 ----
break;
case NFA_START_INVISIBLE:
! {
! char_u *save_reginput = reginput;
! char_u *save_regline = regline;
! int save_reglnum = reglnum;
! int save_nfa_match = nfa_match;
!
! /* Call nfa_regmatch() to check if the current concat matches
! * at this position. The concat ends with the node
! * NFA_END_INVISIBLE */
if (listids == NULL)
{
! listids = (int *)lalloc(sizeof(int) * nstate, TRUE);
if (listids == NULL)
{
EMSG(_("E878: (NFA) Could not allocate memory for branch traversal!"));
***************
*** 3588,3594 ****
result = nfa_regmatch(t->state->out, submatch, m);
nfa_set_neg_listids(start);
nfa_restore_listids(start, listids);
! nfa_match = FALSE;
#ifdef ENABLE_LOG
log_fd = fopen(NFA_REGEXP_RUN_LOG, "a");
--- 3588,3599 ----
result = nfa_regmatch(t->state->out, submatch, m);
nfa_set_neg_listids(start);
nfa_restore_listids(start, listids);
!
! /* restore position in input text */
! reginput = save_reginput;
! regline = save_regline;
! reglnum = save_reglnum;
! nfa_match = save_nfa_match;
#ifdef ENABLE_LOG
log_fd = fopen(NFA_REGEXP_RUN_LOG, "a");
***************
*** 3610,3619 ****
{
int j;
- /* Restore position in input text */
- reginput = old_reginput;
- regline = old_regline;
- reglnum = old_reglnum;
/* Copy submatch info from the recursive call */
if (REG_MULTI)
for (j = 1; j < m->in_use; j++)
--- 3615,3620 ----
***************
*** 3635,3646 ****
addstate_here(thislist, t->state->out1->out, &t->sub,
&listidx);
}
- else
- {
- /* continue with next input char */
- reginput = old_reginput;
- }
break;
case NFA_BOL:
if (reginput == regline)
--- 3636,3643 ----
addstate_here(thislist, t->state->out1->out, &t->sub,
&listidx);
}
break;
+ }
case NFA_BOL:
if (reginput == regline)
*** ../vim-7.3.1081/src/testdir/test64.in 2013-05-30 22:43:57.000000000 +0200
--- src/testdir/test64.in 2013-05-31 21:14:37.000000000 +0200
***************
*** 305,310 ****
--- 305,311 ----
:call add(tl, [2, '\v(abc)@=..', 'xabcd', 'ab', 'abc'])
:call add(tl, [2, '\(.*John\)\@=.*Bob', 'here is John, and here is B'])
:call add(tl, [2, '\(John.*\)\@=.*Bob', 'John is Bobs friend', 'John is Bob', 'John is Bobs friend'])
+ :call add(tl, [2, '\<\S\+\())\)\@=', '$((i=i+1))', 'i=i+1', '))'])
:call add(tl, [2, '.*John\&.*Bob', 'here is John, and here is B'])
:call add(tl, [2, '.*John\&.*Bob', 'John is Bobs friend', 'John is Bob'])
:call add(tl, [2, '\v(test1)@=.*yep', 'this is a test1, yep it is', 'test1, yep', 'test1'])
*** ../vim-7.3.1081/src/testdir/test64.ok 2013-05-30 22:43:57.000000000 +0200
--- src/testdir/test64.ok 2013-05-31 21:16:29.000000000 +0200
***************
*** 669,674 ****
--- 669,677 ----
OK 0 - \(John.*\)\@=.*Bob
OK 1 - \(John.*\)\@=.*Bob
OK 2 - \(John.*\)\@=.*Bob
+ OK 0 - \<\S\+\())\)\@=
+ OK 1 - \<\S\+\())\)\@=
+ OK 2 - \<\S\+\())\)\@=
OK 0 - .*John\&.*Bob
OK 1 - .*John\&.*Bob
OK 2 - .*John\&.*Bob
*** ../vim-7.3.1081/src/version.c 2013-05-31 20:49:27.000000000 +0200
--- src/version.c 2013-05-31 21:21:12.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1082,
/**/
--
To define recursion, we must first define recursion.
/// 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 ///

166
7.3.1083 Normal file
View File

@ -0,0 +1,166 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1083
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1083
Problem: New regexp engine: Does not support \%^ and \%$.
Solution: Support matching start and end of file.
Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok
*** ../vim-7.3.1082/src/regexp_nfa.c 2013-05-31 21:45:05.000000000 +0200
--- src/regexp_nfa.c 2013-05-31 21:55:35.000000000 +0200
***************
*** 865,878 ****
* pattern -- regardless of whether or not it makes sense. */
case '^':
EMIT(NFA_BOF);
- /* TODO: Not yet supported */
- return FAIL;
break;
case '$':
EMIT(NFA_EOF);
- /* TODO: Not yet supported */
- return FAIL;
break;
case '#':
--- 865,874 ----
***************
*** 1780,1785 ****
--- 1776,1783 ----
case NFA_BOL: STRCPY(code, "NFA_BOL "); break;
case NFA_EOW: STRCPY(code, "NFA_EOW "); break;
case NFA_BOW: STRCPY(code, "NFA_BOW "); break;
+ case NFA_EOF: STRCPY(code, "NFA_EOF "); break;
+ case NFA_BOF: STRCPY(code, "NFA_BOF "); break;
case NFA_STAR: STRCPY(code, "NFA_STAR "); break;
case NFA_PLUS: STRCPY(code, "NFA_PLUS "); break;
case NFA_NOT: STRCPY(code, "NFA_NOT "); break;
***************
*** 3705,3710 ****
--- 3703,3719 ----
break;
}
+ case NFA_BOF:
+ if (reglnum == 0 && reginput == regline
+ && (!REG_MULTI || reg_firstlnum == 1))
+ addstate_here(thislist, t->state->out, &t->sub, &listidx);
+ break;
+
+ case NFA_EOF:
+ if (reglnum == reg_maxline && curc == NUL)
+ addstate_here(thislist, t->state->out, &t->sub, &listidx);
+ break;
+
#ifdef FEAT_MBYTE
case NFA_COMPOSING:
{
*** ../vim-7.3.1082/src/testdir/test64.in 2013-05-31 21:45:05.000000000 +0200
--- src/testdir/test64.in 2013-05-31 22:10:12.000000000 +0200
***************
*** 267,272 ****
--- 267,281 ----
:call add(tl, [2, '\_f', " \na ", "\n"])
:call add(tl, [2, '\_f\+', " \na ", "\na"])
:"
+ :"""" Test start/end of line, start/end of file
+ :call add(tl, [2, '^a.', "a_\nb ", "a_"])
+ :call add(tl, [2, '^a.', "b a \na_"])
+ :call add(tl, [2, '.a$', " a\n "])
+ :call add(tl, [2, '.a$', " a b\n_a", "_a"])
+ :call add(tl, [2, '\%^a.', "a a\na", "a "])
+ :call add(tl, [2, '\%^a', " a \na "])
+ :call add(tl, [2, '.a\%$', " a\n "])
+ :call add(tl, [2, '.a\%$', " a\n_a", "_a"])
:"
:"""" Test recognition of some character classes
:call add(tl, [2, '[0-9]', '8', '8'])
***************
*** 466,471 ****
--- 475,489 ----
:call Postest()
:put
:"
+ :" start and end of buffer
+ /\%^
+ yeGop:"
+ 50%/\%^..
+ yeGopA END:"
+ 50%/\%$
+ "ayb20gg/..\%$
+ "bybGo"apo"bp:"
+ :"
:/\%#=1^Results/,$wq! test.out
ENDTEST
*** ../vim-7.3.1082/src/testdir/test64.ok 2013-05-31 21:45:05.000000000 +0200
--- src/testdir/test64.ok 2013-05-31 22:10:47.000000000 +0200
***************
*** 585,590 ****
--- 585,614 ----
OK 0 - \_f\+
OK 1 - \_f\+
OK 2 - \_f\+
+ OK 0 - ^a.
+ OK 1 - ^a.
+ OK 2 - ^a.
+ OK 0 - ^a.
+ OK 1 - ^a.
+ OK 2 - ^a.
+ OK 0 - .a$
+ OK 1 - .a$
+ OK 2 - .a$
+ OK 0 - .a$
+ OK 1 - .a$
+ OK 2 - .a$
+ OK 0 - \%^a.
+ OK 1 - \%^a.
+ OK 2 - \%^a.
+ OK 0 - \%^a
+ OK 1 - \%^a
+ OK 2 - \%^a
+ OK 0 - .a\%$
+ OK 1 - .a\%$
+ OK 2 - .a\%$
+ OK 0 - .a\%$
+ OK 1 - .a\%$
+ OK 2 - .a\%$
OK 0 - [0-9]
OK 1 - [0-9]
OK 2 - [0-9]
***************
*** 818,820 ****
--- 842,848 ----
ab!babababababfoo
ba!ab##abab?bafoo
**!*****_
+ Test
+ Test END
+ EN
+ E
*** ../vim-7.3.1082/src/version.c 2013-05-31 21:45:05.000000000 +0200
--- src/version.c 2013-05-31 21:57:03.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1083,
/**/
--
Have you heard about the new Beowulf cluster? It's so fast, it executes
an infinite loop in 6 seconds.
/// 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 ///

280
7.3.1084 Normal file
View File

@ -0,0 +1,280 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1084
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1084
Problem: New regexp engine: only accepts up to \{,10}.
Solution: Remove upper limit. Remove dead code with NFA_PLUS.
Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok
*** ../vim-7.3.1083/src/regexp_nfa.c 2013-05-31 22:14:48.000000000 +0200
--- src/regexp_nfa.c 2013-05-31 23:09:16.000000000 +0200
***************
*** 29,39 ****
# define NFA_REGEXP_DEBUG_LOG "nfa_regexp_debug.log"
#endif
- /* Upper limit allowed for {m,n} repetitions handled by NFA */
- #define NFA_BRACES_MAXLIMIT 10
- /* For allocating space for the postfix representation */
- #define NFA_POSTFIX_MULTIPLIER (NFA_BRACES_MAXLIMIT + 2)*2
-
enum
{
NFA_SPLIT = -1024,
--- 29,34 ----
***************
*** 44,50 ****
NFA_CONCAT,
NFA_OR,
NFA_STAR,
- NFA_PLUS,
NFA_QUEST,
NFA_QUEST_NONGREEDY, /* Non-greedy version of \? */
NFA_NOT, /* used for [^ab] negated char ranges */
--- 39,44 ----
***************
*** 253,259 ****
nstate = 0;
istate = 0;
/* A reasonable estimation for maximum size */
! nstate_max = (int)(STRLEN(expr) + 1) * NFA_POSTFIX_MULTIPLIER;
/* Some items blow up in size, such as [A-z]. Add more space for that.
* When it is still not enough realloc_post_list() will be used. */
--- 247,253 ----
nstate = 0;
istate = 0;
/* A reasonable estimation for maximum size */
! nstate_max = (int)(STRLEN(expr) + 1) * 25;
/* Some items blow up in size, such as [A-z]. Add more space for that.
* When it is still not enough realloc_post_list() will be used. */
***************
*** 1365,1374 ****
* string.
* The submatch will the empty string.
*
! * In order to be consistent with the old engine, we disable
! * NFA_PLUS, and replace <atom>+ with <atom><atom>*
*/
- /* EMIT(NFA_PLUS); */
regnpar = old_regnpar;
regparse = old_regparse;
curchr = -1;
--- 1359,1367 ----
* string.
* The submatch will the empty string.
*
! * In order to be consistent with the old engine, we replace
! * <atom>+ with <atom><atom>*
*/
regnpar = old_regnpar;
regparse = old_regparse;
curchr = -1;
***************
*** 1443,1454 ****
break;
}
! if (maxval > NFA_BRACES_MAXLIMIT)
! {
! /* This would yield a huge automaton and use too much memory.
! * Revert to old engine */
return FAIL;
- }
/* Special case: x{0} or x{-0} */
if (maxval == 0)
--- 1436,1444 ----
break;
}
! /* TODO: \{-} doesn't work yet */
! if (maxval == MAX_LIMIT && !greedy)
return FAIL;
/* Special case: x{0} or x{-0} */
if (maxval == 0)
***************
*** 1478,1486 ****
return FAIL;
/* after "minval" times, atoms are optional */
if (i + 1 > minval)
! EMIT(quest);
if (old_post_pos != my_post_start)
EMIT(NFA_CONCAT);
}
/* Go to just after the repeated atom and the \{} */
--- 1468,1483 ----
return FAIL;
/* after "minval" times, atoms are optional */
if (i + 1 > minval)
! {
! if (maxval == MAX_LIMIT)
! EMIT(NFA_STAR);
! else
! EMIT(quest);
! }
if (old_post_pos != my_post_start)
EMIT(NFA_CONCAT);
+ if (i + 1 > minval && maxval == MAX_LIMIT)
+ break;
}
/* Go to just after the repeated atom and the \{} */
***************
*** 1779,1785 ****
case NFA_EOF: STRCPY(code, "NFA_EOF "); break;
case NFA_BOF: STRCPY(code, "NFA_BOF "); break;
case NFA_STAR: STRCPY(code, "NFA_STAR "); break;
- case NFA_PLUS: STRCPY(code, "NFA_PLUS "); break;
case NFA_NOT: STRCPY(code, "NFA_NOT "); break;
case NFA_SKIP_CHAR: STRCPY(code, "NFA_SKIP_CHAR"); break;
case NFA_OR: STRCPY(code, "NFA_OR"); break;
--- 1776,1781 ----
***************
*** 2343,2363 ****
PUSH(frag(s, append(e.out, list1(&s->out))));
break;
- case NFA_PLUS:
- /* One or more */
- if (nfa_calc_size == TRUE)
- {
- nstate++;
- break;
- }
- e = POP();
- s = new_state(NFA_SPLIT, e.start, NULL);
- if (s == NULL)
- goto theend;
- patch(e.out, s);
- PUSH(frag(e.start, list1(&s->out1)));
- break;
-
case NFA_SKIP_CHAR:
/* Symbol of 0-length, Used in a repetition
* with max/min count of 0 */
--- 2339,2344 ----
*** ../vim-7.3.1083/src/testdir/test64.in 2013-05-31 22:14:48.000000000 +0200
--- src/testdir/test64.in 2013-05-31 22:55:52.000000000 +0200
***************
*** 182,188 ****
:call add(tl, [2, 'a\{0,}', 'oij sdigfusnf', ''])
:call add(tl, [2, 'a\{0,}', 'aaaaa aa', 'aaaaa'])
:call add(tl, [2, 'a\{2,}', 'sdfiougjdsafg'])
! :call add(tl, [0, 'a\{2,}', 'aaaaasfoij ', 'aaaaa'])
:call add(tl, [2, 'a\{,0}', 'oidfguih iuhi hiu aaaa', ''])
:call add(tl, [2, 'a\{,5}', 'abcd', 'a'])
:call add(tl, [2, 'a\{,5}', 'aaaaaaaaaa', 'aaaaa'])
--- 182,190 ----
:call add(tl, [2, 'a\{0,}', 'oij sdigfusnf', ''])
:call add(tl, [2, 'a\{0,}', 'aaaaa aa', 'aaaaa'])
:call add(tl, [2, 'a\{2,}', 'sdfiougjdsafg'])
! :call add(tl, [2, 'a\{2,}', 'aaaaasfoij ', 'aaaaa'])
! :call add(tl, [2, 'a\{5,}', 'xxaaaaxxx '])
! :call add(tl, [2, 'a\{5,}', 'xxaaaaaxxx ', 'aaaaa'])
:call add(tl, [2, 'a\{,0}', 'oidfguih iuhi hiu aaaa', ''])
:call add(tl, [2, 'a\{,5}', 'abcd', 'a'])
:call add(tl, [2, 'a\{,5}', 'aaaaaaaaaa', 'aaaaa'])
***************
*** 225,231 ****
--- 227,235 ----
:"
:" Test greedy-ness and lazy-ness
:call add(tl, [2, 'a\{-2,7}','aaaaaaaaaaaaa', 'aa'])
+ :call add(tl, [2, 'a\{-2,7}x','aaaaaaaaax', 'aaaaaaax'])
:call add(tl, [2, 'a\{2,7}','aaaaaaaaaaaaaaaaaaaa', 'aaaaaaa'])
+ :call add(tl, [2, 'a\{2,7}x','aaaaaaaaax', 'aaaaaaax'])
:call add(tl, [2, '\vx(.{-,8})yz(.*)','xayxayzxayzxayz','xayxayzxayzxayz','ayxa','xayzxayz'])
:call add(tl, [2, '\vx(.*)yz(.*)','xayxayzxayzxayz','xayxayzxayzxayz', 'ayxayzxayzxa',''])
:call add(tl, [2, '\v(a{1,2}){-2,3}','aaaaaaa','aaaa','aa'])
***************
*** 366,372 ****
:call add(tl, [2, '\_[^a]\+', "asfi\n9888", "sfi\n9888"])
:"
:"""" Requiring lots of states.
! :call add(tl, [0, '[0-9a-zA-Z]\{8}-\([0-9a-zA-Z]\{4}-\)\{3}[0-9a-zA-Z]\{12}', " 12345678-1234-1234-1234-123456789012 ", "12345678-1234-1234-1234-123456789012", "1234-"])
:"
:"
:"""" Run the tests
--- 370,376 ----
:call add(tl, [2, '\_[^a]\+', "asfi\n9888", "sfi\n9888"])
:"
:"""" Requiring lots of states.
! :call add(tl, [2, '[0-9a-zA-Z]\{8}-\([0-9a-zA-Z]\{4}-\)\{3}[0-9a-zA-Z]\{12}', " 12345678-1234-1234-1234-123456789012 ", "12345678-1234-1234-1234-123456789012", "1234-"])
:"
:"
:"""" Run the tests
*** ../vim-7.3.1083/src/testdir/test64.ok 2013-05-31 22:14:48.000000000 +0200
--- src/testdir/test64.ok 2013-05-31 23:02:02.000000000 +0200
***************
*** 389,394 ****
--- 389,401 ----
OK 2 - a\{2,}
OK 0 - a\{2,}
OK 1 - a\{2,}
+ OK 2 - a\{2,}
+ OK 0 - a\{5,}
+ OK 1 - a\{5,}
+ OK 2 - a\{5,}
+ OK 0 - a\{5,}
+ OK 1 - a\{5,}
+ OK 2 - a\{5,}
OK 0 - a\{,0}
OK 1 - a\{,0}
OK 2 - a\{,0}
***************
*** 486,494 ****
--- 493,507 ----
OK 0 - a\{-2,7}
OK 1 - a\{-2,7}
OK 2 - a\{-2,7}
+ OK 0 - a\{-2,7}x
+ OK 1 - a\{-2,7}x
+ OK 2 - a\{-2,7}x
OK 0 - a\{2,7}
OK 1 - a\{2,7}
OK 2 - a\{2,7}
+ OK 0 - a\{2,7}x
+ OK 1 - a\{2,7}x
+ OK 2 - a\{2,7}x
OK 0 - \vx(.{-,8})yz(.*)
OK 1 - \vx(.{-,8})yz(.*)
OK 2 - \vx(.{-,8})yz(.*)
***************
*** 803,808 ****
--- 816,822 ----
OK 2 - \_[^a]\+
OK 0 - [0-9a-zA-Z]\{8}-\([0-9a-zA-Z]\{4}-\)\{3}[0-9a-zA-Z]\{12}
OK 1 - [0-9a-zA-Z]\{8}-\([0-9a-zA-Z]\{4}-\)\{3}[0-9a-zA-Z]\{12}
+ OK 2 - [0-9a-zA-Z]\{8}-\([0-9a-zA-Z]\{4}-\)\{3}[0-9a-zA-Z]\{12}
192.168.0.1
192.168.0.1
192.168.0.1
*** ../vim-7.3.1083/src/version.c 2013-05-31 22:14:48.000000000 +0200
--- src/version.c 2013-05-31 23:10:36.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1084,
/**/
--
hundred-and-one symptoms of being an internet addict:
34. You laugh at people with a 10 Mbit connection.
/// 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 ///

285
7.3.1085 Normal file
View File

@ -0,0 +1,285 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1085
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1085
Problem: New regexp engine: Non-greedy multi doesn't work.
Solution: Implement \{-}.
Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok
*** ../vim-7.3.1084/src/regexp_nfa.c 2013-05-31 23:17:56.000000000 +0200
--- src/regexp_nfa.c 2013-06-01 12:22:17.000000000 +0200
***************
*** 38,46 ****
NFA_CONCAT,
NFA_OR,
! NFA_STAR,
! NFA_QUEST,
! NFA_QUEST_NONGREEDY, /* Non-greedy version of \? */
NFA_NOT, /* used for [^ab] negated char ranges */
NFA_BOL, /* ^ Begin line */
--- 38,47 ----
NFA_CONCAT,
NFA_OR,
! NFA_STAR, /* greedy * */
! NFA_STAR_NONGREEDY, /* non-greedy * */
! NFA_QUEST, /* greedy \? */
! NFA_QUEST_NONGREEDY, /* non-greedy \? */
NFA_NOT, /* used for [^ab] negated char ranges */
NFA_BOL, /* ^ Begin line */
***************
*** 1430,1445 ****
}
/* <atom>{0,inf}, <atom>{0,} and <atom>{} are equivalent to
* <atom>* */
! if (minval == 0 && maxval == MAX_LIMIT && greedy)
{
! EMIT(NFA_STAR);
break;
}
- /* TODO: \{-} doesn't work yet */
- if (maxval == MAX_LIMIT && !greedy)
- return FAIL;
-
/* Special case: x{0} or x{-0} */
if (maxval == 0)
{
--- 1431,1447 ----
}
/* <atom>{0,inf}, <atom>{0,} and <atom>{} are equivalent to
* <atom>* */
! if (minval == 0 && maxval == MAX_LIMIT)
{
! if (greedy)
! /* \{}, \{0,} */
! EMIT(NFA_STAR);
! else
! /* \{-}, \{-0,} */
! EMIT(NFA_STAR_NONGREEDY);
break;
}
/* Special case: x{0} or x{-0} */
if (maxval == 0)
{
***************
*** 1470,1476 ****
if (i + 1 > minval)
{
if (maxval == MAX_LIMIT)
! EMIT(NFA_STAR);
else
EMIT(quest);
}
--- 1472,1483 ----
if (i + 1 > minval)
{
if (maxval == MAX_LIMIT)
! {
! if (greedy)
! EMIT(NFA_STAR);
! else
! EMIT(NFA_STAR_NONGREEDY);
! }
else
EMIT(quest);
}
***************
*** 1776,1786 ****
case NFA_EOF: STRCPY(code, "NFA_EOF "); break;
case NFA_BOF: STRCPY(code, "NFA_BOF "); break;
case NFA_STAR: STRCPY(code, "NFA_STAR "); break;
case NFA_NOT: STRCPY(code, "NFA_NOT "); break;
case NFA_SKIP_CHAR: STRCPY(code, "NFA_SKIP_CHAR"); break;
case NFA_OR: STRCPY(code, "NFA_OR"); break;
- case NFA_QUEST: STRCPY(code, "NFA_QUEST"); break;
- case NFA_QUEST_NONGREEDY: STRCPY(code, "NFA_QUEST_NON_GREEDY"); break;
case NFA_END_NEG_RANGE: STRCPY(code, "NFA_END_NEG_RANGE"); break;
case NFA_CLASS_ALNUM: STRCPY(code, "NFA_CLASS_ALNUM"); break;
case NFA_CLASS_ALPHA: STRCPY(code, "NFA_CLASS_ALPHA"); break;
--- 1783,1794 ----
case NFA_EOF: STRCPY(code, "NFA_EOF "); break;
case NFA_BOF: STRCPY(code, "NFA_BOF "); break;
case NFA_STAR: STRCPY(code, "NFA_STAR "); break;
+ case NFA_STAR_NONGREEDY: STRCPY(code, "NFA_STAR_NONGREEDY "); break;
+ case NFA_QUEST: STRCPY(code, "NFA_QUEST"); break;
+ case NFA_QUEST_NONGREEDY: STRCPY(code, "NFA_QUEST_NON_GREEDY"); break;
case NFA_NOT: STRCPY(code, "NFA_NOT "); break;
case NFA_SKIP_CHAR: STRCPY(code, "NFA_SKIP_CHAR"); break;
case NFA_OR: STRCPY(code, "NFA_OR"); break;
case NFA_END_NEG_RANGE: STRCPY(code, "NFA_END_NEG_RANGE"); break;
case NFA_CLASS_ALNUM: STRCPY(code, "NFA_CLASS_ALNUM"); break;
case NFA_CLASS_ALPHA: STRCPY(code, "NFA_CLASS_ALPHA"); break;
***************
*** 2297,2303 ****
break;
case NFA_STAR:
! /* Zero or more */
if (nfa_calc_size == TRUE)
{
nstate++;
--- 2305,2311 ----
break;
case NFA_STAR:
! /* Zero or more, prefer more */
if (nfa_calc_size == TRUE)
{
nstate++;
***************
*** 2311,2316 ****
--- 2319,2339 ----
PUSH(frag(s, list1(&s->out1)));
break;
+ case NFA_STAR_NONGREEDY:
+ /* Zero or more, prefer zero */
+ if (nfa_calc_size == TRUE)
+ {
+ nstate++;
+ break;
+ }
+ e = POP();
+ s = new_state(NFA_SPLIT, NULL, e.start);
+ if (s == NULL)
+ goto theend;
+ patch(e.out, s);
+ PUSH(frag(s, list1(&s->out)));
+ break;
+
case NFA_QUEST:
/* one or zero atoms=> greedy match */
if (nfa_calc_size == TRUE)
*** ../vim-7.3.1084/src/testdir/test64.in 2013-05-31 23:17:56.000000000 +0200
--- src/testdir/test64.in 2013-06-01 12:29:19.000000000 +0200
***************
*** 23,30 ****
:call add(tl, [2, 'ab', 'aab', 'ab'])
:call add(tl, [2, 'b', 'abcdef', 'b'])
:call add(tl, [2, 'bc*', 'abccccdef', 'bcccc'])
! :call add(tl, [0, 'bc\{-}', 'abccccdef', 'b'])
! :call add(tl, [0, 'bc\{-}\(d\)', 'abccccdef', 'bccccd', 'd'])
:call add(tl, [2, 'bc*', 'abbdef', 'b'])
:call add(tl, [2, 'c*', 'ccc', 'ccc'])
:call add(tl, [2, 'bc*', 'abdef', 'b'])
--- 23,30 ----
:call add(tl, [2, 'ab', 'aab', 'ab'])
:call add(tl, [2, 'b', 'abcdef', 'b'])
:call add(tl, [2, 'bc*', 'abccccdef', 'bcccc'])
! :call add(tl, [2, 'bc\{-}', 'abccccdef', 'b'])
! :call add(tl, [2, 'bc\{-}\(d\)', 'abccccdef', 'bccccd', 'd'])
:call add(tl, [2, 'bc*', 'abbdef', 'b'])
:call add(tl, [2, 'c*', 'ccc', 'ccc'])
:call add(tl, [2, 'bc*', 'abdef', 'b'])
***************
*** 201,216 ****
:call add(tl, [2, 'a\{-0}', 'asoiuj', ''])
:call add(tl, [2, 'a\{-2}', 'aaaa', 'aa'])
:call add(tl, [2, 'a\{-2}', 'abcdefghijklmnopqrestuvwxyz1234567890'])
! :call add(tl, [0, 'a\{-0,}', 'oij sdigfusnf', ''])
! :call add(tl, [0, 'a\{-0,}', 'aaaaa aa', ''])
:call add(tl, [2, 'a\{-2,}', 'sdfiougjdsafg'])
! :call add(tl, [0, 'a\{-2,}', 'aaaaasfoij ', 'aa'])
:call add(tl, [2, 'a\{-,0}', 'oidfguih iuhi hiu aaaa', ''])
:call add(tl, [2, 'a\{-,5}', 'abcd', ''])
:call add(tl, [2, 'a\{-,5}', 'aaaaaaaaaa', ''])
:" anti-greedy version of 'a*'
! :call add(tl, [0, 'a\{-}', 'bbbcddiuhfcd', ''])
! :call add(tl, [0, 'a\{-}', 'aaaaioudfh coisf jda', ''])
:"
:" Test groups of characters and submatches
:call add(tl, [2, '\(abc\)*', 'abcabcabc', 'abcabcabc', 'abc'])
--- 201,216 ----
:call add(tl, [2, 'a\{-0}', 'asoiuj', ''])
:call add(tl, [2, 'a\{-2}', 'aaaa', 'aa'])
:call add(tl, [2, 'a\{-2}', 'abcdefghijklmnopqrestuvwxyz1234567890'])
! :call add(tl, [2, 'a\{-0,}', 'oij sdigfusnf', ''])
! :call add(tl, [2, 'a\{-0,}', 'aaaaa aa', ''])
:call add(tl, [2, 'a\{-2,}', 'sdfiougjdsafg'])
! :call add(tl, [2, 'a\{-2,}', 'aaaaasfoij ', 'aa'])
:call add(tl, [2, 'a\{-,0}', 'oidfguih iuhi hiu aaaa', ''])
:call add(tl, [2, 'a\{-,5}', 'abcd', ''])
:call add(tl, [2, 'a\{-,5}', 'aaaaaaaaaa', ''])
:" anti-greedy version of 'a*'
! :call add(tl, [2, 'a\{-}', 'bbbcddiuhfcd', ''])
! :call add(tl, [2, 'a\{-}', 'aaaaioudfh coisf jda', ''])
:"
:" Test groups of characters and submatches
:call add(tl, [2, '\(abc\)*', 'abcabcabc', 'abcabcabc', 'abc'])
*** ../vim-7.3.1084/src/testdir/test64.ok 2013-05-31 23:17:56.000000000 +0200
--- src/testdir/test64.ok 2013-06-01 12:29:38.000000000 +0200
***************
*** 10,17 ****
--- 10,19 ----
OK 2 - bc*
OK 0 - bc\{-}
OK 1 - bc\{-}
+ OK 2 - bc\{-}
OK 0 - bc\{-}\(d\)
OK 1 - bc\{-}\(d\)
+ OK 2 - bc\{-}\(d\)
OK 0 - bc*
OK 1 - bc*
OK 2 - bc*
***************
*** 437,449 ****
--- 439,454 ----
OK 2 - a\{-2}
OK 0 - a\{-0,}
OK 1 - a\{-0,}
+ OK 2 - a\{-0,}
OK 0 - a\{-0,}
OK 1 - a\{-0,}
+ OK 2 - a\{-0,}
OK 0 - a\{-2,}
OK 1 - a\{-2,}
OK 2 - a\{-2,}
OK 0 - a\{-2,}
OK 1 - a\{-2,}
+ OK 2 - a\{-2,}
OK 0 - a\{-,0}
OK 1 - a\{-,0}
OK 2 - a\{-,0}
***************
*** 455,462 ****
--- 460,469 ----
OK 2 - a\{-,5}
OK 0 - a\{-}
OK 1 - a\{-}
+ OK 2 - a\{-}
OK 0 - a\{-}
OK 1 - a\{-}
+ OK 2 - a\{-}
OK 0 - \(abc\)*
OK 1 - \(abc\)*
OK 2 - \(abc\)*
*** ../vim-7.3.1084/src/version.c 2013-05-31 23:17:56.000000000 +0200
--- src/version.c 2013-06-01 12:39:01.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1085,
/**/
--
hundred-and-one symptoms of being an internet addict:
35. Your husband tells you he's had the beard for 2 months.
/// 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 ///

144
7.3.1086 Normal file
View File

@ -0,0 +1,144 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1086
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1086
Problem: Old regexp engine accepts illegal range, new one doesn't.
Solution: Also accept the illegal range with the new engine.
Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok
*** ../vim-7.3.1085/src/regexp_nfa.c 2013-06-01 12:40:14.000000000 +0200
--- src/regexp_nfa.c 2013-06-01 13:16:34.000000000 +0200
***************
*** 1089,1096 ****
* while loop. */
}
}
! /* Try a range like 'a-x' or '\t-z' */
! if (*regparse == '-')
{
emit_range = TRUE;
startc = oldstartc;
--- 1089,1097 ----
* while loop. */
}
}
! /* Try a range like 'a-x' or '\t-z'. Also allows '-' as a
! * start character. */
! if (*regparse == '-' && oldstartc != -1)
{
emit_range = TRUE;
startc = oldstartc;
***************
*** 1140,1155 ****
/* Normal printable char */
if (startc == -1)
! #ifdef FEAT_MBYTE
! startc = (*mb_ptr2char)(regparse);
! #else
! startc = *regparse;
! #endif
/* Previous char was '-', so this char is end of range. */
if (emit_range)
{
! endc = startc; startc = oldstartc;
if (startc > endc)
EMSG_RET_FAIL(_(e_invrange));
#ifdef FEAT_MBYTE
--- 1141,1153 ----
/* Normal printable char */
if (startc == -1)
! startc = PTR2CHAR(regparse);
/* Previous char was '-', so this char is end of range. */
if (emit_range)
{
! endc = startc;
! startc = oldstartc;
if (startc > endc)
EMSG_RET_FAIL(_(e_invrange));
#ifdef FEAT_MBYTE
***************
*** 1166,1172 ****
TRY_NEG();
EMIT_GLUE();
}
- emit_range = FALSE;
}
else
#endif
--- 1164,1169 ----
***************
*** 1190,1197 ****
TRY_NEG();
EMIT_GLUE();
}
- emit_range = FALSE;
}
}
else
{
--- 1187,1195 ----
TRY_NEG();
EMIT_GLUE();
}
}
+ emit_range = FALSE;
+ startc = -1;
}
else
{
*** ../vim-7.3.1085/src/testdir/test64.in 2013-06-01 12:40:14.000000000 +0200
--- src/testdir/test64.in 2013-06-01 13:14:51.000000000 +0200
***************
*** 270,275 ****
--- 270,276 ----
:call add(tl, [2, '\_[0-9]\+', "asfi\n9888u", "\n9888"])
:call add(tl, [2, '\_f', " \na ", "\n"])
:call add(tl, [2, '\_f\+', " \na ", "\na"])
+ :call add(tl, [2, '[0-9A-Za-z-_.]\+', " @0_a.A-{ ", "0_a.A-"])
:"
:"""" Test start/end of line, start/end of file
:call add(tl, [2, '^a.', "a_\nb ", "a_"])
*** ../vim-7.3.1085/src/testdir/test64.ok 2013-06-01 12:40:14.000000000 +0200
--- src/testdir/test64.ok 2013-06-01 13:22:58.000000000 +0200
***************
*** 605,610 ****
--- 605,613 ----
OK 0 - \_f\+
OK 1 - \_f\+
OK 2 - \_f\+
+ OK 0 - [0-9A-Za-z-_.]\+
+ OK 1 - [0-9A-Za-z-_.]\+
+ OK 2 - [0-9A-Za-z-_.]\+
OK 0 - ^a.
OK 1 - ^a.
OK 2 - ^a.
*** ../vim-7.3.1085/src/version.c 2013-06-01 12:40:14.000000000 +0200
--- src/version.c 2013-06-01 13:17:56.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1086,
/**/
--
Micro$oft: where do you want to go today?
Linux: where do you want to go tomorrow?
FreeBSD: are you guys coming, or what?
/// 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 ///

255
7.3.1087 Normal file
View File

@ -0,0 +1,255 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1087
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1087
Problem: A leading star is not seen as a normal char when \{} follows.
Solution: Save and restore the parse state properly.
Files: src/regexp.c, src/regexp_nfa.c, src/testdir/test64.in,
src/testdir/test64.ok
*** ../vim-7.3.1086/src/regexp.c 2013-05-29 18:45:07.000000000 +0200
--- src/regexp.c 2013-06-01 14:33:26.000000000 +0200
***************
*** 665,674 ****
--- 665,689 ----
#define REG_ZPAREN 2 /* \z(\) */
#define REG_NPAREN 3 /* \%(\) */
+ typedef struct
+ {
+ char_u *regparse;
+ int prevchr_len;
+ int curchr;
+ int prevchr;
+ int prevprevchr;
+ int nextchr;
+ int at_start;
+ int prev_at_start;
+ int regnpar;
+ } parse_state_T;
+
/*
* Forward declarations for vim_regcomp()'s friends.
*/
static void initchr __ARGS((char_u *));
+ static void save_parse_state __ARGS((parse_state_T *ps));
+ static void restore_parse_state __ARGS((parse_state_T *ps));
static int getchr __ARGS((void));
static void skipchr_keepstart __ARGS((void));
static int peekchr __ARGS((void));
***************
*** 2951,2956 ****
--- 2966,3009 ----
}
/*
+ * Save the current parse state, so that it can be restored and parsing
+ * starts in the same state again.
+ */
+ static void
+ save_parse_state(ps)
+ parse_state_T *ps;
+ {
+ ps->regparse = regparse;
+ ps->prevchr_len = prevchr_len;
+ ps->curchr = curchr;
+ ps->prevchr = prevchr;
+ ps->prevprevchr = prevprevchr;
+ ps->nextchr = nextchr;
+ ps->at_start = at_start;
+ ps->prev_at_start = prev_at_start;
+ ps->regnpar = regnpar;
+ }
+
+ /*
+ * Restore a previously saved parse state.
+ */
+ static void
+ restore_parse_state(ps)
+ parse_state_T *ps;
+ {
+ regparse = ps->regparse;
+ prevchr_len = ps->prevchr_len;
+ curchr = ps->curchr;
+ prevchr = ps->prevchr;
+ prevprevchr = ps->prevprevchr;
+ nextchr = ps->nextchr;
+ at_start = ps->at_start;
+ prev_at_start = ps->prev_at_start;
+ regnpar = ps->regnpar;
+ }
+
+
+ /*
* Get the next character without advancing.
*/
static int
*** ../vim-7.3.1086/src/regexp_nfa.c 2013-06-01 13:24:19.000000000 +0200
--- src/regexp_nfa.c 2013-06-01 14:30:27.000000000 +0200
***************
*** 1318,1336 ****
int ret;
long minval, maxval;
int greedy = TRUE; /* Braces are prefixed with '-' ? */
! char_u *old_regparse, *new_regparse;
int c2;
int old_post_pos;
int my_post_start;
- int old_regnpar;
int quest;
! /* Save the current position in the regexp, so that we can use it if
! * <atom>{m,n} is next. */
! old_regparse = regparse;
! /* Save current number of open parenthesis, so we can use it if
! * <atom>{m,n} is next */
! old_regnpar = regnpar;
/* store current pos in the postfix form, for \{m,n} involving 0s */
my_post_start = (int)(post_ptr - post_start);
--- 1318,1334 ----
int ret;
long minval, maxval;
int greedy = TRUE; /* Braces are prefixed with '-' ? */
! parse_state_T old_state;
! parse_state_T new_state;
int c2;
int old_post_pos;
int my_post_start;
int quest;
! /* Save the current parse state, so that we can use it if <atom>{m,n} is
! * next. */
! save_parse_state(&old_state);
!
/* store current pos in the postfix form, for \{m,n} involving 0s */
my_post_start = (int)(post_ptr - post_start);
***************
*** 1361,1368 ****
* In order to be consistent with the old engine, we replace
* <atom>+ with <atom><atom>*
*/
! regnpar = old_regnpar;
! regparse = old_regparse;
curchr = -1;
if (nfa_regatom() == FAIL)
return FAIL;
--- 1359,1365 ----
* In order to be consistent with the old engine, we replace
* <atom>+ with <atom><atom>*
*/
! restore_parse_state(&old_state);
curchr = -1;
if (nfa_regatom() == FAIL)
return FAIL;
***************
*** 1452,1468 ****
/* Ignore previous call to nfa_regatom() */
post_ptr = post_start + my_post_start;
! /* Save pos after the repeated atom and the \{} */
! new_regparse = regparse;
quest = (greedy == TRUE? NFA_QUEST : NFA_QUEST_NONGREEDY);
for (i = 0; i < maxval; i++)
{
/* Goto beginning of the repeated atom */
! regparse = old_regparse;
! curchr = -1;
! /* Restore count of parenthesis */
! regnpar = old_regnpar;
old_post_pos = (int)(post_ptr - post_start);
if (nfa_regatom() == FAIL)
return FAIL;
--- 1449,1462 ----
/* Ignore previous call to nfa_regatom() */
post_ptr = post_start + my_post_start;
! /* Save parse state after the repeated atom and the \{} */
! save_parse_state(&new_state);
quest = (greedy == TRUE? NFA_QUEST : NFA_QUEST_NONGREEDY);
for (i = 0; i < maxval; i++)
{
/* Goto beginning of the repeated atom */
! restore_parse_state(&old_state);
old_post_pos = (int)(post_ptr - post_start);
if (nfa_regatom() == FAIL)
return FAIL;
***************
*** 1486,1492 ****
}
/* Go to just after the repeated atom and the \{} */
! regparse = new_regparse;
curchr = -1;
break;
--- 1480,1486 ----
}
/* Go to just after the repeated atom and the \{} */
! restore_parse_state(&new_state);
curchr = -1;
break;
*** ../vim-7.3.1086/src/testdir/test64.in 2013-06-01 13:24:19.000000000 +0200
--- src/testdir/test64.in 2013-06-01 14:36:15.000000000 +0200
***************
*** 188,193 ****
--- 188,197 ----
:call add(tl, [2, 'a\{,0}', 'oidfguih iuhi hiu aaaa', ''])
:call add(tl, [2, 'a\{,5}', 'abcd', 'a'])
:call add(tl, [2, 'a\{,5}', 'aaaaaaaaaa', 'aaaaa'])
+ :" leading star as normal char when \{} follows
+ :call add(tl, [2, '^*\{4,}$', '***'])
+ :call add(tl, [2, '^*\{4,}$', '****', '****'])
+ :call add(tl, [2, '^*\{4,}$', '*****', '*****'])
:" same thing as 'a*'
:call add(tl, [2, 'a\{}', 'bbbcddiuhfcd', ''])
:call add(tl, [2, 'a\{}', 'aaaaioudfh coisf jda', 'aaaa'])
*** ../vim-7.3.1086/src/testdir/test64.ok 2013-06-01 13:24:19.000000000 +0200
--- src/testdir/test64.ok 2013-06-01 14:36:39.000000000 +0200
***************
*** 407,412 ****
--- 407,421 ----
OK 0 - a\{,5}
OK 1 - a\{,5}
OK 2 - a\{,5}
+ OK 0 - ^*\{4,}$
+ OK 1 - ^*\{4,}$
+ OK 2 - ^*\{4,}$
+ OK 0 - ^*\{4,}$
+ OK 1 - ^*\{4,}$
+ OK 2 - ^*\{4,}$
+ OK 0 - ^*\{4,}$
+ OK 1 - ^*\{4,}$
+ OK 2 - ^*\{4,}$
OK 0 - a\{}
OK 1 - a\{}
OK 2 - a\{}
*** ../vim-7.3.1086/src/version.c 2013-06-01 13:24:19.000000000 +0200
--- src/version.c 2013-06-01 14:37:37.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1087,
/**/
--
Change is inevitable, except from a vending machine.
/// 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 ///

626
7.3.1088 Normal file
View File

@ -0,0 +1,626 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1088
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1088
Problem: New regexp engine: \@<= and \@<! are not implemented.
Solution: Implement look-behind matching. Fix off-by-one error in old
regexp engine.
Files: src/regexp.c, src/regexp_nfa.c, src/testdir/test64.in,
src/testdir/test64.ok
*** ../vim-7.3.1087/src/regexp.c 2013-06-01 14:42:51.000000000 +0200
--- src/regexp.c 2013-06-01 18:55:07.000000000 +0200
***************
*** 5576,5582 ****
limit = OPERAND_MIN(rp->rs_scan);
if (REG_MULTI)
{
! if (rp->rs_un.regsave.rs_u.pos.col == 0)
{
if (rp->rs_un.regsave.rs_u.pos.lnum
< behind_pos.rs_u.pos.lnum
--- 5576,5589 ----
limit = OPERAND_MIN(rp->rs_scan);
if (REG_MULTI)
{
! if (limit > 0
! && ((rp->rs_un.regsave.rs_u.pos.lnum
! < behind_pos.rs_u.pos.lnum
! ? (colnr_T)STRLEN(regline)
! : behind_pos.rs_u.pos.col)
! - rp->rs_un.regsave.rs_u.pos.col >= limit))
! no = FAIL;
! else if (rp->rs_un.regsave.rs_u.pos.col == 0)
{
if (rp->rs_un.regsave.rs_u.pos.lnum
< behind_pos.rs_u.pos.lnum
***************
*** 5601,5613 ****
else
#endif
--rp->rs_un.regsave.rs_u.pos.col;
- if (limit > 0
- && ((rp->rs_un.regsave.rs_u.pos.lnum
- < behind_pos.rs_u.pos.lnum
- ? (colnr_T)STRLEN(regline)
- : behind_pos.rs_u.pos.col)
- - rp->rs_un.regsave.rs_u.pos.col > limit))
- no = FAIL;
}
}
else
--- 5608,5613 ----
*** ../vim-7.3.1087/src/regexp_nfa.c 2013-06-01 14:42:51.000000000 +0200
--- src/regexp_nfa.c 2013-06-01 19:42:22.000000000 +0200
***************
*** 56,61 ****
--- 56,62 ----
NFA_NOPEN, /* Start of subexpression marked with \%( */
NFA_NCLOSE, /* End of subexpr. marked with \%( ... \) */
NFA_START_INVISIBLE,
+ NFA_START_INVISIBLE_BEFORE,
NFA_END_INVISIBLE,
NFA_COMPOSING, /* Next nodes in NFA are part of the
composing multibyte char */
***************
*** 1369,1402 ****
break;
case Magic('@'):
op = no_Magic(getchr());
switch(op)
{
case '=':
! EMIT(NFA_PREV_ATOM_NO_WIDTH);
break;
case '!':
! EMIT(NFA_PREV_ATOM_NO_WIDTH_NEG);
break;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
case '<':
case '>':
! /* Not supported yet */
! return FAIL;
! default:
! syntax_error = TRUE;
! EMSGN(_("E869: (NFA) Unknown operator '\\@%c'"), op);
return FAIL;
}
break;
case Magic('?'):
--- 1370,1412 ----
break;
case Magic('@'):
+ c2 = getdecchrs();
op = no_Magic(getchr());
+ i = 0;
switch(op)
{
case '=':
! /* \@= */
! i = NFA_PREV_ATOM_NO_WIDTH;
break;
case '!':
! /* \@! */
! i = NFA_PREV_ATOM_NO_WIDTH_NEG;
break;
case '<':
+ op = no_Magic(getchr());
+ if (op == '=')
+ /* \@<= */
+ i = NFA_PREV_ATOM_JUST_BEFORE;
+ else if (op == '!')
+ /* \@<! */
+ i = NFA_PREV_ATOM_JUST_BEFORE_NEG;
+ break;
case '>':
! /* \@> Not supported yet */
! /* i = NFA_PREV_ATOM_LIKE_PATTERN; */
return FAIL;
}
+ if (i == 0)
+ {
+ syntax_error = TRUE;
+ EMSGN(_("E869: (NFA) Unknown operator '\\@%c'"), op);
+ return FAIL;
+ }
+ EMIT(i);
+ if (i == NFA_PREV_ATOM_JUST_BEFORE
+ || i == NFA_PREV_ATOM_JUST_BEFORE_NEG)
+ EMIT(c2);
break;
case Magic('?'):
***************
*** 1734,1742 ****
--- 1744,1758 ----
STRCPY(code, "NFA_PREV_ATOM_NO_WIDTH"); break;
case NFA_PREV_ATOM_NO_WIDTH_NEG:
STRCPY(code, "NFA_PREV_ATOM_NO_WIDTH_NEG"); break;
+ case NFA_PREV_ATOM_JUST_BEFORE:
+ STRCPY(code, "NFA_PREV_ATOM_JUST_BEFORE"); break;
+ case NFA_PREV_ATOM_JUST_BEFORE_NEG:
+ STRCPY(code, "NFA_PREV_ATOM_JUST_BEFORE_NEG"); break;
case NFA_NOPEN: STRCPY(code, "NFA_NOPEN"); break;
case NFA_NCLOSE: STRCPY(code, "NFA_NCLOSE"); break;
case NFA_START_INVISIBLE: STRCPY(code, "NFA_START_INVISIBLE"); break;
+ case NFA_START_INVISIBLE_BEFORE:
+ STRCPY(code, "NFA_START_INVISIBLE_BEFORE"); break;
case NFA_END_INVISIBLE: STRCPY(code, "NFA_END_INVISIBLE"); break;
case NFA_COMPOSING: STRCPY(code, "NFA_COMPOSING"); break;
***************
*** 2237,2243 ****
if (nfa_calc_size == FALSE)
{
/* Allocate space for the stack. Max states on the stack : nstate */
! stack = (Frag_T *) lalloc((nstate + 1) * sizeof(Frag_T), TRUE);
stackp = stack;
stack_end = stack + (nstate + 1);
}
--- 2253,2259 ----
if (nfa_calc_size == FALSE)
{
/* Allocate space for the stack. Max states on the stack : nstate */
! stack = (Frag_T *)lalloc((nstate + 1) * sizeof(Frag_T), TRUE);
stackp = stack;
stack_end = stack + (nstate + 1);
}
***************
*** 2370,2377 ****
--- 2386,2397 ----
case NFA_PREV_ATOM_NO_WIDTH:
case NFA_PREV_ATOM_NO_WIDTH_NEG:
+ case NFA_PREV_ATOM_JUST_BEFORE:
+ case NFA_PREV_ATOM_JUST_BEFORE_NEG:
/* The \@= operator: match the preceding atom with zero width.
* The \@! operator: no match for the preceding atom.
+ * The \@<= operator: match for the preceding atom.
+ * The \@<! operator: no match for the preceding atom.
* Surrounds the preceding atom with START_INVISIBLE and
* END_INVISIBLE, similarly to MOPEN. */
***************
*** 2389,2399 ****
s = new_state(NFA_START_INVISIBLE, e.start, s1);
if (s == NULL)
goto theend;
! if (*p == NFA_PREV_ATOM_NO_WIDTH_NEG)
{
s->negated = TRUE;
s1->negated = TRUE;
}
PUSH(frag(s, list1(&s1->out)));
break;
--- 2409,2426 ----
s = new_state(NFA_START_INVISIBLE, e.start, s1);
if (s == NULL)
goto theend;
! if (*p == NFA_PREV_ATOM_NO_WIDTH_NEG
! || *p == NFA_PREV_ATOM_JUST_BEFORE_NEG)
{
s->negated = TRUE;
s1->negated = TRUE;
}
+ if (*p == NFA_PREV_ATOM_JUST_BEFORE
+ || *p == NFA_PREV_ATOM_JUST_BEFORE_NEG)
+ {
+ s->val = *++p; /* get the count */
+ ++s->c; /* NFA_START_INVISIBLE -> NFA_START_INVISIBLE_BEFORE */
+ }
PUSH(frag(s, list1(&s1->out)));
break;
***************
*** 3307,3327 ****
return val == pos;
}
! static int nfa_regmatch __ARGS((nfa_state_T *start, regsub_T *submatch, regsub_T *m));
/*
* Main matching routine.
*
* Run NFA to determine whether it matches reginput.
*
* Return TRUE if there is a match, FALSE otherwise.
* Note: Caller must ensure that: start != NULL.
*/
static int
! nfa_regmatch(start, submatch, m)
nfa_state_T *start;
regsub_T *submatch;
regsub_T *m;
{
int result;
int size = 0;
--- 3334,3357 ----
return val == pos;
}
! static int nfa_regmatch __ARGS((nfa_state_T *start, regsub_T *submatch, regsub_T *m, save_se_T *endp));
/*
* Main matching routine.
*
* Run NFA to determine whether it matches reginput.
*
+ * When "endp" is not NULL it is a required end-of-match position.
+ *
* Return TRUE if there is a match, FALSE otherwise.
* Note: Caller must ensure that: start != NULL.
*/
static int
! nfa_regmatch(start, submatch, m, endp)
nfa_state_T *start;
regsub_T *submatch;
regsub_T *m;
+ save_se_T *endp;
{
int result;
int size = 0;
***************
*** 3532,3547 ****
}
case NFA_END_INVISIBLE:
! /* This is only encountered after a NFA_START_INVISIBLE node.
! * They surround a zero-width group, used with "\@=" and "\&".
* If we got here, it means that the current "invisible" group
* finished successfully, so return control to the parent
* nfa_regmatch(). Submatches are stored in *m, and used in
* the parent call. */
if (start->c == NFA_MOPEN + 0)
addstate_here(thislist, t->state->out, &t->sub, &listidx);
else
{
/* do not set submatches for \@! */
if (!t->state->negated)
/* TODO: only copy positions in use. */
--- 3562,3603 ----
}
case NFA_END_INVISIBLE:
! /* This is only encountered after a NFA_START_INVISIBLE or
! * NFA_START_INVISIBLE_BEFORE node.
! * They surround a zero-width group, used with "\@=", "\&",
! * "\@!", "\@<=" and "\@<!".
* If we got here, it means that the current "invisible" group
* finished successfully, so return control to the parent
* nfa_regmatch(). Submatches are stored in *m, and used in
* the parent call. */
if (start->c == NFA_MOPEN + 0)
+ /* TODO: do we ever get here? */
addstate_here(thislist, t->state->out, &t->sub, &listidx);
else
{
+ #ifdef ENABLE_LOG
+ if (endp != NULL)
+ {
+ if (REG_MULTI)
+ fprintf(log_fd, "Current lnum: %d, endp lnum: %d; current col: %d, endp col: %d\n",
+ (int)reglnum,
+ (int)endp->se_u.pos.lnum,
+ (int)(reginput - regline),
+ endp->se_u.pos.col);
+ else
+ fprintf(log_fd, "Current col: %d, endp col: %d\n",
+ (int)(reginput - regline),
+ (int)(endp->se_u.ptr - reginput));
+ }
+ #endif
+ /* It's only a match if it ends at "endp" */
+ if (endp != NULL && (REG_MULTI
+ ? (reglnum != endp->se_u.pos.lnum
+ || (int)(reginput - regline)
+ != endp->se_u.pos.col)
+ : reginput != endp->se_u.ptr))
+ break;
+
/* do not set submatches for \@! */
if (!t->state->negated)
/* TODO: only copy positions in use. */
***************
*** 3551,3561 ****
break;
case NFA_START_INVISIBLE:
{
! char_u *save_reginput = reginput;
! char_u *save_regline = regline;
! int save_reglnum = reglnum;
! int save_nfa_match = nfa_match;
/* Call nfa_regmatch() to check if the current concat matches
* at this position. The concat ends with the node
--- 3607,3676 ----
break;
case NFA_START_INVISIBLE:
+ case NFA_START_INVISIBLE_BEFORE:
{
! char_u *save_reginput = reginput;
! char_u *save_regline = regline;
! int save_reglnum = reglnum;
! int save_nfa_match = nfa_match;
! save_se_T endpos;
! save_se_T *endposp = NULL;
!
! if (t->state->c == NFA_START_INVISIBLE_BEFORE)
! {
! /* The recursive match must end at the current position. */
! endposp = &endpos;
! if (REG_MULTI)
! {
! endpos.se_u.pos.col = (int)(reginput - regline);
! endpos.se_u.pos.lnum = reglnum;
! }
! else
! endpos.se_u.ptr = reginput;
!
! /* Go back the specified number of bytes, or as far as the
! * start of the previous line, to try matching "\@<=" or
! * not matching "\@<!". */
! if (t->state->val <= 0)
! {
! if (REG_MULTI)
! {
! regline = reg_getline(--reglnum);
! if (regline == NULL)
! /* can't go before the first line */
! regline = reg_getline(++reglnum);
! }
! reginput = regline;
! }
! else
! {
! if (REG_MULTI
! && (int)(reginput - regline) < t->state->val)
! {
! /* Not enough bytes in this line, go to end of
! * previous line. */
! regline = reg_getline(--reglnum);
! if (regline == NULL)
! {
! /* can't go before the first line */
! regline = reg_getline(++reglnum);
! reginput = regline;
! }
! else
! reginput = regline + STRLEN(regline);
! }
! if ((int)(reginput - regline) >= t->state->val)
! {
! reginput -= t->state->val;
! #ifdef FEAT_MBYTE
! if (has_mbyte)
! reginput -= mb_head_off(regline, reginput);
! #endif
! }
! else
! reginput = regline;
! }
! }
/* Call nfa_regmatch() to check if the current concat matches
* at this position. The concat ends with the node
***************
*** 3579,3585 ****
* recursion. */
nfa_save_listids(start, listids);
nfa_set_null_listids(start);
! result = nfa_regmatch(t->state->out, submatch, m);
nfa_set_neg_listids(start);
nfa_restore_listids(start, listids);
--- 3694,3700 ----
* recursion. */
nfa_save_listids(start, listids);
nfa_set_null_listids(start);
! result = nfa_regmatch(t->state->out, submatch, m, endposp);
nfa_set_neg_listids(start);
nfa_restore_listids(start, listids);
***************
*** 4120,4130 ****
* matters!
* Do not add the start state in recursive calls of nfa_regmatch(),
* because recursive calls should only start in the first position.
* Also don't start a match past the first line. */
! if (nfa_match == FALSE && start->c == NFA_MOPEN + 0
! && reglnum == 0 && clen != 0
! && (ireg_maxcol == 0
! || (colnr_T)(reginput - regline) < ireg_maxcol))
{
#ifdef ENABLE_LOG
fprintf(log_fd, "(---) STARTSTATE\n");
--- 4235,4255 ----
* matters!
* Do not add the start state in recursive calls of nfa_regmatch(),
* because recursive calls should only start in the first position.
+ * Unless "endp" is not NULL, then we match the end position.
* Also don't start a match past the first line. */
! if (nfa_match == FALSE
! && ((start->c == NFA_MOPEN + 0
! && reglnum == 0
! && clen != 0
! && (ireg_maxcol == 0
! || (colnr_T)(reginput - regline) < ireg_maxcol))
! || (endp != NULL
! && (REG_MULTI
! ? (reglnum < endp->se_u.pos.lnum
! || (reglnum == endp->se_u.pos.lnum
! && (int)(reginput - regline)
! < endp->se_u.pos.col))
! : reginput < endp->se_u.ptr))))
{
#ifdef ENABLE_LOG
fprintf(log_fd, "(---) STARTSTATE\n");
***************
*** 4148,4154 ****
* finish. */
if (clen != 0)
reginput += clen;
! else if (go_to_nextline)
reg_nextline();
else
break;
--- 4273,4280 ----
* finish. */
if (clen != 0)
reginput += clen;
! else if (go_to_nextline || (endp != NULL && REG_MULTI
! && reglnum < endp->se_u.pos.lnum))
reg_nextline();
else
break;
***************
*** 4225,4231 ****
sub.in_use = 0;
m.in_use = 0;
! if (nfa_regmatch(start, &sub, &m) == FALSE)
return 0;
cleanup_subexpr();
--- 4351,4357 ----
sub.in_use = 0;
m.in_use = 0;
! if (nfa_regmatch(start, &sub, &m, NULL) == FALSE)
return 0;
cleanup_subexpr();
*** ../vim-7.3.1087/src/testdir/test64.in 2013-06-01 14:42:51.000000000 +0200
--- src/testdir/test64.in 2013-06-01 18:45:09.000000000 +0200
***************
*** 363,374 ****
:call add(tl, [2, '\(a\)\(b\)\(c\)\(dd\)\(e\)\(f\)\(g\)\(h\)\(i\)\1\2\3\4\5\6\7\8\9', 'xabcddefghiabcddefghix', 'abcddefghiabcddefghi', 'a', 'b', 'c', 'dd', 'e', 'f', 'g', 'h', 'i'])
:"
:"""" Look-behind with limit
! :call add(tl, [0, '<\@<=span.', 'xxspanxx<spanyyy', 'spany'])
! :call add(tl, [0, '<\@1<=span.', 'xxspanxx<spanyyy', 'spany'])
! :call add(tl, [0, '<\@2<=span.', 'xxspanxx<spanyyy', 'spany'])
! :call add(tl, [0, '\(<<\)\@<=span.', 'xxspanxxxx<spanxx<<spanyyy', 'spany', '<<'])
! :call add(tl, [0, '\(<<\)\@1<=span.', 'xxspanxxxx<spanxx<<spanyyy'])
! :call add(tl, [0, '\(<<\)\@2<=span.', 'xxspanxxxx<spanxx<<spanyyy', 'spany', '<<'])
:"
:"""" "\_" prepended negated collection matches EOL
:call add(tl, [2, '\_[^8-9]\+', "asfi\n9888", "asfi\n"])
--- 363,375 ----
:call add(tl, [2, '\(a\)\(b\)\(c\)\(dd\)\(e\)\(f\)\(g\)\(h\)\(i\)\1\2\3\4\5\6\7\8\9', 'xabcddefghiabcddefghix', 'abcddefghiabcddefghi', 'a', 'b', 'c', 'dd', 'e', 'f', 'g', 'h', 'i'])
:"
:"""" Look-behind with limit
! :call add(tl, [2, '<\@<=span.', 'xxspanxx<spanyyy', 'spany'])
! :call add(tl, [2, '<\@1<=span.', 'xxspanxx<spanyyy', 'spany'])
! :call add(tl, [2, '<\@2<=span.', 'xxspanxx<spanyyy', 'spany'])
! :call add(tl, [2, '\(<<\)\@<=span.', 'xxspanxxxx<spanxx<<spanyyy', 'spany', '<<'])
! :call add(tl, [2, '\(<<\)\@1<=span.', 'xxspanxxxx<spanxx<<spanyyy'])
! :call add(tl, [2, '\(<<\)\@2<=span.', 'xxspanxxxx<spanxx<<spanyyy', 'spany', '<<'])
! :call add(tl, [2, '\(foo\)\@<!bar.', 'xx foobar1 xbar2 xx', 'bar2'])
:"
:"""" "\_" prepended negated collection matches EOL
:call add(tl, [2, '\_[^8-9]\+', "asfi\n9888", "asfi\n"])
***************
*** 514,521 ****
asdfasd<yyy
xxstart1
asdfasd<yy
! xxxxstart2
asdfasd<yy
! xxxstart3
Results of test64:
--- 515,522 ----
asdfasd<yyy
xxstart1
asdfasd<yy
! xxxstart2
asdfasd<yy
! xxstart3
Results of test64:
*** ../vim-7.3.1087/src/testdir/test64.ok 2013-06-01 14:42:51.000000000 +0200
--- src/testdir/test64.ok 2013-06-01 18:55:43.000000000 +0200
***************
*** 817,832 ****
--- 817,841 ----
OK 2 - \(a\)\(b\)\(c\)\(dd\)\(e\)\(f\)\(g\)\(h\)\(i\)\1\2\3\4\5\6\7\8\9
OK 0 - <\@<=span.
OK 1 - <\@<=span.
+ OK 2 - <\@<=span.
OK 0 - <\@1<=span.
OK 1 - <\@1<=span.
+ OK 2 - <\@1<=span.
OK 0 - <\@2<=span.
OK 1 - <\@2<=span.
+ OK 2 - <\@2<=span.
OK 0 - \(<<\)\@<=span.
OK 1 - \(<<\)\@<=span.
+ OK 2 - \(<<\)\@<=span.
OK 0 - \(<<\)\@1<=span.
OK 1 - \(<<\)\@1<=span.
+ OK 2 - \(<<\)\@1<=span.
OK 0 - \(<<\)\@2<=span.
OK 1 - \(<<\)\@2<=span.
+ OK 2 - \(<<\)\@2<=span.
+ OK 0 - \(foo\)\@<!bar.
+ OK 1 - \(foo\)\@<!bar.
+ OK 2 - \(foo\)\@<!bar.
OK 0 - \_[^8-9]\+
OK 1 - \_[^8-9]\+
OK 2 - \_[^8-9]\+
***************
*** 844,850 ****
<T="7">Ac 7</Title>
ghi
! xxxstart3
-0-
ffo
bob
--- 853,859 ----
<T="7">Ac 7</Title>
ghi
! xxstart3
-0-
ffo
bob
*** ../vim-7.3.1087/src/version.c 2013-06-01 14:42:51.000000000 +0200
--- src/version.c 2013-06-01 18:37:11.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1088,
/**/
--
Seen it all, done it all, can't remember most of it.
/// 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 ///

155
7.3.1089 Normal file
View File

@ -0,0 +1,155 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1089
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1089
Problem: Tests 86 and 87 fail on MS-Windows. (Ken Takata)
Solution: Fix platform-specific stuff. (ZyX)
Files: src/testdir/test86.in, src/testdir/test86.ok,
src/testdir/test87.in, src/testdir/test87.ok
*** ../vim-7.3.1088/src/testdir/test86.in 2013-05-31 19:01:13.000000000 +0200
--- src/testdir/test86.in 2013-06-01 20:27:14.000000000 +0200
***************
*** 435,440 ****
--- 435,441 ----
:py bopts1=vim.buffers[vim.bindeval("g:bufs")[2]].options
:py bopts2=vim.buffers[vim.bindeval("g:bufs")[1]].options
:py bopts3=vim.buffers[vim.bindeval("g:bufs")[0]].options
+ :set path=.,..,,
:let lst=[]
:let lst+=[['paste', 1, 0, 1, 2, 1, 1, 0 ]]
:let lst+=[['previewheight', 5, 1, 6, 'a', 0, 1, 0 ]]
***************
*** 530,542 ****
b[0:0]=['baz']
vim.command('call append("$", getbufline(%i, 1, "$"))' % b.number)
# Test assigning to name property
old_name = cb.name
cb.name = 'foo'
! cb.append(cb.name[-11:])
b.name = 'bar'
! cb.append(b.name[-11:])
cb.name = old_name
! cb.append(cb.name[-17:])
# Test CheckBuffer
for _b in vim.buffers:
if _b is not cb:
--- 531,544 ----
b[0:0]=['baz']
vim.command('call append("$", getbufline(%i, 1, "$"))' % b.number)
# Test assigning to name property
+ import os
old_name = cb.name
cb.name = 'foo'
! cb.append(cb.name[-11:].replace(os.path.sep, '/'))
b.name = 'bar'
! cb.append(b.name[-11:].replace(os.path.sep, '/'))
cb.name = old_name
! cb.append(cb.name[-17:].replace(os.path.sep, '/'))
# Test CheckBuffer
for _b in vim.buffers:
if _b is not cb:
*** ../vim-7.3.1088/src/testdir/test86.ok 2013-05-31 19:01:13.000000000 +0200
--- src/testdir/test86.ok 2013-06-01 20:27:14.000000000 +0200
***************
*** 310,316 ****
W: 1:0 2:1 3:0 4:1
B: 1:0 2:1 3:0 4:1
>>> path
! p/gopts1: '.,/usr/include,,'
inv: 0! TypeError
p/wopts1! KeyError
inv: 0! KeyError
--- 310,316 ----
W: 1:0 2:1 3:0 4:1
B: 1:0 2:1 3:0 4:1
>>> path
! p/gopts1: '.,..,,'
inv: 0! TypeError
p/wopts1! KeyError
inv: 0! KeyError
*** ../vim-7.3.1088/src/testdir/test87.in 2013-05-31 18:46:06.000000000 +0200
--- src/testdir/test87.in 2013-06-01 20:27:14.000000000 +0200
***************
*** 404,409 ****
--- 404,410 ----
:py3 bopts1=vim.buffers[vim.bindeval("g:bufs")[2]].options
:py3 bopts2=vim.buffers[vim.bindeval("g:bufs")[1]].options
:py3 bopts3=vim.buffers[vim.bindeval("g:bufs")[0]].options
+ :set path=.,..,,
:let lst=[]
:let lst+=[['paste', 1, 0, 1, 2, 1, 1, 0 ]]
:let lst+=[['previewheight', 5, 1, 6, 'a', 0, 1, 0 ]]
***************
*** 499,511 ****
b[0:0]=['baz']
vim.command('call append("$", getbufline(%i, 1, "$"))' % b.number)
# Test assigning to name property
old_name = cb.name
cb.name = 'foo'
! cb.append(cb.name[-11:])
b.name = 'bar'
! cb.append(b.name[-11:])
cb.name = old_name
! cb.append(cb.name[-17:])
# Test CheckBuffer
for _b in vim.buffers:
if _b is not cb:
--- 500,513 ----
b[0:0]=['baz']
vim.command('call append("$", getbufline(%i, 1, "$"))' % b.number)
# Test assigning to name property
+ import os
old_name = cb.name
cb.name = 'foo'
! cb.append(cb.name[-11:].replace(os.path.sep, '/'))
b.name = 'bar'
! cb.append(b.name[-11:].replace(os.path.sep, '/'))
cb.name = old_name
! cb.append(cb.name[-17:].replace(os.path.sep, '/'))
# Test CheckBuffer
for _b in vim.buffers:
if _b is not cb:
*** ../vim-7.3.1088/src/testdir/test87.ok 2013-05-31 18:46:06.000000000 +0200
--- src/testdir/test87.ok 2013-06-01 20:27:14.000000000 +0200
***************
*** 299,305 ****
W: 1:0 2:1 3:0 4:1
B: 1:0 2:1 3:0 4:1
>>> path
! p/gopts1: b'.,/usr/include,,'
inv: 0! TypeError
p/wopts1! KeyError
inv: 0! KeyError
--- 299,305 ----
W: 1:0 2:1 3:0 4:1
B: 1:0 2:1 3:0 4:1
>>> path
! p/gopts1: b'.,..,,'
inv: 0! TypeError
p/wopts1! KeyError
inv: 0! KeyError
*** ../vim-7.3.1088/src/version.c 2013-06-01 19:54:39.000000000 +0200
--- src/version.c 2013-06-01 20:28:22.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1089,
/**/
--
I wonder how much deeper the ocean would be without sponges.
/// 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 ///

1893
7.3.1090 Normal file

File diff suppressed because it is too large Load Diff

104
7.3.1091 Normal file
View File

@ -0,0 +1,104 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1091
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1091
Problem: New regexp engine: no error when using \z1 or \z( where it does
not work.
Solution: Give an error message.
Files: src/regexp.c, src/regexp_nfa.c
*** ../vim-7.3.1090/src/regexp.c 2013-06-01 19:54:39.000000000 +0200
--- src/regexp.c 2013-06-02 14:56:07.000000000 +0200
***************
*** 361,366 ****
--- 361,368 ----
static char_u e_unmatchedpp[] = N_("E53: Unmatched %s%%(");
static char_u e_unmatchedp[] = N_("E54: Unmatched %s(");
static char_u e_unmatchedpar[] = N_("E55: Unmatched %s)");
+ static char_u e_z_not_allowed[] = N_("E66: \\z( not allowed here");
+ static char_u e_z1_not_allowed[] = N_("E67: \\z1 et al. not allowed here");
#define NOT_MULTI 0
#define MULTI_ONE 1
***************
*** 2120,2126 ****
{
#ifdef FEAT_SYN_HL
case '(': if (reg_do_extmatch != REX_SET)
! EMSG_RET_NULL(_("E66: \\z( not allowed here"));
if (one_exactly)
EMSG_ONE_RET_NULL;
ret = reg(REG_ZPAREN, &flags);
--- 2122,2128 ----
{
#ifdef FEAT_SYN_HL
case '(': if (reg_do_extmatch != REX_SET)
! EMSG_RET_NULL(_(e_z_not_allowed));
if (one_exactly)
EMSG_ONE_RET_NULL;
ret = reg(REG_ZPAREN, &flags);
***************
*** 2139,2145 ****
case '7':
case '8':
case '9': if (reg_do_extmatch != REX_USE)
! EMSG_RET_NULL(_("E67: \\z1 et al. not allowed here"));
ret = regnode(ZREF + c - '0');
re_has_z = REX_USE;
break;
--- 2141,2147 ----
case '7':
case '8':
case '9': if (reg_do_extmatch != REX_USE)
! EMSG_RET_NULL(_(e_z1_not_allowed));
ret = regnode(ZREF + c - '0');
re_has_z = REX_USE;
break;
*** ../vim-7.3.1090/src/regexp_nfa.c 2013-06-01 23:02:48.000000000 +0200
--- src/regexp_nfa.c 2013-06-02 14:56:53.000000000 +0200
***************
*** 865,870 ****
--- 865,872 ----
case '8':
case '9':
/* \z1...\z9 */
+ if (reg_do_extmatch != REX_USE)
+ EMSG_RET_FAIL(_(e_z1_not_allowed));
EMIT(NFA_ZREF1 + (no_Magic(c) - '1'));
/* No need to set nfa_has_backref, the sub-matches don't
* change when \z1 .. \z9 maches or not. */
***************
*** 872,877 ****
--- 874,881 ----
break;
case '(':
/* \z( */
+ if (reg_do_extmatch != REX_SET)
+ EMSG_RET_FAIL(_(e_z_not_allowed));
if (nfa_reg(REG_ZPAREN) == FAIL)
return FAIL; /* cascaded error */
re_has_z = REX_SET;
*** ../vim-7.3.1090/src/version.c 2013-06-01 23:02:48.000000000 +0200
--- src/version.c 2013-06-02 14:58:17.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1091,
/**/
--
Don't believe everything you hear or anything you say.
/// 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 ///

189
7.3.1092 Normal file
View File

@ -0,0 +1,189 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1092
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1092
Problem: Can't build with regexp debugging. NFA debug output shows wrong
pattern.
Solution: Fix debugging code for recent changes. Add the pattern to the
program.
Files: src/regexp_nfa.c, src/regexp.h
*** ../vim-7.3.1091/src/regexp_nfa.c 2013-06-02 15:01:51.000000000 +0200
--- src/regexp_nfa.c 2013-06-02 15:48:57.000000000 +0200
***************
*** 3133,3144 ****
{
int col;
! if (thread->sub.in_use <= 0)
col = -1;
else if (REG_MULTI)
! col = thread->sub.list.multi[0].start.col;
else
! col = (int)(thread->sub.list.line[0].start - regline);
nfa_set_code(state->c);
fprintf(log_fd, "> Adding state %d to list %d. char %d: %s (start col %d)\n",
abs(state->id), l->id, state->c, code, col);
--- 3133,3144 ----
{
int col;
! if (thread->subs.norm.in_use <= 0)
col = -1;
else if (REG_MULTI)
! col = thread->subs.norm.list.multi[0].start.col;
else
! col = (int)(thread->subs.norm.list.line[0].start - regline);
nfa_set_code(state->c);
fprintf(log_fd, "> Adding state %d to list %d. char %d: %s (start col %d)\n",
abs(state->id), l->id, state->c, code, col);
***************
*** 3152,3163 ****
{
int col;
! if (sub->in_use <= 0)
col = -1;
else if (REG_MULTI)
! col = sub->list.multi[0].start.col;
else
! col = (int)(sub->list.line[0].start - regline);
nfa_set_code(state->c);
fprintf(log_fd, "> Processing state %d for list %d. char %d: %s (start col %d)\n",
abs(state->id), l->id, state->c, code, col);
--- 3152,3163 ----
{
int col;
! if (subs->norm.in_use <= 0)
col = -1;
else if (REG_MULTI)
! col = subs->norm.list.multi[0].start.col;
else
! col = (int)(subs->norm.list.line[0].start - regline);
nfa_set_code(state->c);
fprintf(log_fd, "> Processing state %d for list %d. char %d: %s (start col %d)\n",
abs(state->id), l->id, state->c, code, col);
***************
*** 3836,3847 ****
{
int col;
! if (t->sub.in_use <= 0)
col = -1;
else if (REG_MULTI)
! col = t->sub.list.multi[0].start.col;
else
! col = (int)(t->sub.list.line[0].start - regline);
nfa_set_code(t->state->c);
fprintf(log_fd, "(%d) char %d %s (start col %d) ... \n",
abs(t->state->id), (int)t->state->c, code, col);
--- 3836,3847 ----
{
int col;
! if (t->subs.norm.in_use <= 0)
col = -1;
else if (REG_MULTI)
! col = t->subs.norm.list.multi[0].start.col;
else
! col = (int)(t->subs.norm.list.line[0].start - regline);
nfa_set_code(t->state->c);
fprintf(log_fd, "(%d) char %d %s (start col %d) ... \n",
abs(t->state->id), (int)t->state->c, code, col);
***************
*** 4818,4823 ****
--- 4818,4826 ----
nfa_has_zend = prog->has_zend;
nfa_has_backref = prog->has_backref;
nfa_nsubexpr = prog->nsubexp;
+ #ifdef DEBUG
+ nfa_regengine.expr = prog->pattern;
+ #endif
nstate = prog->nstate;
for (i = 0; i < nstate; ++i)
***************
*** 4828,4833 ****
--- 4831,4840 ----
retval = nfa_regtry(prog, col);
+ #ifdef DEBUG
+ nfa_regengine.expr = NULL;
+ #endif
+
theend:
return retval;
}
***************
*** 4921,4926 ****
--- 4928,4937 ----
/* Remember whether this pattern has any \z specials in it. */
prog->reghasz = re_has_z;
#endif
+ #ifdef DEBUG
+ prog->pattern = vim_strsave(expr); /* memory will leak */
+ nfa_regengine.expr = NULL;
+ #endif
out:
vim_free(post_start);
*** ../vim-7.3.1091/src/regexp.h 2013-06-01 23:02:48.000000000 +0200
--- src/regexp.h 2013-06-02 15:42:57.000000000 +0200
***************
*** 86,98 ****
regengine_T *engine;
unsigned regflags;
! regprog_T regprog;
! nfa_state_T *start;
int has_zend; /* pattern contains \ze */
int has_backref; /* pattern contains \1 .. \9 */
#ifdef FEAT_SYN_HL
int reghasz;
#endif
int nsubexp; /* number of () */
int nstate;
nfa_state_T state[0]; /* actually longer.. */
--- 86,100 ----
regengine_T *engine;
unsigned regflags;
! nfa_state_T *start; /* points into state[] */
int has_zend; /* pattern contains \ze */
int has_backref; /* pattern contains \1 .. \9 */
#ifdef FEAT_SYN_HL
int reghasz;
#endif
+ #ifdef DEBUG
+ char_u *pattern;
+ #endif
int nsubexp; /* number of () */
int nstate;
nfa_state_T state[0]; /* actually longer.. */
*** ../vim-7.3.1091/src/version.c 2013-06-02 15:01:51.000000000 +0200
--- src/version.c 2013-06-02 15:53:16.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1092,
/**/
--
I started out with nothing, and I still have most of it.
-- Michael Davis -- "Tonight Show"
/// 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 ///

87
7.3.1093 Normal file
View File

@ -0,0 +1,87 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1093
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1093
Problem: New regexp engine: When a sub expression is empty \1 skips a
character.
Solution: Make \1 try the current position when the match is emtpy.
Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok
*** ../vim-7.3.1092/src/regexp_nfa.c 2013-06-02 15:55:52.000000000 +0200
--- src/regexp_nfa.c 2013-06-02 16:03:28.000000000 +0200
***************
*** 4435,4445 ****
{
if (bytelen == 0)
{
! /* empty match always works, add NFA_SKIP with zero to
! * be used next */
! addstate_here(thislist, t->state->out, &t->subs,
&listidx);
- thislist->t[listidx + 1].count = 0;
}
else if (bytelen <= clen)
{
--- 4435,4444 ----
{
if (bytelen == 0)
{
! /* empty match always works, output of NFA_SKIP to be
! * used next */
! addstate_here(thislist, t->state->out->out, &t->subs,
&listidx);
}
else if (bytelen <= clen)
{
*** ../vim-7.3.1092/src/testdir/test64.in 2013-06-01 19:54:39.000000000 +0200
--- src/testdir/test64.in 2013-06-02 16:02:56.000000000 +0200
***************
*** 361,366 ****
--- 361,367 ----
:call add(tl, [2, '\(\i\+\) \1', ' abc abc', 'abc abc', 'abc'])
:call add(tl, [2, '\(\i\+\) \1', 'xgoo goox', 'goo goo', 'goo'])
:call add(tl, [2, '\(a\)\(b\)\(c\)\(dd\)\(e\)\(f\)\(g\)\(h\)\(i\)\1\2\3\4\5\6\7\8\9', 'xabcddefghiabcddefghix', 'abcddefghiabcddefghi', 'a', 'b', 'c', 'dd', 'e', 'f', 'g', 'h', 'i'])
+ :call add(tl, [2, '\(\d*\)a \1b', ' a b ', 'a b', ''])
:"
:"""" Look-behind with limit
:call add(tl, [2, '<\@<=span.', 'xxspanxx<spanyyy', 'spany'])
*** ../vim-7.3.1092/src/testdir/test64.ok 2013-06-01 19:54:39.000000000 +0200
--- src/testdir/test64.ok 2013-06-02 16:06:44.000000000 +0200
***************
*** 815,820 ****
--- 815,823 ----
OK 0 - \(a\)\(b\)\(c\)\(dd\)\(e\)\(f\)\(g\)\(h\)\(i\)\1\2\3\4\5\6\7\8\9
OK 1 - \(a\)\(b\)\(c\)\(dd\)\(e\)\(f\)\(g\)\(h\)\(i\)\1\2\3\4\5\6\7\8\9
OK 2 - \(a\)\(b\)\(c\)\(dd\)\(e\)\(f\)\(g\)\(h\)\(i\)\1\2\3\4\5\6\7\8\9
+ OK 0 - \(\d*\)a \1b
+ OK 1 - \(\d*\)a \1b
+ OK 2 - \(\d*\)a \1b
OK 0 - <\@<=span.
OK 1 - <\@<=span.
OK 2 - <\@<=span.
*** ../vim-7.3.1092/src/version.c 2013-06-02 15:55:52.000000000 +0200
--- src/version.c 2013-06-02 16:03:55.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1093,
/**/
--
Well, you come from nothing, you go back to nothing... What have you
lost? Nothing!
-- Monty Python: The life of Brian
/// 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 ///

291
7.3.1094 Normal file
View File

@ -0,0 +1,291 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1094
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1094
Problem: New regexp engine: Attempts to match "^" at every character.
Solution: Only try "^" at the start of a line.
Files: rc/regexp_nfa.c
*** ../vim-7.3.1093/src/regexp_nfa.c 2013-06-02 16:07:05.000000000 +0200
--- src/regexp_nfa.c 2013-06-02 16:24:04.000000000 +0200
***************
*** 249,254 ****
--- 249,256 ----
* executing. */
static int istate; /* Index in the state vector, used in new_state() */
+ /* If not NULL match must end at this position */
+ static save_se_T *nfa_endp = NULL;
static int nfa_regcomp_start __ARGS((char_u*expr, int re_flags));
static int nfa_recognize_char_class __ARGS((char_u *start, char_u *end, int extra_newl));
***************
*** 3080,3085 ****
--- 3082,3099 ----
state->lastlist = l->id;
break;
+ case NFA_BOL:
+ case NFA_BOF:
+ /* "^" won't match past end-of-line, don't bother trying.
+ * Except when we are going to the next line for a look-behind
+ * match. */
+ if (reginput > regline
+ && (nfa_endp == NULL
+ || !REG_MULTI
+ || reglnum == nfa_endp->se_u.pos.lnum))
+ goto skip_add;
+ /* FALLTHROUGH */
+
default:
if (state->lastlist == l->id)
{
***************
*** 3659,3682 ****
return val == pos;
}
! static int nfa_regmatch __ARGS((nfa_state_T *start, regsubs_T *submatch, regsubs_T *m, save_se_T *endp));
/*
* Main matching routine.
*
* Run NFA to determine whether it matches reginput.
*
! * When "endp" is not NULL it is a required end-of-match position.
*
* Return TRUE if there is a match, FALSE otherwise.
* Note: Caller must ensure that: start != NULL.
*/
static int
! nfa_regmatch(start, submatch, m, endp)
nfa_state_T *start;
regsubs_T *submatch;
regsubs_T *m;
- save_se_T *endp;
{
int result;
int size = 0;
--- 3673,3695 ----
return val == pos;
}
! static int nfa_regmatch __ARGS((nfa_state_T *start, regsubs_T *submatch, regsubs_T *m));
/*
* Main matching routine.
*
* Run NFA to determine whether it matches reginput.
*
! * When "nfa_endp" is not NULL it is a required end-of-match position.
*
* Return TRUE if there is a match, FALSE otherwise.
* Note: Caller must ensure that: start != NULL.
*/
static int
! nfa_regmatch(start, submatch, m)
nfa_state_T *start;
regsubs_T *submatch;
regsubs_T *m;
{
int result;
int size = 0;
***************
*** 3888,3913 ****
else
{
#ifdef ENABLE_LOG
! if (endp != NULL)
{
if (REG_MULTI)
fprintf(log_fd, "Current lnum: %d, endp lnum: %d; current col: %d, endp col: %d\n",
(int)reglnum,
! (int)endp->se_u.pos.lnum,
(int)(reginput - regline),
! endp->se_u.pos.col);
else
fprintf(log_fd, "Current col: %d, endp col: %d\n",
(int)(reginput - regline),
! (int)(endp->se_u.ptr - reginput));
}
#endif
! /* It's only a match if it ends at "endp" */
! if (endp != NULL && (REG_MULTI
! ? (reglnum != endp->se_u.pos.lnum
|| (int)(reginput - regline)
! != endp->se_u.pos.col)
! : reginput != endp->se_u.ptr))
break;
/* do not set submatches for \@! */
--- 3901,3926 ----
else
{
#ifdef ENABLE_LOG
! if (nfa_endp != NULL)
{
if (REG_MULTI)
fprintf(log_fd, "Current lnum: %d, endp lnum: %d; current col: %d, endp col: %d\n",
(int)reglnum,
! (int)nfa_endp->se_u.pos.lnum,
(int)(reginput - regline),
! nfa_endp->se_u.pos.col);
else
fprintf(log_fd, "Current col: %d, endp col: %d\n",
(int)(reginput - regline),
! (int)(nfa_endp->se_u.ptr - reginput));
}
#endif
! /* It's only a match if it ends at "nfa_endp" */
! if (nfa_endp != NULL && (REG_MULTI
! ? (reglnum != nfa_endp->se_u.pos.lnum
|| (int)(reginput - regline)
! != nfa_endp->se_u.pos.col)
! : reginput != nfa_endp->se_u.ptr))
break;
/* do not set submatches for \@! */
***************
*** 3929,3934 ****
--- 3942,3948 ----
char_u *save_regline = regline;
int save_reglnum = reglnum;
int save_nfa_match = nfa_match;
+ save_se_T *save_nfa_endp = nfa_endp;
save_se_T endpos;
save_se_T *endposp = NULL;
***************
*** 4012,4018 ****
* recursion. */
nfa_save_listids(start, listids);
nfa_set_null_listids(start);
! result = nfa_regmatch(t->state->out, submatch, m, endposp);
nfa_set_neg_listids(start);
nfa_restore_listids(start, listids);
--- 4026,4033 ----
* recursion. */
nfa_save_listids(start, listids);
nfa_set_null_listids(start);
! nfa_endp = endposp;
! result = nfa_regmatch(t->state->out, submatch, m);
nfa_set_neg_listids(start);
nfa_restore_listids(start, listids);
***************
*** 4021,4026 ****
--- 4036,4042 ----
regline = save_regline;
reglnum = save_reglnum;
nfa_match = save_nfa_match;
+ nfa_endp = save_nfa_endp;
#ifdef ENABLE_LOG
log_fd = fopen(NFA_REGEXP_RUN_LOG, "a");
***************
*** 4563,4569 ****
* matters!
* Do not add the start state in recursive calls of nfa_regmatch(),
* because recursive calls should only start in the first position.
! * Unless "endp" is not NULL, then we match the end position.
* Also don't start a match past the first line. */
if (nfa_match == FALSE
&& ((start->c == NFA_MOPEN
--- 4579,4585 ----
* matters!
* Do not add the start state in recursive calls of nfa_regmatch(),
* because recursive calls should only start in the first position.
! * Unless "nfa_endp" is not NULL, then we match the end position.
* Also don't start a match past the first line. */
if (nfa_match == FALSE
&& ((start->c == NFA_MOPEN
***************
*** 4571,4583 ****
&& clen != 0
&& (ireg_maxcol == 0
|| (colnr_T)(reginput - regline) < ireg_maxcol))
! || (endp != NULL
&& (REG_MULTI
! ? (reglnum < endp->se_u.pos.lnum
! || (reglnum == endp->se_u.pos.lnum
&& (int)(reginput - regline)
! < endp->se_u.pos.col))
! : reginput < endp->se_u.ptr))))
{
#ifdef ENABLE_LOG
fprintf(log_fd, "(---) STARTSTATE\n");
--- 4587,4599 ----
&& clen != 0
&& (ireg_maxcol == 0
|| (colnr_T)(reginput - regline) < ireg_maxcol))
! || (nfa_endp != NULL
&& (REG_MULTI
! ? (reglnum < nfa_endp->se_u.pos.lnum
! || (reglnum == nfa_endp->se_u.pos.lnum
&& (int)(reginput - regline)
! < nfa_endp->se_u.pos.col))
! : reginput < nfa_endp->se_u.ptr))))
{
#ifdef ENABLE_LOG
fprintf(log_fd, "(---) STARTSTATE\n");
***************
*** 4601,4608 ****
* finish. */
if (clen != 0)
reginput += clen;
! else if (go_to_nextline || (endp != NULL && REG_MULTI
! && reglnum < endp->se_u.pos.lnum))
reg_nextline();
else
break;
--- 4617,4624 ----
* finish. */
if (clen != 0)
reginput += clen;
! else if (go_to_nextline || (nfa_endp != NULL && REG_MULTI
! && reglnum < nfa_endp->se_u.pos.lnum))
reg_nextline();
else
break;
***************
*** 4678,4684 ****
clear_sub(&m.synt);
#endif
! if (nfa_regmatch(start, &subs, &m, NULL) == FALSE)
return 0;
cleanup_subexpr();
--- 4694,4700 ----
clear_sub(&m.synt);
#endif
! if (nfa_regmatch(start, &subs, &m) == FALSE)
return 0;
cleanup_subexpr();
*** ../vim-7.3.1093/src/version.c 2013-06-02 16:07:05.000000000 +0200
--- src/version.c 2013-06-02 16:25:02.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1094,
/**/
--
The future isn't what it used to be.
/// 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 ///

331
7.3.1095 Normal file
View File

@ -0,0 +1,331 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1095
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1095
Problem: Compiler warnings for shadowed variables. (Christian Brabandt)
Solution: Rename new_state() to alloc_state(). Remove unnecessary
declaration.
Files: src/regexp_nfa.c
*** ../vim-7.3.1094/src/regexp_nfa.c 2013-06-02 16:34:14.000000000 +0200
--- src/regexp_nfa.c 2013-06-02 16:38:44.000000000 +0200
***************
*** 247,253 ****
static int nstate; /* Number of states in the NFA. Also used when
* executing. */
! static int istate; /* Index in the state vector, used in new_state() */
/* If not NULL match must end at this position */
static save_se_T *nfa_endp = NULL;
--- 247,253 ----
static int nstate; /* Number of states in the NFA. Also used when
* executing. */
! static int istate; /* Index in the state vector, used in alloc_state() */
/* If not NULL match must end at this position */
static save_se_T *nfa_endp = NULL;
***************
*** 268,274 ****
static void nfa_dump __ARGS((nfa_regprog_T *prog));
#endif
static int *re2post __ARGS((void));
! static nfa_state_T *new_state __ARGS((int c, nfa_state_T *out, nfa_state_T *out1));
static nfa_state_T *post2nfa __ARGS((int *postfix, int *end, int nfa_calc_size));
static int check_char_class __ARGS((int class, int c));
static void st_error __ARGS((int *postfix, int *end, int *p));
--- 268,274 ----
static void nfa_dump __ARGS((nfa_regprog_T *prog));
#endif
static int *re2post __ARGS((void));
! static nfa_state_T *alloc_state __ARGS((int c, nfa_state_T *out, nfa_state_T *out1));
static nfa_state_T *post2nfa __ARGS((int *postfix, int *end, int nfa_calc_size));
static int check_char_class __ARGS((int class, int c));
static void st_error __ARGS((int *postfix, int *end, int *p));
***************
*** 2134,2140 ****
* Allocate and initialize nfa_state_T.
*/
static nfa_state_T *
! new_state(c, out, out1)
int c;
nfa_state_T *out;
nfa_state_T *out1;
--- 2134,2140 ----
* Allocate and initialize nfa_state_T.
*/
static nfa_state_T *
! alloc_state(c, out, out1)
int c;
nfa_state_T *out;
nfa_state_T *out1;
***************
*** 2431,2437 ****
}
e2 = POP();
e1 = POP();
! s = new_state(NFA_SPLIT, e1.start, e2.start);
if (s == NULL)
goto theend;
PUSH(frag(s, append(e1.out, e2.out)));
--- 2431,2437 ----
}
e2 = POP();
e1 = POP();
! s = alloc_state(NFA_SPLIT, e1.start, e2.start);
if (s == NULL)
goto theend;
PUSH(frag(s, append(e1.out, e2.out)));
***************
*** 2445,2451 ****
break;
}
e = POP();
! s = new_state(NFA_SPLIT, e.start, NULL);
if (s == NULL)
goto theend;
patch(e.out, s);
--- 2445,2451 ----
break;
}
e = POP();
! s = alloc_state(NFA_SPLIT, e.start, NULL);
if (s == NULL)
goto theend;
patch(e.out, s);
***************
*** 2460,2466 ****
break;
}
e = POP();
! s = new_state(NFA_SPLIT, NULL, e.start);
if (s == NULL)
goto theend;
patch(e.out, s);
--- 2460,2466 ----
break;
}
e = POP();
! s = alloc_state(NFA_SPLIT, NULL, e.start);
if (s == NULL)
goto theend;
patch(e.out, s);
***************
*** 2475,2481 ****
break;
}
e = POP();
! s = new_state(NFA_SPLIT, e.start, NULL);
if (s == NULL)
goto theend;
PUSH(frag(s, append(e.out, list1(&s->out1))));
--- 2475,2481 ----
break;
}
e = POP();
! s = alloc_state(NFA_SPLIT, e.start, NULL);
if (s == NULL)
goto theend;
PUSH(frag(s, append(e.out, list1(&s->out1))));
***************
*** 2489,2495 ****
break;
}
e = POP();
! s = new_state(NFA_SPLIT, NULL, e.start);
if (s == NULL)
goto theend;
PUSH(frag(s, append(e.out, list1(&s->out))));
--- 2489,2495 ----
break;
}
e = POP();
! s = alloc_state(NFA_SPLIT, NULL, e.start);
if (s == NULL)
goto theend;
PUSH(frag(s, append(e.out, list1(&s->out))));
***************
*** 2503,2509 ****
nstate++;
break;
}
! s = new_state(NFA_SKIP_CHAR, NULL, NULL);
if (s == NULL)
goto theend;
PUSH(frag(s, list1(&s->out)));
--- 2503,2509 ----
nstate++;
break;
}
! s = alloc_state(NFA_SKIP_CHAR, NULL, NULL);
if (s == NULL)
goto theend;
PUSH(frag(s, list1(&s->out)));
***************
*** 2526,2537 ****
break;
}
e = POP();
! s1 = new_state(NFA_END_INVISIBLE, NULL, NULL);
if (s1 == NULL)
goto theend;
patch(e.out, s1);
! s = new_state(NFA_START_INVISIBLE, e.start, s1);
if (s == NULL)
goto theend;
if (*p == NFA_PREV_ATOM_NO_WIDTH_NEG
--- 2526,2537 ----
break;
}
e = POP();
! s1 = alloc_state(NFA_END_INVISIBLE, NULL, NULL);
if (s1 == NULL)
goto theend;
patch(e.out, s1);
! s = alloc_state(NFA_START_INVISIBLE, e.start, s1);
if (s == NULL)
goto theend;
if (*p == NFA_PREV_ATOM_NO_WIDTH_NEG
***************
*** 2622,2631 ****
* empty groups of parenthesis, and empty mbyte chars */
if (stackp == stack)
{
! s = new_state(mopen, NULL, NULL);
if (s == NULL)
goto theend;
! s1 = new_state(mclose, NULL, NULL);
if (s1 == NULL)
goto theend;
patch(list1(&s->out), s1);
--- 2622,2631 ----
* empty groups of parenthesis, and empty mbyte chars */
if (stackp == stack)
{
! s = alloc_state(mopen, NULL, NULL);
if (s == NULL)
goto theend;
! s1 = alloc_state(mclose, NULL, NULL);
if (s1 == NULL)
goto theend;
patch(list1(&s->out), s1);
***************
*** 2636,2646 ****
/* At least one node was emitted before NFA_MOPEN, so
* at least one node will be between NFA_MOPEN and NFA_MCLOSE */
e = POP();
! s = new_state(mopen, e.start, NULL); /* `(' */
if (s == NULL)
goto theend;
! s1 = new_state(mclose, NULL, NULL); /* `)' */
if (s1 == NULL)
goto theend;
patch(e.out, s1);
--- 2636,2646 ----
/* At least one node was emitted before NFA_MOPEN, so
* at least one node will be between NFA_MOPEN and NFA_MCLOSE */
e = POP();
! s = alloc_state(mopen, e.start, NULL); /* `(' */
if (s == NULL)
goto theend;
! s1 = alloc_state(mclose, NULL, NULL); /* `)' */
if (s1 == NULL)
goto theend;
patch(e.out, s1);
***************
*** 2679,2688 ****
nstate += 2;
break;
}
! s = new_state(*p, NULL, NULL);
if (s == NULL)
goto theend;
! s1 = new_state(NFA_SKIP, NULL, NULL);
if (s1 == NULL)
goto theend;
patch(list1(&s->out), s1);
--- 2679,2688 ----
nstate += 2;
break;
}
! s = alloc_state(*p, NULL, NULL);
if (s == NULL)
goto theend;
! s1 = alloc_state(NFA_SKIP, NULL, NULL);
if (s1 == NULL)
goto theend;
patch(list1(&s->out), s1);
***************
*** 2704,2710 ****
break;
}
e1 = POP();
! s = new_state(*p, NULL, NULL);
if (s == NULL)
goto theend;
s->val = e1.start->c;
--- 2704,2710 ----
break;
}
e1 = POP();
! s = alloc_state(*p, NULL, NULL);
if (s == NULL)
goto theend;
s->val = e1.start->c;
***************
*** 2720,2726 ****
nstate++;
break;
}
! s = new_state(*p, NULL, NULL);
if (s == NULL)
goto theend;
PUSH(frag(s, list1(&s->out)));
--- 2720,2726 ----
nstate++;
break;
}
! s = alloc_state(*p, NULL, NULL);
if (s == NULL)
goto theend;
PUSH(frag(s, list1(&s->out)));
***************
*** 4742,4749 ****
if (prog->reghasz == REX_SET)
{
- int i;
-
cleanup_zsubexpr();
re_extmatch_out = make_extmatch();
for (i = 0; i < subs.synt.in_use; i++)
--- 4742,4747 ----
*** ../vim-7.3.1094/src/version.c 2013-06-02 16:34:14.000000000 +0200
--- src/version.c 2013-06-02 16:39:59.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1095,
/**/
--
Microsoft is to software what McDonalds is to gourmet cooking
/// 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 ///

333
7.3.1096 Normal file
View File

@ -0,0 +1,333 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1096
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1096
Problem: Python: popitem() was not defined in a standard way.
Solution: Remove the argument from popitem(). (ZyX)
Files: runtime/doc/if_pyth.txt, src/if_py_both.h, src/testdir/test86.in,
src/testdir/test86.ok, src/testdir/test87.in,
src/testdir/test87.ok
*** ../vim-7.3.1095/runtime/doc/if_pyth.txt 2013-05-30 13:32:26.000000000 +0200
--- runtime/doc/if_pyth.txt 2013-06-02 17:39:35.000000000 +0200
***************
*** 174,180 ****
vim.bindeval(str) *python-bindeval*
Like |python-eval|, but returns special objects described in
|python-bindeval-objects|. These python objects let you modify (|List|
! or |Dictionary|) or call (|Funcref|) vim objecs.
Error object of the "vim" module
--- 174,180 ----
vim.bindeval(str) *python-bindeval*
Like |python-eval|, but returns special objects described in
|python-bindeval-objects|. These python objects let you modify (|List|
! or |Dictionary|) or call (|Funcref|) vim objects.
Error object of the "vim" module
***************
*** 208,214 ****
:py w in vim.windows # Membership test
:py n = len(vim.windows) # Number of elements
:py for w in vim.windows: # Sequential access
! < Note: vim.windows object always accesses current tab page,.
|python-tabpage|.windows objects are bound to parent |python-tabpage|
object and always use windows from that tab page (or throw vim.error
in case tab page was deleted). You can keep a reference to both
--- 208,214 ----
:py w in vim.windows # Membership test
:py n = len(vim.windows) # Number of elements
:py for w in vim.windows: # Sequential access
! < Note: vim.windows object always accesses current tab page.
|python-tabpage|.windows objects are bound to parent |python-tabpage|
object and always use windows from that tab page (or throw vim.error
in case tab page was deleted). You can keep a reference to both
***************
*** 494,503 ****
Remove specified key from dictionary and return
corresponding value. If key is not found and default is
given returns the default, otherwise raises KeyError.
! popitem(key)
! Remove specified key from dictionary and return a pair
! with it and the corresponding value. Returned key is a new
! object.
has_key(key)
Check whether dictionary contains specified key, similar
to `key in dict`.
--- 494,502 ----
Remove specified key from dictionary and return
corresponding value. If key is not found and default is
given returns the default, otherwise raises KeyError.
! popitem()
! Remove random key from dictionary and return (key, value)
! pair.
has_key(key)
Check whether dictionary contains specified key, similar
to `key in dict`.
*** ../vim-7.3.1095/src/if_py_both.h 2013-05-31 20:49:27.000000000 +0200
--- src/if_py_both.h 2013-06-02 17:39:35.000000000 +0200
***************
*** 1061,1077 ****
dictitem_free(di);
}
- if (flags & DICT_FLAG_RETURN_PAIR)
- {
- PyObject *tmp = r;
-
- if (!(r = Py_BuildValue("(" Py_bytes_fmt "O)", hi->hi_key, tmp)))
- {
- Py_DECREF(tmp);
- return NULL;
- }
- }
-
return r;
}
--- 1061,1066 ----
***************
*** 1457,1471 ****
}
static PyObject *
! DictionaryPopItem(DictionaryObject *self, PyObject *args)
{
! PyObject *keyObject;
! if (!PyArg_ParseTuple(args, "O", &keyObject))
return NULL;
! return _DictionaryItem(self, keyObject,
! DICT_FLAG_POP|DICT_FLAG_RETURN_PAIR);
}
static PyObject *
--- 1446,1483 ----
}
static PyObject *
! DictionaryPopItem(DictionaryObject *self)
{
! hashitem_T *hi;
! PyObject *r;
! PyObject *valObject;
! dictitem_T *di;
! if (self->dict->dv_hashtab.ht_used == 0)
! {
! PyErr_SetNone(PyExc_KeyError);
! return NULL;
! }
!
! hi = self->dict->dv_hashtab.ht_array;
! while (HASHITEM_EMPTY(hi))
! ++hi;
!
! di = dict_lookup(hi);
!
! if (!(valObject = ConvertToPyObject(&di->di_tv)))
return NULL;
! if (!(r = Py_BuildValue("(" Py_bytes_fmt "O)", hi->hi_key, valObject)))
! {
! Py_DECREF(valObject);
! return NULL;
! }
!
! hash_remove(&self->dict->dv_hashtab, hi);
! dictitem_free(di);
!
! return r;
}
static PyObject *
***************
*** 1505,1511 ****
{"update", (PyCFunction)DictionaryUpdate, METH_VARARGS|METH_KEYWORDS, ""},
{"get", (PyCFunction)DictionaryGet, METH_VARARGS, ""},
{"pop", (PyCFunction)DictionaryPop, METH_VARARGS, ""},
! {"popitem", (PyCFunction)DictionaryPopItem, METH_VARARGS, ""},
{"has_key", (PyCFunction)DictionaryHasKey, METH_VARARGS, ""},
{"__dir__", (PyCFunction)DictionaryDir, METH_NOARGS, ""},
{ NULL, NULL, 0, NULL}
--- 1517,1523 ----
{"update", (PyCFunction)DictionaryUpdate, METH_VARARGS|METH_KEYWORDS, ""},
{"get", (PyCFunction)DictionaryGet, METH_VARARGS, ""},
{"pop", (PyCFunction)DictionaryPop, METH_VARARGS, ""},
! {"popitem", (PyCFunction)DictionaryPopItem, METH_NOARGS, ""},
{"has_key", (PyCFunction)DictionaryHasKey, METH_VARARGS, ""},
{"__dir__", (PyCFunction)DictionaryDir, METH_NOARGS, ""},
{ NULL, NULL, 0, NULL}
*** ../vim-7.3.1095/src/testdir/test86.in 2013-06-01 20:32:09.000000000 +0200
--- src/testdir/test86.in 2013-06-02 17:39:35.000000000 +0200
***************
*** 83,89 ****
:$put =pyeval('repr(''1'' in d)')
:$put =pyeval('repr(list(iter(d)))')
:$put =string(d)
! :$put =pyeval('repr(d.popitem(''0''))')
:$put =pyeval('repr(d.get(''0''))')
:$put =pyeval('repr(list(iter(d)))')
:"
--- 83,89 ----
:$put =pyeval('repr(''1'' in d)')
:$put =pyeval('repr(list(iter(d)))')
:$put =string(d)
! :$put =pyeval('repr(d.popitem())')
:$put =pyeval('repr(d.get(''0''))')
:$put =pyeval('repr(list(iter(d)))')
:"
***************
*** 226,232 ****
em('d[u"a\\0b"]=1')
em('d.pop("abc")')
! em('d.popitem("abc")')
EOF
:$put =messages
:unlet messages
--- 226,232 ----
em('d[u"a\\0b"]=1')
em('d.pop("abc")')
! em('d.popitem()')
EOF
:$put =messages
:unlet messages
*** ../vim-7.3.1095/src/testdir/test86.ok 2013-06-01 20:32:09.000000000 +0200
--- src/testdir/test86.ok 2013-06-02 17:39:35.000000000 +0200
***************
*** 26,32 ****
False
['0']
{'0': -1}
! ('', -1L)
None
[]
[0, 1, 2, 3]
--- 26,32 ----
False
['0']
{'0': -1}
! ('0', -1L)
None
[]
[0, 1, 2, 3]
***************
*** 666,672 ****
d.update((("a", FailingMappingKey()),)):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
<<< Finished
>> DictionaryPopItem
! d.popitem(1, 2):(<type 'exceptions.TypeError'>, TypeError('function takes exactly 1 argument (2 given)',))
>> DictionaryHasKey
d.has_key():(<type 'exceptions.TypeError'>, TypeError('function takes exactly 1 argument (0 given)',))
> List
--- 666,672 ----
d.update((("a", FailingMappingKey()),)):(<type 'exceptions.NotImplementedError'>, NotImplementedError())
<<< Finished
>> DictionaryPopItem
! d.popitem(1, 2):(<type 'exceptions.TypeError'>, TypeError('popitem() takes no arguments (2 given)',))
>> DictionaryHasKey
d.has_key():(<type 'exceptions.TypeError'>, TypeError('function takes exactly 1 argument (0 given)',))
> List
*** ../vim-7.3.1095/src/testdir/test87.in 2013-06-01 20:32:09.000000000 +0200
--- src/testdir/test87.in 2013-06-02 17:39:35.000000000 +0200
***************
*** 77,83 ****
:$put =py3eval('repr(''1'' in d)')
:$put =py3eval('repr(list(iter(d)))')
:$put =string(d)
! :$put =py3eval('repr(d.popitem(''0''))')
:$put =py3eval('repr(d.get(''0''))')
:$put =py3eval('repr(list(iter(d)))')
:"
--- 77,83 ----
:$put =py3eval('repr(''1'' in d)')
:$put =py3eval('repr(list(iter(d)))')
:$put =string(d)
! :$put =py3eval('repr(d.popitem())')
:$put =py3eval('repr(d.get(''0''))')
:$put =py3eval('repr(list(iter(d)))')
:"
***************
*** 220,226 ****
em('d[b"a\\0b"]=1')
em('d.pop("abc")')
! em('d.popitem("abc")')
EOF
:$put =messages
:unlet messages
--- 220,226 ----
em('d[b"a\\0b"]=1')
em('d.pop("abc")')
! em('d.popitem()')
EOF
:$put =messages
:unlet messages
*** ../vim-7.3.1095/src/testdir/test87.ok 2013-06-01 20:32:09.000000000 +0200
--- src/testdir/test87.ok 2013-06-02 17:39:35.000000000 +0200
***************
*** 26,32 ****
False
[b'0']
{'0': -1}
! (b'', -1)
None
[]
[0, 1, 2, 3]
--- 26,32 ----
False
[b'0']
{'0': -1}
! (b'0', -1)
None
[]
[0, 1, 2, 3]
***************
*** 663,669 ****
d.update((("a", FailingMappingKey()),)):(<class 'NotImplementedError'>, NotImplementedError())
<<< Finished
>> DictionaryPopItem
! d.popitem(1, 2):(<class 'TypeError'>, TypeError('function takes exactly 1 argument (2 given)',))
>> DictionaryHasKey
d.has_key():(<class 'TypeError'>, TypeError('function takes exactly 1 argument (0 given)',))
> List
--- 663,669 ----
d.update((("a", FailingMappingKey()),)):(<class 'NotImplementedError'>, NotImplementedError())
<<< Finished
>> DictionaryPopItem
! d.popitem(1, 2):(<class 'TypeError'>, TypeError('popitem() takes no arguments (2 given)',))
>> DictionaryHasKey
d.has_key():(<class 'TypeError'>, TypeError('function takes exactly 1 argument (0 given)',))
> List
*** ../vim-7.3.1095/src/version.c 2013-06-02 16:40:44.000000000 +0200
--- src/version.c 2013-06-02 17:40:20.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1096,
/**/
--
hundred-and-one symptoms of being an internet addict:
44. Your friends no longer send you e-mail...they just log on to your IRC
channel.
/// 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 ///

81
7.3.1097 Normal file
View File

@ -0,0 +1,81 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1097
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1097
Problem: Python: a few recently added items are not documented.
Solution: Update the documentation. (ZyX)
Files: runtime/doc/if_pyth.txt
*** ../vim-7.3.1096/runtime/doc/if_pyth.txt 2013-06-02 17:41:50.000000000 +0200
--- runtime/doc/if_pyth.txt 2013-06-02 17:44:29.000000000 +0200
***************
*** 176,181 ****
--- 176,185 ----
|python-bindeval-objects|. These python objects let you modify (|List|
or |Dictionary|) or call (|Funcref|) vim objects.
+ vim.strwidth(str) *python-strwidth*
+ Like |strwidth()|: returns number of display cells str occupies, tab
+ is counted as one cell.
+
Error object of the "vim" module
vim.error *python-error*
***************
*** 329,334 ****
--- 333,340 ----
|BufFilePost| autocommands are launched.
b.number Buffer number. Can be used as |python-buffers| key.
Read-only.
+ b.valid True or False. Buffer object becames invalid when
+ corresponding buffer is wiped out.
The buffer object methods are:
b.append(str) Append a line to the buffer
***************
*** 433,438 ****
--- 439,446 ----
row, col (read-only) On-screen window position in display cells.
First position is zero.
tabpage (read-only) Window tab page.
+ valid (read-write) True or False. Window object becames invalid
+ when corresponding window is closed.
The height attribute is writable only if the screen is split horizontally.
The width attribute is writable only if the screen is split vertically.
***************
*** 456,461 ****
--- 464,471 ----
windows Like |python-windows|, but for current tab page.
vars The tab page |t:| variables.
window Current tabpage window.
+ valid True or False. Tab page object becames invalid when
+ corresponding tab page is closed.
TabPage object type is available using "TabPage" attribute of vim module.
*** ../vim-7.3.1096/src/version.c 2013-06-02 17:41:50.000000000 +0200
--- src/version.c 2013-06-02 17:44:06.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1097,
/**/
--
hundred-and-one symptoms of being an internet addict:
45. You buy a Captain Kirk chair with a built-in keyboard and mouse.
/// 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 ///

103
7.3.1098 Normal file
View File

@ -0,0 +1,103 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1098
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1098
Problem: Python: Possible memory leaks
Solution: Add Py_XDECREF() calls. (ZyX)
Files: src/if_py_both.h
*** ../vim-7.3.1097/src/if_py_both.h 2013-06-02 17:41:50.000000000 +0200
--- src/if_py_both.h 2013-06-02 18:01:56.000000000 +0200
***************
*** 1017,1022 ****
--- 1017,1023 ----
if (*key == NUL)
{
RAISE_NO_EMPTY_KEYS;
+ Py_XDECREF(todecref);
return NULL;
}
***************
*** 1160,1165 ****
--- 1161,1167 ----
if (!(key = StringToChars(keyObject, &todecref)))
return -1;
+
if (*key == NUL)
{
RAISE_NO_EMPTY_KEYS;
***************
*** 2216,2224 ****
--- 2218,2228 ----
if (!(key = StringToChars(keyObject, &todecref)))
return NULL;
+
if (*key == NUL)
{
RAISE_NO_EMPTY_KEYS;
+ Py_XDECREF(todecref);
return NULL;
}
***************
*** 2349,2357 ****
--- 2353,2363 ----
if (!(key = StringToChars(keyObject, &todecref)))
return -1;
+
if (*key == NUL)
{
RAISE_NO_EMPTY_KEYS;
+ Py_XDECREF(todecref);
return -1;
}
***************
*** 4568,4573 ****
--- 4574,4580 ----
dict_unref(dict);
return -1;
}
+
if (*key == NUL)
{
dict_unref(dict);
***************
*** 4651,4656 ****
--- 4658,4664 ----
dict_unref(dict);
return -1;
}
+
if (*key == NUL)
{
Py_DECREF(keyObject);
*** ../vim-7.3.1097/src/version.c 2013-06-02 17:46:37.000000000 +0200
--- src/version.c 2013-06-02 18:02:37.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1098,
/**/
--
hundred-and-one symptoms of being an internet addict:
47. You are so familiar with the WWW that you find the search engines useless.
/// 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 ///

505
7.3.1099 Normal file
View File

@ -0,0 +1,505 @@
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1099
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1099
Problem: Python: Changing directory with os.chdir() causes problems for
Vim's notion of directories.
Solution: Add vim.chdir() and vim.fchdir(). (ZyX)
Files: runtime/doc/if_pyth.txt, src/ex_docmd.c, src/if_py_both.h,
src/if_python3.c, src/if_python.c, src/proto/ex_docmd.pro,
src/testdir/test86.in, src/testdir/test86.ok,
src/testdir/test87.in, src/testdir/test87.ok
*** ../vim-7.3.1098/runtime/doc/if_pyth.txt 2013-06-02 17:46:37.000000000 +0200
--- runtime/doc/if_pyth.txt 2013-06-02 18:11:13.000000000 +0200
***************
*** 180,185 ****
--- 180,192 ----
Like |strwidth()|: returns number of display cells str occupies, tab
is counted as one cell.
+ vim.chdir(*args, **kwargs) *python-chdir*
+ vim.fchdir(*args, **kwargs) *python-fchdir*
+ Run os.chdir or os.fchdir, then all appropriate vim stuff.
+ Note: you should not use these functions directly, use os.chdir and
+ os.fchdir instead. Behavior of vim.fchdir is undefined in case
+ os.fchdir does not exist.
+
Error object of the "vim" module
vim.error *python-error*
*** ../vim-7.3.1098/src/ex_docmd.c 2013-05-17 16:39:59.000000000 +0200
--- src/ex_docmd.c 2013-06-02 18:20:05.000000000 +0200
***************
*** 8182,8187 ****
--- 8182,8218 ----
}
#endif
+ /*
+ * Deal with the side effects of changing the current directory.
+ * When "local" is TRUE then this was after an ":lcd" command.
+ */
+ void
+ post_chdir(local)
+ int local;
+ {
+ vim_free(curwin->w_localdir);
+ if (local)
+ {
+ /* If still in global directory, need to remember current
+ * directory as global directory. */
+ if (globaldir == NULL && prev_dir != NULL)
+ globaldir = vim_strsave(prev_dir);
+ /* Remember this local directory for the window. */
+ if (mch_dirname(NameBuff, MAXPATHL) == OK)
+ curwin->w_localdir = vim_strsave(NameBuff);
+ }
+ else
+ {
+ /* We are now in the global directory, no need to remember its
+ * name. */
+ vim_free(globaldir);
+ globaldir = NULL;
+ curwin->w_localdir = NULL;
+ }
+
+ shorten_fnames(TRUE);
+ }
+
/*
* ":cd", ":lcd", ":chdir" and ":lchdir".
***************
*** 8253,8279 ****
EMSG(_(e_failed));
else
{
! vim_free(curwin->w_localdir);
! if (eap->cmdidx == CMD_lcd || eap->cmdidx == CMD_lchdir)
! {
! /* If still in global directory, need to remember current
! * directory as global directory. */
! if (globaldir == NULL && prev_dir != NULL)
! globaldir = vim_strsave(prev_dir);
! /* Remember this local directory for the window. */
! if (mch_dirname(NameBuff, MAXPATHL) == OK)
! curwin->w_localdir = vim_strsave(NameBuff);
! }
! else
! {
! /* We are now in the global directory, no need to remember its
! * name. */
! vim_free(globaldir);
! globaldir = NULL;
! curwin->w_localdir = NULL;
! }
!
! shorten_fnames(TRUE);
/* Echo the new current directory if the command was typed. */
if (KeyTyped || p_verbose >= 5)
--- 8284,8290 ----
EMSG(_(e_failed));
else
{
! post_chdir(eap->cmdidx == CMD_lcd || eap->cmdidx == CMD_lchdir);
/* Echo the new current directory if the command was typed. */
if (KeyTyped || p_verbose >= 5)
*** ../vim-7.3.1098/src/if_py_both.h 2013-06-02 18:07:33.000000000 +0200
--- src/if_py_both.h 2013-06-02 18:11:13.000000000 +0200
***************
*** 52,57 ****
--- 52,61 ----
static PyObject *globals;
+ static PyObject *py_chdir;
+ static PyObject *py_fchdir;
+ static PyObject *py_getcwd;
+
/*
* obtain a lock on the Vim data structures
*/
***************
*** 706,722 ****
);
}
/*
* Vim module - Definitions
*/
static struct PyMethodDef VimMethods[] = {
! /* name, function, calling, documentation */
! {"command", VimCommand, METH_VARARGS, "Execute a Vim ex-mode command" },
! {"eval", VimEval, METH_VARARGS, "Evaluate an expression using Vim evaluator" },
! {"bindeval", VimEvalPy, METH_VARARGS, "Like eval(), but returns objects attached to vim ones"},
! {"strwidth", VimStrwidth, METH_VARARGS, "Screen string width, counts <Tab> as having width 1"},
! { NULL, NULL, 0, NULL }
};
/*
--- 710,793 ----
);
}
+ static PyObject *
+ _VimChdir(PyObject *_chdir, PyObject *args, PyObject *kwargs)
+ {
+ PyObject *r;
+ PyObject *newwd;
+ PyObject *todecref;
+ char_u *new_dir;
+
+ if (!(r = PyObject_Call(_chdir, args, kwargs)))
+ return NULL;
+
+ if (!(newwd = PyObject_CallFunctionObjArgs(py_getcwd, NULL)))
+ {
+ Py_DECREF(r);
+ return NULL;
+ }
+
+ if (!(new_dir = StringToChars(newwd, &todecref)))
+ {
+ Py_DECREF(r);
+ Py_DECREF(newwd);
+ return NULL;
+ }
+
+ VimTryStart();
+
+ if (vim_chdir(new_dir))
+ {
+ Py_DECREF(r);
+ Py_DECREF(newwd);
+ Py_XDECREF(todecref);
+
+ if (VimTryEnd())
+ return NULL;
+
+ PyErr_SetVim(_("failed to change directory"));
+ return NULL;
+ }
+
+ Py_DECREF(newwd);
+ Py_XDECREF(todecref);
+
+ post_chdir(FALSE);
+
+ if (VimTryEnd())
+ {
+ Py_DECREF(r);
+ return NULL;
+ }
+
+ return r;
+ }
+
+ static PyObject *
+ VimChdir(PyObject *self UNUSED, PyObject *args, PyObject *kwargs)
+ {
+ return _VimChdir(py_chdir, args, kwargs);
+ }
+
+ static PyObject *
+ VimFchdir(PyObject *self UNUSED, PyObject *args, PyObject *kwargs)
+ {
+ return _VimChdir(py_fchdir, args, kwargs);
+ }
+
/*
* Vim module - Definitions
*/
static struct PyMethodDef VimMethods[] = {
! /* name, function, calling, documentation */
! {"command", VimCommand, METH_VARARGS, "Execute a Vim ex-mode command" },
! {"eval", VimEval, METH_VARARGS, "Evaluate an expression using Vim evaluator" },
! {"bindeval", VimEvalPy, METH_VARARGS, "Like eval(), but returns objects attached to vim ones"},
! {"strwidth", VimStrwidth, METH_VARARGS, "Screen string width, counts <Tab> as having width 1"},
! {"chdir", (PyCFunction)VimChdir, METH_VARARGS|METH_KEYWORDS, "Change directory"},
! {"fchdir", (PyCFunction)VimFchdir, METH_VARARGS|METH_KEYWORDS, "Change directory"},
! { NULL, NULL, 0, NULL }
};
/*
***************
*** 5274,5279 ****
--- 5345,5351 ----
};
typedef int (*object_adder)(PyObject *, const char *, PyObject *);
+ typedef PyObject *(*attr_getter)(PyObject *, const char *);
#define ADD_OBJECT(m, name, obj) \
if (add_object(m, name, obj)) \
***************
*** 5288,5296 ****
}
static int
! populate_module(PyObject *m, object_adder add_object)
{
int i;
for (i = 0; i < (int)(sizeof(numeric_constants)
/ sizeof(struct numeric_constant));
--- 5360,5369 ----
}
static int
! populate_module(PyObject *m, object_adder add_object, attr_getter get_attr)
{
int i;
+ PyObject *os;
for (i = 0; i < (int)(sizeof(numeric_constants)
/ sizeof(struct numeric_constant));
***************
*** 5317,5321 ****
--- 5390,5416 ----
ADD_CHECKED_OBJECT(m, "vvars", NEW_DICTIONARY(&vimvardict));
ADD_CHECKED_OBJECT(m, "options",
OptionsNew(SREQ_GLOBAL, NULL, dummy_check, NULL));
+
+ if (!(os = PyImport_ImportModule("os")))
+ return -1;
+ ADD_OBJECT(m, "os", os);
+
+ if (!(py_getcwd = PyObject_GetAttrString(os, "getcwd")))
+ return -1;
+ ADD_OBJECT(m, "_getcwd", py_getcwd)
+
+ if (!(py_chdir = PyObject_GetAttrString(os, "chdir")))
+ return -1;
+ ADD_OBJECT(m, "_chdir", py_chdir);
+ if (PyObject_SetAttrString(os, "chdir", get_attr(m, "chdir")))
+ return -1;
+
+ if ((py_fchdir = PyObject_GetAttrString(os, "fchdir")))
+ {
+ ADD_OBJECT(m, "_fchdir", py_fchdir);
+ if (PyObject_SetAttrString(os, "fchdir", get_attr(m, "fchdir")))
+ return -1;
+ }
+
return 0;
}
*** ../vim-7.3.1098/src/if_python3.c 2013-05-30 13:22:07.000000000 +0200
--- src/if_python3.c 2013-06-02 18:14:51.000000000 +0200
***************
*** 174,179 ****
--- 174,180 ----
# define PyObject_HasAttrString py3_PyObject_HasAttrString
# define PyObject_SetAttrString py3_PyObject_SetAttrString
# define PyObject_CallFunctionObjArgs py3_PyObject_CallFunctionObjArgs
+ # define PyObject_Call py3_PyObject_Call
# define PyEval_GetLocals py3_PyEval_GetLocals
# define PyEval_GetGlobals py3_PyEval_GetGlobals
# define PySys_SetObject py3_PySys_SetObject
***************
*** 290,295 ****
--- 291,297 ----
static int (*py3_PyObject_HasAttrString)(PyObject *, const char *);
static PyObject* (*py3_PyObject_SetAttrString)(PyObject *, const char *, PyObject *);
static PyObject* (*py3_PyObject_CallFunctionObjArgs)(PyObject *, ...);
+ static PyObject* (*py3_PyObject_Call)(PyObject *, PyObject *, PyObject *);
static PyObject* (*py3_PyEval_GetGlobals)();
static PyObject* (*py3_PyEval_GetLocals)();
static PyObject* (*py3_PyList_GetItem)(PyObject *, Py_ssize_t);
***************
*** 446,451 ****
--- 448,454 ----
{"PyObject_HasAttrString", (PYTHON_PROC*)&py3_PyObject_HasAttrString},
{"PyObject_SetAttrString", (PYTHON_PROC*)&py3_PyObject_SetAttrString},
{"PyObject_CallFunctionObjArgs", (PYTHON_PROC*)&py3_PyObject_CallFunctionObjArgs},
+ {"PyObject_Call", (PYTHON_PROC*)&py3_PyObject_Call},
{"PyEval_GetGlobals", (PYTHON_PROC*)&py3_PyEval_GetGlobals},
{"PyEval_GetLocals", (PYTHON_PROC*)&py3_PyEval_GetLocals},
{"PyList_GetItem", (PYTHON_PROC*)&py3_PyList_GetItem},
***************
*** 1600,1606 ****
if (mod == NULL)
return NULL;
! if (populate_module(mod, PyModule_AddObject))
return NULL;
return mod;
--- 1603,1609 ----
if (mod == NULL)
return NULL;
! if (populate_module(mod, PyModule_AddObject, PyObject_GetAttrString))
return NULL;
return mod;
*** ../vim-7.3.1098/src/if_python.c 2013-05-30 15:38:20.000000000 +0200
--- src/if_python.c 2013-06-02 18:14:46.000000000 +0200
***************
*** 213,218 ****
--- 213,219 ----
# define PyObject_HasAttrString dll_PyObject_HasAttrString
# define PyObject_SetAttrString dll_PyObject_SetAttrString
# define PyObject_CallFunctionObjArgs dll_PyObject_CallFunctionObjArgs
+ # define PyObject_Call dll_PyObject_Call
# define PyString_AsString dll_PyString_AsString
# define PyString_AsStringAndSize dll_PyString_AsStringAndSize
# define PyString_FromString dll_PyString_FromString
***************
*** 346,351 ****
--- 347,353 ----
static int (*dll_PyObject_HasAttrString)(PyObject *, const char *);
static PyObject* (*dll_PyObject_SetAttrString)(PyObject *, const char *, PyObject *);
static PyObject* (*dll_PyObject_CallFunctionObjArgs)(PyObject *, ...);
+ static PyObject* (*dll_PyObject_Call)(PyObject *, PyObject *, PyObject *);
static char*(*dll_PyString_AsString)(PyObject *);
static int(*dll_PyString_AsStringAndSize)(PyObject *, char **, int *);
static PyObject*(*dll_PyString_FromString)(const char *);
***************
*** 510,515 ****
--- 512,518 ----
{"PyObject_HasAttrString", (PYTHON_PROC*)&dll_PyObject_HasAttrString},
{"PyObject_SetAttrString", (PYTHON_PROC*)&dll_PyObject_SetAttrString},
{"PyObject_CallFunctionObjArgs", (PYTHON_PROC*)&dll_PyObject_CallFunctionObjArgs},
+ {"PyObject_Call", (PYTHON_PROC*)&dll_PyObject_Call},
{"PyString_AsString", (PYTHON_PROC*)&dll_PyString_AsString},
{"PyString_AsStringAndSize", (PYTHON_PROC*)&dll_PyString_AsStringAndSize},
{"PyString_FromString", (PYTHON_PROC*)&dll_PyString_FromString},
***************
*** 1374,1383 ****
/* Set sys.argv[] to avoid a crash in warn(). */
PySys_SetArgv(1, argv);
! mod = Py_InitModule4("vim", VimMethods, (char *)NULL, (PyObject *)NULL, PYTHON_API_VERSION);
dict = PyModule_GetDict(mod);
! return populate_module(dict, add_object);
}
/*************************************************************************
--- 1377,1387 ----
/* Set sys.argv[] to avoid a crash in warn(). */
PySys_SetArgv(1, argv);
! mod = Py_InitModule4("vim", VimMethods, (char *)NULL, (PyObject *)NULL,
! PYTHON_API_VERSION);
dict = PyModule_GetDict(mod);
! return populate_module(dict, add_object, PyDict_GetItemString);
}
/*************************************************************************
*** ../vim-7.3.1098/src/proto/ex_docmd.pro 2012-02-04 21:57:44.000000000 +0100
--- src/proto/ex_docmd.pro 2013-06-02 18:11:13.000000000 +0200
***************
*** 53,56 ****
--- 53,57 ----
int put_line __ARGS((FILE *fd, char *s));
void dialog_msg __ARGS((char_u *buff, char *format, char_u *fname));
char_u *get_behave_arg __ARGS((expand_T *xp, int idx));
+ void post_chdir __ARGS((int local));
/* vim: set ft=c : */
*** ../vim-7.3.1098/src/testdir/test86.in 2013-06-02 17:41:50.000000000 +0200
--- src/testdir/test86.in 2013-06-02 18:11:13.000000000 +0200
***************
*** 788,793 ****
--- 788,807 ----
:$put =string(pyeval('dl2'))
:$put =string(pyeval('df(2)'))
:"
+ :" Test chdir
+ py << EOF
+ import os
+ fnamemodify = vim.Function('fnamemodify')
+ cb.append(fnamemodify('.', ':p:h:t'))
+ cb.append(vim.eval('@%'))
+ os.chdir('..')
+ cb.append(fnamemodify('.', ':p:h:t'))
+ cb.append(vim.eval('@%').replace(os.path.sep, '/'))
+ os.chdir('testdir')
+ cb.append(fnamemodify('.', ':p:h:t'))
+ cb.append(vim.eval('@%'))
+ EOF
+ :"
:" Test errors
:fun F() dict
:endfun
*** ../vim-7.3.1098/src/testdir/test86.ok 2013-06-02 17:41:50.000000000 +0200
--- src/testdir/test86.ok 2013-06-02 18:11:13.000000000 +0200
***************
*** 429,434 ****
--- 429,440 ----
['a', 'b', 'c']
[2, 2]
[2, 2]
+ testdir
+ test86.in
+ src
+ testdir/test86.in
+ testdir
+ test86.in
> Output
>> OutputSetattr
del sys.stdout.softspace:(<type 'exceptions.AttributeError'>, AttributeError("can't delete OutputObject attributes",))
*** ../vim-7.3.1098/src/testdir/test87.in 2013-06-02 17:41:50.000000000 +0200
--- src/testdir/test87.in 2013-06-02 18:11:13.000000000 +0200
***************
*** 748,753 ****
--- 748,767 ----
:$put =string(py3eval('dl2'))
:$put =string(py3eval('df(2)'))
:"
+ :" Test chdir
+ py3 << EOF
+ import os
+ fnamemodify = vim.Function('fnamemodify')
+ cb.append(str(fnamemodify('.', ':p:h:t')))
+ cb.append(vim.eval('@%'))
+ os.chdir('..')
+ cb.append(str(fnamemodify('.', ':p:h:t')))
+ cb.append(vim.eval('@%').replace(os.path.sep, '/'))
+ os.chdir('testdir')
+ cb.append(str(fnamemodify('.', ':p:h:t')))
+ cb.append(vim.eval('@%'))
+ EOF
+ :"
:" Test errors
:fun F() dict
:endfun
*** ../vim-7.3.1098/src/testdir/test87.ok 2013-06-02 17:41:50.000000000 +0200
--- src/testdir/test87.ok 2013-06-02 18:11:13.000000000 +0200
***************
*** 418,423 ****
--- 418,429 ----
['a', 'b', 'c']
[2, 2]
[2, 2]
+ b'testdir'
+ test87.in
+ b'src'
+ testdir/test87.in
+ b'testdir'
+ test87.in
> Output
>> OutputSetattr
del sys.stdout.softspace:(<class 'AttributeError'>, AttributeError("can't delete OutputObject attributes",))
*** ../vim-7.3.1098/src/version.c 2013-06-02 18:07:33.000000000 +0200
--- src/version.c 2013-06-02 18:12:58.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1099,
/**/

Some files were not shown because too many files have changed in this diff Show More