[pywin32-checkins] pywin32/com/win32comext/axcontrol/src AXControl.cpp, 1.8, 1.8.2.1
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Roger U. <ru...@us...> - 2008-09-13 17:42:23
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/axcontrol/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv306 Modified Files: Tag: py3k AXControl.cpp Log Message: Convert module init for Py3k Index: AXControl.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/axcontrol/src/AXControl.cpp,v retrieving revision 1.8 retrieving revision 1.8.2.1 diff -C2 -d -r1.8 -r1.8.2.1 *** AXControl.cpp 15 Oct 2007 05:20:44 -0000 1.8 --- AXControl.cpp 13 Sep 2008 17:42:33 -0000 1.8.2.1 *************** *** 335,351 **** }; - 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) static const PyCom_InterfaceSupportInfo g_interfaceSupportData[] = --- 335,340 ---- }; ! #define ADD_CONSTANT(tok) if (PyModule_AddIntConstant(module, #tok, tok) == -1) RETURN_ERROR; static const PyCom_InterfaceSupportInfo g_interfaceSupportData[] = *************** *** 367,380 **** /* Module initialisation */ ! extern "C" __declspec(dllexport) void initaxcontrol() { ! char *modName = "axcontrol"; ! PyObject *oModule; ! // Create the module and add the functions ! oModule = Py_InitModule(modName, axcontrol_methods); ! if (!oModule) /* Eeek - some serious error! */ ! return; ! PyObject *dict = PyModule_GetDict(oModule); ! if (!dict) return; /* Another serious error!*/ // Register all of our interfaces, gateways and IIDs. --- 356,388 ---- /* Module initialisation */ ! extern "C" __declspec(dllexport) ! #if (PY_VERSION_HEX < 0x03000000) ! void initaxcontrol(void) ! #else ! PyObject *PyInit_axcontrol(void) ! #endif { ! PyObject *dict, *module; ! ! #if (PY_VERSION_HEX < 0x03000000) ! #define RETURN_ERROR return; ! module = Py_InitModule("axcontrol", axcontrol_methods); ! #else ! #define RETURN_ERROR return NULL; ! static PyModuleDef axcontrol_def = { ! PyModuleDef_HEAD_INIT, ! "axcontrol", ! "A module, encapsulating the ActiveX Control interfaces.", ! -1, ! axcontrol_methods ! }; ! module = PyModule_Create(&axcontrol_def); ! #endif ! ! if (!module) ! RETURN_ERROR; ! dict = PyModule_GetDict(module); ! if (!dict) ! RETURN_ERROR; // Register all of our interfaces, gateways and IIDs. *************** *** 406,408 **** --- 414,420 ---- ADD_CONSTANT(EMBDHLP_DELAYCREATE); // @const axcontrol|EMBDHLP_DELAYCREATE| ADD_CONSTANT(OLECREATE_LEAVERUNNING); // @const axcontrol|OLECREATE_LEAVERUNNING| + + #if (PY_VERSION_HEX >= 0x03000000) + return module; + #endif } |