Karsten Hopp ae61a4
To: vim_dev@googlegroups.com
Karsten Hopp ae61a4
Subject: Patch 7.3.994
Karsten Hopp ae61a4
Fcc: outbox
Karsten Hopp ae61a4
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp ae61a4
Mime-Version: 1.0
Karsten Hopp ae61a4
Content-Type: text/plain; charset=UTF-8
Karsten Hopp ae61a4
Content-Transfer-Encoding: 8bit
Karsten Hopp ae61a4
------------
Karsten Hopp ae61a4
Karsten Hopp ae61a4
Patch 7.3.994
Karsten Hopp ae61a4
Problem:    Python: using magic constants.
Karsten Hopp ae61a4
Solution:   Use descriptive values for ml_flags. (ZyX)
Karsten Hopp ae61a4
Files:	    src/if_py_both.h, src/if_python3.c
Karsten Hopp ae61a4
Karsten Hopp ae61a4
Karsten Hopp ae61a4
*** ../vim-7.3.993/src/if_py_both.h	2013-05-21 18:47:17.000000000 +0200
Karsten Hopp ae61a4
--- src/if_py_both.h	2013-05-21 18:51:12.000000000 +0200
Karsten Hopp ae61a4
***************
Karsten Hopp ae61a4
*** 220,226 ****
Karsten Hopp ae61a4
  }
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
      static PyObject *
Karsten Hopp ae61a4
! OutputFlush(PyObject *self UNUSED, PyObject *args UNUSED)
Karsten Hopp ae61a4
  {
Karsten Hopp ae61a4
      /* do nothing */
Karsten Hopp ae61a4
      Py_INCREF(Py_None);
Karsten Hopp ae61a4
--- 220,226 ----
Karsten Hopp ae61a4
  }
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
      static PyObject *
Karsten Hopp ae61a4
! OutputFlush(PyObject *self UNUSED)
Karsten Hopp ae61a4
  {
Karsten Hopp ae61a4
      /* do nothing */
Karsten Hopp ae61a4
      Py_INCREF(Py_None);
Karsten Hopp ae61a4
***************
Karsten Hopp ae61a4
*** 230,240 ****
Karsten Hopp ae61a4
  /***************/
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
  static struct PyMethodDef OutputMethods[] = {
Karsten Hopp ae61a4
!     /* name,	    function,				calling,    doc */
Karsten Hopp ae61a4
!     {"write",	    (PyCFunction)OutputWrite,		1,	    ""},
Karsten Hopp ae61a4
!     {"writelines",  (PyCFunction)OutputWritelines,	1,	    ""},
Karsten Hopp ae61a4
!     {"flush",	    (PyCFunction)OutputFlush,		1,	    ""},
Karsten Hopp ae61a4
!     { NULL,	    NULL,				0,	    NULL}
Karsten Hopp ae61a4
  };
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
  static OutputObject Output =
Karsten Hopp ae61a4
--- 230,240 ----
Karsten Hopp ae61a4
  /***************/
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
  static struct PyMethodDef OutputMethods[] = {
Karsten Hopp ae61a4
!     /* name,	    function,				calling,	doc */
Karsten Hopp ae61a4
!     {"write",	    (PyCFunction)OutputWrite,		METH_VARARGS,	""},
Karsten Hopp ae61a4
!     {"writelines",  (PyCFunction)OutputWritelines,	METH_VARARGS,	""},
Karsten Hopp ae61a4
!     {"flush",	    (PyCFunction)OutputFlush,		METH_NOARGS,	""},
Karsten Hopp ae61a4
!     { NULL,	    NULL,				0,		NULL}
Karsten Hopp ae61a4
  };
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
  static OutputObject Output =
Karsten Hopp ae61a4
***************
Karsten Hopp ae61a4
*** 533,544 ****
Karsten Hopp ae61a4
   */
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
  static struct PyMethodDef VimMethods[] = {
Karsten Hopp ae61a4
!     /* name,	     function,		calling,    documentation */
Karsten Hopp ae61a4
!     {"command",	     VimCommand,	1,	    "Execute a Vim ex-mode command" },
Karsten Hopp ae61a4
!     {"eval",	     VimEval,		1,	    "Evaluate an expression using Vim evaluator" },
Karsten Hopp ae61a4
!     {"bindeval",     VimEvalPy,		1,	    "Like eval(), but returns objects attached to vim ones"},
Karsten Hopp ae61a4
!     {"strwidth",     VimStrwidth,	1,	    "Screen string width, counts <Tab> as having width 1"},
Karsten Hopp ae61a4
!     { NULL,	     NULL,		0,	    NULL }
Karsten Hopp ae61a4
  };
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
  /*
Karsten Hopp ae61a4
--- 533,544 ----
Karsten Hopp ae61a4
   */
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
  static struct PyMethodDef VimMethods[] = {
Karsten Hopp ae61a4
!     /* name,	     function,		calling,	documentation */
Karsten Hopp ae61a4
!     {"command",	     VimCommand,	METH_VARARGS,	"Execute a Vim ex-mode command" },
Karsten Hopp ae61a4
!     {"eval",	     VimEval,		METH_VARARGS,	"Evaluate an expression using Vim evaluator" },
Karsten Hopp ae61a4
!     {"bindeval",     VimEvalPy,		METH_VARARGS,	"Like eval(), but returns objects attached to vim ones"},
Karsten Hopp ae61a4
!     {"strwidth",     VimStrwidth,	METH_VARARGS,	"Screen string width, counts <Tab> as having width 1"},
Karsten Hopp ae61a4
!     { NULL,	     NULL,		0,		NULL }
Karsten Hopp ae61a4
  };
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
  /*
Karsten Hopp ae61a4
***************
Karsten Hopp ae61a4
*** 868,875 ****
Karsten Hopp ae61a4
  };
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
  static struct PyMethodDef DictionaryMethods[] = {
Karsten Hopp ae61a4
!     {"keys", (PyCFunction)DictionaryListKeys, METH_NOARGS, ""},
Karsten Hopp ae61a4
!     { NULL,	    NULL,		0,	    NULL }
Karsten Hopp ae61a4
  };
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
  static PyTypeObject ListType;
Karsten Hopp ae61a4
--- 868,875 ----
Karsten Hopp ae61a4
  };
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
  static struct PyMethodDef DictionaryMethods[] = {
Karsten Hopp ae61a4
!     {"keys",	(PyCFunction)DictionaryListKeys,	METH_NOARGS,	""},
Karsten Hopp ae61a4
!     { NULL,	NULL,					0,		NULL }
Karsten Hopp ae61a4
  };
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
  static PyTypeObject ListType;
Karsten Hopp ae61a4
***************
Karsten Hopp ae61a4
*** 1248,1255 ****
Karsten Hopp ae61a4
  }
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
  static struct PyMethodDef ListMethods[] = {
Karsten Hopp ae61a4
!     {"extend", (PyCFunction)ListConcatInPlace, METH_O, ""},
Karsten Hopp ae61a4
!     { NULL,	    NULL,		0,	    NULL }
Karsten Hopp ae61a4
  };
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
  typedef struct
Karsten Hopp ae61a4
--- 1248,1255 ----
Karsten Hopp ae61a4
  }
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
  static struct PyMethodDef ListMethods[] = {
Karsten Hopp ae61a4
!     {"extend",	(PyCFunction)ListConcatInPlace,	METH_O,	""},
Karsten Hopp ae61a4
!     { NULL,	NULL,				0,	NULL }
Karsten Hopp ae61a4
  };
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
  typedef struct
Karsten Hopp ae61a4
***************
Karsten Hopp ae61a4
*** 1349,1356 ****
Karsten Hopp ae61a4
  }
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
  static struct PyMethodDef FunctionMethods[] = {
Karsten Hopp ae61a4
!     {"__call__",    (PyCFunction)FunctionCall, METH_VARARGS|METH_KEYWORDS, ""},
Karsten Hopp ae61a4
!     { NULL,	    NULL,		0,	    NULL }
Karsten Hopp ae61a4
  };
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
  /*
Karsten Hopp ae61a4
--- 1349,1356 ----
Karsten Hopp ae61a4
  }
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
  static struct PyMethodDef FunctionMethods[] = {
Karsten Hopp ae61a4
!     {"__call__",    (PyCFunction)FunctionCall,	METH_VARARGS|METH_KEYWORDS, ""},
Karsten Hopp ae61a4
!     { NULL,	    NULL,			0,			   NULL}
Karsten Hopp ae61a4
  };
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
  /*
Karsten Hopp ae61a4
***************
Karsten Hopp ae61a4
*** 2960,2968 ****
Karsten Hopp ae61a4
  }
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
  static struct PyMethodDef RangeMethods[] = {
Karsten Hopp ae61a4
!     /* name,	    function,			calling,    documentation */
Karsten Hopp ae61a4
!     {"append",	    (PyCFunction)RangeAppend,	1,	    "Append data to the Vim range" },
Karsten Hopp ae61a4
!     { NULL,	    NULL,			0,	    NULL }
Karsten Hopp ae61a4
  };
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
  static PyTypeObject BufferType;
Karsten Hopp ae61a4
--- 2960,2968 ----
Karsten Hopp ae61a4
  }
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
  static struct PyMethodDef RangeMethods[] = {
Karsten Hopp ae61a4
!     /* name,	function,			calling,	documentation */
Karsten Hopp ae61a4
!     {"append",	(PyCFunction)RangeAppend,	METH_VARARGS,	"Append data to the Vim range" },
Karsten Hopp ae61a4
!     { NULL,	NULL,				0,		NULL }
Karsten Hopp ae61a4
  };
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
  static PyTypeObject BufferType;
Karsten Hopp ae61a4
***************
Karsten Hopp ae61a4
*** 3146,3159 ****
Karsten Hopp ae61a4
  }
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
  static struct PyMethodDef BufferMethods[] = {
Karsten Hopp ae61a4
!     /* name,	    function,			calling,    documentation */
Karsten Hopp ae61a4
!     {"append",	    (PyCFunction)BufferAppend,	1,	    "Append data to Vim buffer" },
Karsten Hopp ae61a4
!     {"mark",	    (PyCFunction)BufferMark,	1,	    "Return (row,col) representing position of named mark" },
Karsten Hopp ae61a4
!     {"range",	    (PyCFunction)BufferRange,	1,	    "Return a range object which represents the part of the given buffer between line numbers s and e" },
Karsten Hopp ae61a4
  #if PY_VERSION_HEX >= 0x03000000
Karsten Hopp ae61a4
!     {"__dir__",	    (PyCFunction)BufferDir,	4,	    "List its attributes" },
Karsten Hopp ae61a4
  #endif
Karsten Hopp ae61a4
!     { NULL,	    NULL,			0,	    NULL }
Karsten Hopp ae61a4
  };
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
  /*
Karsten Hopp ae61a4
--- 3146,3159 ----
Karsten Hopp ae61a4
  }
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
  static struct PyMethodDef BufferMethods[] = {
Karsten Hopp ae61a4
!     /* name,	    function,			calling,	documentation */
Karsten Hopp ae61a4
!     {"append",	    (PyCFunction)BufferAppend,	METH_VARARGS,	"Append data to Vim buffer" },
Karsten Hopp ae61a4
!     {"mark",	    (PyCFunction)BufferMark,	METH_VARARGS,	"Return (row,col) representing position of named mark" },
Karsten Hopp ae61a4
!     {"range",	    (PyCFunction)BufferRange,	METH_VARARGS,	"Return a range object which represents the part of the given buffer between line numbers s and e" },
Karsten Hopp ae61a4
  #if PY_VERSION_HEX >= 0x03000000
Karsten Hopp ae61a4
!     {"__dir__",	    (PyCFunction)BufferDir,	METH_NOARGS,	"List buffer attributes" },
Karsten Hopp ae61a4
  #endif
Karsten Hopp ae61a4
!     { NULL,	    NULL,			0,		NULL }
Karsten Hopp ae61a4
  };
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
  /*
Karsten Hopp ae61a4
*** ../vim-7.3.993/src/if_python3.c	2013-05-21 18:47:17.000000000 +0200
Karsten Hopp ae61a4
--- src/if_python3.c	2013-05-21 18:51:12.000000000 +0200
Karsten Hopp ae61a4
***************
Karsten Hopp ae61a4
*** 666,672 ****
Karsten Hopp ae61a4
      return PyType_GenericAlloc(type,nitems);
Karsten Hopp ae61a4
  }
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
! static PyObject *BufferDir(PyObject *, PyObject *);
Karsten Hopp ae61a4
  static PyObject *OutputGetattro(PyObject *, PyObject *);
Karsten Hopp ae61a4
  static int OutputSetattro(PyObject *, PyObject *, PyObject *);
Karsten Hopp ae61a4
  static PyObject *BufferGetattro(PyObject *, PyObject *);
Karsten Hopp ae61a4
--- 666,672 ----
Karsten Hopp ae61a4
      return PyType_GenericAlloc(type,nitems);
Karsten Hopp ae61a4
  }
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
! static PyObject *BufferDir(PyObject *);
Karsten Hopp ae61a4
  static PyObject *OutputGetattro(PyObject *, PyObject *);
Karsten Hopp ae61a4
  static int OutputSetattro(PyObject *, PyObject *, PyObject *);
Karsten Hopp ae61a4
  static PyObject *BufferGetattro(PyObject *, PyObject *);
Karsten Hopp ae61a4
***************
Karsten Hopp ae61a4
*** 1091,1097 ****
Karsten Hopp ae61a4
  }
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
      static PyObject *
Karsten Hopp ae61a4
! BufferDir(PyObject *self UNUSED, PyObject *args UNUSED)
Karsten Hopp ae61a4
  {
Karsten Hopp ae61a4
      return Py_BuildValue("[sssss]", "name", "number",
Karsten Hopp ae61a4
  						   "append", "mark", "range");
Karsten Hopp ae61a4
--- 1091,1097 ----
Karsten Hopp ae61a4
  }
Karsten Hopp ae61a4
  
Karsten Hopp ae61a4
      static PyObject *
Karsten Hopp ae61a4
! BufferDir(PyObject *self UNUSED)
Karsten Hopp ae61a4
  {
Karsten Hopp ae61a4
      return Py_BuildValue("[sssss]", "name", "number",
Karsten Hopp ae61a4
  						   "append", "mark", "range");
Karsten Hopp ae61a4
*** ../vim-7.3.993/src/version.c	2013-05-21 18:47:17.000000000 +0200
Karsten Hopp ae61a4
--- src/version.c	2013-05-21 18:51:33.000000000 +0200
Karsten Hopp ae61a4
***************
Karsten Hopp ae61a4
*** 730,731 ****
Karsten Hopp ae61a4
--- 730,733 ----
Karsten Hopp ae61a4
  {   /* Add new patch number below this line */
Karsten Hopp ae61a4
+ /**/
Karsten Hopp ae61a4
+     994,
Karsten Hopp ae61a4
  /**/
Karsten Hopp ae61a4
Karsten Hopp ae61a4
-- 
Karsten Hopp ae61a4
It might look like I'm doing nothing, but at the cellular level
Karsten Hopp ae61a4
I'm really quite busy.
Karsten Hopp ae61a4
Karsten Hopp ae61a4
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp ae61a4
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp ae61a4
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp ae61a4
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///