comparison src/if_py_both.h @ 4593:0cf552b325b5 v7.3.1044

updated for version 7.3.1044 Problem: Python: No {Buffer,TabPage,Window}.valid attributes. Solution: Python patch 5: add .valid (ZyX)
author Bram Moolenaar <bram@vim.org>
date Wed, 29 May 2013 22:15:30 +0200
parents fa39483a1363
children 29b2be2bba0d
comparison
equal deleted inserted replaced
4592:706bcc2010f5 4593:0cf552b325b5
1813 1813
1814 DESTRUCTOR_FINISH(self); 1814 DESTRUCTOR_FINISH(self);
1815 } 1815 }
1816 1816
1817 static PyObject * 1817 static PyObject *
1818 TabPageAttrValid(TabPageObject *self, char *name)
1819 {
1820 PyObject *r;
1821
1822 if (strcmp(name, "valid") != 0)
1823 return NULL;
1824
1825 r = ((self->tab == INVALID_TABPAGE_VALUE) ? Py_False : Py_True);
1826 Py_INCREF(r);
1827 return r;
1828 }
1829
1830 static PyObject *
1818 TabPageAttr(TabPageObject *self, char *name) 1831 TabPageAttr(TabPageObject *self, char *name)
1819 { 1832 {
1820 if (strcmp(name, "windows") == 0) 1833 if (strcmp(name, "windows") == 0)
1821 return WinListNew(self); 1834 return WinListNew(self);
1822 else if (strcmp(name, "number") == 0) 1835 else if (strcmp(name, "number") == 0)
2005 else 2018 else
2006 return tabObject->tab->tp_firstwin; 2019 return tabObject->tab->tp_firstwin;
2007 } 2020 }
2008 else 2021 else
2009 return firstwin; 2022 return firstwin;
2023 }
2024
2025 static PyObject *
2026 WindowAttrValid(WindowObject *self, char *name)
2027 {
2028 PyObject *r;
2029
2030 if (strcmp(name, "valid") != 0)
2031 return NULL;
2032
2033 r = ((self->win == INVALID_WINDOW_VALUE) ? Py_False : Py_True);
2034 Py_INCREF(r);
2035 return r;
2010 } 2036 }
2011 2037
2012 static PyObject * 2038 static PyObject *
2013 WindowAttr(WindowObject *self, char *name) 2039 WindowAttr(WindowObject *self, char *name)
2014 { 2040 {
2048 { 2074 {
2049 Py_INCREF(self->tabObject); 2075 Py_INCREF(self->tabObject);
2050 return (PyObject *)(self->tabObject); 2076 return (PyObject *)(self->tabObject);
2051 } 2077 }
2052 else if (strcmp(name,"__members__") == 0) 2078 else if (strcmp(name,"__members__") == 0)
2053 return Py_BuildValue("[sssssssss]", "buffer", "cursor", "height", 2079 return Py_BuildValue("[ssssssssss]", "buffer", "cursor", "height",
2054 "vars", "options", "number", "row", "col", "tabpage"); 2080 "vars", "options", "number", "row", "col", "tabpage", "valid");
2055 else 2081 else
2056 return NULL; 2082 return NULL;
2057 } 2083 }
2058 2084
2059 static int 2085 static int
3184 { 3210 {
3185 return RBSlice(self, lo, hi, 1, -1); 3211 return RBSlice(self, lo, hi, 1, -1);
3186 } 3212 }
3187 3213
3188 static PyObject * 3214 static PyObject *
3215 BufferAttrValid(BufferObject *self, char *name)
3216 {
3217 PyObject *r;
3218
3219 if (strcmp(name, "valid") != 0)
3220 return NULL;
3221
3222 r = ((self->buf == INVALID_BUFFER_VALUE) ? Py_False : Py_True);
3223 Py_INCREF(r);
3224 return r;
3225 }
3226
3227 static PyObject *
3189 BufferAttr(BufferObject *self, char *name) 3228 BufferAttr(BufferObject *self, char *name)
3190 { 3229 {
3191 if (strcmp(name, "name") == 0) 3230 if (strcmp(name, "name") == 0)
3192 return Py_BuildValue("s", self->buf->b_ffname); 3231 return Py_BuildValue("s", self->buf->b_ffname);
3193 else if (strcmp(name, "number") == 0) 3232 else if (strcmp(name, "number") == 0)
3196 return DictionaryNew(self->buf->b_vars); 3235 return DictionaryNew(self->buf->b_vars);
3197 else if (strcmp(name, "options") == 0) 3236 else if (strcmp(name, "options") == 0)
3198 return OptionsNew(SREQ_BUF, self->buf, (checkfun) CheckBuffer, 3237 return OptionsNew(SREQ_BUF, self->buf, (checkfun) CheckBuffer,
3199 (PyObject *) self); 3238 (PyObject *) self);
3200 else if (strcmp(name,"__members__") == 0) 3239 else if (strcmp(name,"__members__") == 0)
3201 return Py_BuildValue("[ssss]", "name", "number", "vars", "options"); 3240 return Py_BuildValue("[sssss]", "name", "number", "vars", "options",
3241 "valid");
3202 else 3242 else
3203 return NULL; 3243 return NULL;
3204 } 3244 }
3205 3245
3206 static int 3246 static int