[pywin32-checkins] pywin32/Pythonwin ddemodule.cpp, 1.1.4.1, 1.1.4.2 win32uimodule.cpp, 1.39.2.8, 1
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Mark H. <mha...@us...> - 2008-12-09 12:38:58
|
Update of /cvsroot/pywin32/pywin32/Pythonwin In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22375/Pythonwin Modified Files: Tag: py3k ddemodule.cpp win32uimodule.cpp win32uiole.cpp Log Message: Merge more PYWIN32_MODULE_* macro usage from the trunk Index: win32uiole.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32uiole.cpp,v retrieving revision 1.8.2.2 retrieving revision 1.8.2.3 diff -C2 -d -r1.8.2.2 -r1.8.2.3 *** win32uiole.cpp 13 Nov 2008 05:02:23 -0000 1.8.2.2 --- win32uiole.cpp 9 Dec 2008 12:38:51 -0000 1.8.2.3 *************** *** 188,225 **** } ! extern "C" __declspec(dllexport) ! #if (PY_VERSION_HEX < 0x03000000) ! void initwin32uiole(void) ! #else ! PyObject *PyInit_win32uiole(void) ! #endif { ! PyObject *dict, *module; ! PyWinGlobals_Ensure(); ! ! #if (PY_VERSION_HEX < 0x03000000) ! #define RETURN_ERROR return; ! module = Py_InitModule("win32uiole", win32uiole_functions); ! #else ! ! #define RETURN_ERROR return NULL; ! static PyModuleDef win32uiole_def = { ! PyModuleDef_HEAD_INIT, ! "win32uiole", ! "A module, encapsulating the Microsoft Foundation Classes OLE functionality.", ! -1, ! win32uiole_functions ! }; ! module = PyModule_Create(&win32uiole_def); ! #endif; ! ! if (!module) ! RETURN_ERROR; ! dict = PyModule_GetDict(module); ! if (!dict) ! RETURN_ERROR; if (AddConstants(module)) ! RETURN_ERROR; if (PyType_Ready(&PyCCommonDialog::type) == - 1 || --- 188,198 ---- } ! PYWIN_MODULE_INIT_FUNC(win32uiole) { ! PYWIN_MODULE_INIT_PREPARE(win32uiole, win32uiole_functions, ! "A module, encapsulating the Microsoft Foundation Classes OLE functionality."); if (AddConstants(module)) ! PYWIN_MODULE_INIT_RETURN_ERROR; if (PyType_Ready(&PyCCommonDialog::type) == - 1 || *************** *** 228,235 **** PyType_Ready(&PyCOleDocument::type) == -1 || PyType_Ready(&PyCOleClientItem::type) == -1) ! RETURN_ERROR; ! #if (PY_VERSION_HEX >= 0x03000000) ! return module; ! #endif } --- 201,206 ---- PyType_Ready(&PyCOleDocument::type) == -1 || PyType_Ready(&PyCOleClientItem::type) == -1) ! PYWIN_MODULE_INIT_RETURN_ERROR; ! PYWIN_MODULE_INIT_RETURN_SUCCESS; } Index: ddemodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/ddemodule.cpp,v retrieving revision 1.1.4.1 retrieving revision 1.1.4.2 diff -C2 -d -r1.1.4.1 -r1.1.4.2 *** ddemodule.cpp 29 Aug 2008 05:53:28 -0000 1.1.4.1 --- ddemodule.cpp 9 Dec 2008 12:38:51 -0000 1.1.4.2 *************** *** 161,211 **** ! #if (PY_VERSION_HEX < 0x03000000) ! #define ADD_CONSTANT(tok) if (PyModule_AddIntConstant(module, #tok, tok)) return; ! #else ! #define ADD_CONSTANT(tok) if (PyModule_AddIntConstant(module, #tok, tok)) return NULL; ! #endif ! extern "C" __declspec(dllexport) ! #if (PY_VERSION_HEX < 0x03000000) ! void initdde(void) ! #else ! PyObject *PyInit_dde(void) ! #endif { if (AfxGetApp()==NULL) { PyErr_SetString(PyExc_ImportError, "This must be an MFC application - try loading win32ui first"); ! #if (PY_VERSION_HEX < 0x03000000) ! return; ! #else ! return NULL; ! #endif } ! ! PyObject *dict, *module; ! PyWinGlobals_Ensure(); ! ! #if (PY_VERSION_HEX < 0x03000000) ! module = Py_InitModule("dde", dde_functions); ! if (!module) ! return; ! dict = PyModule_GetDict(module); ! if (!dict) ! return; ! #else ! static PyModuleDef dde_def = { ! PyModuleDef_HEAD_INIT, ! "dde", ! "A module for Dynamic Data Exchange support", ! -1, ! dde_functions ! }; ! module = PyModule_Create(&dde_def); ! if (!module) ! return NULL; ! dict = PyModule_GetDict(module); ! if (!dict) ! return NULL; ! #endif dde_module_error = PyErr_NewException("dde.error", NULL, NULL); --- 161,174 ---- ! #define ADD_CONSTANT(tok) if (PyModule_AddIntConstant(module, #tok, tok)) PYWIN_MODULE_INIT_RETURN_ERROR; ! PYWIN_MODULE_INIT_FUNC(dde) { if (AfxGetApp()==NULL) { PyErr_SetString(PyExc_ImportError, "This must be an MFC application - try loading win32ui first"); ! PYWIN_MODULE_INIT_RETURN_ERROR; } ! PYWIN_MODULE_INIT_PREPARE(dde, dde_functions, ! "A module for Dynamic Data Exchange support"); dde_module_error = PyErr_NewException("dde.error", NULL, NULL); *************** *** 236,241 **** ADD_CONSTANT(MF_SENDMSGS); // Notifies the callback function whenever the system or an application sends a DDE message. ! #if (PY_VERSION_HEX >= 0x03000000) ! return module; ! #endif } --- 199,202 ---- ADD_CONSTANT(MF_SENDMSGS); // Notifies the callback function whenever the system or an application sends a DDE message. ! PYWIN_MODULE_INIT_RETURN_SUCCESS; } Index: win32uimodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32uimodule.cpp,v retrieving revision 1.39.2.8 retrieving revision 1.39.2.9 diff -C2 -d -r1.39.2.8 -r1.39.2.9 *** win32uimodule.cpp 6 Dec 2008 01:48:26 -0000 1.39.2.8 --- win32uimodule.cpp 9 Dec 2008 12:38:51 -0000 1.39.2.9 *************** *** 47,52 **** extern DWORD DebuggerThreadFunc( LPDWORD lpdwWhatever ); - static char BASED_CODE uiModName[] = "win32ui"; - // We can't init exceptionHandler in initwin32ui because the application using // us could have called SetExceptionHandler earlier. We do a forward declaration --- 47,50 ---- *************** *** 2249,2312 **** return 0; } ! extern bool CheckGoodWinApp(); extern HINSTANCE hWin32uiDll; // Handle to this DLL, from dllmain.cpp /* Initialize this module. */ ! extern "C" __declspec(dllexport) ! #if (PY_VERSION_HEX < 0x03000000) ! void initwin32ui(void) ! #else ! PyObject *PyInit_win32ui(void) ! #endif { ! // XXX - hack alert! ! // Win9x manages to wind up in here twice when used from a console - ! // CheckGoodWinApp() winds up re-initializing - so when we return ! // we see if we already did init, and get out. ! // Would be nice to solve this properly, but Win9x is a bitch to debug :( ! #if (PY_VERSION_HEX < 0x03000000) ! #define RETURN_ERROR return; ! #define RETURN_MODULE return; ! #else ! #define RETURN_ERROR return NULL; ! #define RETURN_MODULE return module; ! #endif; ! ! static bool bInitialized = false; ! static PyObject *dict, *module; ! if (!CheckGoodWinApp()) { ! PyErr_SetString(PyExc_RuntimeError, "The win32ui module could not initialize the application object."); ! RETURN_ERROR; ! } ! if (bInitialized) ! RETURN_MODULE; ! ! if (PyWinGlobals_Ensure() == -1) ! RETURN_ERROR; ! #if (PY_VERSION_HEX < 0x03000000) ! module = Py_InitModule(uiModName, ui_functions); #else ! ! static PyModuleDef win32ui_def = { ! PyModuleDef_HEAD_INIT, ! uiModName, ! "A module, encapsulating the Microsoft Foundation Classes.", ! -1, ! ui_functions ! }; ! module = PyModule_Create(&win32ui_def); #endif ! if (!module) ! RETURN_ERROR; ! dict = PyModule_GetDict(module); ! if (!dict) ! RETURN_ERROR; ui_module_error = PyErr_NewException("win32ui.error", NULL, NULL); if ((ui_module_error == NULL) || PyDict_SetItemString(dict, "error", ui_module_error) == -1) ! RETURN_ERROR; // drop email addy - too many ppl use it for support requests for other --- 2247,2278 ---- return 0; } ! extern bool CheckGoodWinApp(); extern HINSTANCE hWin32uiDll; // Handle to this DLL, from dllmain.cpp /* Initialize this module. */ ! PYWIN_MODULE_INIT_FUNC(win32ui) { ! // For various hysterical reasons, Win32uiApplicationInit also calls ! // initwin32ui, meaning we need to deal with being called multiple ! // times. ! static PyObject *existing_module = NULL; ! if (!CheckGoodWinApp()) { ! PyErr_SetString(PyExc_RuntimeError, "The win32ui module could not initialize the application object."); ! PYWIN_MODULE_INIT_RETURN_ERROR; ! } ! if (existing_module) #if (PY_VERSION_HEX < 0x03000000) ! return; #else ! return existing_module; #endif ! PYWIN_MODULE_INIT_PREPARE(win32ui, ui_functions, ! "A module, encapsulating the Microsoft Foundation Classes."); ui_module_error = PyErr_NewException("win32ui.error", NULL, NULL); if ((ui_module_error == NULL) || PyDict_SetItemString(dict, "error", ui_module_error) == -1) ! PYWIN_MODULE_INIT_RETURN_ERROR; // drop email addy - too many ppl use it for support requests for other *************** *** 2314,2318 **** PyObject *copyright = PyWinCoreString_FromString("Copyright 1994-2008 Mark Hammond"); if ((copyright == NULL) || PyDict_SetItemString(dict, "copyright", copyright) == -1) ! RETURN_ERROR; Py_XDECREF(copyright); --- 2280,2284 ---- PyObject *copyright = PyWinCoreString_FromString("Copyright 1994-2008 Mark Hammond"); if ((copyright == NULL) || PyDict_SetItemString(dict, "copyright", copyright) == -1) ! PYWIN_MODULE_INIT_RETURN_ERROR; Py_XDECREF(copyright); *************** *** 2331,2335 **** HookWindowsMessages(); // need to be notified of certain events... if (AddConstants(module) == -1) ! RETURN_ERROR; // Add all the types. --- 2297,2301 ---- HookWindowsMessages(); // need to be notified of certain events... if (AddConstants(module) == -1) ! PYWIN_MODULE_INIT_RETURN_ERROR; // Add all the types. *************** *** 2341,2354 **** ui_type_CObject::typemap->GetNextAssoc(pos, pRT, pT); ! #if (PY_VERSION_HEX < 0x03000000) ! PyObject *typeName = PyString_FromString(pT->tp_name); ! #else ! PyObject *typeName = PyUnicodeObject_FromString(pT->tp_name); ! #endif // PyType_Ready sets tp_mro for inheritance to work, so it *must* be called on the type objects now. if ((typeName==NULL) ||(PyWinType_Ready(pT)==-1) ||(PyDict_SetItem(typeDict, typeName, (PyObject *)pT)==-1)) ! RETURN_ERROR; Py_XDECREF(typeName); } --- 2307,2316 ---- ui_type_CObject::typemap->GetNextAssoc(pos, pRT, pT); ! PyObject *typeName = PyWinCoreString_FromString(pT->tp_name); // PyType_Ready sets tp_mro for inheritance to work, so it *must* be called on the type objects now. if ((typeName==NULL) ||(PyWinType_Ready(pT)==-1) ||(PyDict_SetItem(typeDict, typeName, (PyObject *)pT)==-1)) ! PYWIN_MODULE_INIT_RETURN_ERROR; Py_XDECREF(typeName); } *************** *** 2356,2364 **** PyDict_SetItemString(dict, "types", typeDict); Py_XDECREF(typeDict); ! bInitialized = true; ! #if (PY_VERSION_HEX >= 0x03000000) ! return module; ! #endif } --- 2318,2324 ---- PyDict_SetItemString(dict, "types", typeDict); Py_XDECREF(typeDict); ! existing_module = module; ! PYWIN_MODULE_INIT_RETURN_SUCCESS; } |