comparison src/if_python3.c @ 4393:80eea7a9d6b9 v7.3.945

updated for version 7.3.945 Problem: Python: List of buffers is not very useful. Solution: Make vim.buffers a map. No iterator yet. (ZyX)
author Bram Moolenaar <bram@vim.org>
date Wed, 15 May 2013 13:38:47 +0200
parents 736b8e18a3bc
children a84f21892563
comparison
equal deleted inserted replaced
4392:430672fe7d54 4393:80eea7a9d6b9
1270 PyErr_SetString(PyExc_IndexError, "Index must be int or slice"); 1270 PyErr_SetString(PyExc_IndexError, "Index must be int or slice");
1271 return -1; 1271 return -1;
1272 } 1272 }
1273 } 1273 }
1274 1274
1275 /* Buffer list object - Definitions
1276 */
1277
1278 static PySequenceMethods BufListAsSeq = {
1279 (lenfunc) BufListLength, /* sq_length, len(x) */
1280 (binaryfunc) 0, /* sq_concat, x+y */
1281 (ssizeargfunc) 0, /* sq_repeat, x*n */
1282 (ssizeargfunc) BufListItem, /* sq_item, x[i] */
1283 0, /* was_sq_slice, x[i:j] */
1284 (ssizeobjargproc) 0, /* sq_as_item, x[i]=v */
1285 0, /* sq_ass_slice, x[i:j]=v */
1286 0, /* sq_contains */
1287 0, /* sq_inplace_concat */
1288 0, /* sq_inplace_repeat */
1289 };
1290
1291 /* Window object - Implementation 1275 /* Window object - Implementation
1292 */ 1276 */
1293 1277
1294 static PyObject * 1278 static PyObject *
1295 WindowGetattro(PyObject *self, PyObject *nameobj) 1279 WindowGetattro(PyObject *self, PyObject *nameobj)
1510 WIN_PYTHON_REF(win) = NULL; 1494 WIN_PYTHON_REF(win) = NULL;
1511 } 1495 }
1512 } 1496 }
1513 #endif 1497 #endif
1514 1498
1515 static BufListObject TheBufferList = 1499 static BufMapObject TheBufferMap =
1516 { 1500 {
1517 PyObject_HEAD_INIT(&BufListType) 1501 PyObject_HEAD_INIT(&BufMapType)
1518 }; 1502 };
1519 1503
1520 static WinListObject TheWindowList = 1504 static WinListObject TheWindowList =
1521 { 1505 {
1522 PyObject_HEAD_INIT(&WinListType) 1506 PyObject_HEAD_INIT(&WinListType)
1536 static wchar_t *(argv[2]) = {L"/must>not&exist/foo", NULL}; 1520 static wchar_t *(argv[2]) = {L"/must>not&exist/foo", NULL};
1537 1521
1538 PyType_Ready(&BufferType); 1522 PyType_Ready(&BufferType);
1539 PyType_Ready(&RangeType); 1523 PyType_Ready(&RangeType);
1540 PyType_Ready(&WindowType); 1524 PyType_Ready(&WindowType);
1541 PyType_Ready(&BufListType); 1525 PyType_Ready(&BufMapType);
1542 PyType_Ready(&WinListType); 1526 PyType_Ready(&WinListType);
1543 PyType_Ready(&CurrentType); 1527 PyType_Ready(&CurrentType);
1544 PyType_Ready(&DictionaryType); 1528 PyType_Ready(&DictionaryType);
1545 PyType_Ready(&ListType); 1529 PyType_Ready(&ListType);
1546 PyType_Ready(&FunctionType); 1530 PyType_Ready(&FunctionType);
1555 1539
1556 VimError = PyErr_NewException("vim.error", NULL, NULL); 1540 VimError = PyErr_NewException("vim.error", NULL, NULL);
1557 Py_INCREF(VimError); 1541 Py_INCREF(VimError);
1558 1542
1559 PyModule_AddObject(mod, "error", VimError); 1543 PyModule_AddObject(mod, "error", VimError);
1560 Py_INCREF((PyObject *)(void *)&TheBufferList); 1544 Py_INCREF((PyObject *)(void *)&TheBufferMap);
1561 PyModule_AddObject(mod, "buffers", (PyObject *)(void *)&TheBufferList); 1545 PyModule_AddObject(mod, "buffers", (PyObject *)(void *)&TheBufferMap);
1562 Py_INCREF((PyObject *)(void *)&TheCurrent); 1546 Py_INCREF((PyObject *)(void *)&TheCurrent);
1563 PyModule_AddObject(mod, "current", (PyObject *)(void *)&TheCurrent); 1547 PyModule_AddObject(mod, "current", (PyObject *)(void *)&TheCurrent);
1564 Py_INCREF((PyObject *)(void *)&TheWindowList); 1548 Py_INCREF((PyObject *)(void *)&TheWindowList);
1565 PyModule_AddObject(mod, "windows", (PyObject *)(void *)&TheWindowList); 1549 PyModule_AddObject(mod, "windows", (PyObject *)(void *)&TheWindowList);
1566 1550