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