Update of /cvsroot/pywin32/pywin32/com/win32comext/axdebug/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12648
Modified Files:
Tag: py3k
AXDebug.cpp
Log Message:
Convert module init for Py3k
Index: AXDebug.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/axdebug/src/AXDebug.cpp,v
retrieving revision 1.4
retrieving revision 1.4.4.1
diff -C2 -d -r1.4 -r1.4.4.1
*** AXDebug.cpp 10 Mar 2003 01:01:40 -0000 1.4
--- AXDebug.cpp 14 Sep 2008 03:34:45 -0000 1.4.4.1
***************
*** 207,211 ****
}
/* List of module functions */
! // @module axdebug|A module, encapsulating the ActiveX Debugging
static struct PyMethodDef axdebug_methods[]=
{
--- 207,211 ----
}
/* List of module functions */
! // @module axdebug|A module, encapsulating the ActiveX Debugging interfaces
static struct PyMethodDef axdebug_methods[]=
{
***************
*** 216,232 ****
};
- static int AddConstant(PyObject *dict, const char *key, long value)
- {
- PyObject *oval = PyInt_FromLong(value);
- if (!oval)
- {
- return 1;
- }
- int rc = PyDict_SetItemString(dict, (char*)key, oval);
- Py_DECREF(oval);
- return rc;
- }
-
- #define ADD_CONSTANT(tok) AddConstant(dict, #tok, tok)
// The list of interfaces and gateways we support.
--- 216,219 ----
***************
*** 293,318 ****
};
/* Module initialisation */
! extern "C" __declspec(dllexport) void initaxdebug()
{
! char *modName = "axdebug";
! PyObject *oModule;
! // We need to be thread friendly!
PyEval_InitThreads();
- // Create the module and add the functions
- oModule = Py_InitModule(modName, axdebug_methods);
- if (!oModule) /* Eeek - some serious error! */
- return;
- PyObject *dict = PyModule_GetDict(oModule);
- if (!dict) return; /* Another serious error!*/
! // Add some symbolic constants to the module
! axdebug_Error = PyString_FromString("error");
if (axdebug_Error == NULL || PyDict_SetItemString(dict, "error", axdebug_Error) != 0)
! {
! PyErr_SetString(PyExc_MemoryError, "can't define error");
! return;
! }
// AX-Debugging interface registration
--- 280,322 ----
};
+ #define ADD_CONSTANT(tok) if (PyModule_AddIntConstant(module, #tok, tok) == -1) RETURN_ERROR;
/* Module initialisation */
! extern "C" __declspec(dllexport)
! #if (PY_VERSION_HEX < 0x03000000)
! void initaxdebug(void)
! #else
! PyObject *PyInit_axdebug(void)
! #endif
{
! PyObject *module, *dict;
!
! #if (PY_VERSION_HEX < 0x03000000)
! #define RETURN_ERROR return;
! module = Py_InitModule("axdebug", axdebug_methods);
! #else
! #define RETURN_ERROR return NULL;
! static PyModuleDef axdebug_def = {
! PyModuleDef_HEAD_INIT,
! "axdebug",
! "A module, encapsulating the ActiveX Debugging interfaces",
! -1,
! axdebug_methods
! };
! module = PyModule_Create(&axdebug_def);
! #endif
!
! if (!module)
! RETURN_ERROR;
! dict = PyModule_GetDict(module);
! if (!dict)
! RETURN_ERROR;
!
PyEval_InitThreads();
! // Add some symbolic constants to the module
! axdebug_Error = PyErr_NewException("axdebug.error", NULL, NULL);
if (axdebug_Error == NULL || PyDict_SetItemString(dict, "error", axdebug_Error) != 0)
! RETURN_ERROR;
// AX-Debugging interface registration
***************
*** 400,405 ****
ADD_CONSTANT(TEXT_DOC_ATTR_READONLY); // @const axdebug|TEXT_DOC_ATTR_READONLY|Indicates that the document is read-only.
!
! // ADD_CONSTANT();
!
}
--- 404,409 ----
ADD_CONSTANT(TEXT_DOC_ATTR_READONLY); // @const axdebug|TEXT_DOC_ATTR_READONLY|Indicates that the document is read-only.
! #if (PY_VERSION_HEX >= 0x03000000)
! return module;
! #endif
}
|