[Python-checkins] python/dist/src/Mac/Modules/menu _Menumodule.c,1.13,1.14 menusupport.py,1.18,1.19
jackjansen@users.sourceforge.net
jackjansen@users.sourceforge.net
Tue, 03 Dec 2002 15:40:53 -0800
Update of /cvsroot/python/python/dist/src/Mac/Modules/menu
In directory sc8-pr-cvs1:/tmp/cvs-serv10318/menu
Modified Files:
_Menumodule.c menusupport.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: _Menumodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/menu/_Menumodule.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** _Menumodule.c 29 Nov 2002 23:40:44 -0000 1.13
--- _Menumodule.c 3 Dec 2002 23:40:20 -0000 1.14
***************
*** 3003,3006 ****
--- 3003,3007 ----
#define MenuObj_getsetlist NULL
+
#define MenuObj_compare NULL
***************
*** 3008,3011 ****
--- 3009,3030 ----
#define MenuObj_hash NULL
+ #define MenuObj_tp_init 0
+
+ #define MenuObj_tp_alloc PyType_GenericAlloc
+
+ static PyObject *MenuObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+ {
+ PyObject *self;
+ MenuHandle itself;
+ char *kw[] = {"itself", 0};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, MenuObj_Convert, &itself)) return NULL;
+ if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
+ ((MenuObject *)self)->ob_itself = itself;
+ return self;
+ }
+
+ #define MenuObj_tp_free PyObject_Del
+
PyTypeObject Menu_Type = {
***************
*** 3030,3046 ****
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*/
MenuObj_methods, /* tp_methods */
! 0, /*outputHook_tp_members*/
MenuObj_getsetlist, /*tp_getset*/
! 0, /*outputHook_tp_base*/
};
--- 3049,3073 ----
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*/
MenuObj_methods, /* tp_methods */
! 0, /*tp_members*/
MenuObj_getsetlist, /*tp_getset*/
! 0, /*tp_base*/
! 0, /*tp_dict*/
! 0, /*tp_descr_get*/
! 0, /*tp_descr_set*/
! 0, /*tp_dictoffset*/
! MenuObj_tp_init, /* tp_init */
! MenuObj_tp_alloc, /* tp_alloc */
! MenuObj_tp_new, /* tp_new */
! MenuObj_tp_free, /* tp_free */
};
***************
*** 4128,4133 ****
Menu_Type.ob_type = &PyType_Type;
Py_INCREF(&Menu_Type);
! if (PyDict_SetItemString(d, "MenuType", (PyObject *)&Menu_Type) != 0)
! Py_FatalError("can't initialize MenuType");
}
--- 4155,4162 ----
Menu_Type.ob_type = &PyType_Type;
Py_INCREF(&Menu_Type);
! PyModule_AddObject(m, "Menu", (PyObject *)&Menu_Type);
! /* Backward-compatible name */
! Py_INCREF(&Menu_Type);
! PyModule_AddObject(m, "MenuType", (PyObject *)&Menu_Type);
}
Index: menusupport.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/menu/menusupport.py,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** menusupport.py 29 Nov 2002 23:40:44 -0000 1.18
--- menusupport.py 3 Dec 2002 23:40:20 -0000 1.19
***************
*** 99,103 ****
"""
! class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition):
pass
--- 99,103 ----
"""
! class MyObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
pass