Update of /cvsroot/pywin32/pywin32/win32/src/PerfMon
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16887/PerfMon
Modified Files:
Tag: py3k
MappingManager.cpp PerfCounterDefn.cpp PerfObjectType.cpp
PyPerfMon.cpp pyperfmon.h
Log Message:
Changes to build for Python 3.0
Index: PerfCounterDefn.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/PerfMon/PerfCounterDefn.cpp,v
retrieving revision 1.1
retrieving revision 1.1.4.1
diff -C2 -d -r1.1 -r1.1.4.1
*** PerfCounterDefn.cpp 2 Sep 1999 00:24:54 -0000 1.1
--- PerfCounterDefn.cpp 29 Aug 2008 05:00:24 -0000 1.1.4.1
***************
*** 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
***************
*** 108,128 ****
PyTypeObject PyPERF_COUNTER_DEFINITION::type =
{
! PyObject_HEAD_INIT(&PyType_Type)
! 0,
"PyPERF_COUNTER_DEFINITION",
sizeof(PyPERF_COUNTER_DEFINITION),
0,
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 */
0, /* tp_as_number */
! 0, /* tp_as_sequence */
0, /* tp_as_mapping */
! 0,
0, /* tp_call */
! 0, /* tp_str */
};
--- 108,149 ----
PyTypeObject PyPERF_COUNTER_DEFINITION::type =
{
! PYWIN_OBJECT_HEAD
"PyPERF_COUNTER_DEFINITION",
sizeof(PyPERF_COUNTER_DEFINITION),
0,
PyPERF_COUNTER_DEFINITION::deallocFunc, /* tp_dealloc */
! 0, /* tp_print */
! 0, /* tp_getattr */
! 0, /* tp_setattr */
! 0, /* tp_compare */
0, /* tp_repr */
0, /* tp_as_number */
! 0, /* tp_as_sequence */
0, /* tp_as_mapping */
! 0, /* tp_hash */
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 */
};
***************
*** 130,134 ****
! /*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.
***************
*** 190,213 ****
}
- 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.3
retrieving revision 1.3.4.1
diff -C2 -d -r1.3 -r1.3.4.1
*** MappingManager.cpp 5 Mar 2005 04:50:47 -0000 1.3
--- MappingManager.cpp 29 Aug 2008 05:00:24 -0000 1.3.4.1
***************
*** 60,64 ****
_tcscat(szGlobalMapping, szMappingName);
! m_hMappedObject = CreateFileMapping((HANDLE)0xFFFFFFFF,
NULL,
PAGE_READWRITE,
--- 60,64 ----
_tcscat(szGlobalMapping, szMappingName);
! m_hMappedObject = CreateFileMapping(INVALID_HANDLE_VALUE,
NULL,
PAGE_READWRITE,
***************
*** 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}
***************
*** 186,213 ****
PyTypeObject PyPerfMonManager::type =
{
! PyObject_HEAD_INIT(&PyType_Type)
! 0,
"PyPerfMonManager",
sizeof(PyPerfMonManager),
0,
PyPerfMonManager::deallocFunc, /* tp_dealloc */
! 0, /* tp_print */
! PyPerfMonManager::getattr, /* tp_getattr */
! PyPerfMonManager::setattr, /* tp_setattr */
! 0, /* tp_compare */
0, /* tp_repr */
0, /* tp_as_number */
! 0, /* tp_as_sequence */
0, /* tp_as_mapping */
! 0,
0, /* tp_call */
! 0, /* tp_str */
};
-
#define OFF(e) offsetof(PyPerfMonManager, e)
! /*static*/ struct memberlist PyPerfMonManager::memberlist[] = {
{NULL} /* Sentinel */
};
--- 186,233 ----
PyTypeObject PyPerfMonManager::type =
{
! PYWIN_OBJECT_HEAD
"PyPerfMonManager",
sizeof(PyPerfMonManager),
0,
PyPerfMonManager::deallocFunc, /* tp_dealloc */
! 0, /* tp_print */
! 0, /* tp_getattr */
! 0, /* tp_setattr */
! 0, /* tp_compare */
0, /* tp_repr */
0, /* tp_as_number */
! 0, /* tp_as_sequence */
0, /* tp_as_mapping */
! 0, /* tp_hash */
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 */
};
#define OFF(e) offsetof(PyPerfMonManager, e)
! /*static*/ struct PyMemberDef PyPerfMonManager::members[] = {
{NULL} /* Sentinel */
};
***************
*** 270,293 ****
}
- 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.1
retrieving revision 1.1.4.1
diff -C2 -d -r1.1 -r1.1.4.1
*** pyperfmon.h 2 Sep 1999 00:24:54 -0000 1.1
--- pyperfmon.h 29 Aug 2008 05:00:24 -0000 1.1.4.1
***************
*** 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,128 ****
/* 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);
!
! // #pragma warning( disable : 4251 )
! static struct memberlist memberlist[];
static PyTypeObject type;
- #pragma warning( default : 4251 )
protected:
--- 113,120 ----
/* 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;
protected:
Index: PyPerfMon.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/PerfMon/PyPerfMon.cpp,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -C2 -d -r1.2 -r1.2.4.1
*** PyPerfMon.cpp 9 Feb 2001 07:35:59 -0000 1.2
--- PyPerfMon.cpp 29 Aug 2008 05:00:24 -0000 1.2.4.1
***************
*** 86,90 ****
/* List of functions exported by this module */
! // @module perfmon|A module which supports common Windows types.
static struct PyMethodDef perfmon_functions[] = {
{"LoadPerfCounterTextStrings", PyLoadPerfCounterTextStrings, 1}, // @pymeth LoadPerfCounterTextStrings|
--- 86,90 ----
/* List of functions exported by this module */
! // @module perfmon|A module which wraps Performance Monitor functions.
static struct PyMethodDef perfmon_functions[] = {
{"LoadPerfCounterTextStrings", PyLoadPerfCounterTextStrings, 1}, // @pymeth LoadPerfCounterTextStrings|
***************
*** 98,109 ****
! extern "C" __declspec(dllexport) void
! initperfmon(void)
{
! PyObject *dict, *module;
! module = Py_InitModule("perfmon", perfmon_functions);
! if (!module) return;
! dict = PyModule_GetDict(module);
}
--- 98,130 ----
! extern "C" __declspec(dllexport)
! #if (PY_VERSION_HEX < 0x03000000)
! void initperfmon(void)
{
! PyObject *dict, *module;
! module = Py_InitModule("perfmon", perfmon_functions);
! if (!module) return;
! dict = PyModule_GetDict(module);
}
+ #else
+ PyObject *PyInit_perfmon(void)
+ {
+ PyObject *dict, *module;
+ static PyModuleDef permon_def = {
+ PyModuleDef_HEAD_INIT,
+ "perfmon",
+ "Contains functions and objects wrapping the Performance Monitor APIs",
+ -1,
+ perfmon_functions
+ };
+ module = PyModule_Create(&permon_def);
+ if (!module)
+ return NULL;
+ dict = PyModule_GetDict(module);
+ if (!dict)
+ return NULL;
+ return module;
+ }
+ #endif
Index: PerfObjectType.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/PerfMon/PerfObjectType.cpp,v
retrieving revision 1.1
retrieving revision 1.1.4.1
diff -C2 -d -r1.1 -r1.1.4.1
*** PerfObjectType.cpp 2 Sep 1999 00:24:54 -0000 1.1
--- PerfObjectType.cpp 29 Aug 2008 05:00:24 -0000 1.1.4.1
***************
*** 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}
***************
*** 65,85 ****
PyTypeObject PyPERF_OBJECT_TYPE::type =
{
! PyObject_HEAD_INIT(&PyType_Type)
! 0,
"PyPERF_OBJECT_TYPE",
sizeof(PyPERF_OBJECT_TYPE),
0,
! 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 */
0, /* tp_as_number */
! 0, /* tp_as_sequence */
0, /* tp_as_mapping */
! 0,
0, /* tp_call */
! 0, /* tp_str */
};
--- 65,106 ----
PyTypeObject PyPERF_OBJECT_TYPE::type =
{
! PYWIN_OBJECT_HEAD
"PyPERF_OBJECT_TYPE",
sizeof(PyPERF_OBJECT_TYPE),
0,
! PyPERF_OBJECT_TYPE::deallocFunc, /* tp_dealloc */
! 0, /* tp_print */
! 0, /* tp_getattr */
! 0, /* tp_setattr */
! 0, /* tp_compare */
0, /* tp_repr */
0, /* tp_as_number */
! 0, /* tp_as_sequence */
0, /* tp_as_mapping */
! 0, /* tp_hash */
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 */
};
***************
*** 87,95 ****
! /*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|
{"DefaultCounterIndex", T_LONG, OFF(m_DefaultCounter)}, // @prop integer|DefaultCounterIndex|
! {NULL} /* Sentinel */
};
--- 108,116 ----
! /*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|
{"DefaultCounterIndex", T_LONG, OFF(m_DefaultCounter)}, // @prop integer|DefaultCounterIndex|
! {NULL}
};
***************
*** 241,264 ****
}
- 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 ----
|