Current Path : /usr/local/share/python2.5/Tools/modulator/Templates/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //usr/local/share/python2.5/Tools/modulator/Templates/object_structure |
/* Code to access structure members by accessing attributes */ #include "structmember.h" #define OFF(x) offsetof(XXXXobject, x) static struct memberlist $abbrev$_memberlist[] = { /* XXXX Add lines like { "foo", T_INT, OFF(foo), RO } */ {NULL} /* Sentinel */ }; static PyObject * $abbrev$_getattr($abbrev$object *self, char *name) { PyObject *rv; /* XXXX Add your own getattr code here */ rv = PyMember_Get((char *)/*XXXX*/0, $abbrev$_memberlist, name); if (rv) return rv; PyErr_Clear(); return Py_FindMethod($abbrev$_methods, (PyObject *)self, name); } static int $abbrev$_setattr($abbrev$object *self, char *name, PyObject *v) { /* XXXX Add your own setattr code here */ if ( v == NULL ) { PyErr_SetString(PyExc_AttributeError, "Cannot delete attribute"); return -1; } return PyMember_Set((char *)/*XXXX*/0, $abbrev$_memberlist, name, v); }