Blob Blame History Raw
To: vim-dev@vim.org
Subject: Patch 7.1.320
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
------------

Patch 7.1.320 (extra)
Problem:    Win64: Warnings while compiling Python interface.
Solution:   Use PyInt in more places.  Also update version message for the
	    console. (George Reilly)
Files:	    src/if_python.c, src/version.c


*** ../vim-7.1.319/src/if_python.c	Wed Jun  4 13:33:15 2008
--- src/if_python.c	Fri Jun 20 14:45:59 2008
***************
*** 50,60 ****
  
  #if !defined(FEAT_PYTHON) && defined(PROTO)
  /* Use this to be able to generate prototypes without python being used. */
! # define PyObject int
! # define PyThreadState int
! # define PyTypeObject int
! struct PyMethodDef { int a; };
! # define PySequenceMethods int
  #endif
  
  #if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02050000
--- 50,60 ----
  
  #if !defined(FEAT_PYTHON) && defined(PROTO)
  /* Use this to be able to generate prototypes without python being used. */
! # define PyObject Py_ssize_t
! # define PyThreadState Py_ssize_t
! # define PyTypeObject Py_ssize_t
! struct PyMethodDef { Py_ssize_t a; };
! # define PySequenceMethods Py_ssize_t
  #endif
  
  #if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02050000
***************
*** 64,69 ****
--- 64,70 ----
  # define PyIntIntArgFunc ssizessizeargfunc
  # define PyIntObjArgProc ssizeobjargproc
  # define PyIntIntObjArgProc ssizessizeobjargproc
+ # define Py_ssize_t_fmt "n"
  #else
  # define PyInt int
  # define PyInquiry inquiry
***************
*** 71,76 ****
--- 72,78 ----
  # define PyIntIntArgFunc intintargfunc
  # define PyIntObjArgProc intobjargproc
  # define PyIntIntObjArgProc intintobjargproc
+ # define Py_ssize_t_fmt "i"
  #endif
  
  /* Parser flags */
***************
*** 85,93 ****
  
  #if defined(DYNAMIC_PYTHON) || defined(PROTO)
  # ifndef DYNAMIC_PYTHON
! #  define HINSTANCE int		/* for generating prototypes */
  # endif
  
  /*
   * Wrapper defines
   */
--- 87,104 ----
  
  #if defined(DYNAMIC_PYTHON) || defined(PROTO)
  # ifndef DYNAMIC_PYTHON
! #  define HINSTANCE long_u		/* for generating prototypes */
  # endif
  
+ /* This makes if_python.c compile without warnings against Python 2.5
+  * on Win32 and Win64. */
+ #undef PyRun_SimpleString
+ #undef PyArg_Parse
+ #undef PyArg_ParseTuple
+ #undef Py_BuildValue
+ #undef Py_InitModule4
+ #undef Py_InitModule4_64
+ 
  /*
   * Wrapper defines
   */
***************
*** 269,275 ****
--- 280,290 ----
      {"PyType_Type", (PYTHON_PROC*)&dll_PyType_Type},
      {"Py_BuildValue", (PYTHON_PROC*)&dll_Py_BuildValue},
      {"Py_FindMethod", (PYTHON_PROC*)&dll_Py_FindMethod},
+ # if (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_Initialize", (PYTHON_PROC*)&dll_Py_Initialize},
      {"Py_Finalize", (PYTHON_PROC*)&dll_Py_Finalize},
      {"Py_IsInitialized", (PYTHON_PROC*)&dll_Py_IsInitialized},
***************
*** 339,346 ****
   * TRUE, else FALSE.
   */
      int
! python_enabled(verbose)
!     int		verbose;
  {
      return python_runtime_link_init(DYNAMIC_PYTHON_DLL, verbose) == OK;
  }
--- 354,360 ----
   * TRUE, else FALSE.
   */
      int
! python_enabled(int verbose)
  {
      return python_runtime_link_init(DYNAMIC_PYTHON_DLL, verbose) == OK;
  }
***************
*** 374,381 ****
   */
  
  static void DoPythonCommand(exarg_T *, const char *);
! static int RangeStart;
! static int RangeEnd;
  
  static void PythonIO_Flush(void);
  static int PythonIO_Init(void);
--- 388,395 ----
   */
  
  static void DoPythonCommand(exarg_T *, const char *);
! static PyInt RangeStart;
! static PyInt RangeEnd;
  
  static void PythonIO_Flush(void);
  static int PythonIO_Init(void);
***************
*** 384,395 ****
  /* Utility functions for the vim/python interface
   * ----------------------------------------------
   */
! static PyObject *GetBufferLine(buf_T *, int);
  static PyObject *GetBufferLineList(buf_T *, PyInt, PyInt);
  
! static int SetBufferLine(buf_T *, int, PyObject *, int *);
! static int SetBufferLineList(buf_T *, PyInt, PyInt, PyObject *, int *);
! static int InsertBufferLines(buf_T *, int, PyObject *, int *);
  
  static PyObject *LineToString(const char *);
  static char *StringToLine(PyObject *);
--- 398,409 ----
  /* Utility functions for the vim/python interface
   * ----------------------------------------------
   */
! static PyObject *GetBufferLine(buf_T *, PyInt);
  static PyObject *GetBufferLineList(buf_T *, PyInt, PyInt);
  
! static int SetBufferLine(buf_T *, PyInt, PyObject *, PyInt *);
! static int SetBufferLineList(buf_T *, PyInt, PyInt, PyObject *, PyInt *);
! static int InsertBufferLines(buf_T *, PyInt, PyObject *, PyInt *);
  
  static PyObject *LineToString(const char *);
  static char *StringToLine(PyObject *);
***************
*** 690,696 ****
  static PyObject *OutputWritelines(PyObject *, PyObject *);
  
  typedef void (*writefn)(char_u *);
! static void writer(writefn fn, char_u *str, int n);
  
  /* Output object definition
   */
--- 704,710 ----
  static PyObject *OutputWritelines(PyObject *, PyObject *);
  
  typedef void (*writefn)(char_u *);
! static void writer(writefn fn, char_u *str, PyInt n);
  
  /* Output object definition
   */
***************
*** 812,818 ****
      {
  	PyObject *line = PyList_GetItem(list, i);
  	char *str;
! 	int len;
  
  	if (!PyArg_Parse(line, "s#", &str, &len)) {
  	    PyErr_SetString(PyExc_TypeError, _("writelines() requires list of strings"));
--- 826,832 ----
      {
  	PyObject *line = PyList_GetItem(list, i);
  	char *str;
! 	PyInt len;
  
  	if (!PyArg_Parse(line, "s#", &str, &len)) {
  	    PyErr_SetString(PyExc_TypeError, _("writelines() requires list of strings"));
***************
*** 836,850 ****
   */
  
  static char_u *buffer = NULL;
! static int buffer_len = 0;
! static int buffer_size = 0;
  
  static writefn old_fn = NULL;
  
      static void
! buffer_ensure(int n)
  {
!     int new_size;
      char_u *new_buffer;
  
      if (n < buffer_size)
--- 850,864 ----
   */
  
  static char_u *buffer = NULL;
! static PyInt buffer_len = 0;
! static PyInt buffer_size = 0;
  
  static writefn old_fn = NULL;
  
      static void
! buffer_ensure(PyInt n)
  {
!     PyInt new_size;
      char_u *new_buffer;
  
      if (n < buffer_size)
***************
*** 884,890 ****
  }
  
      static void
! writer(writefn fn, char_u *str, int n)
  {
      char_u *ptr;
  
--- 898,904 ----
  }
  
      static void
! writer(writefn fn, char_u *str, PyInt n)
  {
      char_u *ptr;
  
***************
*** 895,901 ****
  
      while (n > 0 && (ptr = memchr(str, '\n', n)) != NULL)
      {
! 	int len = ptr - str;
  
  	buffer_ensure(buffer_len + len + 1);
  
--- 909,915 ----
  
      while (n > 0 && (ptr = memchr(str, '\n', n)) != NULL)
      {
! 	PyInt len = ptr - str;
  
  	buffer_ensure(buffer_len + len + 1);
  
***************
*** 1022,1035 ****
  {
      PyObject_HEAD
      BufferObject *buf;
!     int start;
!     int end;
  }
  RangeObject;
  
  #define RangeType_Check(obj) ((obj)->ob_type == &RangeType)
  
! static PyObject *RangeNew(buf_T *, int, int);
  
  static void RangeDestructor(PyObject *);
  static PyObject *RangeGetattr(PyObject *, char *);
--- 1036,1049 ----
  {
      PyObject_HEAD
      BufferObject *buf;
!     PyInt start;
!     PyInt end;
  }
  RangeObject;
  
  #define RangeType_Check(obj) ((obj)->ob_type == &RangeType)
  
! static PyObject *RangeNew(buf_T *, PyInt, PyInt);
  
  static void RangeDestructor(PyObject *);
  static PyObject *RangeGetattr(PyObject *, char *);
***************
*** 1069,1076 ****
  
  static struct PyMethodDef VimMethods[] = {
      /* name,	     function,		calling,    documentation */
!     {"command",	     VimCommand,	1,	    "" },
!     {"eval",	     VimEval,		1,	    "" },
      { NULL,	     NULL,		0,	    NULL }
  };
  
--- 1083,1090 ----
  
  static struct PyMethodDef VimMethods[] = {
      /* name,	     function,		calling,    documentation */
!     {"command",	     VimCommand,	1,	    "Execute a Vim ex-mode command" },
!     {"eval",	     VimEval,		1,	    "Evaluate an expression using Vim evaluator" },
      { NULL,	     NULL,		0,	    NULL }
  };
  
***************
*** 1110,1116 ****
   * Function to translate a typval_T into a PyObject; this will recursively
   * translate lists/dictionaries into their Python equivalents.
   *
!  * The depth parameter is too avoid infinite recursion, set it to 1 when
   * you call VimToPython.
   */
      static PyObject *
--- 1124,1130 ----
   * Function to translate a typval_T into a PyObject; this will recursively
   * translate lists/dictionaries into their Python equivalents.
   *
!  * The depth parameter is to avoid infinite recursion, set it to 1 when
   * you call VimToPython.
   */
      static PyObject *
***************
*** 1130,1136 ****
  
      /* Check if we run into a recursive loop.  The item must be in lookupDict
       * then and we can use it again. */
!     sprintf(ptrBuf, "%ld", (long)our_tv);
      result = PyDict_GetItemString(lookupDict, ptrBuf);
      if (result != NULL)
  	Py_INCREF(result);
--- 1144,1150 ----
  
      /* Check if we run into a recursive loop.  The item must be in lookupDict
       * then and we can use it again. */
!     sprintf(ptrBuf, PRINTF_DECIMAL_LONG_U, (long_u)our_tv);
      result = PyDict_GetItemString(lookupDict, ptrBuf);
      if (result != NULL)
  	Py_INCREF(result);
***************
*** 1184,1190 ****
  	if (our_tv->vval.v_dict != NULL)
  	{
  	    hashtab_T	*ht = &our_tv->vval.v_dict->dv_hashtab;
! 	    int		todo = ht->ht_used;
  	    hashitem_T	*hi;
  	    dictitem_T	*di;
  
--- 1198,1204 ----
  	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;
  
***************
*** 1273,1279 ****
  }
  
      static PyObject *
! RBItem(BufferObject *self, PyInt n, int start, int end)
  {
      if (CheckBuffer(self))
  	return NULL;
--- 1287,1293 ----
  }
  
      static PyObject *
! RBItem(BufferObject *self, PyInt n, PyInt start, PyInt end)
  {
      if (CheckBuffer(self))
  	return NULL;
***************
*** 1288,1294 ****
  }
  
      static PyObject *
! RBSlice(BufferObject *self, PyInt lo, PyInt hi, int start, int end)
  {
      PyInt size;
  
--- 1302,1308 ----
  }
  
      static PyObject *
! RBSlice(BufferObject *self, PyInt lo, PyInt hi, PyInt start, PyInt end)
  {
      PyInt size;
  
***************
*** 1312,1320 ****
  }
  
      static PyInt
! RBAssItem(BufferObject *self, PyInt n, PyObject *val, int start, int end, int *new_end)
  {
!     int len_change;
  
      if (CheckBuffer(self))
  	return -1;
--- 1326,1334 ----
  }
  
      static PyInt
! RBAssItem(BufferObject *self, PyInt n, PyObject *val, PyInt start, PyInt end, PyInt *new_end)
  {
!     PyInt len_change;
  
      if (CheckBuffer(self))
  	return -1;
***************
*** 1335,1344 ****
  }
  
      static PyInt
! RBAssSlice(BufferObject *self, PyInt lo, PyInt hi, PyObject *val, int start, int end, int *new_end)
  {
!     int size;
!     int len_change;
  
      /* Self must be a valid buffer */
      if (CheckBuffer(self))
--- 1349,1358 ----
  }
  
      static PyInt
! RBAssSlice(BufferObject *self, PyInt lo, PyInt hi, PyObject *val, PyInt start, PyInt end, PyInt *new_end)
  {
!     PyInt size;
!     PyInt len_change;
  
      /* Self must be a valid buffer */
      if (CheckBuffer(self))
***************
*** 1368,1386 ****
  }
  
      static PyObject *
! RBAppend(BufferObject *self, PyObject *args, int start, int end, int *new_end)
  {
      PyObject *lines;
!     int len_change;
!     int max;
!     int n;
  
      if (CheckBuffer(self))
  	return NULL;
  
      max = n = end - start + 1;
  
!     if (!PyArg_ParseTuple(args, "O|i", &lines, &n))
  	return NULL;
  
      if (n < 0 || n > max)
--- 1382,1400 ----
  }
  
      static PyObject *
! RBAppend(BufferObject *self, PyObject *args, PyInt start, PyInt end, PyInt *new_end)
  {
      PyObject *lines;
!     PyInt len_change;
!     PyInt max;
!     PyInt n;
  
      if (CheckBuffer(self))
  	return NULL;
  
      max = n = end - start + 1;
  
!     if (!PyArg_ParseTuple(args, "O|" Py_ssize_t_fmt, &lines, &n))
  	return NULL;
  
      if (n < 0 || n > max)
***************
*** 1405,1413 ****
  
  static struct PyMethodDef BufferMethods[] = {
      /* name,	    function,		calling,    documentation */
!     {"append",	    BufferAppend,	1,	    "" },
!     {"mark",	    BufferMark,		1,	    "" },
!     {"range",	    BufferRange,	1,	    "" },
      { NULL,	    NULL,		0,	    NULL }
  };
  
--- 1419,1427 ----
  
  static struct PyMethodDef BufferMethods[] = {
      /* name,	    function,		calling,    documentation */
!     {"append",	    BufferAppend,	1,	    "Append data to Vim buffer" },
!     {"mark",	    BufferMark,		1,	    "Return (row,col) representing position of named mark" },
!     {"range",	    BufferRange,	1,	    "Return a range object which represents the part of the given buffer between line numbers s and e" },
      { NULL,	    NULL,		0,	    NULL }
  };
  
***************
*** 1503,1511 ****
  	return NULL;
  
      if (strcmp(name, "name") == 0)
! 	return Py_BuildValue("s",this->buf->b_ffname);
      else if (strcmp(name, "number") == 0)
! 	return Py_BuildValue("i",this->buf->b_fnum);
      else if (strcmp(name,"__members__") == 0)
  	return Py_BuildValue("[ss]", "name", "number");
      else
--- 1517,1525 ----
  	return NULL;
  
      if (strcmp(name, "name") == 0)
! 	return Py_BuildValue("s", this->buf->b_ffname);
      else if (strcmp(name, "number") == 0)
! 	return Py_BuildValue(Py_ssize_t_fmt, this->buf->b_fnum);
      else if (strcmp(name,"__members__") == 0)
  	return Py_BuildValue("[ss]", "name", "number");
      else
***************
*** 1520,1533 ****
  
      if (this->buf == INVALID_BUFFER_VALUE)
      {
! 	vim_snprintf(repr, 100, _("<buffer object (deleted) at %8lX>"),
! 								(long)(self));
  	return PyString_FromString(repr);
      }
      else
      {
  	char *name = (char *)this->buf->b_fname;
! 	int len;
  
  	if (name == NULL)
  	    name = "";
--- 1534,1546 ----
  
      if (this->buf == INVALID_BUFFER_VALUE)
      {
! 	vim_snprintf(repr, 100, _("<buffer object (deleted) at %p>"), (self));
  	return PyString_FromString(repr);
      }
      else
      {
  	char *name = (char *)this->buf->b_fname;
! 	PyInt len;
  
  	if (name == NULL)
  	    name = "";
***************
*** 1572,1578 ****
  BufferAssItem(PyObject *self, PyInt n, PyObject *val)
  {
      return RBAssItem((BufferObject *)(self), n, val, 1,
! 		     (int)((BufferObject *)(self))->buf->b_ml.ml_line_count,
  		     NULL);
  }
  
--- 1585,1591 ----
  BufferAssItem(PyObject *self, PyInt n, PyObject *val)
  {
      return RBAssItem((BufferObject *)(self), n, val, 1,
! 		     (PyInt)((BufferObject *)(self))->buf->b_ml.ml_line_count,
  		     NULL);
  }
  
***************
*** 1580,1586 ****
  BufferAssSlice(PyObject *self, PyInt lo, PyInt hi, PyObject *val)
  {
      return RBAssSlice((BufferObject *)(self), lo, hi, val, 1,
! 		      (int)((BufferObject *)(self))->buf->b_ml.ml_line_count,
  		      NULL);
  }
  
--- 1593,1599 ----
  BufferAssSlice(PyObject *self, PyInt lo, PyInt hi, PyObject *val)
  {
      return RBAssSlice((BufferObject *)(self), lo, hi, val, 1,
! 		      (PyInt)((BufferObject *)(self))->buf->b_ml.ml_line_count,
  		      NULL);
  }
  
***************
*** 1588,1594 ****
  BufferAppend(PyObject *self, PyObject *args)
  {
      return RBAppend((BufferObject *)(self), args, 1,
! 		    (int)((BufferObject *)(self))->buf->b_ml.ml_line_count,
  		    NULL);
  }
  
--- 1601,1607 ----
  BufferAppend(PyObject *self, PyObject *args)
  {
      return RBAppend((BufferObject *)(self), args, 1,
! 		    (PyInt)((BufferObject *)(self))->buf->b_ml.ml_line_count,
  		    NULL);
  }
  
***************
*** 1633,1645 ****
      static PyObject *
  BufferRange(PyObject *self, PyObject *args)
  {
!     int start;
!     int end;
  
      if (CheckBuffer((BufferObject *)(self)))
  	return NULL;
  
!     if (!PyArg_ParseTuple(args, "ii", &start, &end))
  	return NULL;
  
      return RangeNew(((BufferObject *)(self))->buf, start, end);
--- 1646,1658 ----
      static PyObject *
  BufferRange(PyObject *self, PyObject *args)
  {
!     PyInt start;
!     PyInt end;
  
      if (CheckBuffer((BufferObject *)(self)))
  	return NULL;
  
!     if (!PyArg_ParseTuple(args, Py_ssize_t_fmt Py_ssize_t_fmt, &start, &end))
  	return NULL;
  
      return RangeNew(((BufferObject *)(self))->buf, start, end);
***************
*** 1650,1656 ****
  
  static struct PyMethodDef RangeMethods[] = {
      /* name,	    function,		calling,    documentation */
!     {"append",	    RangeAppend,	1,	    "" },
      { NULL,	    NULL,		0,	    NULL }
  };
  
--- 1663,1669 ----
  
  static struct PyMethodDef RangeMethods[] = {
      /* name,	    function,		calling,    documentation */
!     {"append",	    RangeAppend,	1,	    "Append data to the Vim range" },
      { NULL,	    NULL,		0,	    NULL }
  };
  
***************
*** 1691,1697 ****
   */
  
      static PyObject *
! RangeNew(buf_T *buf, int start, int end)
  {
      BufferObject *bufr;
      RangeObject *self;
--- 1704,1710 ----
   */
  
      static PyObject *
! RangeNew(buf_T *buf, PyInt start, PyInt end)
  {
      BufferObject *bufr;
      RangeObject *self;
***************
*** 1725,1733 ****
  RangeGetattr(PyObject *self, char *name)
  {
      if (strcmp(name, "start") == 0)
! 	return Py_BuildValue("i",((RangeObject *)(self))->start - 1);
      else if (strcmp(name, "end") == 0)
! 	return Py_BuildValue("i",((RangeObject *)(self))->end - 1);
      else
  	return Py_FindMethod(RangeMethods, self, name);
  }
--- 1738,1746 ----
  RangeGetattr(PyObject *self, char *name)
  {
      if (strcmp(name, "start") == 0)
! 	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
  	return Py_FindMethod(RangeMethods, self, name);
  }
***************
*** 1740,1747 ****
  
      if (this->buf->buf == INVALID_BUFFER_VALUE)
      {
! 	vim_snprintf(repr, 100, "<range object (for deleted buffer) at %8lX>",
! 								(long)(self));
  	return PyString_FromString(repr);
      }
      else
--- 1753,1760 ----
  
      if (this->buf->buf == INVALID_BUFFER_VALUE)
      {
! 	vim_snprintf(repr, 100, "<range object (for deleted buffer) at %p>",
! 								      (self));
  	return PyString_FromString(repr);
      }
      else
***************
*** 1869,1875 ****
  BufListLength(PyObject *self)
  {
      buf_T	*b = firstbuf;
!     int		n = 0;
  
      while (b)
      {
--- 1882,1888 ----
  BufListLength(PyObject *self)
  {
      buf_T	*b = firstbuf;
!     PyInt	n = 0;
  
      while (b)
      {
***************
*** 2115,2122 ****
  
      if (this->win == INVALID_WINDOW_VALUE)
      {
! 	vim_snprintf(repr, 100, _("<window object (deleted) at %.8lX>"),
! 								(long)(self));
  	return PyString_FromString(repr);
      }
      else
--- 2128,2134 ----
  
      if (this->win == INVALID_WINDOW_VALUE)
      {
! 	vim_snprintf(repr, 100, _("<window object (deleted) at %p>"), (self));
  	return PyString_FromString(repr);
      }
      else
***************
*** 2128,2135 ****
  	    ++i;
  
  	if (w == NULL)
! 	    vim_snprintf(repr, 100, _("<window object (unknown) at %.8lX>"),
! 								(long)(self));
  	else
  	    vim_snprintf(repr, 100, _("<window %d>"), i);
  
--- 2140,2147 ----
  	    ++i;
  
  	if (w == NULL)
! 	    vim_snprintf(repr, 100, _("<window object (unknown) at %p>"),
! 								      (self));
  	else
  	    vim_snprintf(repr, 100, _("<window %d>"), i);
  
***************
*** 2186,2192 ****
  WinListLength(PyObject *self)
  {
      win_T	*w = firstwin;
!     int		n = 0;
  
      while (w != NULL)
      {
--- 2198,2204 ----
  WinListLength(PyObject *self)
  {
      win_T	*w = firstwin;
!     PyInt	n = 0;
  
      while (w != NULL)
      {
***************
*** 2254,2260 ****
      else if (strcmp(name, "window") == 0)
  	return (PyObject *)WindowNew(curwin);
      else if (strcmp(name, "line") == 0)
! 	return GetBufferLine(curbuf, (int)curwin->w_cursor.lnum);
      else if (strcmp(name, "range") == 0)
  	return RangeNew(curbuf, RangeStart, RangeEnd);
      else if (strcmp(name,"__members__") == 0)
--- 2266,2272 ----
      else if (strcmp(name, "window") == 0)
  	return (PyObject *)WindowNew(curwin);
      else if (strcmp(name, "line") == 0)
! 	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)
***************
*** 2272,2278 ****
  {
      if (strcmp(name, "line") == 0)
      {
! 	if (SetBufferLine(curbuf, (int)curwin->w_cursor.lnum, value, NULL) == FAIL)
  	    return -1;
  
  	return 0;
--- 2284,2290 ----
  {
      if (strcmp(name, "line") == 0)
      {
! 	if (SetBufferLine(curbuf, (PyInt)curwin->w_cursor.lnum, value, NULL) == FAIL)
  	    return -1;
  
  	return 0;
***************
*** 2344,2350 ****
      /* Set sys.argv[] to avoid a crash in warn(). */
      PySys_SetArgv(1, argv);
  
!     mod = Py_InitModule("vim", VimMethods);
      dict = PyModule_GetDict(mod);
  
      VimError = Py_BuildValue("s", "vim.error");
--- 2356,2362 ----
      /* 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);
  
      VimError = Py_BuildValue("s", "vim.error");
***************
*** 2369,2375 ****
   * string object.
   */
      static PyObject *
! GetBufferLine(buf_T *buf, int n)
  {
      return LineToString((char *)ml_get_buf(buf, (linenr_T)n, FALSE));
  }
--- 2381,2387 ----
   * string object.
   */
      static PyObject *
! GetBufferLine(buf_T *buf, PyInt n)
  {
      return LineToString((char *)ml_get_buf(buf, (linenr_T)n, FALSE));
  }
***************
*** 2422,2428 ****
   * deleted).
   */
      static void
! py_fix_cursor(int lo, int hi, int extra)
  {
      if (curwin->w_cursor.lnum >= lo)
      {
--- 2434,2440 ----
   * deleted).
   */
      static void
! py_fix_cursor(linenr_T lo, linenr_T hi, linenr_T extra)
  {
      if (curwin->w_cursor.lnum >= lo)
      {
***************
*** 2454,2460 ****
   * is set to the change in the buffer length.
   */
      static int
! SetBufferLine(buf_T *buf, int n, PyObject *line, int *len_change)
  {
      /* First of all, we check the thpe of the supplied Python object.
       * There are three cases:
--- 2466,2472 ----
   * is set to the change in the buffer length.
   */
      static int
! SetBufferLine(buf_T *buf, PyInt n, PyObject *line, PyInt *len_change)
  {
      /* First of all, we check the thpe of the supplied Python object.
       * There are three cases:
***************
*** 2477,2483 ****
  	{
  	    deleted_lines_mark((linenr_T)n, 1L);
  	    if (buf == curwin->w_buffer)
! 		py_fix_cursor(n, n + 1, -1);
  	}
  
  	curbuf = savebuf;
--- 2489,2495 ----
  	{
  	    deleted_lines_mark((linenr_T)n, 1L);
  	    if (buf == curwin->w_buffer)
! 		py_fix_cursor((linenr_T)n, (linenr_T)n + 1, (linenr_T)-1);
  	}
  
  	curbuf = savebuf;
***************
*** 2545,2551 ****
   * is set to the change in the buffer length.
   */
      static int
! SetBufferLineList(buf_T *buf, PyInt lo, PyInt hi, PyObject *list, int *len_change)
  {
      /* First of all, we check the thpe of the supplied Python object.
       * There are three cases:
--- 2557,2563 ----
   * is set to the change in the buffer length.
   */
      static int
! SetBufferLineList(buf_T *buf, PyInt lo, PyInt hi, PyObject *list, PyInt *len_change)
  {
      /* First of all, we check the thpe of the supplied Python object.
       * There are three cases:
***************
*** 2556,2562 ****
      if (list == Py_None || list == NULL)
      {
  	PyInt	i;
! 	PyInt	n = hi - lo;
  	buf_T	*savebuf = curbuf;
  
  	PyErr_Clear();
--- 2568,2574 ----
      if (list == Py_None || list == NULL)
      {
  	PyInt	i;
! 	PyInt	n = (int)(hi - lo);
  	buf_T	*savebuf = curbuf;
  
  	PyErr_Clear();
***************
*** 2577,2583 ****
  	    deleted_lines_mark((linenr_T)lo, (long)i);
  
  	    if (buf == curwin->w_buffer)
! 		py_fix_cursor(lo, hi, -n);
  	}
  
  	curbuf = savebuf;
--- 2589,2595 ----
  	    deleted_lines_mark((linenr_T)lo, (long)i);
  
  	    if (buf == curwin->w_buffer)
! 		py_fix_cursor((linenr_T)lo, (linenr_T)hi, (linenr_T)-n);
  	}
  
  	curbuf = savebuf;
***************
*** 2595,2601 ****
  	PyInt	i;
  	PyInt	new_len = PyList_Size(list);
  	PyInt	old_len = hi - lo;
! 	int	extra = 0;	/* lines added to text, can be negative */
  	char	**array;
  	buf_T	*savebuf;
  
--- 2607,2613 ----
  	PyInt	i;
  	PyInt	new_len = PyList_Size(list);
  	PyInt	old_len = hi - lo;
! 	PyInt	extra = 0;	/* lines added to text, can be negative */
  	char	**array;
  	buf_T	*savebuf;
  
***************
*** 2706,2712 ****
  	changed_lines((linenr_T)lo, 0, (linenr_T)hi, (long)extra);
  
  	if (buf == curwin->w_buffer)
! 	    py_fix_cursor(lo, hi, extra);
  
  	curbuf = savebuf;
  
--- 2718,2724 ----
  	changed_lines((linenr_T)lo, 0, (linenr_T)hi, (long)extra);
  
  	if (buf == curwin->w_buffer)
! 	    py_fix_cursor((linenr_T)lo, (linenr_T)hi, (linenr_T)extra);
  
  	curbuf = savebuf;
  
***************
*** 2734,2740 ****
   * is set to the change in the buffer length.
   */
      static int
! InsertBufferLines(buf_T *buf, int n, PyObject *lines, int *len_change)
  {
      /* First of all, we check the type of the supplied Python object.
       * It must be a string or a list, or the call is in error.
--- 2746,2752 ----
   * is set to the change in the buffer length.
   */
      static int
! InsertBufferLines(buf_T *buf, PyInt n, PyObject *lines, PyInt *len_change)
  {
      /* First of all, we check the type of the supplied Python object.
       * It must be a string or a list, or the call is in error.
*** ../vim-7.1.319/src/version.c	Fri Jun 20 12:55:28 2008
--- src/version.c	Fri Jun 20 16:25:28 2008
***************
*** 1367,1378 ****
  # ifdef FEAT_GUI_W32
  #  if defined(_MSC_VER) && (_MSC_VER <= 1010)
      /* Only MS VC 4.1 and earlier can do Win32s */
!     MSG_PUTS(_("\nMS-Windows 16/32 bit GUI version"));
  #  else
  #   ifdef _WIN64
!     MSG_PUTS(_("\nMS-Windows 64 bit GUI version"));
  #   else
!     MSG_PUTS(_("\nMS-Windows 32 bit GUI version"));
  #   endif
  #  endif
      if (gui_is_win32s())
--- 1374,1385 ----
  # ifdef FEAT_GUI_W32
  #  if defined(_MSC_VER) && (_MSC_VER <= 1010)
      /* Only MS VC 4.1 and earlier can do Win32s */
!     MSG_PUTS(_("\nMS-Windows 16/32-bit GUI version"));
  #  else
  #   ifdef _WIN64
!     MSG_PUTS(_("\nMS-Windows 64-bit GUI version"));
  #   else
!     MSG_PUTS(_("\nMS-Windows 32-bit GUI version"));
  #   endif
  #  endif
      if (gui_is_win32s())
***************
*** 1381,1397 ****
      MSG_PUTS(_(" with OLE support"));
  # endif
  # else
!     MSG_PUTS(_("\nMS-Windows 32 bit console version"));
  # endif
  #endif
  #ifdef WIN16
!     MSG_PUTS(_("\nMS-Windows 16 bit version"));
  #endif
  #ifdef MSDOS
  # ifdef DJGPP
!     MSG_PUTS(_("\n32 bit MS-DOS version"));
  # else
!     MSG_PUTS(_("\n16 bit MS-DOS version"));
  # endif
  #endif
  #ifdef MACOS
--- 1388,1408 ----
      MSG_PUTS(_(" with OLE support"));
  # endif
  # else
! #  ifdef _WIN64
!     MSG_PUTS(_("\nMS-Windows 64-bit console version"));
! #  else
!     MSG_PUTS(_("\nMS-Windows 32-bit console version"));
! #  endif
  # endif
  #endif
  #ifdef WIN16
!     MSG_PUTS(_("\nMS-Windows 16-bit version"));
  #endif
  #ifdef MSDOS
  # ifdef DJGPP
!     MSG_PUTS(_("\n32-bit MS-DOS version"));
  # else
!     MSG_PUTS(_("\n16-bit MS-DOS version"));
  # endif
  #endif
  #ifdef MACOS
*** ../vim-7.1.319/src/version.c	Fri Jun 20 12:55:28 2008
--- src/version.c	Fri Jun 20 16:25:28 2008
***************
*** 668,669 ****
--- 673,676 ----
  {   /* Add new patch number below this line */
+ /**/
+     320,
  /**/

-- 
The real
trick is
this: to
keep the
lines as
short as
possible
and keep
the size
the same
yet free
from the
need for
hyphena-
Dammit!!  (Matthew Winn)

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///