Update of /cvsroot/pywin32/pywin32/win32/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14865
Modified Files:
Tag: py3k
win2krasmodule.cpp win32rasmodule.cpp
Log Message:
Call PyType_Ready, add constants with unicode names
Index: win2krasmodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win2krasmodule.cpp,v
retrieving revision 1.6.2.1
retrieving revision 1.6.2.2
diff -C2 -d -r1.6.2.1 -r1.6.2.2
*** win2krasmodule.cpp 29 Aug 2008 04:59:26 -0000 1.6.2.1
--- win2krasmodule.cpp 2 Sep 2008 09:39:31 -0000 1.6.2.2
***************
*** 93,99 ****
0, /*tp_setattro*/
0, /*tp_as_buffer*/
};
-
PyRASEAPUSERIDENTITY::PyRASEAPUSERIDENTITY(RASEAPUSERIDENTITY *identity)
{
--- 93,117 ----
0, /*tp_setattro*/
0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT, // tp_flags;
+ "An object that describes a Win32 RASDIALEXTENSIONS structure", // tp_doc
+ 0, // tp_traverse;
+ 0, // tp_clear
+ 0, // tp_richcompare;
+ 0, // tp_weaklistoffset;
+ 0, // tp_iter
+ 0, // iternextfunc tp_iternext
+ 0, // tp_methods
+ 0, // 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, // newfunc tp_new;
};
PyRASEAPUSERIDENTITY::PyRASEAPUSERIDENTITY(RASEAPUSERIDENTITY *identity)
{
***************
*** 175,196 ****
};
- int AddConstant(PyObject *dict, char *key, long value)
- {
- PyObject *okey = PyString_FromString(key);
- PyObject *oval = PyInt_FromLong(value);
- if (!okey || !oval) {
- Py_XDECREF(okey);
- Py_XDECREF(oval);
- return 1;
- }
- int rc = PyDict_SetItem(dict,okey, oval);
- Py_XDECREF(okey);
- Py_XDECREF(oval);
- return rc;
- }
! #define ADD_CONSTANT(tok) if (rc=AddConstant(dict,#tok, tok)) return rc
! static int AddConstants(PyObject *dict)
{
int rc;
--- 193,200 ----
};
! #define ADD_CONSTANT(tok) if (rc=PyModule_AddIntConstant(module, #tok, tok)) return rc
! static int AddConstants(PyObject *module)
{
int rc;
***************
*** 237,241 ****
#endif
! AddConstants(dict);
#ifdef _DEBUG
const TCHAR *modName = _T("win32ras_d.pyd");
--- 241,249 ----
#endif
! if (PyType_Ready(&PyRASEAPUSERIDENTITY::type) == -1)
! RETURN_ERROR;
! if (AddConstants(module) != 0)
! RETURN_ERROR;
!
#ifdef _DEBUG
const TCHAR *modName = _T("win32ras_d.pyd");
Index: win32rasmodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32rasmodule.cpp,v
retrieving revision 1.10.2.1
retrieving revision 1.10.2.2
diff -C2 -d -r1.10.2.1 -r1.10.2.2
*** win32rasmodule.cpp 29 Aug 2008 04:59:27 -0000 1.10.2.1
--- win32rasmodule.cpp 2 Sep 2008 09:39:31 -0000 1.10.2.2
***************
*** 139,143 ****
#define PyRASDIALEXTENSIONS_Check(ob) ((ob)->ob_type == &PyRASDIALEXTENSIONS::type)
! // @object RASDIALEXTENSIONS|An object that describes a Win32 RASDIALPARAMS structure
BOOL PyWinObject_AsRASDIALEXTENSIONS(PyObject *ob, RASDIALEXTENSIONS **ppRASDIALEXTENSIONS, BOOL bNoneOK /*= TRUE*/)
{
--- 139,143 ----
#define PyRASDIALEXTENSIONS_Check(ob) ((ob)->ob_type == &PyRASDIALEXTENSIONS::type)
! // @object RASDIALEXTENSIONS|An object that describes a Win32 RASDIALEXTENSIONS structure
BOOL PyWinObject_AsRASDIALEXTENSIONS(PyObject *ob, RASDIALEXTENSIONS **ppRASDIALEXTENSIONS, BOOL bNoneOK /*= TRUE*/)
{
***************
*** 178,184 ****
0, /* tp_call */
0, /* tp_str */
! PyRASDIALEXTENSIONS::getattro, /* tp_getattr */
! PyRASDIALEXTENSIONS::setattro, /* tp_setattr */
! 0, /*tp_as_buffer*/
};
--- 178,203 ----
0, /* tp_call */
0, /* tp_str */
! PyRASDIALEXTENSIONS::getattro, /* tp_getattro */
! PyRASDIALEXTENSIONS::setattro, /* tp_setattro */
! 0, /*tp_as_buffer*/
! Py_TPFLAGS_DEFAULT, // tp_flags;
! "An object that describes a Win32 RASDIALEXTENSIONS structure", // tp_doc
! 0, // tp_traverse;
! 0, // tp_clear
! 0, // tp_richcompare;
! 0, // tp_weaklistoffset;
! 0, // tp_iter
! 0, // iternextfunc tp_iternext
! 0, // tp_methods
! 0, // 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, // newfunc tp_new;
};
***************
*** 807,832 ****
};
! int AddConstant(PyObject *dict, char *key, long value)
! {
! PyObject *okey = PyString_FromString(key);
! PyObject *oval = PyInt_FromLong(value);
! if (!okey || !oval) {
! Py_XDECREF(okey);
! Py_XDECREF(oval);
! return 1;
! }
! int rc = PyDict_SetItem(dict,okey, oval);
! Py_XDECREF(okey);
! Py_XDECREF(oval);
! return rc;
! }
! #define ADD_CONSTANT(tok) if (rc=AddConstant(dict,#tok, tok)) return rc
! #define ADD_ENUM(parta, partb) if (rc=AddConstant(dict,#parta "_" #partb, parta::partb)) return rc
! #define ADD_ENUM3(parta, partb, partc) if (rc=AddConstant(dict,#parta "_" #partb "_" #partc, parta::partb::partc)) return rc
!
! static int AddConstants(PyObject *dict)
{
! int rc;
ADD_CONSTANT(RASCS_OpenPort); // @const win32ras|RASCS_OpenPort|Constant for RAS state.
ADD_CONSTANT(RASCS_PortOpened); // @const win32ras|RASCS_PortOpened|Constant for RAS state.
--- 826,836 ----
};
+ #define ADD_CONSTANT(tok) if (rc = PyModule_AddIntConstant(module, #tok, tok)) return rc
+ #define ADD_ENUM(parta, partb) if (rc = PyModule_AddIntConstant(module, #parta "_" #partb, parta::partb)) return rc
+ #define ADD_ENUM3(parta, partb, partc) if (rc = PyModule_AddIntConstant(module, #parta "_" #partb "_" #partc, parta::partb::partc)) return rc
! static int AddConstants(PyObject *module)
{
! int rc;
ADD_CONSTANT(RASCS_OpenPort); // @const win32ras|RASCS_OpenPort|Constant for RAS state.
ADD_CONSTANT(RASCS_PortOpened); // @const win32ras|RASCS_PortOpened|Constant for RAS state.
***************
*** 895,903 ****
return NULL;
#endif
-
module_error = PyWinExc_ApiError;
Py_INCREF(module_error);
PyDict_SetItemString(dict, "error", module_error);
! AddConstants(dict);
#if (PY_VERSION_HEX >= 0x03000000)
--- 899,909 ----
return NULL;
#endif
module_error = PyWinExc_ApiError;
Py_INCREF(module_error);
PyDict_SetItemString(dict, "error", module_error);
! if (PyType_Ready(&PyRASDIALEXTENSIONS::type) == -1)
! RETURN_ERROR;
! if (AddConstants(module) != 0)
! RETURN_ERROR;
#if (PY_VERSION_HEX >= 0x03000000)
|