Update of /cvsroot/pywin32/pywin32/win32/src/PerfMon
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv11688/src/PerfMon
Modified Files:
MappingManager.cpp PerfCounterDefn.cpp PerfObjectType.cpp
pyperfmon.h
Log Message:
Merge many tp_getattro/setattro, "2 ints" and buffer changes from Roger
via the py3k branch.
Index: PerfCounterDefn.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/PerfMon/PerfCounterDefn.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** PerfCounterDefn.cpp 3 Dec 2008 22:34:21 -0000 1.2
--- PerfCounterDefn.cpp 11 Dec 2008 00:25:40 -0000 1.3
***************
*** 97,101 ****
// excessive tests for lack of performance monitor functionality.
// However, the method <om PyPERF_COUNTER_DEFINITION.Get> will raise a ValueError exception in this case.
! static struct PyMethodDef PyPERF_COUNTER_DEFINITION_methods[] = {
{"Increment", PyPERF_COUNTER_DEFINITION::Increment, 1}, // @pymeth Increment|Increments the value of the performance counter
{"Decrement", PyPERF_COUNTER_DEFINITION::Decrement, 1}, // @pymeth Decrement|Decrements the value of the performance counter
--- 97,101 ----
// excessive tests for lack of performance monitor functionality.
// However, the method <om PyPERF_COUNTER_DEFINITION.Get> will raise a ValueError exception in this case.
! struct PyMethodDef PyPERF_COUNTER_DEFINITION::methods[] = {
{"Increment", PyPERF_COUNTER_DEFINITION::Increment, 1}, // @pymeth Increment|Increments the value of the performance counter
{"Decrement", PyPERF_COUNTER_DEFINITION::Decrement, 1}, // @pymeth Decrement|Decrements the value of the performance counter
***************
*** 114,119 ****
PyPERF_COUNTER_DEFINITION::deallocFunc, /* tp_dealloc */
0, /* tp_print */
! PyPERF_COUNTER_DEFINITION::getattr, /* tp_getattr */
! PyPERF_COUNTER_DEFINITION::setattr, /* tp_setattr */
0, /* tp_compare */
0, /* tp_repr */
--- 114,119 ----
PyPERF_COUNTER_DEFINITION::deallocFunc, /* tp_dealloc */
0, /* tp_print */
! 0, /* tp_getattr */
! 0, /* tp_setattr */
0, /* tp_compare */
0, /* tp_repr */
***************
*** 124,127 ****
--- 124,149 ----
0, /* tp_call */
0, /* tp_str */
+ PyObject_GenericGetAttr, /* tp_getattro */
+ PyObject_GenericSetAttr, /* tp_setattro */
+ 0, /* tp_as_buffer */
+ Py_TPFLAGS_DEFAULT, /* tp_flags */
+ 0, /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ PyPERF_COUNTER_DEFINITION::methods, /* tp_methods */
+ PyPERF_COUNTER_DEFINITION::members, /* tp_members */
+ 0, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ 0, /* tp_init */
+ 0, /* tp_alloc */
+ 0, /* tp_new */
};
***************
*** 129,133 ****
! /*static*/ struct memberlist PyPERF_COUNTER_DEFINITION::memberlist[] = {
{"DefaultScale", T_LONG, OFF(m_DefaultScale)}, // @prop integer|DefaultScale|The default scale of the counter.
{"DetailLevel", T_LONG, OFF(m_DetailLevel)}, // @prop integer|DetailLevel|The detail level of the counter.
--- 151,155 ----
! /*static*/ struct PyMemberDef PyPERF_COUNTER_DEFINITION::members[] = {
{"DefaultScale", T_LONG, OFF(m_DefaultScale)}, // @prop integer|DefaultScale|The default scale of the counter.
{"DetailLevel", T_LONG, OFF(m_DetailLevel)}, // @prop integer|DetailLevel|The detail level of the counter.
***************
*** 189,212 ****
}
- PyObject *PyPERF_COUNTER_DEFINITION::getattr(PyObject *self, char *name)
- {
- PyObject *res;
-
- res = Py_FindMethod(PyPERF_COUNTER_DEFINITION_methods, self, name);
- if (res != NULL)
- return res;
- PyErr_Clear();
- return PyMember_Get((char *)self, memberlist, name);
- }
-
- int PyPERF_COUNTER_DEFINITION::setattr(PyObject *self, char *name, PyObject *v)
- {
- if (v == NULL) {
- PyErr_SetString(PyExc_AttributeError, "can't delete PERF_COUNTER_DEFINITION attributes");
- return -1;
- }
- return PyMember_Set((char *)self, memberlist, name, v);
- }
-
/*static*/ void PyPERF_COUNTER_DEFINITION::deallocFunc(PyObject *ob)
{
--- 211,214 ----
Index: MappingManager.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/PerfMon/MappingManager.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** MappingManager.cpp 3 Dec 2008 22:34:21 -0000 1.5
--- MappingManager.cpp 11 Dec 2008 00:25:40 -0000 1.6
***************
*** 179,183 ****
// @object PyPerfMonManager|A Python object
! static struct PyMethodDef PyPerfMonManager_methods[] = {
{"Close", PyPerfMonManager::Close, 1}, // @pymeth Close|Closes all counters.
{NULL}
--- 179,183 ----
// @object PyPerfMonManager|A Python object
! struct PyMethodDef PyPerfMonManager::methods[] = {
{"Close", PyPerfMonManager::Close, 1}, // @pymeth Close|Closes all counters.
{NULL}
***************
*** 192,197 ****
PyPerfMonManager::deallocFunc, /* tp_dealloc */
0, /* tp_print */
! PyPerfMonManager::getattr, /* tp_getattr */
! PyPerfMonManager::setattr, /* tp_setattr */
0, /* tp_compare */
0, /* tp_repr */
--- 192,197 ----
PyPerfMonManager::deallocFunc, /* tp_dealloc */
0, /* tp_print */
! 0, /* tp_getattr */
! 0, /* tp_setattr */
0, /* tp_compare */
0, /* tp_repr */
***************
*** 202,205 ****
--- 202,227 ----
0, /* tp_call */
0, /* tp_str */
+ PyObject_GenericGetAttr, /* tp_getattro */
+ PyObject_GenericSetAttr, /* tp_setattro */
+ 0, /* tp_as_buffer */
+ Py_TPFLAGS_DEFAULT, /* tp_flags */
+ 0, /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ PyPerfMonManager::methods, /* tp_methods */
+ PyPerfMonManager::members, /* tp_members */
+ 0, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ 0, /* tp_init */
+ 0, /* tp_alloc */
+ 0, /* tp_new */
};
***************
*** 207,211 ****
! /*static*/ struct memberlist PyPerfMonManager::memberlist[] = {
{NULL} /* Sentinel */
};
--- 229,233 ----
! /*static*/ struct PyMemberDef PyPerfMonManager::members[] = {
{NULL} /* Sentinel */
};
***************
*** 268,291 ****
}
- PyObject *PyPerfMonManager::getattr(PyObject *self, char *name)
- {
- PyObject *res;
-
- res = Py_FindMethod(PyPerfMonManager_methods, self, name);
- if (res != NULL)
- return res;
- PyErr_Clear();
- return PyMember_Get((char *)self, memberlist, name);
- }
-
- int PyPerfMonManager::setattr(PyObject *self, char *name, PyObject *v)
- {
- if (v == NULL) {
- PyErr_SetString(PyExc_AttributeError, "can't delete PERF_OBJECT_TYPE attributes");
- return -1;
- }
- return PyMember_Set((char *)self, memberlist, name, v);
- }
-
/*static*/ void PyPerfMonManager::deallocFunc(PyObject *ob)
{
--- 290,293 ----
Index: pyperfmon.h
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/PerfMon/pyperfmon.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** pyperfmon.h 4 Dec 2008 00:17:13 -0000 1.2
--- pyperfmon.h 11 Dec 2008 00:25:40 -0000 1.3
***************
*** 40,46 ****
static void deallocFunc(PyObject *ob);
! static PyObject *getattr(PyObject *self, char *name);
! static int setattr(PyObject *self, char *name, PyObject *v);
! static struct memberlist memberlist[];
static PyTypeObject type;
protected:
--- 40,45 ----
static void deallocFunc(PyObject *ob);
! static struct PyMemberDef members[];
! static struct PyMethodDef methods[];
static PyTypeObject type;
protected:
***************
*** 69,74 ****
static void deallocFunc(PyObject *ob);
! static PyObject *getattr(PyObject *self, char *name);
! static int setattr(PyObject *self, char *name, PyObject *v);
static PyObject *Increment(PyObject *self, PyObject *args);
--- 68,73 ----
static void deallocFunc(PyObject *ob);
! static PyObject *getattro(PyObject *self, PyObject *obname);
! static int setattro(PyObject *self, PyObject *obname, PyObject *v);
static PyObject *Increment(PyObject *self, PyObject *args);
***************
*** 77,84 ****
static PyObject *Get(PyObject *self, PyObject *args);
! // #pragma warning( disable : 4251 )
! static struct memberlist memberlist[];
static PyTypeObject type;
- #pragma warning( default : 4251 )
protected:
--- 76,82 ----
static PyObject *Get(PyObject *self, PyObject *args);
! static struct PyMemberDef members[];
! static struct PyMethodDef methods[];
static PyTypeObject type;
protected:
***************
*** 115,125 ****
/* Python support */
static void deallocFunc(PyObject *ob);
-
- static PyObject *getattr(PyObject *self, char *name);
- static int setattr(PyObject *self, char *name, PyObject *v);
-
static PyObject *Close(PyObject *self, PyObject *args);
!
! static struct memberlist memberlist[];
static PyTypeObject type;
--- 113,119 ----
/* Python support */
static void deallocFunc(PyObject *ob);
static PyObject *Close(PyObject *self, PyObject *args);
! static struct PyMemberDef members[];
! static struct PyMethodDef methods[];
static PyTypeObject type;
Index: PerfObjectType.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/PerfMon/PerfObjectType.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** PerfObjectType.cpp 3 Dec 2008 22:34:21 -0000 1.2
--- PerfObjectType.cpp 11 Dec 2008 00:25:40 -0000 1.3
***************
*** 57,61 ****
// @object PyPERF_OBJECT_TYPE|A Python object, representing a PERF_OBJECT_TYPE structure
! static struct PyMethodDef PyPERF_OBJECT_TYPE_methods[] = {
{"Close", PyPERF_OBJECT_TYPE::Close, 1}, // @pymeth Close|Closes all counters.
{NULL}
--- 57,61 ----
// @object PyPERF_OBJECT_TYPE|A Python object, representing a PERF_OBJECT_TYPE structure
! struct PyMethodDef PyPERF_OBJECT_TYPE::methods[] = {
{"Close", PyPERF_OBJECT_TYPE::Close, 1}, // @pymeth Close|Closes all counters.
{NULL}
***************
*** 71,76 ****
PyPERF_OBJECT_TYPE::deallocFunc, /* tp_dealloc */
0, /* tp_print */
! PyPERF_OBJECT_TYPE::getattr, /* tp_getattr */
! PyPERF_OBJECT_TYPE::setattr, /* tp_setattr */
0, /* tp_compare */
0, /* tp_repr */
--- 71,76 ----
PyPERF_OBJECT_TYPE::deallocFunc, /* tp_dealloc */
0, /* tp_print */
! 0, /* tp_getattr */
! 0, /* tp_setattr */
0, /* tp_compare */
0, /* tp_repr */
***************
*** 81,84 ****
--- 81,106 ----
0, /* tp_call */
0, /* tp_str */
+ PyObject_GenericGetAttr, /* tp_getattro */
+ PyObject_GenericSetAttr, /* tp_setattro */
+ 0, /* tp_as_buffer */
+ Py_TPFLAGS_DEFAULT, /* tp_flags */
+ 0, /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ PyPERF_OBJECT_TYPE::methods, /* tp_methods */
+ PyPERF_OBJECT_TYPE::members, /* tp_members */
+ 0, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ 0, /* tp_init */
+ 0, /* tp_alloc */
+ 0, /* tp_new */
};
***************
*** 86,90 ****
! /*static*/ struct memberlist PyPERF_OBJECT_TYPE::memberlist[] = {
{"ObjectNameTitleIndex", T_LONG, OFF(m_ObjectNameTitleIndex)}, // @prop integer|ObjectNameTitleIndex|
{"ObjectHelpTitleIndex", T_LONG, OFF(m_ObjectHelpTitleIndex)}, // @prop integer|ObjectHelpTitleIndex|
--- 108,112 ----
! /*static*/ struct PyMemberDef PyPERF_OBJECT_TYPE::members[] = {
{"ObjectNameTitleIndex", T_LONG, OFF(m_ObjectNameTitleIndex)}, // @prop integer|ObjectNameTitleIndex|
{"ObjectHelpTitleIndex", T_LONG, OFF(m_ObjectHelpTitleIndex)}, // @prop integer|ObjectHelpTitleIndex|
***************
*** 240,263 ****
}
- PyObject *PyPERF_OBJECT_TYPE::getattr(PyObject *self, char *name)
- {
- PyObject *res;
-
- res = Py_FindMethod(PyPERF_OBJECT_TYPE_methods, self, name);
- if (res != NULL)
- return res;
- PyErr_Clear();
- return PyMember_Get((char *)self, memberlist, name);
- }
-
- int PyPERF_OBJECT_TYPE::setattr(PyObject *self, char *name, PyObject *v)
- {
- if (v == NULL) {
- PyErr_SetString(PyExc_AttributeError, "can't delete PERF_OBJECT_TYPE attributes");
- return -1;
- }
- return PyMember_Set((char *)self, memberlist, name, v);
- }
-
/*static*/ void PyPERF_OBJECT_TYPE::deallocFunc(PyObject *ob)
{
--- 262,265 ----
|