Update of /cvsroot/pywin32/pywin32/com/win32comext/directsound/src
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14086/com/win32comext/directsound/src
Modified Files:
directsound.cpp
Log Message:
More modules use the PYWIN_MODULE_* macros
Index: directsound.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/directsound/src/directsound.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** directsound.cpp 25 Mar 2005 01:52:11 -0000 1.8
--- directsound.cpp 9 Dec 2008 07:21:06 -0000 1.9
***************
*** 237,253 ****
};
- 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[] =
--- 237,242 ----
};
! #define ADD_CONSTANT(tok) if (PyModule_AddIntConstant(module, #tok, tok) == -1) PYWIN_MODULE_INIT_RETURN_ERROR;
static const PyCom_InterfaceSupportInfo g_interfaceSupportData[] =
***************
*** 261,274 ****
/* Module initialisation */
! extern "C" __declspec(dllexport) void initdirectsound()
{
! char *modName = "directsound";
! PyObject *oModule;
! // Create the module and add the functions
! oModule = Py_InitModule(modName, directsound_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.
--- 250,258 ----
/* Module initialisation */
! PYWIN_MODULE_INIT_FUNC(directsound)
{
! PYWIN_MODULE_INIT_PREPARE(directsound, directsound_methods,
! "A module encapsulating the DirectSound interfaces.");
!
// Register all of our interfaces, gateways and IIDs.
***************
*** 395,404 ****
ADD_CONSTANT(DSBPN_OFFSETSTOP);
! PyDict_SetItemString(dict, "DSCAPSType", (PyObject *)&PyDSCAPSType);
! PyDict_SetItemString(dict, "DSBCAPSType", (PyObject *)&PyDSBCAPSType);
! PyDict_SetItemString(dict, "DSBUFFERDESCType", (PyObject *)&PyDSBUFFERDESCType);
! PyDict_SetItemString(dict, "DSCCAPSType", (PyObject *)&PyDSCCAPSType);
! PyDict_SetItemString(dict, "DSCBCAPSType", (PyObject *)&PyDSCBCAPSType);
! PyDict_SetItemString(dict, "DSCBUFFERDESCType", (PyObject *)&PyDSCBUFFERDESCType);
}
--- 379,397 ----
ADD_CONSTANT(DSBPN_OFFSETSTOP);
! if (PyType_Ready(&PyDSCAPSType) == -1
! ||PyType_Ready(&PyDSBCAPSType) == -1
! ||PyType_Ready(&PyDSBUFFERDESCType) == -1
! ||PyType_Ready(&PyDSCCAPSType) == -1
! ||PyType_Ready(&PyDSCBCAPSType) == -1
! ||PyType_Ready(&PyDSCBUFFERDESCType) == -1
! ||PyDict_SetItemString(dict, "DSCAPSType", (PyObject *)&PyDSCAPSType) == -1
! ||PyDict_SetItemString(dict, "DSBCAPSType", (PyObject *)&PyDSBCAPSType) == -1
! ||PyDict_SetItemString(dict, "DSBUFFERDESCType", (PyObject *)&PyDSBUFFERDESCType) == -1
! ||PyDict_SetItemString(dict, "DSCCAPSType", (PyObject *)&PyDSCCAPSType) == -1
! ||PyDict_SetItemString(dict, "DSCBCAPSType", (PyObject *)&PyDSCBCAPSType) == -1
! ||PyDict_SetItemString(dict, "DSCBUFFERDESCType", (PyObject *)&PyDSCBUFFERDESCType) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
!
! PYWIN_MODULE_INIT_RETURN_SUCCESS;
}
|