|
Karsten Hopp |
869996 |
To: vim_dev@googlegroups.com
|
|
Karsten Hopp |
869996 |
Subject: Patch 7.3.909
|
|
Karsten Hopp |
869996 |
Fcc: outbox
|
|
Karsten Hopp |
869996 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
869996 |
Mime-Version: 1.0
|
|
Karsten Hopp |
869996 |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
869996 |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
869996 |
------------
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
Patch 7.3.909
|
|
Karsten Hopp |
869996 |
Problem: Duplicate Python code.
|
|
Karsten Hopp |
869996 |
Solution: Move more items to if_py_both.h. (ZyX) Also avoid compiler
|
|
Karsten Hopp |
869996 |
warnings for missing initializers.
|
|
Karsten Hopp |
869996 |
Files: src/if_py_both.h, src/if_python3.c, src/if_python.c
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
*** ../vim-7.3.908/src/if_py_both.h 2013-04-24 13:10:35.000000000 +0200
|
|
Karsten Hopp |
869996 |
--- src/if_py_both.h 2013-04-24 13:26:54.000000000 +0200
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 542,547 ****
|
|
Karsten Hopp |
869996 |
--- 542,555 ----
|
|
Karsten Hopp |
869996 |
* Buffer list object - Implementation
|
|
Karsten Hopp |
869996 |
*/
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
+ typedef struct
|
|
Karsten Hopp |
869996 |
+ {
|
|
Karsten Hopp |
869996 |
+ PyObject_HEAD
|
|
Karsten Hopp |
869996 |
+ } BufListObject;
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
+ static PyTypeObject BufListType;
|
|
Karsten Hopp |
869996 |
+ static PySequenceMethods WinListAsSeq;
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
static PyInt
|
|
Karsten Hopp |
869996 |
BufListLength(PyObject *self UNUSED)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 578,583 ****
|
|
Karsten Hopp |
869996 |
--- 586,596 ----
|
|
Karsten Hopp |
869996 |
win_T *win;
|
|
Karsten Hopp |
869996 |
} WindowObject;
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
+ static struct PyMethodDef WindowMethods[] = {
|
|
Karsten Hopp |
869996 |
+ /* name, function, calling, documentation */
|
|
Karsten Hopp |
869996 |
+ { NULL, NULL, 0, NULL }
|
|
Karsten Hopp |
869996 |
+ };
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
static int ConvertFromPyObject(PyObject *, typval_T *);
|
|
Karsten Hopp |
869996 |
static int _ConvertFromPyObject(PyObject *, typval_T *, PyObject *);
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 642,647 ****
|
|
Karsten Hopp |
869996 |
--- 655,670 ----
|
|
Karsten Hopp |
869996 |
pylinkedlist_T ref;
|
|
Karsten Hopp |
869996 |
} DictionaryObject;
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
+ static PyInt DictionaryAssItem(PyObject *, PyObject *, PyObject *);
|
|
Karsten Hopp |
869996 |
+ static PyInt DictionaryLength(PyObject *);
|
|
Karsten Hopp |
869996 |
+ static PyObject *DictionaryItem(PyObject *, PyObject *);
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
+ static PyMappingMethods DictionaryAsMapping = {
|
|
Karsten Hopp |
869996 |
+ (lenfunc) DictionaryLength,
|
|
Karsten Hopp |
869996 |
+ (binaryfunc) DictionaryItem,
|
|
Karsten Hopp |
869996 |
+ (objobjargproc) DictionaryAssItem,
|
|
Karsten Hopp |
869996 |
+ };
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
static PyObject *
|
|
Karsten Hopp |
869996 |
DictionaryNew(dict_T *dict)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 658,663 ****
|
|
Karsten Hopp |
869996 |
--- 681,697 ----
|
|
Karsten Hopp |
869996 |
return (PyObject *)(self);
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
+ static void
|
|
Karsten Hopp |
869996 |
+ DictionaryDestructor(PyObject *self)
|
|
Karsten Hopp |
869996 |
+ {
|
|
Karsten Hopp |
869996 |
+ DictionaryObject *this = ((DictionaryObject *) (self));
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
+ pyll_remove(&this->ref, &lastdict);
|
|
Karsten Hopp |
869996 |
+ dict_unref(this->dict);
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
+ DESTRUCTOR_FINISH(self);
|
|
Karsten Hopp |
869996 |
+ }
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
static int
|
|
Karsten Hopp |
869996 |
pydict_to_tv(PyObject *obj, typval_T *tv, PyObject *lookupDict)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 804,812 ****
|
|
Karsten Hopp |
869996 |
return 0;
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
! static PyInt
|
|
Karsten Hopp |
869996 |
! DictionarySetattr(DictionaryObject *self, char *name, PyObject *val)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
if (val == NULL)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
PyErr_SetString(PyExc_AttributeError, _("Cannot delete DictionaryObject attributes"));
|
|
Karsten Hopp |
869996 |
--- 838,848 ----
|
|
Karsten Hopp |
869996 |
return 0;
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
! static int
|
|
Karsten Hopp |
869996 |
! DictionarySetattr(PyObject *self, char *name, PyObject *val)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
+ DictionaryObject *this = (DictionaryObject *)(self);
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
if (val == NULL)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
PyErr_SetString(PyExc_AttributeError, _("Cannot delete DictionaryObject attributes"));
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 815,821 ****
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
if (strcmp(name, "locked") == 0)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
! if (self->dict->dv_lock == VAR_FIXED)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
PyErr_SetString(PyExc_TypeError, _("Cannot modify fixed dictionary"));
|
|
Karsten Hopp |
869996 |
return -1;
|
|
Karsten Hopp |
869996 |
--- 851,857 ----
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
if (strcmp(name, "locked") == 0)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
! if (this->dict->dv_lock == VAR_FIXED)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
PyErr_SetString(PyExc_TypeError, _("Cannot modify fixed dictionary"));
|
|
Karsten Hopp |
869996 |
return -1;
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 829,837 ****
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
if (val == Py_True)
|
|
Karsten Hopp |
869996 |
! self->dict->dv_lock = VAR_LOCKED;
|
|
Karsten Hopp |
869996 |
else
|
|
Karsten Hopp |
869996 |
! self->dict->dv_lock = 0;
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
return 0;
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
--- 865,873 ----
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
if (val == Py_True)
|
|
Karsten Hopp |
869996 |
! this->dict->dv_lock = VAR_LOCKED;
|
|
Karsten Hopp |
869996 |
else
|
|
Karsten Hopp |
869996 |
! this->dict->dv_lock = 0;
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
return 0;
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 963,968 ****
|
|
Karsten Hopp |
869996 |
--- 999,1006 ----
|
|
Karsten Hopp |
869996 |
};
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
static PyTypeObject ListType;
|
|
Karsten Hopp |
869996 |
+ static PySequenceMethods ListAsSeq;
|
|
Karsten Hopp |
869996 |
+ static PyMappingMethods ListAsMapping;
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
typedef struct
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 987,992 ****
|
|
Karsten Hopp |
869996 |
--- 1025,1041 ----
|
|
Karsten Hopp |
869996 |
return (PyObject *)(self);
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
+ static void
|
|
Karsten Hopp |
869996 |
+ ListDestructor(PyObject *self)
|
|
Karsten Hopp |
869996 |
+ {
|
|
Karsten Hopp |
869996 |
+ ListObject *this = (ListObject *)(self);
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
+ pyll_remove(&this->ref, &lastlist);
|
|
Karsten Hopp |
869996 |
+ list_unref(this->list);
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
+ DESTRUCTOR_FINISH(self);
|
|
Karsten Hopp |
869996 |
+ }
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
static int
|
|
Karsten Hopp |
869996 |
list_py_concat(list_T *l, PyObject *obj, PyObject *lookupDict)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 1307,1314 ****
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
static int
|
|
Karsten Hopp |
869996 |
! ListSetattr(ListObject *self, char *name, PyObject *val)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
if (val == NULL)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
PyErr_SetString(PyExc_AttributeError, _("Cannot delete DictionaryObject attributes"));
|
|
Karsten Hopp |
869996 |
--- 1356,1365 ----
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
static int
|
|
Karsten Hopp |
869996 |
! ListSetattr(PyObject *self, char *name, PyObject *val)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
+ ListObject *this = (ListObject *)(self);
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
if (val == NULL)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
PyErr_SetString(PyExc_AttributeError, _("Cannot delete DictionaryObject attributes"));
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 1317,1323 ****
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
if (strcmp(name, "locked") == 0)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
! if (self->list->lv_lock == VAR_FIXED)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
PyErr_SetString(PyExc_TypeError, _("Cannot modify fixed list"));
|
|
Karsten Hopp |
869996 |
return -1;
|
|
Karsten Hopp |
869996 |
--- 1368,1374 ----
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
if (strcmp(name, "locked") == 0)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
! if (this->list->lv_lock == VAR_FIXED)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
PyErr_SetString(PyExc_TypeError, _("Cannot modify fixed list"));
|
|
Karsten Hopp |
869996 |
return -1;
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 1331,1339 ****
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
if (val == Py_True)
|
|
Karsten Hopp |
869996 |
! self->list->lv_lock = VAR_LOCKED;
|
|
Karsten Hopp |
869996 |
else
|
|
Karsten Hopp |
869996 |
! self->list->lv_lock = 0;
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
return 0;
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
--- 1382,1390 ----
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
if (val == Py_True)
|
|
Karsten Hopp |
869996 |
! this->list->lv_lock = VAR_LOCKED;
|
|
Karsten Hopp |
869996 |
else
|
|
Karsten Hopp |
869996 |
! this->list->lv_lock = 0;
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
return 0;
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 1376,1381 ****
|
|
Karsten Hopp |
869996 |
--- 1427,1443 ----
|
|
Karsten Hopp |
869996 |
return (PyObject *)(self);
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
+ static void
|
|
Karsten Hopp |
869996 |
+ FunctionDestructor(PyObject *self)
|
|
Karsten Hopp |
869996 |
+ {
|
|
Karsten Hopp |
869996 |
+ FunctionObject *this = (FunctionObject *) (self);
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
+ func_unref(this->name);
|
|
Karsten Hopp |
869996 |
+ PyMem_Del(this->name);
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
+ DESTRUCTOR_FINISH(self);
|
|
Karsten Hopp |
869996 |
+ }
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
static PyObject *
|
|
Karsten Hopp |
869996 |
FunctionCall(PyObject *self, PyObject *argsObject, PyObject *kwargs)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 1451,1456 ****
|
|
Karsten Hopp |
869996 |
--- 1513,1557 ----
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
static int WindowSetattr(PyObject *, char *, PyObject *);
|
|
Karsten Hopp |
869996 |
static PyObject *WindowRepr(PyObject *);
|
|
Karsten Hopp |
869996 |
+ static PyTypeObject WindowType;
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
+ static PyObject *
|
|
Karsten Hopp |
869996 |
+ WindowAttr(WindowObject *this, char *name)
|
|
Karsten Hopp |
869996 |
+ {
|
|
Karsten Hopp |
869996 |
+ if (strcmp(name, "buffer") == 0)
|
|
Karsten Hopp |
869996 |
+ return (PyObject *)BufferNew(this->win->w_buffer);
|
|
Karsten Hopp |
869996 |
+ else if (strcmp(name, "cursor") == 0)
|
|
Karsten Hopp |
869996 |
+ {
|
|
Karsten Hopp |
869996 |
+ pos_T *pos = &this->win->w_cursor;
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
+ return Py_BuildValue("(ll)", (long)(pos->lnum), (long)(pos->col));
|
|
Karsten Hopp |
869996 |
+ }
|
|
Karsten Hopp |
869996 |
+ else if (strcmp(name, "height") == 0)
|
|
Karsten Hopp |
869996 |
+ return Py_BuildValue("l", (long)(this->win->w_height));
|
|
Karsten Hopp |
869996 |
+ #ifdef FEAT_VERTSPLIT
|
|
Karsten Hopp |
869996 |
+ else if (strcmp(name, "width") == 0)
|
|
Karsten Hopp |
869996 |
+ return Py_BuildValue("l", (long)(W_WIDTH(this->win)));
|
|
Karsten Hopp |
869996 |
+ #endif
|
|
Karsten Hopp |
869996 |
+ else if (strcmp(name,"__members__") == 0)
|
|
Karsten Hopp |
869996 |
+ return Py_BuildValue("[sss]", "buffer", "cursor", "height");
|
|
Karsten Hopp |
869996 |
+ else
|
|
Karsten Hopp |
869996 |
+ return NULL;
|
|
Karsten Hopp |
869996 |
+ }
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
+ static void
|
|
Karsten Hopp |
869996 |
+ WindowDestructor(PyObject *self)
|
|
Karsten Hopp |
869996 |
+ {
|
|
Karsten Hopp |
869996 |
+ WindowObject *this = (WindowObject *)(self);
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
+ if (this->win && this->win != INVALID_WINDOW_VALUE)
|
|
Karsten Hopp |
869996 |
+ #if PY_MAJOR_VERSION >= 3
|
|
Karsten Hopp |
869996 |
+ this->win->w_python3_ref = NULL;
|
|
Karsten Hopp |
869996 |
+ #else
|
|
Karsten Hopp |
869996 |
+ this->win->w_python_ref = NULL;
|
|
Karsten Hopp |
869996 |
+ #endif
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
+ DESTRUCTOR_FINISH(self);
|
|
Karsten Hopp |
869996 |
+ }
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
static int
|
|
Karsten Hopp |
869996 |
WindowSetattr(PyObject *self, char *name, PyObject *val)
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 1579,1584 ****
|
|
Karsten Hopp |
869996 |
--- 1680,1694 ----
|
|
Karsten Hopp |
869996 |
/*
|
|
Karsten Hopp |
869996 |
* Window list object - Implementation
|
|
Karsten Hopp |
869996 |
*/
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
+ typedef struct
|
|
Karsten Hopp |
869996 |
+ {
|
|
Karsten Hopp |
869996 |
+ PyObject_HEAD
|
|
Karsten Hopp |
869996 |
+ } WinListObject;
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
+ static PyTypeObject WinListType;
|
|
Karsten Hopp |
869996 |
+ static PySequenceMethods BufListAsSeq;
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
static PyInt
|
|
Karsten Hopp |
869996 |
WinListLength(PyObject *self UNUSED)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 2310,2319 ****
|
|
Karsten Hopp |
869996 |
return Py_None;
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
!
|
|
Karsten Hopp |
869996 |
! /* Buffer object - Definitions
|
|
Karsten Hopp |
869996 |
*/
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
typedef struct
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
PyObject_HEAD
|
|
Karsten Hopp |
869996 |
--- 2420,2430 ----
|
|
Karsten Hopp |
869996 |
return Py_None;
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
! /* Range object - Definitions
|
|
Karsten Hopp |
869996 |
*/
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
+ static PyTypeObject RangeType;
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
typedef struct
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
PyObject_HEAD
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 2322,2327 ****
|
|
Karsten Hopp |
869996 |
--- 2433,2442 ----
|
|
Karsten Hopp |
869996 |
PyInt end;
|
|
Karsten Hopp |
869996 |
} RangeObject;
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
+ static void RangeDestructor(PyObject *);
|
|
Karsten Hopp |
869996 |
+ static PySequenceMethods RangeAsSeq;
|
|
Karsten Hopp |
869996 |
+ static PyMappingMethods RangeAsMapping;
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
static PyObject *
|
|
Karsten Hopp |
869996 |
RangeNew(buf_T *buf, PyInt start, PyInt end)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 2346,2351 ****
|
|
Karsten Hopp |
869996 |
--- 2461,2506 ----
|
|
Karsten Hopp |
869996 |
return (PyObject *)(self);
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
+ static void
|
|
Karsten Hopp |
869996 |
+ RangeDestructor(PyObject *self)
|
|
Karsten Hopp |
869996 |
+ {
|
|
Karsten Hopp |
869996 |
+ Py_DECREF(((RangeObject *)(self))->buf);
|
|
Karsten Hopp |
869996 |
+ DESTRUCTOR_FINISH(self);
|
|
Karsten Hopp |
869996 |
+ }
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
+ static PyTypeObject BufferType;
|
|
Karsten Hopp |
869996 |
+ static PyObject *BufferRepr(PyObject *);
|
|
Karsten Hopp |
869996 |
+ static PySequenceMethods BufferAsSeq;
|
|
Karsten Hopp |
869996 |
+ static PyMappingMethods BufferAsMapping;
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
+ static void
|
|
Karsten Hopp |
869996 |
+ BufferDestructor(PyObject *self)
|
|
Karsten Hopp |
869996 |
+ {
|
|
Karsten Hopp |
869996 |
+ BufferObject *this = (BufferObject *)(self);
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
+ if (this->buf && this->buf != INVALID_BUFFER_VALUE)
|
|
Karsten Hopp |
869996 |
+ #if PY_MAJOR_VERSION >= 3
|
|
Karsten Hopp |
869996 |
+ this->buf->b_python3_ref = NULL;
|
|
Karsten Hopp |
869996 |
+ #else
|
|
Karsten Hopp |
869996 |
+ this->buf->b_python_ref = NULL;
|
|
Karsten Hopp |
869996 |
+ #endif
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
+ DESTRUCTOR_FINISH(self);
|
|
Karsten Hopp |
869996 |
+ }
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
+ static PyObject *
|
|
Karsten Hopp |
869996 |
+ BufferAttr(BufferObject *this, char *name)
|
|
Karsten Hopp |
869996 |
+ {
|
|
Karsten Hopp |
869996 |
+ if (strcmp(name, "name") == 0)
|
|
Karsten Hopp |
869996 |
+ return Py_BuildValue("s", this->buf->b_ffname);
|
|
Karsten Hopp |
869996 |
+ else if (strcmp(name, "number") == 0)
|
|
Karsten Hopp |
869996 |
+ return Py_BuildValue(Py_ssize_t_fmt, this->buf->b_fnum);
|
|
Karsten Hopp |
869996 |
+ else if (strcmp(name,"__members__") == 0)
|
|
Karsten Hopp |
869996 |
+ return Py_BuildValue("[ss]", "name", "number");
|
|
Karsten Hopp |
869996 |
+ else
|
|
Karsten Hopp |
869996 |
+ return NULL;
|
|
Karsten Hopp |
869996 |
+ }
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
static PyObject *
|
|
Karsten Hopp |
869996 |
BufferAppend(PyObject *self, PyObject *args)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 2409,2414 ****
|
|
Karsten Hopp |
869996 |
--- 2564,2598 ----
|
|
Karsten Hopp |
869996 |
return RangeNew(((BufferObject *)(self))->buf, start, end);
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
+ static PyObject *
|
|
Karsten Hopp |
869996 |
+ BufferRepr(PyObject *self)
|
|
Karsten Hopp |
869996 |
+ {
|
|
Karsten Hopp |
869996 |
+ static char repr[100];
|
|
Karsten Hopp |
869996 |
+ BufferObject *this = (BufferObject *)(self);
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
+ if (this->buf == INVALID_BUFFER_VALUE)
|
|
Karsten Hopp |
869996 |
+ {
|
|
Karsten Hopp |
869996 |
+ vim_snprintf(repr, 100, _("<buffer object (deleted) at %p>"), (self));
|
|
Karsten Hopp |
869996 |
+ return PyString_FromString(repr);
|
|
Karsten Hopp |
869996 |
+ }
|
|
Karsten Hopp |
869996 |
+ else
|
|
Karsten Hopp |
869996 |
+ {
|
|
Karsten Hopp |
869996 |
+ char *name = (char *)this->buf->b_fname;
|
|
Karsten Hopp |
869996 |
+ PyInt len;
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
+ if (name == NULL)
|
|
Karsten Hopp |
869996 |
+ name = "";
|
|
Karsten Hopp |
869996 |
+ len = strlen(name);
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
+ if (len > 35)
|
|
Karsten Hopp |
869996 |
+ name = name + (35 - len);
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
+ vim_snprintf(repr, 100, "<buffer %s%s>", len > 35 ? "..." : "", name);
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
+ return PyString_FromString(repr);
|
|
Karsten Hopp |
869996 |
+ }
|
|
Karsten Hopp |
869996 |
+ }
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
static struct PyMethodDef BufferMethods[] = {
|
|
Karsten Hopp |
869996 |
/* name, function, calling, documentation */
|
|
Karsten Hopp |
869996 |
{"append", BufferAppend, 1, "Append data to Vim buffer" },
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 2497,2502 ****
|
|
Karsten Hopp |
869996 |
--- 2681,2729 ----
|
|
Karsten Hopp |
869996 |
{ NULL, NULL, 0, NULL }
|
|
Karsten Hopp |
869996 |
};
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
+ /* Current items object - Implementation
|
|
Karsten Hopp |
869996 |
+ */
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
+ static PyInt RangeStart;
|
|
Karsten Hopp |
869996 |
+ static PyInt RangeEnd;
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
+ static PyObject *
|
|
Karsten Hopp |
869996 |
+ CurrentGetattr(PyObject *self UNUSED, char *name)
|
|
Karsten Hopp |
869996 |
+ {
|
|
Karsten Hopp |
869996 |
+ if (strcmp(name, "buffer") == 0)
|
|
Karsten Hopp |
869996 |
+ return (PyObject *)BufferNew(curbuf);
|
|
Karsten Hopp |
869996 |
+ else if (strcmp(name, "window") == 0)
|
|
Karsten Hopp |
869996 |
+ return (PyObject *)WindowNew(curwin);
|
|
Karsten Hopp |
869996 |
+ else if (strcmp(name, "line") == 0)
|
|
Karsten Hopp |
869996 |
+ return GetBufferLine(curbuf, (PyInt)curwin->w_cursor.lnum);
|
|
Karsten Hopp |
869996 |
+ else if (strcmp(name, "range") == 0)
|
|
Karsten Hopp |
869996 |
+ return RangeNew(curbuf, RangeStart, RangeEnd);
|
|
Karsten Hopp |
869996 |
+ else if (strcmp(name,"__members__") == 0)
|
|
Karsten Hopp |
869996 |
+ return Py_BuildValue("[ssss]", "buffer", "window", "line", "range");
|
|
Karsten Hopp |
869996 |
+ else
|
|
Karsten Hopp |
869996 |
+ {
|
|
Karsten Hopp |
869996 |
+ PyErr_SetString(PyExc_AttributeError, name);
|
|
Karsten Hopp |
869996 |
+ return NULL;
|
|
Karsten Hopp |
869996 |
+ }
|
|
Karsten Hopp |
869996 |
+ }
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
+ static int
|
|
Karsten Hopp |
869996 |
+ CurrentSetattr(PyObject *self UNUSED, char *name, PyObject *value)
|
|
Karsten Hopp |
869996 |
+ {
|
|
Karsten Hopp |
869996 |
+ if (strcmp(name, "line") == 0)
|
|
Karsten Hopp |
869996 |
+ {
|
|
Karsten Hopp |
869996 |
+ if (SetBufferLine(curbuf, (PyInt)curwin->w_cursor.lnum, value, NULL) == FAIL)
|
|
Karsten Hopp |
869996 |
+ return -1;
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
+ return 0;
|
|
Karsten Hopp |
869996 |
+ }
|
|
Karsten Hopp |
869996 |
+ else
|
|
Karsten Hopp |
869996 |
+ {
|
|
Karsten Hopp |
869996 |
+ PyErr_SetString(PyExc_AttributeError, name);
|
|
Karsten Hopp |
869996 |
+ return -1;
|
|
Karsten Hopp |
869996 |
+ }
|
|
Karsten Hopp |
869996 |
+ }
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
static void
|
|
Karsten Hopp |
869996 |
set_ref_in_py(const int copyID)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 2770,2772 ****
|
|
Karsten Hopp |
869996 |
--- 2997,3165 ----
|
|
Karsten Hopp |
869996 |
return NULL;
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
+ typedef struct
|
|
Karsten Hopp |
869996 |
+ {
|
|
Karsten Hopp |
869996 |
+ PyObject_HEAD
|
|
Karsten Hopp |
869996 |
+ } CurrentObject;
|
|
Karsten Hopp |
869996 |
+ static PyTypeObject CurrentType;
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
+ static void
|
|
Karsten Hopp |
869996 |
+ init_structs(void)
|
|
Karsten Hopp |
869996 |
+ {
|
|
Karsten Hopp |
869996 |
+ vim_memset(&OutputType, 0, sizeof(OutputType));
|
|
Karsten Hopp |
869996 |
+ OutputType.tp_name = "vim.message";
|
|
Karsten Hopp |
869996 |
+ OutputType.tp_basicsize = sizeof(OutputObject);
|
|
Karsten Hopp |
869996 |
+ OutputType.tp_flags = Py_TPFLAGS_DEFAULT;
|
|
Karsten Hopp |
869996 |
+ OutputType.tp_doc = "vim message object";
|
|
Karsten Hopp |
869996 |
+ OutputType.tp_methods = OutputMethods;
|
|
Karsten Hopp |
869996 |
+ #if PY_MAJOR_VERSION >= 3
|
|
Karsten Hopp |
869996 |
+ OutputType.tp_getattro = OutputGetattro;
|
|
Karsten Hopp |
869996 |
+ OutputType.tp_setattro = OutputSetattro;
|
|
Karsten Hopp |
869996 |
+ OutputType.tp_alloc = call_PyType_GenericAlloc;
|
|
Karsten Hopp |
869996 |
+ OutputType.tp_new = call_PyType_GenericNew;
|
|
Karsten Hopp |
869996 |
+ OutputType.tp_free = call_PyObject_Free;
|
|
Karsten Hopp |
869996 |
+ #else
|
|
Karsten Hopp |
869996 |
+ OutputType.tp_getattr = OutputGetattr;
|
|
Karsten Hopp |
869996 |
+ OutputType.tp_setattr = OutputSetattr;
|
|
Karsten Hopp |
869996 |
+ #endif
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
+ vim_memset(&BufferType, 0, sizeof(BufferType));
|
|
Karsten Hopp |
869996 |
+ BufferType.tp_name = "vim.buffer";
|
|
Karsten Hopp |
869996 |
+ BufferType.tp_basicsize = sizeof(BufferType);
|
|
Karsten Hopp |
869996 |
+ BufferType.tp_dealloc = BufferDestructor;
|
|
Karsten Hopp |
869996 |
+ BufferType.tp_repr = BufferRepr;
|
|
Karsten Hopp |
869996 |
+ BufferType.tp_as_sequence = &BufferAsSeq;
|
|
Karsten Hopp |
869996 |
+ BufferType.tp_as_mapping = &BufferAsMapping;
|
|
Karsten Hopp |
869996 |
+ BufferType.tp_flags = Py_TPFLAGS_DEFAULT;
|
|
Karsten Hopp |
869996 |
+ BufferType.tp_doc = "vim buffer object";
|
|
Karsten Hopp |
869996 |
+ BufferType.tp_methods = BufferMethods;
|
|
Karsten Hopp |
869996 |
+ #if PY_MAJOR_VERSION >= 3
|
|
Karsten Hopp |
869996 |
+ BufferType.tp_getattro = BufferGetattro;
|
|
Karsten Hopp |
869996 |
+ BufferType.tp_alloc = call_PyType_GenericAlloc;
|
|
Karsten Hopp |
869996 |
+ BufferType.tp_new = call_PyType_GenericNew;
|
|
Karsten Hopp |
869996 |
+ BufferType.tp_free = call_PyObject_Free;
|
|
Karsten Hopp |
869996 |
+ #else
|
|
Karsten Hopp |
869996 |
+ BufferType.tp_getattr = BufferGetattr;
|
|
Karsten Hopp |
869996 |
+ #endif
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
+ vim_memset(&WindowType, 0, sizeof(WindowType));
|
|
Karsten Hopp |
869996 |
+ WindowType.tp_name = "vim.window";
|
|
Karsten Hopp |
869996 |
+ WindowType.tp_basicsize = sizeof(WindowObject);
|
|
Karsten Hopp |
869996 |
+ WindowType.tp_dealloc = WindowDestructor;
|
|
Karsten Hopp |
869996 |
+ WindowType.tp_repr = WindowRepr;
|
|
Karsten Hopp |
869996 |
+ WindowType.tp_flags = Py_TPFLAGS_DEFAULT;
|
|
Karsten Hopp |
869996 |
+ WindowType.tp_doc = "vim Window object";
|
|
Karsten Hopp |
869996 |
+ WindowType.tp_methods = WindowMethods;
|
|
Karsten Hopp |
869996 |
+ #if PY_MAJOR_VERSION >= 3
|
|
Karsten Hopp |
869996 |
+ WindowType.tp_getattro = WindowGetattro;
|
|
Karsten Hopp |
869996 |
+ WindowType.tp_setattro = WindowSetattro;
|
|
Karsten Hopp |
869996 |
+ WindowType.tp_alloc = call_PyType_GenericAlloc;
|
|
Karsten Hopp |
869996 |
+ WindowType.tp_new = call_PyType_GenericNew;
|
|
Karsten Hopp |
869996 |
+ WindowType.tp_free = call_PyObject_Free;
|
|
Karsten Hopp |
869996 |
+ #else
|
|
Karsten Hopp |
869996 |
+ WindowType.tp_getattr = WindowGetattr;
|
|
Karsten Hopp |
869996 |
+ WindowType.tp_setattr = WindowSetattr;
|
|
Karsten Hopp |
869996 |
+ #endif
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
+ vim_memset(&BufListType, 0, sizeof(BufListType));
|
|
Karsten Hopp |
869996 |
+ BufListType.tp_name = "vim.bufferlist";
|
|
Karsten Hopp |
869996 |
+ BufListType.tp_basicsize = sizeof(BufListObject);
|
|
Karsten Hopp |
869996 |
+ BufListType.tp_as_sequence = &BufListAsSeq;
|
|
Karsten Hopp |
869996 |
+ BufListType.tp_flags = Py_TPFLAGS_DEFAULT;
|
|
Karsten Hopp |
869996 |
+ BufferType.tp_doc = "vim buffer list";
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
+ vim_memset(&WinListType, 0, sizeof(WinListType));
|
|
Karsten Hopp |
869996 |
+ WinListType.tp_name = "vim.windowlist";
|
|
Karsten Hopp |
869996 |
+ WinListType.tp_basicsize = sizeof(WinListType);
|
|
Karsten Hopp |
869996 |
+ WinListType.tp_as_sequence = &WinListAsSeq;
|
|
Karsten Hopp |
869996 |
+ WinListType.tp_flags = Py_TPFLAGS_DEFAULT;
|
|
Karsten Hopp |
869996 |
+ WinListType.tp_doc = "vim window list";
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
+ vim_memset(&RangeType, 0, sizeof(RangeType));
|
|
Karsten Hopp |
869996 |
+ RangeType.tp_name = "vim.range";
|
|
Karsten Hopp |
869996 |
+ RangeType.tp_basicsize = sizeof(RangeObject);
|
|
Karsten Hopp |
869996 |
+ RangeType.tp_dealloc = RangeDestructor;
|
|
Karsten Hopp |
869996 |
+ RangeType.tp_repr = RangeRepr;
|
|
Karsten Hopp |
869996 |
+ RangeType.tp_as_sequence = &RangeAsSeq;
|
|
Karsten Hopp |
869996 |
+ RangeType.tp_as_mapping = &RangeAsMapping;
|
|
Karsten Hopp |
869996 |
+ RangeType.tp_flags = Py_TPFLAGS_DEFAULT;
|
|
Karsten Hopp |
869996 |
+ RangeType.tp_doc = "vim Range object";
|
|
Karsten Hopp |
869996 |
+ RangeType.tp_methods = RangeMethods;
|
|
Karsten Hopp |
869996 |
+ #if PY_MAJOR_VERSION >= 3
|
|
Karsten Hopp |
869996 |
+ RangeType.tp_getattro = RangeGetattro;
|
|
Karsten Hopp |
869996 |
+ RangeType.tp_alloc = call_PyType_GenericAlloc;
|
|
Karsten Hopp |
869996 |
+ RangeType.tp_new = call_PyType_GenericNew;
|
|
Karsten Hopp |
869996 |
+ RangeType.tp_free = call_PyObject_Free;
|
|
Karsten Hopp |
869996 |
+ #else
|
|
Karsten Hopp |
869996 |
+ RangeType.tp_getattr = RangeGetattr;
|
|
Karsten Hopp |
869996 |
+ #endif
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
+ vim_memset(&CurrentType, 0, sizeof(CurrentType));
|
|
Karsten Hopp |
869996 |
+ CurrentType.tp_name = "vim.currentdata";
|
|
Karsten Hopp |
869996 |
+ CurrentType.tp_basicsize = sizeof(CurrentObject);
|
|
Karsten Hopp |
869996 |
+ CurrentType.tp_flags = Py_TPFLAGS_DEFAULT;
|
|
Karsten Hopp |
869996 |
+ CurrentType.tp_doc = "vim current object";
|
|
Karsten Hopp |
869996 |
+ #if PY_MAJOR_VERSION >= 3
|
|
Karsten Hopp |
869996 |
+ CurrentType.tp_getattro = CurrentGetattro;
|
|
Karsten Hopp |
869996 |
+ CurrentType.tp_setattro = CurrentSetattro;
|
|
Karsten Hopp |
869996 |
+ #else
|
|
Karsten Hopp |
869996 |
+ CurrentType.tp_getattr = CurrentGetattr;
|
|
Karsten Hopp |
869996 |
+ CurrentType.tp_setattr = CurrentSetattr;
|
|
Karsten Hopp |
869996 |
+ #endif
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
+ vim_memset(&DictionaryType, 0, sizeof(DictionaryType));
|
|
Karsten Hopp |
869996 |
+ DictionaryType.tp_name = "vim.dictionary";
|
|
Karsten Hopp |
869996 |
+ DictionaryType.tp_basicsize = sizeof(DictionaryObject);
|
|
Karsten Hopp |
869996 |
+ DictionaryType.tp_dealloc = DictionaryDestructor;
|
|
Karsten Hopp |
869996 |
+ DictionaryType.tp_as_mapping = &DictionaryAsMapping;
|
|
Karsten Hopp |
869996 |
+ DictionaryType.tp_flags = Py_TPFLAGS_DEFAULT;
|
|
Karsten Hopp |
869996 |
+ DictionaryType.tp_doc = "dictionary pushing modifications to vim structure";
|
|
Karsten Hopp |
869996 |
+ DictionaryType.tp_methods = DictionaryMethods;
|
|
Karsten Hopp |
869996 |
+ #if PY_MAJOR_VERSION >= 3
|
|
Karsten Hopp |
869996 |
+ DictionaryType.tp_getattro = DictionaryGetattro;
|
|
Karsten Hopp |
869996 |
+ DictionaryType.tp_setattro = DictionarySetattro;
|
|
Karsten Hopp |
869996 |
+ #else
|
|
Karsten Hopp |
869996 |
+ DictionaryType.tp_getattr = DictionaryGetattr;
|
|
Karsten Hopp |
869996 |
+ DictionaryType.tp_setattr = DictionarySetattr;
|
|
Karsten Hopp |
869996 |
+ #endif
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
+ vim_memset(&ListType, 0, sizeof(ListType));
|
|
Karsten Hopp |
869996 |
+ ListType.tp_name = "vim.list";
|
|
Karsten Hopp |
869996 |
+ ListType.tp_dealloc = ListDestructor;
|
|
Karsten Hopp |
869996 |
+ ListType.tp_basicsize = sizeof(ListObject);
|
|
Karsten Hopp |
869996 |
+ ListType.tp_as_sequence = &ListAsSeq;
|
|
Karsten Hopp |
869996 |
+ ListType.tp_as_mapping = &ListAsMapping;
|
|
Karsten Hopp |
869996 |
+ ListType.tp_flags = Py_TPFLAGS_DEFAULT;
|
|
Karsten Hopp |
869996 |
+ ListType.tp_doc = "list pushing modifications to vim structure";
|
|
Karsten Hopp |
869996 |
+ ListType.tp_methods = ListMethods;
|
|
Karsten Hopp |
869996 |
+ #if PY_MAJOR_VERSION >= 3
|
|
Karsten Hopp |
869996 |
+ ListType.tp_getattro = ListGetattro;
|
|
Karsten Hopp |
869996 |
+ ListType.tp_setattro = ListSetattro;
|
|
Karsten Hopp |
869996 |
+ #else
|
|
Karsten Hopp |
869996 |
+ ListType.tp_getattr = ListGetattr;
|
|
Karsten Hopp |
869996 |
+ ListType.tp_setattr = ListSetattr;
|
|
Karsten Hopp |
869996 |
+ #endif
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
+ vim_memset(&FunctionType, 0, sizeof(FunctionType));
|
|
Karsten Hopp |
869996 |
+ FunctionType.tp_name = "vim.list";
|
|
Karsten Hopp |
869996 |
+ FunctionType.tp_basicsize = sizeof(FunctionObject);
|
|
Karsten Hopp |
869996 |
+ FunctionType.tp_dealloc = FunctionDestructor;
|
|
Karsten Hopp |
869996 |
+ FunctionType.tp_call = FunctionCall;
|
|
Karsten Hopp |
869996 |
+ FunctionType.tp_flags = Py_TPFLAGS_DEFAULT;
|
|
Karsten Hopp |
869996 |
+ FunctionType.tp_doc = "object that calls vim function";
|
|
Karsten Hopp |
869996 |
+ FunctionType.tp_methods = FunctionMethods;
|
|
Karsten Hopp |
869996 |
+ #if PY_MAJOR_VERSION >= 3
|
|
Karsten Hopp |
869996 |
+ FunctionType.tp_getattro = FunctionGetattro;
|
|
Karsten Hopp |
869996 |
+ #else
|
|
Karsten Hopp |
869996 |
+ FunctionType.tp_getattr = FunctionGetattr;
|
|
Karsten Hopp |
869996 |
+ #endif
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
+ #if PY_MAJOR_VERSION >= 3
|
|
Karsten Hopp |
869996 |
+ vim_memset(&vimmodule, 0, sizeof(vimmodule));
|
|
Karsten Hopp |
869996 |
+ vimmodule.m_name = "vim";
|
|
Karsten Hopp |
869996 |
+ vimmodule.m_doc = "Vim Python interface\n";
|
|
Karsten Hopp |
869996 |
+ vimmodule.m_size = -1;
|
|
Karsten Hopp |
869996 |
+ vimmodule.m_methods = VimMethods;
|
|
Karsten Hopp |
869996 |
+ #endif
|
|
Karsten Hopp |
869996 |
+ }
|
|
Karsten Hopp |
869996 |
*** ../vim-7.3.908/src/if_python3.c 2013-04-24 13:04:21.000000000 +0200
|
|
Karsten Hopp |
869996 |
--- src/if_python3.c 2013-04-24 13:26:54.000000000 +0200
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 91,96 ****
|
|
Karsten Hopp |
869996 |
--- 91,97 ----
|
|
Karsten Hopp |
869996 |
#define PyInt_Check(obj) PyLong_Check(obj)
|
|
Karsten Hopp |
869996 |
#define PyInt_FromLong(i) PyLong_FromLong(i)
|
|
Karsten Hopp |
869996 |
#define PyInt_AsLong(obj) PyLong_AsLong(obj)
|
|
Karsten Hopp |
869996 |
+ #define Py_ssize_t_fmt "n"
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
#if defined(DYNAMIC_PYTHON3) || defined(PROTO)
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 588,595 ****
|
|
Karsten Hopp |
869996 |
static PyObject *LineToString(const char *);
|
|
Karsten Hopp |
869996 |
static PyObject *BufferDir(PyObject *, PyObject *);
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
- static PyTypeObject RangeType;
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
static int py3initialised = 0;
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
#define PYINITIALISED py3initialised
|
|
Karsten Hopp |
869996 |
--- 589,594 ----
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 620,636 ****
|
|
Karsten Hopp |
869996 |
if (bytes != NULL) \
|
|
Karsten Hopp |
869996 |
Py_XDECREF(bytes);
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
! /*
|
|
Karsten Hopp |
869996 |
! * Include the code shared with if_python.c
|
|
Karsten Hopp |
869996 |
! */
|
|
Karsten Hopp |
869996 |
! #include "if_py_both.h"
|
|
Karsten Hopp |
869996 |
!
|
|
Karsten Hopp |
869996 |
! #define GET_ATTR_STRING(name, nameobj) \
|
|
Karsten Hopp |
869996 |
! char *name = ""; \
|
|
Karsten Hopp |
869996 |
! if (PyUnicode_Check(nameobj)) \
|
|
Karsten Hopp |
869996 |
! name = _PyUnicode_AsString(nameobj)
|
|
Karsten Hopp |
869996 |
!
|
|
Karsten Hopp |
869996 |
! #define PY3OBJ_DELETED(obj) (obj->ob_base.ob_refcnt<=0)
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
static void
|
|
Karsten Hopp |
869996 |
call_PyObject_Free(void *p)
|
|
Karsten Hopp |
869996 |
--- 619,625 ----
|
|
Karsten Hopp |
869996 |
if (bytes != NULL) \
|
|
Karsten Hopp |
869996 |
Py_XDECREF(bytes);
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
! #define DESTRUCTOR_FINISH(self) Py_TYPE(self)->tp_free((PyObject*)self);
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
static void
|
|
Karsten Hopp |
869996 |
call_PyObject_Free(void *p)
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 654,666 ****
|
|
Karsten Hopp |
869996 |
return PyType_GenericAlloc(type,nitems);
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
/******************************************************
|
|
Karsten Hopp |
869996 |
* Internal function prototypes.
|
|
Karsten Hopp |
869996 |
*/
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
- static Py_ssize_t RangeStart;
|
|
Karsten Hopp |
869996 |
- static Py_ssize_t RangeEnd;
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
static PyObject *globals;
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
static int PythonIO_Init(void);
|
|
Karsten Hopp |
869996 |
--- 643,680 ----
|
|
Karsten Hopp |
869996 |
return PyType_GenericAlloc(type,nitems);
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
+ static PyObject *OutputGetattro(PyObject *, PyObject *);
|
|
Karsten Hopp |
869996 |
+ static int OutputSetattro(PyObject *, PyObject *, PyObject *);
|
|
Karsten Hopp |
869996 |
+ static PyObject *BufferGetattro(PyObject *, PyObject *);
|
|
Karsten Hopp |
869996 |
+ static PyObject *WindowGetattro(PyObject *, PyObject *);
|
|
Karsten Hopp |
869996 |
+ static int WindowSetattro(PyObject *, PyObject *, PyObject *);
|
|
Karsten Hopp |
869996 |
+ static PyObject *RangeGetattro(PyObject *, PyObject *);
|
|
Karsten Hopp |
869996 |
+ static PyObject *CurrentGetattro(PyObject *, PyObject *);
|
|
Karsten Hopp |
869996 |
+ static int CurrentSetattro(PyObject *, PyObject *, PyObject *);
|
|
Karsten Hopp |
869996 |
+ static PyObject *DictionaryGetattro(PyObject *, PyObject *);
|
|
Karsten Hopp |
869996 |
+ static int DictionarySetattro(PyObject *, PyObject *, PyObject *);
|
|
Karsten Hopp |
869996 |
+ static PyObject *ListGetattro(PyObject *, PyObject *);
|
|
Karsten Hopp |
869996 |
+ static int ListSetattro(PyObject *, PyObject *, PyObject *);
|
|
Karsten Hopp |
869996 |
+ static PyObject *FunctionGetattro(PyObject *, PyObject *);
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
+ static struct PyModuleDef vimmodule;
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
+ /*
|
|
Karsten Hopp |
869996 |
+ * Include the code shared with if_python.c
|
|
Karsten Hopp |
869996 |
+ */
|
|
Karsten Hopp |
869996 |
+ #include "if_py_both.h"
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
+ #define GET_ATTR_STRING(name, nameobj) \
|
|
Karsten Hopp |
869996 |
+ char *name = ""; \
|
|
Karsten Hopp |
869996 |
+ if (PyUnicode_Check(nameobj)) \
|
|
Karsten Hopp |
869996 |
+ name = _PyUnicode_AsString(nameobj)
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
+ #define PY3OBJ_DELETED(obj) (obj->ob_base.ob_refcnt<=0)
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
/******************************************************
|
|
Karsten Hopp |
869996 |
* Internal function prototypes.
|
|
Karsten Hopp |
869996 |
*/
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
static PyObject *globals;
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
static int PythonIO_Init(void);
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 1046,1052 ****
|
|
Karsten Hopp |
869996 |
0, /* sq_inplace_repeat */
|
|
Karsten Hopp |
869996 |
};
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
! PyMappingMethods BufferAsMapping = {
|
|
Karsten Hopp |
869996 |
/* mp_length */ (lenfunc)BufferLength,
|
|
Karsten Hopp |
869996 |
/* mp_subscript */ (binaryfunc)BufferSubscript,
|
|
Karsten Hopp |
869996 |
/* mp_ass_subscript */ (objobjargproc)BufferAsSubscript,
|
|
Karsten Hopp |
869996 |
--- 1060,1066 ----
|
|
Karsten Hopp |
869996 |
0, /* sq_inplace_repeat */
|
|
Karsten Hopp |
869996 |
};
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
! static PyMappingMethods BufferAsMapping = {
|
|
Karsten Hopp |
869996 |
/* mp_length */ (lenfunc)BufferLength,
|
|
Karsten Hopp |
869996 |
/* mp_subscript */ (binaryfunc)BufferSubscript,
|
|
Karsten Hopp |
869996 |
/* mp_ass_subscript */ (objobjargproc)BufferAsSubscript,
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 1056,1063 ****
|
|
Karsten Hopp |
869996 |
/* Buffer object - Definitions
|
|
Karsten Hopp |
869996 |
*/
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
- static PyTypeObject BufferType;
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
static PyObject *
|
|
Karsten Hopp |
869996 |
BufferNew(buf_T *buf)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
--- 1070,1075 ----
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 1094,1124 ****
|
|
Karsten Hopp |
869996 |
return (PyObject *)(self);
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
- static void
|
|
Karsten Hopp |
869996 |
- BufferDestructor(PyObject *self)
|
|
Karsten Hopp |
869996 |
- {
|
|
Karsten Hopp |
869996 |
- BufferObject *this = (BufferObject *)(self);
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- if (this->buf && this->buf != INVALID_BUFFER_VALUE)
|
|
Karsten Hopp |
869996 |
- this->buf->b_python3_ref = NULL;
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- Py_TYPE(self)->tp_free((PyObject*)self);
|
|
Karsten Hopp |
869996 |
- }
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
static PyObject *
|
|
Karsten Hopp |
869996 |
BufferGetattro(PyObject *self, PyObject*nameobj)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
! BufferObject *this = (BufferObject *)(self);
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
GET_ATTR_STRING(name, nameobj);
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
! if (CheckBuffer(this))
|
|
Karsten Hopp |
869996 |
return NULL;
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
! if (strcmp(name, "name") == 0)
|
|
Karsten Hopp |
869996 |
! return Py_BuildValue("s", this->buf->b_ffname);
|
|
Karsten Hopp |
869996 |
! else if (strcmp(name, "number") == 0)
|
|
Karsten Hopp |
869996 |
! return Py_BuildValue("n", this->buf->b_fnum);
|
|
Karsten Hopp |
869996 |
else
|
|
Karsten Hopp |
869996 |
return PyObject_GenericGetAttr(self, nameobj);
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
--- 1106,1124 ----
|
|
Karsten Hopp |
869996 |
return (PyObject *)(self);
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
static PyObject *
|
|
Karsten Hopp |
869996 |
BufferGetattro(PyObject *self, PyObject*nameobj)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
! PyObject *r;
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
GET_ATTR_STRING(name, nameobj);
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
! if (CheckBuffer((BufferObject *)(self)))
|
|
Karsten Hopp |
869996 |
return NULL;
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
! r = BufferAttr((BufferObject *)(self), name);
|
|
Karsten Hopp |
869996 |
! if (r || PyErr_Occurred())
|
|
Karsten Hopp |
869996 |
! return r;
|
|
Karsten Hopp |
869996 |
else
|
|
Karsten Hopp |
869996 |
return PyObject_GenericGetAttr(self, nameobj);
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 1130,1164 ****
|
|
Karsten Hopp |
869996 |
"append", "mark", "range");
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
- static PyObject *
|
|
Karsten Hopp |
869996 |
- BufferRepr(PyObject *self)
|
|
Karsten Hopp |
869996 |
- {
|
|
Karsten Hopp |
869996 |
- static char repr[100];
|
|
Karsten Hopp |
869996 |
- BufferObject *this = (BufferObject *)(self);
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- if (this->buf == INVALID_BUFFER_VALUE)
|
|
Karsten Hopp |
869996 |
- {
|
|
Karsten Hopp |
869996 |
- vim_snprintf(repr, 100, _("<buffer object (deleted) at %p>"), (self));
|
|
Karsten Hopp |
869996 |
- return PyUnicode_FromString(repr);
|
|
Karsten Hopp |
869996 |
- }
|
|
Karsten Hopp |
869996 |
- else
|
|
Karsten Hopp |
869996 |
- {
|
|
Karsten Hopp |
869996 |
- char *name = (char *)this->buf->b_fname;
|
|
Karsten Hopp |
869996 |
- Py_ssize_t len;
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- if (name == NULL)
|
|
Karsten Hopp |
869996 |
- name = "";
|
|
Karsten Hopp |
869996 |
- len = strlen(name);
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- if (len > 35)
|
|
Karsten Hopp |
869996 |
- name = name + (35 - len);
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- vim_snprintf(repr, 100, "<buffer %s%s>", len > 35 ? "..." : "", name);
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- return PyUnicode_FromString(repr);
|
|
Karsten Hopp |
869996 |
- }
|
|
Karsten Hopp |
869996 |
- }
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
/******************/
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
static Py_ssize_t
|
|
Karsten Hopp |
869996 |
--- 1130,1135 ----
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 1255,1261 ****
|
|
Karsten Hopp |
869996 |
0, /* sq_inplace_repeat */
|
|
Karsten Hopp |
869996 |
};
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
! PyMappingMethods RangeAsMapping = {
|
|
Karsten Hopp |
869996 |
/* mp_length */ (lenfunc)RangeLength,
|
|
Karsten Hopp |
869996 |
/* mp_subscript */ (binaryfunc)RangeSubscript,
|
|
Karsten Hopp |
869996 |
/* mp_ass_subscript */ (objobjargproc)RangeAsSubscript,
|
|
Karsten Hopp |
869996 |
--- 1226,1232 ----
|
|
Karsten Hopp |
869996 |
0, /* sq_inplace_repeat */
|
|
Karsten Hopp |
869996 |
};
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
! static PyMappingMethods RangeAsMapping = {
|
|
Karsten Hopp |
869996 |
/* mp_length */ (lenfunc)RangeLength,
|
|
Karsten Hopp |
869996 |
/* mp_subscript */ (binaryfunc)RangeSubscript,
|
|
Karsten Hopp |
869996 |
/* mp_ass_subscript */ (objobjargproc)RangeAsSubscript,
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 1264,1276 ****
|
|
Karsten Hopp |
869996 |
/* Line range object - Implementation
|
|
Karsten Hopp |
869996 |
*/
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
- static void
|
|
Karsten Hopp |
869996 |
- RangeDestructor(PyObject *self)
|
|
Karsten Hopp |
869996 |
- {
|
|
Karsten Hopp |
869996 |
- Py_DECREF(((RangeObject *)(self))->buf);
|
|
Karsten Hopp |
869996 |
- Py_TYPE(self)->tp_free((PyObject*)self);
|
|
Karsten Hopp |
869996 |
- }
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
static PyObject *
|
|
Karsten Hopp |
869996 |
RangeGetattro(PyObject *self, PyObject *nameobj)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
--- 1235,1240 ----
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 1358,1372 ****
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
/* Buffer list object - Definitions
|
|
Karsten Hopp |
869996 |
*/
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
- typedef struct
|
|
Karsten Hopp |
869996 |
- {
|
|
Karsten Hopp |
869996 |
- PyObject_HEAD
|
|
Karsten Hopp |
869996 |
- } BufListObject;
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
static PySequenceMethods BufListAsSeq = {
|
|
Karsten Hopp |
869996 |
(lenfunc) BufListLength, /* sq_length, len(x) */
|
|
Karsten Hopp |
869996 |
(binaryfunc) 0, /* sq_concat, x+y */
|
|
Karsten Hopp |
869996 |
--- 1322,1330 ----
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 1380,1397 ****
|
|
Karsten Hopp |
869996 |
0, /* sq_inplace_repeat */
|
|
Karsten Hopp |
869996 |
};
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
- static PyTypeObject BufListType;
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- /* Window object - Definitions
|
|
Karsten Hopp |
869996 |
- */
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- static struct PyMethodDef WindowMethods[] = {
|
|
Karsten Hopp |
869996 |
- /* name, function, calling, documentation */
|
|
Karsten Hopp |
869996 |
- { NULL, NULL, 0, NULL }
|
|
Karsten Hopp |
869996 |
- };
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- static PyTypeObject WindowType;
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
/* Window object - Implementation
|
|
Karsten Hopp |
869996 |
*/
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
--- 1338,1343 ----
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 1429,1471 ****
|
|
Karsten Hopp |
869996 |
return (PyObject *)(self);
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
- static void
|
|
Karsten Hopp |
869996 |
- WindowDestructor(PyObject *self)
|
|
Karsten Hopp |
869996 |
- {
|
|
Karsten Hopp |
869996 |
- WindowObject *this = (WindowObject *)(self);
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- if (this->win && this->win != INVALID_WINDOW_VALUE)
|
|
Karsten Hopp |
869996 |
- this->win->w_python3_ref = NULL;
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- Py_TYPE(self)->tp_free((PyObject*)self);
|
|
Karsten Hopp |
869996 |
- }
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
static PyObject *
|
|
Karsten Hopp |
869996 |
WindowGetattro(PyObject *self, PyObject *nameobj)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
! WindowObject *this = (WindowObject *)(self);
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
GET_ATTR_STRING(name, nameobj);
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
! if (CheckWindow(this))
|
|
Karsten Hopp |
869996 |
return NULL;
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
! if (strcmp(name, "buffer") == 0)
|
|
Karsten Hopp |
869996 |
! return (PyObject *)BufferNew(this->win->w_buffer);
|
|
Karsten Hopp |
869996 |
! else if (strcmp(name, "cursor") == 0)
|
|
Karsten Hopp |
869996 |
! {
|
|
Karsten Hopp |
869996 |
! pos_T *pos = &this->win->w_cursor;
|
|
Karsten Hopp |
869996 |
!
|
|
Karsten Hopp |
869996 |
! return Py_BuildValue("(ll)", (long)(pos->lnum), (long)(pos->col));
|
|
Karsten Hopp |
869996 |
! }
|
|
Karsten Hopp |
869996 |
! else if (strcmp(name, "height") == 0)
|
|
Karsten Hopp |
869996 |
! return Py_BuildValue("l", (long)(this->win->w_height));
|
|
Karsten Hopp |
869996 |
! #ifdef FEAT_VERTSPLIT
|
|
Karsten Hopp |
869996 |
! else if (strcmp(name, "width") == 0)
|
|
Karsten Hopp |
869996 |
! return Py_BuildValue("l", (long)(W_WIDTH(this->win)));
|
|
Karsten Hopp |
869996 |
! #endif
|
|
Karsten Hopp |
869996 |
! else if (strcmp(name,"__members__") == 0)
|
|
Karsten Hopp |
869996 |
! return Py_BuildValue("[sss]", "buffer", "cursor", "height");
|
|
Karsten Hopp |
869996 |
else
|
|
Karsten Hopp |
869996 |
return PyObject_GenericGetAttr(self, nameobj);
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
--- 1375,1393 ----
|
|
Karsten Hopp |
869996 |
return (PyObject *)(self);
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
static PyObject *
|
|
Karsten Hopp |
869996 |
WindowGetattro(PyObject *self, PyObject *nameobj)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
! PyObject *r;
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
GET_ATTR_STRING(name, nameobj);
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
! if (CheckWindow((WindowObject *)(self)))
|
|
Karsten Hopp |
869996 |
return NULL;
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
! r = WindowAttr((WindowObject *)(self), name);
|
|
Karsten Hopp |
869996 |
! if (r || PyErr_Occurred())
|
|
Karsten Hopp |
869996 |
! return r;
|
|
Karsten Hopp |
869996 |
else
|
|
Karsten Hopp |
869996 |
return PyObject_GenericGetAttr(self, nameobj);
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 1481,1492 ****
|
|
Karsten Hopp |
869996 |
/* Window list object - Definitions
|
|
Karsten Hopp |
869996 |
*/
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
- typedef struct
|
|
Karsten Hopp |
869996 |
- {
|
|
Karsten Hopp |
869996 |
- PyObject_HEAD
|
|
Karsten Hopp |
869996 |
- }
|
|
Karsten Hopp |
869996 |
- WinListObject;
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
static PySequenceMethods WinListAsSeq = {
|
|
Karsten Hopp |
869996 |
(lenfunc) WinListLength, /* sq_length, len(x) */
|
|
Karsten Hopp |
869996 |
(binaryfunc) 0, /* sq_concat, x+y */
|
|
Karsten Hopp |
869996 |
--- 1403,1408 ----
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 1500,1560 ****
|
|
Karsten Hopp |
869996 |
0, /* sq_inplace_repeat */
|
|
Karsten Hopp |
869996 |
};
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
- static PyTypeObject WinListType;
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- /* Current items object - Definitions
|
|
Karsten Hopp |
869996 |
- */
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- typedef struct
|
|
Karsten Hopp |
869996 |
- {
|
|
Karsten Hopp |
869996 |
- PyObject_HEAD
|
|
Karsten Hopp |
869996 |
- } CurrentObject;
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- static PyTypeObject CurrentType;
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
/* Current items object - Implementation
|
|
Karsten Hopp |
869996 |
*/
|
|
Karsten Hopp |
869996 |
static PyObject *
|
|
Karsten Hopp |
869996 |
! CurrentGetattro(PyObject *self UNUSED, PyObject *nameobj)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
GET_ATTR_STRING(name, nameobj);
|
|
Karsten Hopp |
869996 |
!
|
|
Karsten Hopp |
869996 |
! if (strcmp(name, "buffer") == 0)
|
|
Karsten Hopp |
869996 |
! return (PyObject *)BufferNew(curbuf);
|
|
Karsten Hopp |
869996 |
! else if (strcmp(name, "window") == 0)
|
|
Karsten Hopp |
869996 |
! return (PyObject *)WindowNew(curwin);
|
|
Karsten Hopp |
869996 |
! else if (strcmp(name, "line") == 0)
|
|
Karsten Hopp |
869996 |
! return GetBufferLine(curbuf, (Py_ssize_t)curwin->w_cursor.lnum);
|
|
Karsten Hopp |
869996 |
! else if (strcmp(name, "range") == 0)
|
|
Karsten Hopp |
869996 |
! return RangeNew(curbuf, RangeStart, RangeEnd);
|
|
Karsten Hopp |
869996 |
! else if (strcmp(name,"__members__") == 0)
|
|
Karsten Hopp |
869996 |
! return Py_BuildValue("[ssss]", "buffer", "window", "line", "range");
|
|
Karsten Hopp |
869996 |
! else
|
|
Karsten Hopp |
869996 |
! {
|
|
Karsten Hopp |
869996 |
! PyErr_SetString(PyExc_AttributeError, name);
|
|
Karsten Hopp |
869996 |
! return NULL;
|
|
Karsten Hopp |
869996 |
! }
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
static int
|
|
Karsten Hopp |
869996 |
! CurrentSetattro(PyObject *self UNUSED, PyObject *nameobj, PyObject *value)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
! char *name = "";
|
|
Karsten Hopp |
869996 |
! if (PyUnicode_Check(nameobj))
|
|
Karsten Hopp |
869996 |
! name = _PyUnicode_AsString(nameobj);
|
|
Karsten Hopp |
869996 |
!
|
|
Karsten Hopp |
869996 |
! if (strcmp(name, "line") == 0)
|
|
Karsten Hopp |
869996 |
! {
|
|
Karsten Hopp |
869996 |
! if (SetBufferLine(curbuf, (Py_ssize_t)curwin->w_cursor.lnum, value, NULL) == FAIL)
|
|
Karsten Hopp |
869996 |
! return -1;
|
|
Karsten Hopp |
869996 |
!
|
|
Karsten Hopp |
869996 |
! return 0;
|
|
Karsten Hopp |
869996 |
! }
|
|
Karsten Hopp |
869996 |
! else
|
|
Karsten Hopp |
869996 |
! {
|
|
Karsten Hopp |
869996 |
! PyErr_SetString(PyExc_AttributeError, name);
|
|
Karsten Hopp |
869996 |
! return -1;
|
|
Karsten Hopp |
869996 |
! }
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
/* Dictionary object - Definitions
|
|
Karsten Hopp |
869996 |
--- 1416,1435 ----
|
|
Karsten Hopp |
869996 |
0, /* sq_inplace_repeat */
|
|
Karsten Hopp |
869996 |
};
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
/* Current items object - Implementation
|
|
Karsten Hopp |
869996 |
*/
|
|
Karsten Hopp |
869996 |
static PyObject *
|
|
Karsten Hopp |
869996 |
! CurrentGetattro(PyObject *self, PyObject *nameobj)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
GET_ATTR_STRING(name, nameobj);
|
|
Karsten Hopp |
869996 |
! return CurrentGetattr(self, name);
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
static int
|
|
Karsten Hopp |
869996 |
! CurrentSetattro(PyObject *self, PyObject *nameobj, PyObject *value)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
! GET_ATTR_STRING(name, nameobj);
|
|
Karsten Hopp |
869996 |
! return CurrentSetattr(self, name, value);
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
/* Dictionary object - Definitions
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 1562,1573 ****
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
static PyInt DictionaryLength(PyObject *);
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
- static PyMappingMethods DictionaryAsMapping = {
|
|
Karsten Hopp |
869996 |
- /* mp_length */ (lenfunc) DictionaryLength,
|
|
Karsten Hopp |
869996 |
- /* mp_subscript */ (binaryfunc) DictionaryItem,
|
|
Karsten Hopp |
869996 |
- /* mp_ass_subscript */ (objobjargproc) DictionaryAssItem,
|
|
Karsten Hopp |
869996 |
- };
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
static PyObject *
|
|
Karsten Hopp |
869996 |
DictionaryGetattro(PyObject *self, PyObject *nameobj)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
--- 1437,1442 ----
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 1587,1606 ****
|
|
Karsten Hopp |
869996 |
DictionarySetattro(PyObject *self, PyObject *nameobj, PyObject *val)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
GET_ATTR_STRING(name, nameobj);
|
|
Karsten Hopp |
869996 |
! return DictionarySetattr((DictionaryObject *) self, name, val);
|
|
Karsten Hopp |
869996 |
! }
|
|
Karsten Hopp |
869996 |
!
|
|
Karsten Hopp |
869996 |
! static PyTypeObject DictionaryType;
|
|
Karsten Hopp |
869996 |
!
|
|
Karsten Hopp |
869996 |
! static void
|
|
Karsten Hopp |
869996 |
! DictionaryDestructor(PyObject *self)
|
|
Karsten Hopp |
869996 |
! {
|
|
Karsten Hopp |
869996 |
! DictionaryObject *this = (DictionaryObject *)(self);
|
|
Karsten Hopp |
869996 |
!
|
|
Karsten Hopp |
869996 |
! pyll_remove(&this->ref, &lastdict);
|
|
Karsten Hopp |
869996 |
! dict_unref(this->dict);
|
|
Karsten Hopp |
869996 |
!
|
|
Karsten Hopp |
869996 |
! Py_TYPE(self)->tp_free((PyObject*)self);
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
/* List object - Definitions
|
|
Karsten Hopp |
869996 |
--- 1456,1462 ----
|
|
Karsten Hopp |
869996 |
DictionarySetattro(PyObject *self, PyObject *nameobj, PyObject *val)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
GET_ATTR_STRING(name, nameobj);
|
|
Karsten Hopp |
869996 |
! return DictionarySetattr(self, name, val);
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
/* List object - Definitions
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 1631,1638 ****
|
|
Karsten Hopp |
869996 |
/* mp_ass_subscript */ (objobjargproc) ListAsSubscript,
|
|
Karsten Hopp |
869996 |
};
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
- static PyTypeObject ListType;
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
static PyObject *
|
|
Karsten Hopp |
869996 |
ListSubscript(PyObject *self, PyObject* idxObject)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
--- 1487,1492 ----
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 1696,1729 ****
|
|
Karsten Hopp |
869996 |
ListSetattro(PyObject *self, PyObject *nameobj, PyObject *val)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
GET_ATTR_STRING(name, nameobj);
|
|
Karsten Hopp |
869996 |
! return ListSetattr((ListObject *) self, name, val);
|
|
Karsten Hopp |
869996 |
! }
|
|
Karsten Hopp |
869996 |
!
|
|
Karsten Hopp |
869996 |
! static void
|
|
Karsten Hopp |
869996 |
! ListDestructor(PyObject *self)
|
|
Karsten Hopp |
869996 |
! {
|
|
Karsten Hopp |
869996 |
! ListObject *this = (ListObject *)(self);
|
|
Karsten Hopp |
869996 |
!
|
|
Karsten Hopp |
869996 |
! pyll_remove(&this->ref, &lastlist);
|
|
Karsten Hopp |
869996 |
! list_unref(this->list);
|
|
Karsten Hopp |
869996 |
!
|
|
Karsten Hopp |
869996 |
! Py_TYPE(self)->tp_free((PyObject*)self);
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
/* Function object - Definitions
|
|
Karsten Hopp |
869996 |
*/
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
- static void
|
|
Karsten Hopp |
869996 |
- FunctionDestructor(PyObject *self)
|
|
Karsten Hopp |
869996 |
- {
|
|
Karsten Hopp |
869996 |
- FunctionObject *this = (FunctionObject *) (self);
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- func_unref(this->name);
|
|
Karsten Hopp |
869996 |
- PyMem_Del(this->name);
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- Py_TYPE(self)->tp_free((PyObject*)self);
|
|
Karsten Hopp |
869996 |
- }
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
static PyObject *
|
|
Karsten Hopp |
869996 |
FunctionGetattro(PyObject *self, PyObject *nameobj)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
--- 1550,1561 ----
|
|
Karsten Hopp |
869996 |
ListSetattro(PyObject *self, PyObject *nameobj, PyObject *val)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
GET_ATTR_STRING(name, nameobj);
|
|
Karsten Hopp |
869996 |
! return ListSetattr(self, name, val);
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
/* Function object - Definitions
|
|
Karsten Hopp |
869996 |
*/
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
static PyObject *
|
|
Karsten Hopp |
869996 |
FunctionGetattro(PyObject *self, PyObject *nameobj)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 1779,1788 ****
|
|
Karsten Hopp |
869996 |
PyObject_HEAD_INIT(&CurrentType)
|
|
Karsten Hopp |
869996 |
};
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
- PyDoc_STRVAR(vim_module_doc,"vim python interface\n");
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- static struct PyModuleDef vimmodule;
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
static PyObject *
|
|
Karsten Hopp |
869996 |
Py3Init_vim(void)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
--- 1611,1616 ----
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 1898,2021 ****
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
set_ref_in_py(copyID);
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- static void
|
|
Karsten Hopp |
869996 |
- init_structs(void)
|
|
Karsten Hopp |
869996 |
- {
|
|
Karsten Hopp |
869996 |
- vim_memset(&OutputType, 0, sizeof(OutputType));
|
|
Karsten Hopp |
869996 |
- OutputType.tp_name = "vim.message";
|
|
Karsten Hopp |
869996 |
- OutputType.tp_basicsize = sizeof(OutputObject);
|
|
Karsten Hopp |
869996 |
- OutputType.tp_getattro = OutputGetattro;
|
|
Karsten Hopp |
869996 |
- OutputType.tp_setattro = OutputSetattro;
|
|
Karsten Hopp |
869996 |
- OutputType.tp_flags = Py_TPFLAGS_DEFAULT;
|
|
Karsten Hopp |
869996 |
- OutputType.tp_doc = "vim message object";
|
|
Karsten Hopp |
869996 |
- OutputType.tp_methods = OutputMethods;
|
|
Karsten Hopp |
869996 |
- OutputType.tp_alloc = call_PyType_GenericAlloc;
|
|
Karsten Hopp |
869996 |
- OutputType.tp_new = call_PyType_GenericNew;
|
|
Karsten Hopp |
869996 |
- OutputType.tp_free = call_PyObject_Free;
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- vim_memset(&BufferType, 0, sizeof(BufferType));
|
|
Karsten Hopp |
869996 |
- BufferType.tp_name = "vim.buffer";
|
|
Karsten Hopp |
869996 |
- BufferType.tp_basicsize = sizeof(BufferType);
|
|
Karsten Hopp |
869996 |
- BufferType.tp_dealloc = BufferDestructor;
|
|
Karsten Hopp |
869996 |
- BufferType.tp_repr = BufferRepr;
|
|
Karsten Hopp |
869996 |
- BufferType.tp_as_sequence = &BufferAsSeq;
|
|
Karsten Hopp |
869996 |
- BufferType.tp_as_mapping = &BufferAsMapping;
|
|
Karsten Hopp |
869996 |
- BufferType.tp_getattro = BufferGetattro;
|
|
Karsten Hopp |
869996 |
- BufferType.tp_flags = Py_TPFLAGS_DEFAULT;
|
|
Karsten Hopp |
869996 |
- BufferType.tp_doc = "vim buffer object";
|
|
Karsten Hopp |
869996 |
- BufferType.tp_methods = BufferMethods;
|
|
Karsten Hopp |
869996 |
- BufferType.tp_alloc = call_PyType_GenericAlloc;
|
|
Karsten Hopp |
869996 |
- BufferType.tp_new = call_PyType_GenericNew;
|
|
Karsten Hopp |
869996 |
- BufferType.tp_free = call_PyObject_Free;
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- vim_memset(&WindowType, 0, sizeof(WindowType));
|
|
Karsten Hopp |
869996 |
- WindowType.tp_name = "vim.window";
|
|
Karsten Hopp |
869996 |
- WindowType.tp_basicsize = sizeof(WindowObject);
|
|
Karsten Hopp |
869996 |
- WindowType.tp_dealloc = WindowDestructor;
|
|
Karsten Hopp |
869996 |
- WindowType.tp_repr = WindowRepr;
|
|
Karsten Hopp |
869996 |
- WindowType.tp_getattro = WindowGetattro;
|
|
Karsten Hopp |
869996 |
- WindowType.tp_setattro = WindowSetattro;
|
|
Karsten Hopp |
869996 |
- WindowType.tp_flags = Py_TPFLAGS_DEFAULT;
|
|
Karsten Hopp |
869996 |
- WindowType.tp_doc = "vim Window object";
|
|
Karsten Hopp |
869996 |
- WindowType.tp_methods = WindowMethods;
|
|
Karsten Hopp |
869996 |
- WindowType.tp_alloc = call_PyType_GenericAlloc;
|
|
Karsten Hopp |
869996 |
- WindowType.tp_new = call_PyType_GenericNew;
|
|
Karsten Hopp |
869996 |
- WindowType.tp_free = call_PyObject_Free;
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- vim_memset(&BufListType, 0, sizeof(BufListType));
|
|
Karsten Hopp |
869996 |
- BufListType.tp_name = "vim.bufferlist";
|
|
Karsten Hopp |
869996 |
- BufListType.tp_basicsize = sizeof(BufListObject);
|
|
Karsten Hopp |
869996 |
- BufListType.tp_as_sequence = &BufListAsSeq;
|
|
Karsten Hopp |
869996 |
- BufListType.tp_flags = Py_TPFLAGS_DEFAULT;
|
|
Karsten Hopp |
869996 |
- BufferType.tp_doc = "vim buffer list";
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- vim_memset(&WinListType, 0, sizeof(WinListType));
|
|
Karsten Hopp |
869996 |
- WinListType.tp_name = "vim.windowlist";
|
|
Karsten Hopp |
869996 |
- WinListType.tp_basicsize = sizeof(WinListType);
|
|
Karsten Hopp |
869996 |
- WinListType.tp_as_sequence = &WinListAsSeq;
|
|
Karsten Hopp |
869996 |
- WinListType.tp_flags = Py_TPFLAGS_DEFAULT;
|
|
Karsten Hopp |
869996 |
- WinListType.tp_doc = "vim window list";
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- vim_memset(&RangeType, 0, sizeof(RangeType));
|
|
Karsten Hopp |
869996 |
- RangeType.tp_name = "vim.range";
|
|
Karsten Hopp |
869996 |
- RangeType.tp_basicsize = sizeof(RangeObject);
|
|
Karsten Hopp |
869996 |
- RangeType.tp_dealloc = RangeDestructor;
|
|
Karsten Hopp |
869996 |
- RangeType.tp_repr = RangeRepr;
|
|
Karsten Hopp |
869996 |
- RangeType.tp_as_sequence = &RangeAsSeq;
|
|
Karsten Hopp |
869996 |
- RangeType.tp_as_mapping = &RangeAsMapping;
|
|
Karsten Hopp |
869996 |
- RangeType.tp_getattro = RangeGetattro;
|
|
Karsten Hopp |
869996 |
- RangeType.tp_flags = Py_TPFLAGS_DEFAULT;
|
|
Karsten Hopp |
869996 |
- RangeType.tp_doc = "vim Range object";
|
|
Karsten Hopp |
869996 |
- RangeType.tp_methods = RangeMethods;
|
|
Karsten Hopp |
869996 |
- RangeType.tp_alloc = call_PyType_GenericAlloc;
|
|
Karsten Hopp |
869996 |
- RangeType.tp_new = call_PyType_GenericNew;
|
|
Karsten Hopp |
869996 |
- RangeType.tp_free = call_PyObject_Free;
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- vim_memset(&CurrentType, 0, sizeof(CurrentType));
|
|
Karsten Hopp |
869996 |
- CurrentType.tp_name = "vim.currentdata";
|
|
Karsten Hopp |
869996 |
- CurrentType.tp_basicsize = sizeof(CurrentObject);
|
|
Karsten Hopp |
869996 |
- CurrentType.tp_getattro = CurrentGetattro;
|
|
Karsten Hopp |
869996 |
- CurrentType.tp_setattro = CurrentSetattro;
|
|
Karsten Hopp |
869996 |
- CurrentType.tp_flags = Py_TPFLAGS_DEFAULT;
|
|
Karsten Hopp |
869996 |
- CurrentType.tp_doc = "vim current object";
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- vim_memset(&DictionaryType, 0, sizeof(DictionaryType));
|
|
Karsten Hopp |
869996 |
- DictionaryType.tp_name = "vim.dictionary";
|
|
Karsten Hopp |
869996 |
- DictionaryType.tp_basicsize = sizeof(DictionaryObject);
|
|
Karsten Hopp |
869996 |
- DictionaryType.tp_getattro = DictionaryGetattro;
|
|
Karsten Hopp |
869996 |
- DictionaryType.tp_setattro = DictionarySetattro;
|
|
Karsten Hopp |
869996 |
- DictionaryType.tp_dealloc = DictionaryDestructor;
|
|
Karsten Hopp |
869996 |
- DictionaryType.tp_as_mapping = &DictionaryAsMapping;
|
|
Karsten Hopp |
869996 |
- DictionaryType.tp_flags = Py_TPFLAGS_DEFAULT;
|
|
Karsten Hopp |
869996 |
- DictionaryType.tp_doc = "dictionary pushing modifications to vim structure";
|
|
Karsten Hopp |
869996 |
- DictionaryType.tp_methods = DictionaryMethods;
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- vim_memset(&ListType, 0, sizeof(ListType));
|
|
Karsten Hopp |
869996 |
- ListType.tp_name = "vim.list";
|
|
Karsten Hopp |
869996 |
- ListType.tp_dealloc = ListDestructor;
|
|
Karsten Hopp |
869996 |
- ListType.tp_basicsize = sizeof(ListObject);
|
|
Karsten Hopp |
869996 |
- ListType.tp_getattro = ListGetattro;
|
|
Karsten Hopp |
869996 |
- ListType.tp_setattro = ListSetattro;
|
|
Karsten Hopp |
869996 |
- ListType.tp_as_sequence = &ListAsSeq;
|
|
Karsten Hopp |
869996 |
- ListType.tp_as_mapping = &ListAsMapping;
|
|
Karsten Hopp |
869996 |
- ListType.tp_flags = Py_TPFLAGS_DEFAULT;
|
|
Karsten Hopp |
869996 |
- ListType.tp_doc = "list pushing modifications to vim structure";
|
|
Karsten Hopp |
869996 |
- ListType.tp_methods = ListMethods;
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- vim_memset(&FunctionType, 0, sizeof(FunctionType));
|
|
Karsten Hopp |
869996 |
- FunctionType.tp_name = "vim.list";
|
|
Karsten Hopp |
869996 |
- FunctionType.tp_basicsize = sizeof(FunctionObject);
|
|
Karsten Hopp |
869996 |
- FunctionType.tp_getattro = FunctionGetattro;
|
|
Karsten Hopp |
869996 |
- FunctionType.tp_dealloc = FunctionDestructor;
|
|
Karsten Hopp |
869996 |
- FunctionType.tp_call = FunctionCall;
|
|
Karsten Hopp |
869996 |
- FunctionType.tp_flags = Py_TPFLAGS_DEFAULT;
|
|
Karsten Hopp |
869996 |
- FunctionType.tp_doc = "object that calls vim function";
|
|
Karsten Hopp |
869996 |
- FunctionType.tp_methods = FunctionMethods;
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- vim_memset(&vimmodule, 0, sizeof(vimmodule));
|
|
Karsten Hopp |
869996 |
- vimmodule.m_name = "vim";
|
|
Karsten Hopp |
869996 |
- vimmodule.m_doc = vim_module_doc;
|
|
Karsten Hopp |
869996 |
- vimmodule.m_size = -1;
|
|
Karsten Hopp |
869996 |
- vimmodule.m_methods = VimMethods;
|
|
Karsten Hopp |
869996 |
- }
|
|
Karsten Hopp |
869996 |
--- 1726,1728 ----
|
|
Karsten Hopp |
869996 |
*** ../vim-7.3.908/src/if_python.c 2013-04-24 13:04:21.000000000 +0200
|
|
Karsten Hopp |
869996 |
--- src/if_python.c 2013-04-24 13:35:06.000000000 +0200
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 87,92 ****
|
|
Karsten Hopp |
869996 |
--- 87,93 ----
|
|
Karsten Hopp |
869996 |
# define Py_ssize_t_fmt "n"
|
|
Karsten Hopp |
869996 |
#else
|
|
Karsten Hopp |
869996 |
# define PyInt int
|
|
Karsten Hopp |
869996 |
+ # define lenfunc inquiry
|
|
Karsten Hopp |
869996 |
# define PyInquiry inquiry
|
|
Karsten Hopp |
869996 |
# define PyIntArgFunc intargfunc
|
|
Karsten Hopp |
869996 |
# define PyIntIntArgFunc intintargfunc
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 600,607 ****
|
|
Karsten Hopp |
869996 |
static PyObject *DictionaryNew(dict_T *);
|
|
Karsten Hopp |
869996 |
static PyObject *LineToString(const char *);
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
- static PyTypeObject RangeType;
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
static int initialised = 0;
|
|
Karsten Hopp |
869996 |
#define PYINITIALISED initialised
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
--- 601,606 ----
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 617,622 ****
|
|
Karsten Hopp |
869996 |
--- 616,631 ----
|
|
Karsten Hopp |
869996 |
#define DICTKEY_UNREF
|
|
Karsten Hopp |
869996 |
#define DICTKEY_DECL
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
+ #define DESTRUCTOR_FINISH(self) Py_DECREF(self);
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
+ static PyObject *OutputGetattr(PyObject *, char *);
|
|
Karsten Hopp |
869996 |
+ static PyObject *BufferGetattr(PyObject *, char *);
|
|
Karsten Hopp |
869996 |
+ static PyObject *WindowGetattr(PyObject *, char *);
|
|
Karsten Hopp |
869996 |
+ static PyObject *RangeGetattr(PyObject *, char *);
|
|
Karsten Hopp |
869996 |
+ static PyObject *DictionaryGetattr(PyObject *, char*);
|
|
Karsten Hopp |
869996 |
+ static PyObject *ListGetattr(PyObject *, char *);
|
|
Karsten Hopp |
869996 |
+ static PyObject *FunctionGetattr(PyObject *, char *);
|
|
Karsten Hopp |
869996 |
+
|
|
Karsten Hopp |
869996 |
/*
|
|
Karsten Hopp |
869996 |
* Include the code shared with if_python3.c
|
|
Karsten Hopp |
869996 |
*/
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 627,635 ****
|
|
Karsten Hopp |
869996 |
* Internal function prototypes.
|
|
Karsten Hopp |
869996 |
*/
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
- static PyInt RangeStart;
|
|
Karsten Hopp |
869996 |
- static PyInt RangeEnd;
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
static PyObject *globals;
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
static void PythonIO_Flush(void);
|
|
Karsten Hopp |
869996 |
--- 636,641 ----
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 1003,1021 ****
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
#define WindowType_Check(obj) ((obj)->ob_type == &WindowType)
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
- static void WindowDestructor(PyObject *);
|
|
Karsten Hopp |
869996 |
- static PyObject *WindowGetattr(PyObject *, char *);
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
/* Buffer type - Implementation functions
|
|
Karsten Hopp |
869996 |
* --------------------------------------
|
|
Karsten Hopp |
869996 |
*/
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
#define BufferType_Check(obj) ((obj)->ob_type == &BufferType)
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
- static void BufferDestructor(PyObject *);
|
|
Karsten Hopp |
869996 |
- static PyObject *BufferGetattr(PyObject *, char *);
|
|
Karsten Hopp |
869996 |
- static PyObject *BufferRepr(PyObject *);
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
static PyInt BufferLength(PyObject *);
|
|
Karsten Hopp |
869996 |
static PyObject *BufferItem(PyObject *, PyInt);
|
|
Karsten Hopp |
869996 |
static PyObject *BufferSlice(PyObject *, PyInt, PyInt);
|
|
Karsten Hopp |
869996 |
--- 1009,1020 ----
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 1035,1043 ****
|
|
Karsten Hopp |
869996 |
* -----------------------------------------------
|
|
Karsten Hopp |
869996 |
*/
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
- static PyObject *CurrentGetattr(PyObject *, char *);
|
|
Karsten Hopp |
869996 |
- static int CurrentSetattr(PyObject *, char *, PyObject *);
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
static PySequenceMethods BufferAsSeq = {
|
|
Karsten Hopp |
869996 |
(PyInquiry) BufferLength, /* sq_length, len(x) */
|
|
Karsten Hopp |
869996 |
(binaryfunc) 0, /* BufferConcat, sq_concat, x+y */
|
|
Karsten Hopp |
869996 |
--- 1034,1039 ----
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 1045,1074 ****
|
|
Karsten Hopp |
869996 |
(PyIntArgFunc) BufferItem, /* sq_item, x[i] */
|
|
Karsten Hopp |
869996 |
(PyIntIntArgFunc) BufferSlice, /* sq_slice, x[i:j] */
|
|
Karsten Hopp |
869996 |
(PyIntObjArgProc) BufferAssItem, /* sq_ass_item, x[i]=v */
|
|
Karsten Hopp |
869996 |
! (PyIntIntObjArgProc) BufferAssSlice, /* sq_ass_slice, x[i:j]=v */
|
|
Karsten Hopp |
869996 |
! };
|
|
Karsten Hopp |
869996 |
!
|
|
Karsten Hopp |
869996 |
! static PyTypeObject BufferType = {
|
|
Karsten Hopp |
869996 |
! PyObject_HEAD_INIT(0)
|
|
Karsten Hopp |
869996 |
! 0,
|
|
Karsten Hopp |
869996 |
! "buffer",
|
|
Karsten Hopp |
869996 |
! sizeof(BufferObject),
|
|
Karsten Hopp |
869996 |
0,
|
|
Karsten Hopp |
869996 |
!
|
|
Karsten Hopp |
869996 |
! (destructor) BufferDestructor, /* tp_dealloc, refcount==0 */
|
|
Karsten Hopp |
869996 |
! (printfunc) 0, /* tp_print, print x */
|
|
Karsten Hopp |
869996 |
! (getattrfunc) BufferGetattr, /* tp_getattr, x.attr */
|
|
Karsten Hopp |
869996 |
! (setattrfunc) 0, /* tp_setattr, x.attr=v */
|
|
Karsten Hopp |
869996 |
! (cmpfunc) 0, /* tp_compare, x>y */
|
|
Karsten Hopp |
869996 |
! (reprfunc) BufferRepr, /* tp_repr, `x`, print x */
|
|
Karsten Hopp |
869996 |
!
|
|
Karsten Hopp |
869996 |
! 0, /* as number */
|
|
Karsten Hopp |
869996 |
! &BufferAsSeq, /* as sequence */
|
|
Karsten Hopp |
869996 |
! 0, /* as mapping */
|
|
Karsten Hopp |
869996 |
!
|
|
Karsten Hopp |
869996 |
! (hashfunc) 0, /* tp_hash, dict(x) */
|
|
Karsten Hopp |
869996 |
! (ternaryfunc) 0, /* tp_call, x() */
|
|
Karsten Hopp |
869996 |
! (reprfunc) 0, /* tp_str, str(x) */
|
|
Karsten Hopp |
869996 |
};
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
/* Buffer object - Implementation
|
|
Karsten Hopp |
869996 |
--- 1041,1052 ----
|
|
Karsten Hopp |
869996 |
(PyIntArgFunc) BufferItem, /* sq_item, x[i] */
|
|
Karsten Hopp |
869996 |
(PyIntIntArgFunc) BufferSlice, /* sq_slice, x[i:j] */
|
|
Karsten Hopp |
869996 |
(PyIntObjArgProc) BufferAssItem, /* sq_ass_item, x[i]=v */
|
|
Karsten Hopp |
869996 |
! (PyIntIntObjArgProc) BufferAssSlice, /* sq_ass_slice, x[i:j]=v */
|
|
Karsten Hopp |
869996 |
! (objobjproc) 0,
|
|
Karsten Hopp |
869996 |
! #if PY_MAJOR_VERSION >= 2
|
|
Karsten Hopp |
869996 |
! (binaryfunc) 0,
|
|
Karsten Hopp |
869996 |
0,
|
|
Karsten Hopp |
869996 |
! #endif
|
|
Karsten Hopp |
869996 |
};
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
/* Buffer object - Implementation
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 1110,1173 ****
|
|
Karsten Hopp |
869996 |
return (PyObject *)(self);
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
- static void
|
|
Karsten Hopp |
869996 |
- BufferDestructor(PyObject *self)
|
|
Karsten Hopp |
869996 |
- {
|
|
Karsten Hopp |
869996 |
- BufferObject *this = (BufferObject *)(self);
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- if (this->buf && this->buf != INVALID_BUFFER_VALUE)
|
|
Karsten Hopp |
869996 |
- this->buf->b_python_ref = NULL;
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- Py_DECREF(self);
|
|
Karsten Hopp |
869996 |
- }
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
static PyObject *
|
|
Karsten Hopp |
869996 |
BufferGetattr(PyObject *self, char *name)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
! BufferObject *this = (BufferObject *)(self);
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
! if (CheckBuffer(this))
|
|
Karsten Hopp |
869996 |
return NULL;
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
! if (strcmp(name, "name") == 0)
|
|
Karsten Hopp |
869996 |
! return Py_BuildValue("s", this->buf->b_ffname);
|
|
Karsten Hopp |
869996 |
! else if (strcmp(name, "number") == 0)
|
|
Karsten Hopp |
869996 |
! return Py_BuildValue(Py_ssize_t_fmt, this->buf->b_fnum);
|
|
Karsten Hopp |
869996 |
! else if (strcmp(name,"__members__") == 0)
|
|
Karsten Hopp |
869996 |
! return Py_BuildValue("[ss]", "name", "number");
|
|
Karsten Hopp |
869996 |
else
|
|
Karsten Hopp |
869996 |
return Py_FindMethod(BufferMethods, self, name);
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
- static PyObject *
|
|
Karsten Hopp |
869996 |
- BufferRepr(PyObject *self)
|
|
Karsten Hopp |
869996 |
- {
|
|
Karsten Hopp |
869996 |
- static char repr[100];
|
|
Karsten Hopp |
869996 |
- BufferObject *this = (BufferObject *)(self);
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- if (this->buf == INVALID_BUFFER_VALUE)
|
|
Karsten Hopp |
869996 |
- {
|
|
Karsten Hopp |
869996 |
- vim_snprintf(repr, 100, _("<buffer object (deleted) at %p>"), (self));
|
|
Karsten Hopp |
869996 |
- return PyString_FromString(repr);
|
|
Karsten Hopp |
869996 |
- }
|
|
Karsten Hopp |
869996 |
- else
|
|
Karsten Hopp |
869996 |
- {
|
|
Karsten Hopp |
869996 |
- char *name = (char *)this->buf->b_fname;
|
|
Karsten Hopp |
869996 |
- PyInt len;
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- if (name == NULL)
|
|
Karsten Hopp |
869996 |
- name = "";
|
|
Karsten Hopp |
869996 |
- len = strlen(name);
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- if (len > 35)
|
|
Karsten Hopp |
869996 |
- name = name + (35 - len);
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- vim_snprintf(repr, 100, "<buffer %s%s>", len > 35 ? "..." : "", name);
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- return PyString_FromString(repr);
|
|
Karsten Hopp |
869996 |
- }
|
|
Karsten Hopp |
869996 |
- }
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
/******************/
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
static PyInt
|
|
Karsten Hopp |
869996 |
--- 1088,1108 ----
|
|
Karsten Hopp |
869996 |
return (PyObject *)(self);
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
static PyObject *
|
|
Karsten Hopp |
869996 |
BufferGetattr(PyObject *self, char *name)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
! PyObject *r;
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
! if (CheckBuffer((BufferObject *)(self)))
|
|
Karsten Hopp |
869996 |
return NULL;
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
! r = BufferAttr((BufferObject *)(self), name);
|
|
Karsten Hopp |
869996 |
! if (r || PyErr_Occurred())
|
|
Karsten Hopp |
869996 |
! return r;
|
|
Karsten Hopp |
869996 |
else
|
|
Karsten Hopp |
869996 |
return Py_FindMethod(BufferMethods, self, name);
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
/******************/
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
static PyInt
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 1211,1235 ****
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
static PySequenceMethods RangeAsSeq = {
|
|
Karsten Hopp |
869996 |
! (PyInquiry) RangeLength, /* sq_length, len(x) */
|
|
Karsten Hopp |
869996 |
! (binaryfunc) 0, /* RangeConcat, */ /* sq_concat, x+y */
|
|
Karsten Hopp |
869996 |
! (PyIntArgFunc) 0, /* RangeRepeat, */ /* sq_repeat, x*n */
|
|
Karsten Hopp |
869996 |
! (PyIntArgFunc) RangeItem, /* sq_item, x[i] */
|
|
Karsten Hopp |
869996 |
! (PyIntIntArgFunc) RangeSlice, /* sq_slice, x[i:j] */
|
|
Karsten Hopp |
869996 |
! (PyIntObjArgProc) RangeAssItem, /* sq_ass_item, x[i]=v */
|
|
Karsten Hopp |
869996 |
! (PyIntIntObjArgProc) RangeAssSlice, /* sq_ass_slice, x[i:j]=v */
|
|
Karsten Hopp |
869996 |
};
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
/* Line range object - Implementation
|
|
Karsten Hopp |
869996 |
*/
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
- static void
|
|
Karsten Hopp |
869996 |
- RangeDestructor(PyObject *self)
|
|
Karsten Hopp |
869996 |
- {
|
|
Karsten Hopp |
869996 |
- Py_DECREF(((RangeObject *)(self))->buf);
|
|
Karsten Hopp |
869996 |
- Py_DECREF(self);
|
|
Karsten Hopp |
869996 |
- }
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
static PyObject *
|
|
Karsten Hopp |
869996 |
RangeGetattr(PyObject *self, char *name)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
--- 1146,1168 ----
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
static PySequenceMethods RangeAsSeq = {
|
|
Karsten Hopp |
869996 |
! (PyInquiry) RangeLength, /* sq_length, len(x) */
|
|
Karsten Hopp |
869996 |
! (binaryfunc) 0, /* RangeConcat, */ /* sq_concat, x+y */
|
|
Karsten Hopp |
869996 |
! (PyIntArgFunc) 0, /* RangeRepeat, */ /* sq_repeat, x*n */
|
|
Karsten Hopp |
869996 |
! (PyIntArgFunc) RangeItem, /* sq_item, x[i] */
|
|
Karsten Hopp |
869996 |
! (PyIntIntArgFunc) RangeSlice, /* sq_slice, x[i:j] */
|
|
Karsten Hopp |
869996 |
! (PyIntObjArgProc) RangeAssItem, /* sq_ass_item, x[i]=v */
|
|
Karsten Hopp |
869996 |
! (PyIntIntObjArgProc) RangeAssSlice, /* sq_ass_slice, x[i:j]=v */
|
|
Karsten Hopp |
869996 |
! (objobjproc) 0,
|
|
Karsten Hopp |
869996 |
! #if PY_MAJOR_VERSION >= 2
|
|
Karsten Hopp |
869996 |
! (binaryfunc) 0,
|
|
Karsten Hopp |
869996 |
! 0,
|
|
Karsten Hopp |
869996 |
! #endif
|
|
Karsten Hopp |
869996 |
};
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
/* Line range object - Implementation
|
|
Karsten Hopp |
869996 |
*/
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
static PyObject *
|
|
Karsten Hopp |
869996 |
RangeGetattr(PyObject *self, char *name)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 1264,1274 ****
|
|
Karsten Hopp |
869996 |
/* Buffer list object - Definitions
|
|
Karsten Hopp |
869996 |
*/
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
- typedef struct
|
|
Karsten Hopp |
869996 |
- {
|
|
Karsten Hopp |
869996 |
- PyObject_HEAD
|
|
Karsten Hopp |
869996 |
- } BufListObject;
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
static PySequenceMethods BufListAsSeq = {
|
|
Karsten Hopp |
869996 |
(PyInquiry) BufListLength, /* sq_length, len(x) */
|
|
Karsten Hopp |
869996 |
(binaryfunc) 0, /* sq_concat, x+y */
|
|
Karsten Hopp |
869996 |
--- 1197,1202 ----
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 1276,1336 ****
|
|
Karsten Hopp |
869996 |
(PyIntArgFunc) BufListItem, /* sq_item, x[i] */
|
|
Karsten Hopp |
869996 |
(PyIntIntArgFunc) 0, /* sq_slice, x[i:j] */
|
|
Karsten Hopp |
869996 |
(PyIntObjArgProc) 0, /* sq_ass_item, x[i]=v */
|
|
Karsten Hopp |
869996 |
! (PyIntIntObjArgProc) 0, /* sq_ass_slice, x[i:j]=v */
|
|
Karsten Hopp |
869996 |
! };
|
|
Karsten Hopp |
869996 |
!
|
|
Karsten Hopp |
869996 |
! static PyTypeObject BufListType = {
|
|
Karsten Hopp |
869996 |
! PyObject_HEAD_INIT(0)
|
|
Karsten Hopp |
869996 |
! 0,
|
|
Karsten Hopp |
869996 |
! "buffer list",
|
|
Karsten Hopp |
869996 |
! sizeof(BufListObject),
|
|
Karsten Hopp |
869996 |
! 0,
|
|
Karsten Hopp |
869996 |
!
|
|
Karsten Hopp |
869996 |
! (destructor) 0, /* tp_dealloc, refcount==0 */
|
|
Karsten Hopp |
869996 |
! (printfunc) 0, /* tp_print, print x */
|
|
Karsten Hopp |
869996 |
! (getattrfunc) 0, /* tp_getattr, x.attr */
|
|
Karsten Hopp |
869996 |
! (setattrfunc) 0, /* tp_setattr, x.attr=v */
|
|
Karsten Hopp |
869996 |
! (cmpfunc) 0, /* tp_compare, x>y */
|
|
Karsten Hopp |
869996 |
! (reprfunc) 0, /* tp_repr, `x`, print x */
|
|
Karsten Hopp |
869996 |
!
|
|
Karsten Hopp |
869996 |
! 0, /* as number */
|
|
Karsten Hopp |
869996 |
! &BufListAsSeq, /* as sequence */
|
|
Karsten Hopp |
869996 |
! 0, /* as mapping */
|
|
Karsten Hopp |
869996 |
!
|
|
Karsten Hopp |
869996 |
! (hashfunc) 0, /* tp_hash, dict(x) */
|
|
Karsten Hopp |
869996 |
! (ternaryfunc) 0, /* tp_call, x() */
|
|
Karsten Hopp |
869996 |
! (reprfunc) 0, /* tp_str, str(x) */
|
|
Karsten Hopp |
869996 |
! };
|
|
Karsten Hopp |
869996 |
!
|
|
Karsten Hopp |
869996 |
! /* Window object - Definitions
|
|
Karsten Hopp |
869996 |
! */
|
|
Karsten Hopp |
869996 |
!
|
|
Karsten Hopp |
869996 |
! static struct PyMethodDef WindowMethods[] = {
|
|
Karsten Hopp |
869996 |
! /* name, function, calling, documentation */
|
|
Karsten Hopp |
869996 |
! { NULL, NULL, 0, NULL }
|
|
Karsten Hopp |
869996 |
! };
|
|
Karsten Hopp |
869996 |
!
|
|
Karsten Hopp |
869996 |
! static PyTypeObject WindowType = {
|
|
Karsten Hopp |
869996 |
! PyObject_HEAD_INIT(0)
|
|
Karsten Hopp |
869996 |
! 0,
|
|
Karsten Hopp |
869996 |
! "window",
|
|
Karsten Hopp |
869996 |
! sizeof(WindowObject),
|
|
Karsten Hopp |
869996 |
0,
|
|
Karsten Hopp |
869996 |
!
|
|
Karsten Hopp |
869996 |
! (destructor) WindowDestructor, /* tp_dealloc, refcount==0 */
|
|
Karsten Hopp |
869996 |
! (printfunc) 0, /* tp_print, print x */
|
|
Karsten Hopp |
869996 |
! (getattrfunc) WindowGetattr, /* tp_getattr, x.attr */
|
|
Karsten Hopp |
869996 |
! (setattrfunc) WindowSetattr, /* tp_setattr, x.attr=v */
|
|
Karsten Hopp |
869996 |
! (cmpfunc) 0, /* tp_compare, x>y */
|
|
Karsten Hopp |
869996 |
! (reprfunc) WindowRepr, /* tp_repr, `x`, print x */
|
|
Karsten Hopp |
869996 |
!
|
|
Karsten Hopp |
869996 |
! 0, /* as number */
|
|
Karsten Hopp |
869996 |
! 0, /* as sequence */
|
|
Karsten Hopp |
869996 |
! 0, /* as mapping */
|
|
Karsten Hopp |
869996 |
!
|
|
Karsten Hopp |
869996 |
! (hashfunc) 0, /* tp_hash, dict(x) */
|
|
Karsten Hopp |
869996 |
! (ternaryfunc) 0, /* tp_call, x() */
|
|
Karsten Hopp |
869996 |
! (reprfunc) 0, /* tp_str, str(x) */
|
|
Karsten Hopp |
869996 |
};
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
/* Window object - Implementation
|
|
Karsten Hopp |
869996 |
--- 1204,1215 ----
|
|
Karsten Hopp |
869996 |
(PyIntArgFunc) BufListItem, /* sq_item, x[i] */
|
|
Karsten Hopp |
869996 |
(PyIntIntArgFunc) 0, /* sq_slice, x[i:j] */
|
|
Karsten Hopp |
869996 |
(PyIntObjArgProc) 0, /* sq_ass_item, x[i]=v */
|
|
Karsten Hopp |
869996 |
! (PyIntIntObjArgProc) 0, /* sq_ass_slice, x[i:j]=v */
|
|
Karsten Hopp |
869996 |
! (objobjproc) 0,
|
|
Karsten Hopp |
869996 |
! #if PY_MAJOR_VERSION >= 2
|
|
Karsten Hopp |
869996 |
! (binaryfunc) 0,
|
|
Karsten Hopp |
869996 |
0,
|
|
Karsten Hopp |
869996 |
! #endif
|
|
Karsten Hopp |
869996 |
};
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
/* Window object - Implementation
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 1370,1410 ****
|
|
Karsten Hopp |
869996 |
return (PyObject *)(self);
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
- static void
|
|
Karsten Hopp |
869996 |
- WindowDestructor(PyObject *self)
|
|
Karsten Hopp |
869996 |
- {
|
|
Karsten Hopp |
869996 |
- WindowObject *this = (WindowObject *)(self);
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- if (this->win && this->win != INVALID_WINDOW_VALUE)
|
|
Karsten Hopp |
869996 |
- this->win->w_python_ref = NULL;
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- Py_DECREF(self);
|
|
Karsten Hopp |
869996 |
- }
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
static PyObject *
|
|
Karsten Hopp |
869996 |
WindowGetattr(PyObject *self, char *name)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
! WindowObject *this = (WindowObject *)(self);
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
! if (CheckWindow(this))
|
|
Karsten Hopp |
869996 |
return NULL;
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
! if (strcmp(name, "buffer") == 0)
|
|
Karsten Hopp |
869996 |
! return (PyObject *)BufferNew(this->win->w_buffer);
|
|
Karsten Hopp |
869996 |
! else if (strcmp(name, "cursor") == 0)
|
|
Karsten Hopp |
869996 |
! {
|
|
Karsten Hopp |
869996 |
! pos_T *pos = &this->win->w_cursor;
|
|
Karsten Hopp |
869996 |
!
|
|
Karsten Hopp |
869996 |
! return Py_BuildValue("(ll)", (long)(pos->lnum), (long)(pos->col));
|
|
Karsten Hopp |
869996 |
! }
|
|
Karsten Hopp |
869996 |
! else if (strcmp(name, "height") == 0)
|
|
Karsten Hopp |
869996 |
! return Py_BuildValue("l", (long)(this->win->w_height));
|
|
Karsten Hopp |
869996 |
! #ifdef FEAT_VERTSPLIT
|
|
Karsten Hopp |
869996 |
! else if (strcmp(name, "width") == 0)
|
|
Karsten Hopp |
869996 |
! return Py_BuildValue("l", (long)(W_WIDTH(this->win)));
|
|
Karsten Hopp |
869996 |
! #endif
|
|
Karsten Hopp |
869996 |
! else if (strcmp(name,"__members__") == 0)
|
|
Karsten Hopp |
869996 |
! return Py_BuildValue("[sss]", "buffer", "cursor", "height");
|
|
Karsten Hopp |
869996 |
else
|
|
Karsten Hopp |
869996 |
return Py_FindMethod(WindowMethods, self, name);
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
--- 1249,1265 ----
|
|
Karsten Hopp |
869996 |
return (PyObject *)(self);
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
static PyObject *
|
|
Karsten Hopp |
869996 |
WindowGetattr(PyObject *self, char *name)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
! PyObject *r;
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
! if (CheckWindow((WindowObject *)(self)))
|
|
Karsten Hopp |
869996 |
return NULL;
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
! r = WindowAttr((WindowObject *)(self), name);
|
|
Karsten Hopp |
869996 |
! if (r || PyErr_Occurred())
|
|
Karsten Hopp |
869996 |
! return r;
|
|
Karsten Hopp |
869996 |
else
|
|
Karsten Hopp |
869996 |
return Py_FindMethod(WindowMethods, self, name);
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 1412,1423 ****
|
|
Karsten Hopp |
869996 |
/* Window list object - Definitions
|
|
Karsten Hopp |
869996 |
*/
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
- typedef struct
|
|
Karsten Hopp |
869996 |
- {
|
|
Karsten Hopp |
869996 |
- PyObject_HEAD
|
|
Karsten Hopp |
869996 |
- }
|
|
Karsten Hopp |
869996 |
- WinListObject;
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
static PySequenceMethods WinListAsSeq = {
|
|
Karsten Hopp |
869996 |
(PyInquiry) WinListLength, /* sq_length, len(x) */
|
|
Karsten Hopp |
869996 |
(binaryfunc) 0, /* sq_concat, x+y */
|
|
Karsten Hopp |
869996 |
--- 1267,1272 ----
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 1425,1526 ****
|
|
Karsten Hopp |
869996 |
(PyIntArgFunc) WinListItem, /* sq_item, x[i] */
|
|
Karsten Hopp |
869996 |
(PyIntIntArgFunc) 0, /* sq_slice, x[i:j] */
|
|
Karsten Hopp |
869996 |
(PyIntObjArgProc) 0, /* sq_ass_item, x[i]=v */
|
|
Karsten Hopp |
869996 |
! (PyIntIntObjArgProc) 0, /* sq_ass_slice, x[i:j]=v */
|
|
Karsten Hopp |
869996 |
! };
|
|
Karsten Hopp |
869996 |
!
|
|
Karsten Hopp |
869996 |
! static PyTypeObject WinListType = {
|
|
Karsten Hopp |
869996 |
! PyObject_HEAD_INIT(0)
|
|
Karsten Hopp |
869996 |
! 0,
|
|
Karsten Hopp |
869996 |
! "window list",
|
|
Karsten Hopp |
869996 |
! sizeof(WinListObject),
|
|
Karsten Hopp |
869996 |
! 0,
|
|
Karsten Hopp |
869996 |
!
|
|
Karsten Hopp |
869996 |
! (destructor) 0, /* tp_dealloc, refcount==0 */
|
|
Karsten Hopp |
869996 |
! (printfunc) 0, /* tp_print, print x */
|
|
Karsten Hopp |
869996 |
! (getattrfunc) 0, /* tp_getattr, x.attr */
|
|
Karsten Hopp |
869996 |
! (setattrfunc) 0, /* tp_setattr, x.attr=v */
|
|
Karsten Hopp |
869996 |
! (cmpfunc) 0, /* tp_compare, x>y */
|
|
Karsten Hopp |
869996 |
! (reprfunc) 0, /* tp_repr, `x`, print x */
|
|
Karsten Hopp |
869996 |
!
|
|
Karsten Hopp |
869996 |
! 0, /* as number */
|
|
Karsten Hopp |
869996 |
! &WinListAsSeq, /* as sequence */
|
|
Karsten Hopp |
869996 |
! 0, /* as mapping */
|
|
Karsten Hopp |
869996 |
!
|
|
Karsten Hopp |
869996 |
! (hashfunc) 0, /* tp_hash, dict(x) */
|
|
Karsten Hopp |
869996 |
! (ternaryfunc) 0, /* tp_call, x() */
|
|
Karsten Hopp |
869996 |
! (reprfunc) 0, /* tp_str, str(x) */
|
|
Karsten Hopp |
869996 |
! };
|
|
Karsten Hopp |
869996 |
!
|
|
Karsten Hopp |
869996 |
! /* Current items object - Definitions
|
|
Karsten Hopp |
869996 |
! */
|
|
Karsten Hopp |
869996 |
!
|
|
Karsten Hopp |
869996 |
! typedef struct
|
|
Karsten Hopp |
869996 |
! {
|
|
Karsten Hopp |
869996 |
! PyObject_HEAD
|
|
Karsten Hopp |
869996 |
! } CurrentObject;
|
|
Karsten Hopp |
869996 |
!
|
|
Karsten Hopp |
869996 |
! static PyTypeObject CurrentType = {
|
|
Karsten Hopp |
869996 |
! PyObject_HEAD_INIT(0)
|
|
Karsten Hopp |
869996 |
! 0,
|
|
Karsten Hopp |
869996 |
! "current data",
|
|
Karsten Hopp |
869996 |
! sizeof(CurrentObject),
|
|
Karsten Hopp |
869996 |
0,
|
|
Karsten Hopp |
869996 |
!
|
|
Karsten Hopp |
869996 |
! (destructor) 0, /* tp_dealloc, refcount==0 */
|
|
Karsten Hopp |
869996 |
! (printfunc) 0, /* tp_print, print x */
|
|
Karsten Hopp |
869996 |
! (getattrfunc) CurrentGetattr, /* tp_getattr, x.attr */
|
|
Karsten Hopp |
869996 |
! (setattrfunc) CurrentSetattr, /* tp_setattr, x.attr=v */
|
|
Karsten Hopp |
869996 |
! (cmpfunc) 0, /* tp_compare, x>y */
|
|
Karsten Hopp |
869996 |
! (reprfunc) 0, /* tp_repr, `x`, print x */
|
|
Karsten Hopp |
869996 |
!
|
|
Karsten Hopp |
869996 |
! 0, /* as number */
|
|
Karsten Hopp |
869996 |
! 0, /* as sequence */
|
|
Karsten Hopp |
869996 |
! 0, /* as mapping */
|
|
Karsten Hopp |
869996 |
!
|
|
Karsten Hopp |
869996 |
! (hashfunc) 0, /* tp_hash, dict(x) */
|
|
Karsten Hopp |
869996 |
! (ternaryfunc) 0, /* tp_call, x() */
|
|
Karsten Hopp |
869996 |
! (reprfunc) 0, /* tp_str, str(x) */
|
|
Karsten Hopp |
869996 |
};
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
- /* Current items object - Implementation
|
|
Karsten Hopp |
869996 |
- */
|
|
Karsten Hopp |
869996 |
- static PyObject *
|
|
Karsten Hopp |
869996 |
- CurrentGetattr(PyObject *self UNUSED, char *name)
|
|
Karsten Hopp |
869996 |
- {
|
|
Karsten Hopp |
869996 |
- if (strcmp(name, "buffer") == 0)
|
|
Karsten Hopp |
869996 |
- return (PyObject *)BufferNew(curbuf);
|
|
Karsten Hopp |
869996 |
- else if (strcmp(name, "window") == 0)
|
|
Karsten Hopp |
869996 |
- return (PyObject *)WindowNew(curwin);
|
|
Karsten Hopp |
869996 |
- else if (strcmp(name, "line") == 0)
|
|
Karsten Hopp |
869996 |
- return GetBufferLine(curbuf, (PyInt)curwin->w_cursor.lnum);
|
|
Karsten Hopp |
869996 |
- else if (strcmp(name, "range") == 0)
|
|
Karsten Hopp |
869996 |
- return RangeNew(curbuf, RangeStart, RangeEnd);
|
|
Karsten Hopp |
869996 |
- else if (strcmp(name,"__members__") == 0)
|
|
Karsten Hopp |
869996 |
- return Py_BuildValue("[ssss]", "buffer", "window", "line", "range");
|
|
Karsten Hopp |
869996 |
- else
|
|
Karsten Hopp |
869996 |
- {
|
|
Karsten Hopp |
869996 |
- PyErr_SetString(PyExc_AttributeError, name);
|
|
Karsten Hopp |
869996 |
- return NULL;
|
|
Karsten Hopp |
869996 |
- }
|
|
Karsten Hopp |
869996 |
- }
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- static int
|
|
Karsten Hopp |
869996 |
- CurrentSetattr(PyObject *self UNUSED, char *name, PyObject *value)
|
|
Karsten Hopp |
869996 |
- {
|
|
Karsten Hopp |
869996 |
- if (strcmp(name, "line") == 0)
|
|
Karsten Hopp |
869996 |
- {
|
|
Karsten Hopp |
869996 |
- if (SetBufferLine(curbuf, (PyInt)curwin->w_cursor.lnum, value, NULL) == FAIL)
|
|
Karsten Hopp |
869996 |
- return -1;
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- return 0;
|
|
Karsten Hopp |
869996 |
- }
|
|
Karsten Hopp |
869996 |
- else
|
|
Karsten Hopp |
869996 |
- {
|
|
Karsten Hopp |
869996 |
- PyErr_SetString(PyExc_AttributeError, name);
|
|
Karsten Hopp |
869996 |
- return -1;
|
|
Karsten Hopp |
869996 |
- }
|
|
Karsten Hopp |
869996 |
- }
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
/* External interface
|
|
Karsten Hopp |
869996 |
*/
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
--- 1274,1287 ----
|
|
Karsten Hopp |
869996 |
(PyIntArgFunc) WinListItem, /* sq_item, x[i] */
|
|
Karsten Hopp |
869996 |
(PyIntIntArgFunc) 0, /* sq_slice, x[i:j] */
|
|
Karsten Hopp |
869996 |
(PyIntObjArgProc) 0, /* sq_ass_item, x[i]=v */
|
|
Karsten Hopp |
869996 |
! (PyIntIntObjArgProc) 0, /* sq_ass_slice, x[i:j]=v */
|
|
Karsten Hopp |
869996 |
! (objobjproc) 0,
|
|
Karsten Hopp |
869996 |
! #if PY_MAJOR_VERSION >= 2
|
|
Karsten Hopp |
869996 |
! (binaryfunc) 0,
|
|
Karsten Hopp |
869996 |
0,
|
|
Karsten Hopp |
869996 |
! #endif
|
|
Karsten Hopp |
869996 |
};
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
/* External interface
|
|
Karsten Hopp |
869996 |
*/
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 1642,1690 ****
|
|
Karsten Hopp |
869996 |
return result;
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
- static void DictionaryDestructor(PyObject *);
|
|
Karsten Hopp |
869996 |
- static PyObject *DictionaryGetattr(PyObject *, char*);
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- static PyMappingMethods DictionaryAsMapping = {
|
|
Karsten Hopp |
869996 |
- (PyInquiry) DictionaryLength,
|
|
Karsten Hopp |
869996 |
- (binaryfunc) DictionaryItem,
|
|
Karsten Hopp |
869996 |
- (objobjargproc) DictionaryAssItem,
|
|
Karsten Hopp |
869996 |
- };
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- static PyTypeObject DictionaryType = {
|
|
Karsten Hopp |
869996 |
- PyObject_HEAD_INIT(0)
|
|
Karsten Hopp |
869996 |
- 0,
|
|
Karsten Hopp |
869996 |
- "vimdictionary",
|
|
Karsten Hopp |
869996 |
- sizeof(DictionaryObject),
|
|
Karsten Hopp |
869996 |
- 0,
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- (destructor) DictionaryDestructor,
|
|
Karsten Hopp |
869996 |
- (printfunc) 0,
|
|
Karsten Hopp |
869996 |
- (getattrfunc) DictionaryGetattr,
|
|
Karsten Hopp |
869996 |
- (setattrfunc) DictionarySetattr,
|
|
Karsten Hopp |
869996 |
- (cmpfunc) 0,
|
|
Karsten Hopp |
869996 |
- (reprfunc) 0,
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- 0, /* as number */
|
|
Karsten Hopp |
869996 |
- 0, /* as sequence */
|
|
Karsten Hopp |
869996 |
- &DictionaryAsMapping, /* as mapping */
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- (hashfunc) 0,
|
|
Karsten Hopp |
869996 |
- (ternaryfunc) 0,
|
|
Karsten Hopp |
869996 |
- (reprfunc) 0,
|
|
Karsten Hopp |
869996 |
- };
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- static void
|
|
Karsten Hopp |
869996 |
- DictionaryDestructor(PyObject *self)
|
|
Karsten Hopp |
869996 |
- {
|
|
Karsten Hopp |
869996 |
- DictionaryObject *this = ((DictionaryObject *) (self));
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- pyll_remove(&this->ref, &lastdict);
|
|
Karsten Hopp |
869996 |
- dict_unref(this->dict);
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- Py_DECREF(self);
|
|
Karsten Hopp |
869996 |
- }
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
static PyObject *
|
|
Karsten Hopp |
869996 |
DictionaryGetattr(PyObject *self, char *name)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
--- 1403,1408 ----
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 1698,1706 ****
|
|
Karsten Hopp |
869996 |
return Py_FindMethod(DictionaryMethods, self, name);
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
- static void ListDestructor(PyObject *);
|
|
Karsten Hopp |
869996 |
- static PyObject *ListGetattr(PyObject *, char *);
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
static PySequenceMethods ListAsSeq = {
|
|
Karsten Hopp |
869996 |
(PyInquiry) ListLength,
|
|
Karsten Hopp |
869996 |
(binaryfunc) 0,
|
|
Karsten Hopp |
869996 |
--- 1416,1421 ----
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 1716,1755 ****
|
|
Karsten Hopp |
869996 |
#endif
|
|
Karsten Hopp |
869996 |
};
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
- static PyTypeObject ListType = {
|
|
Karsten Hopp |
869996 |
- PyObject_HEAD_INIT(0)
|
|
Karsten Hopp |
869996 |
- 0,
|
|
Karsten Hopp |
869996 |
- "vimlist",
|
|
Karsten Hopp |
869996 |
- sizeof(ListObject),
|
|
Karsten Hopp |
869996 |
- 0,
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- (destructor) ListDestructor,
|
|
Karsten Hopp |
869996 |
- (printfunc) 0,
|
|
Karsten Hopp |
869996 |
- (getattrfunc) ListGetattr,
|
|
Karsten Hopp |
869996 |
- (setattrfunc) ListSetattr,
|
|
Karsten Hopp |
869996 |
- (cmpfunc) 0,
|
|
Karsten Hopp |
869996 |
- (reprfunc) 0,
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- 0, /* as number */
|
|
Karsten Hopp |
869996 |
- &ListAsSeq, /* as sequence */
|
|
Karsten Hopp |
869996 |
- 0, /* as mapping */
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- (hashfunc) 0,
|
|
Karsten Hopp |
869996 |
- (ternaryfunc) 0,
|
|
Karsten Hopp |
869996 |
- (reprfunc) 0,
|
|
Karsten Hopp |
869996 |
- };
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- static void
|
|
Karsten Hopp |
869996 |
- ListDestructor(PyObject *self)
|
|
Karsten Hopp |
869996 |
- {
|
|
Karsten Hopp |
869996 |
- ListObject *this = ((ListObject *) (self));
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- pyll_remove(&this->ref, &lastlist);
|
|
Karsten Hopp |
869996 |
- list_unref(this->list);
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- Py_DECREF(self);
|
|
Karsten Hopp |
869996 |
- }
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
static PyObject *
|
|
Karsten Hopp |
869996 |
ListGetattr(PyObject *self, char *name)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
--- 1431,1436 ----
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 1759,1801 ****
|
|
Karsten Hopp |
869996 |
return Py_FindMethod(ListMethods, self, name);
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
- static void FunctionDestructor(PyObject *);
|
|
Karsten Hopp |
869996 |
- static PyObject *FunctionGetattr(PyObject *, char *);
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- static PyTypeObject FunctionType = {
|
|
Karsten Hopp |
869996 |
- PyObject_HEAD_INIT(0)
|
|
Karsten Hopp |
869996 |
- 0,
|
|
Karsten Hopp |
869996 |
- "vimfunction",
|
|
Karsten Hopp |
869996 |
- sizeof(FunctionObject),
|
|
Karsten Hopp |
869996 |
- 0,
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- (destructor) FunctionDestructor,
|
|
Karsten Hopp |
869996 |
- (printfunc) 0,
|
|
Karsten Hopp |
869996 |
- (getattrfunc) FunctionGetattr,
|
|
Karsten Hopp |
869996 |
- (setattrfunc) 0,
|
|
Karsten Hopp |
869996 |
- (cmpfunc) 0,
|
|
Karsten Hopp |
869996 |
- (reprfunc) 0,
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- 0, /* as number */
|
|
Karsten Hopp |
869996 |
- 0, /* as sequence */
|
|
Karsten Hopp |
869996 |
- 0, /* as mapping */
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- (hashfunc) 0,
|
|
Karsten Hopp |
869996 |
- (ternaryfunc) FunctionCall,
|
|
Karsten Hopp |
869996 |
- (reprfunc) 0,
|
|
Karsten Hopp |
869996 |
- };
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- static void
|
|
Karsten Hopp |
869996 |
- FunctionDestructor(PyObject *self)
|
|
Karsten Hopp |
869996 |
- {
|
|
Karsten Hopp |
869996 |
- FunctionObject *this = (FunctionObject *) (self);
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- func_unref(this->name);
|
|
Karsten Hopp |
869996 |
- PyMem_Del(this->name);
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- Py_DECREF(self);
|
|
Karsten Hopp |
869996 |
- }
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
static PyObject *
|
|
Karsten Hopp |
869996 |
FunctionGetattr(PyObject *self, char *name)
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
--- 1440,1445 ----
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 1839,1859 ****
|
|
Karsten Hopp |
869996 |
{
|
|
Karsten Hopp |
869996 |
set_ref_in_py(copyID);
|
|
Karsten Hopp |
869996 |
}
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- static void
|
|
Karsten Hopp |
869996 |
- init_structs(void)
|
|
Karsten Hopp |
869996 |
- {
|
|
Karsten Hopp |
869996 |
- vim_memset(&OutputType, 0, sizeof(OutputType));
|
|
Karsten Hopp |
869996 |
- OutputType.tp_name = "message";
|
|
Karsten Hopp |
869996 |
- OutputType.tp_basicsize = sizeof(OutputObject);
|
|
Karsten Hopp |
869996 |
- OutputType.tp_getattr = OutputGetattr;
|
|
Karsten Hopp |
869996 |
- OutputType.tp_setattr = OutputSetattr;
|
|
Karsten Hopp |
869996 |
-
|
|
Karsten Hopp |
869996 |
- vim_memset(&RangeType, 0, sizeof(RangeType));
|
|
Karsten Hopp |
869996 |
- RangeType.tp_name = "range";
|
|
Karsten Hopp |
869996 |
- RangeType.tp_basicsize = sizeof(RangeObject);
|
|
Karsten Hopp |
869996 |
- RangeType.tp_dealloc = RangeDestructor;
|
|
Karsten Hopp |
869996 |
- RangeType.tp_getattr = RangeGetattr;
|
|
Karsten Hopp |
869996 |
- RangeType.tp_repr = RangeRepr;
|
|
Karsten Hopp |
869996 |
- RangeType.tp_as_sequence = &RangeAsSeq;
|
|
Karsten Hopp |
869996 |
- }
|
|
Karsten Hopp |
869996 |
--- 1483,1485 ----
|
|
Karsten Hopp |
869996 |
*** ../vim-7.3.908/src/version.c 2013-04-24 13:10:35.000000000 +0200
|
|
Karsten Hopp |
869996 |
--- src/version.c 2013-04-24 13:27:49.000000000 +0200
|
|
Karsten Hopp |
869996 |
***************
|
|
Karsten Hopp |
869996 |
*** 730,731 ****
|
|
Karsten Hopp |
869996 |
--- 730,733 ----
|
|
Karsten Hopp |
869996 |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
869996 |
+ /**/
|
|
Karsten Hopp |
869996 |
+ 909,
|
|
Karsten Hopp |
869996 |
/**/
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
--
|
|
Karsten Hopp |
869996 |
hundred-and-one symptoms of being an internet addict:
|
|
Karsten Hopp |
869996 |
221. Your wife melts your keyboard in the oven.
|
|
Karsten Hopp |
869996 |
|
|
Karsten Hopp |
869996 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
869996 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
869996 |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
Karsten Hopp |
869996 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|