[Python-checkins] python/dist/src/Mac/Modules/waste wastemodule.c,1.27,1.28 wastesupport.py,1.18,1.19
jackjansen@users.sourceforge.net
jackjansen@users.sourceforge.net
Tue, 03 Dec 2002 15:40:24 -0800
Update of /cvsroot/python/python/dist/src/Mac/Modules/waste
In directory sc8-pr-cvs1:/tmp/cvs-serv10318/waste
Modified Files:
wastemodule.c wastesupport.py
Log Message:
Added PEP253 support to most Carbon modules. This isn't complete yet:
some of the more compilcated cases (CF, Res) haven't been done yet. Also,
various types should inherit from each other (anything with an as_Resource
method should be a Resource subtype, the CF types should become one family).
Index: wastemodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/waste/wastemodule.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** wastemodule.c 29 Nov 2002 23:40:47 -0000 1.27
--- wastemodule.c 3 Dec 2002 23:40:22 -0000 1.28
***************
*** 387,390 ****
--- 387,391 ----
#define WEOObj_getsetlist NULL
+
#define WEOObj_compare NULL
***************
*** 392,395 ****
--- 393,414 ----
#define WEOObj_hash NULL
+ #define WEOObj_tp_init 0
+
+ #define WEOObj_tp_alloc PyType_GenericAlloc
+
+ static PyObject *WEOObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+ {
+ PyObject *self;
+ WEObjectReference itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, WEOObj_Convert, &itself)) return NULL;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((WEOObject *)self)->ob_itself = itself;
+ return self;
+ }
+
+ #define WEOObj_tp_free PyObject_Del
+
PyTypeObject WEO_Type = {
***************
*** 414,430 ****
PyObject_GenericGetAttr, /*tp_getattro*/
PyObject_GenericSetAttr, /*tp_setattro */
! 0, /*outputHook_tp_as_buffer*/
! 0, /*outputHook_tp_flags*/
! 0, /*outputHook_tp_doc*/
! 0, /*outputHook_tp_traverse*/
! 0, /*outputHook_tp_clear*/
! 0, /*outputHook_tp_richcompare*/
! 0, /*outputHook_tp_weaklistoffset*/
! 0, /*outputHook_tp_iter*/
! 0, /*outputHook_tp_iternext*/
WEOObj_methods, /* tp_methods */
! 0, /*outputHook_tp_members*/
WEOObj_getsetlist, /*tp_getset*/
! 0, /*outputHook_tp_base*/
};
--- 433,457 ----
PyObject_GenericGetAttr, /*tp_getattro*/
PyObject_GenericSetAttr, /*tp_setattro */
! 0, /*tp_as_buffer*/
! Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
! 0, /*tp_doc*/
! 0, /*tp_traverse*/
! 0, /*tp_clear*/
! 0, /*tp_richcompare*/
! 0, /*tp_weaklistoffset*/
! 0, /*tp_iter*/
! 0, /*tp_iternext*/
WEOObj_methods, /* tp_methods */
! 0, /*tp_members*/
WEOObj_getsetlist, /*tp_getset*/
! 0, /*tp_base*/
! 0, /*tp_dict*/
! 0, /*tp_descr_get*/
! 0, /*tp_descr_set*/
! 0, /*tp_dictoffset*/
! WEOObj_tp_init, /* tp_init */
! WEOObj_tp_alloc, /* tp_alloc */
! WEOObj_tp_new, /* tp_new */
! WEOObj_tp_free, /* tp_free */
};
***************
*** 2109,2112 ****
--- 2136,2140 ----
#define wasteObj_getsetlist NULL
+
#define wasteObj_compare NULL
***************
*** 2114,2117 ****
--- 2142,2163 ----
#define wasteObj_hash NULL
+ #define wasteObj_tp_init 0
+
+ #define wasteObj_tp_alloc PyType_GenericAlloc
+
+ static PyObject *wasteObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+ {
+ PyObject *self;
+ WEReference itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, wasteObj_Convert, &itself)) return NULL;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((wasteObject *)self)->ob_itself = itself;
+ return self;
+ }
+
+ #define wasteObj_tp_free PyObject_Del
+
PyTypeObject waste_Type = {
***************
*** 2136,2152 ****
PyObject_GenericGetAttr, /*tp_getattro*/
PyObject_GenericSetAttr, /*tp_setattro */
! 0, /*outputHook_tp_as_buffer*/
! 0, /*outputHook_tp_flags*/
! 0, /*outputHook_tp_doc*/
! 0, /*outputHook_tp_traverse*/
! 0, /*outputHook_tp_clear*/
! 0, /*outputHook_tp_richcompare*/
! 0, /*outputHook_tp_weaklistoffset*/
! 0, /*outputHook_tp_iter*/
! 0, /*outputHook_tp_iternext*/
wasteObj_methods, /* tp_methods */
! 0, /*outputHook_tp_members*/
wasteObj_getsetlist, /*tp_getset*/
! 0, /*outputHook_tp_base*/
};
--- 2182,2206 ----
PyObject_GenericGetAttr, /*tp_getattro*/
PyObject_GenericSetAttr, /*tp_setattro */
! 0, /*tp_as_buffer*/
! Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
! 0, /*tp_doc*/
! 0, /*tp_traverse*/
! 0, /*tp_clear*/
! 0, /*tp_richcompare*/
! 0, /*tp_weaklistoffset*/
! 0, /*tp_iter*/
! 0, /*tp_iternext*/
wasteObj_methods, /* tp_methods */
! 0, /*tp_members*/
wasteObj_getsetlist, /*tp_getset*/
! 0, /*tp_base*/
! 0, /*tp_dict*/
! 0, /*tp_descr_get*/
! 0, /*tp_descr_set*/
! 0, /*tp_dictoffset*/
! wasteObj_tp_init, /* tp_init */
! wasteObj_tp_alloc, /* tp_alloc */
! wasteObj_tp_new, /* tp_new */
! wasteObj_tp_free, /* tp_free */
};
***************
*** 2507,2516 ****
WEO_Type.ob_type = &PyType_Type;
Py_INCREF(&WEO_Type);
! if (PyDict_SetItemString(d, "WEOType", (PyObject *)&WEO_Type) != 0)
! Py_FatalError("can't initialize WEOType");
waste_Type.ob_type = &PyType_Type;
Py_INCREF(&waste_Type);
! if (PyDict_SetItemString(d, "wasteType", (PyObject *)&waste_Type) != 0)
! Py_FatalError("can't initialize wasteType");
callbackdict = PyDict_New();
--- 2561,2574 ----
WEO_Type.ob_type = &PyType_Type;
Py_INCREF(&WEO_Type);
! PyModule_AddObject(m, "WEO", (PyObject *)&WEO_Type);
! /* Backward-compatible name */
! Py_INCREF(&WEO_Type);
! PyModule_AddObject(m, "WEOType", (PyObject *)&WEO_Type);
waste_Type.ob_type = &PyType_Type;
Py_INCREF(&waste_Type);
! PyModule_AddObject(m, "waste", (PyObject *)&waste_Type);
! /* Backward-compatible name */
! Py_INCREF(&waste_Type);
! PyModule_AddObject(m, "wasteType", (PyObject *)&waste_Type);
callbackdict = PyDict_New();
Index: wastesupport.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/waste/wastesupport.py,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** wastesupport.py 29 Nov 2002 23:40:47 -0000 1.18
--- wastesupport.py 3 Dec 2002 23:40:22 -0000 1.19
***************
*** 278,282 ****
! class WEObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("""if (itself == NULL) {
--- 278,282 ----
! class WEObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("""if (itself == NULL) {
***************
*** 290,294 ****
Output("WEDispose(%s);", itselfname)
! class WEOObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("""if (itself == NULL) {
--- 290,294 ----
Output("WEDispose(%s);", itselfname)
! class WEOObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("""if (itself == NULL) {